rpm -q kernel or dpkg -l linux-image*, and closed the maintenance window. Then a vulnerability scanner fires again, or worse, a proof-of-concept exploit for the same CVE still escalates privileges on the box. The patch is on disk. The vulnerability is still in memory. Here is how that happens and what to do about it.
Initial impact: the scanner that would not shut up
.ko file on disk, but the old, vulnerable copy of that module is still running in kernel space. The scanner or PoC does not care what is on disk. It tests what is in memory.
A concrete example from recent advisories: CVE-2026-31431, sometimes called "Copy Fail," involves the algif_aead module (part of the kernel's AF_ALG cryptographic interface). If that module was loaded before you applied the patch, it remains loaded with the vulnerable code until the next reboot or until you manually intervene.
Investigation: confirming what is actually loaded
lsmod lists every module currently loaded.
BASH
lsmod | grep algif_aead.ko file on disk is what matters going forward.
For a more detailed view, modinfo shows the file path and version string of the module the kernel loaded from:
BASH
modinfo algif_aeadfilename: line. If it points to the old kernel's module directory (e.g., /lib/modules/5.15.0-100-generic/ when you just installed 5.15.0-101-generic), you have confirmation: the running module belongs to the pre-patch kernel.
This is the critical discovery moment. The package manager did its job. The kernel on disk is patched. But the kernel in memory, specifically this module, is not.
If you have already read about the related problem of the entire kernel being outdated in memory, the pattern is similar but narrower. With a module-level flaw, even booting into the new kernel is not always enough if something auto-loads the old module from a leftover directory. The broader running-vs-installed kernel mismatch is covered in Installed the Kernel Fix but the CVE Still Shows? Compare Running vs Installed Kernel.
Temporary mitigation: unload and blacklist
modprobe -r removes a module from the running kernel, but only if nothing is currently using it.
BASH
sudo modprobe -r algif_aeadlsmod | grep algif_aead again. If it returns an error like Module algif_aead is in use, something has an open handle to it. You need to find and stop whatever process is using the module first, or accept that a reboot is the only clean path. Forcing a module out while it is in use risks a kernel panic, so do not attempt rmmod -f on a production box unless you are already in an emergency and have accepted the downtime.
Blacklisting the module. Even after unloading, another process or a udev rule could reload the module minutes later. A blacklist entry prevents that. Create a file in /etc/modprobe.d/:
BASH
echo 'install algif_aead /bin/true' | sudo tee /etc/modprobe.d/blacklist-algif-aead.confinstall modulename /bin/true instead of blacklist modulename? The blacklist directive only prevents auto-loading. Another module that depends on it, or a manual modprobe call, can still pull it in. The install directive redirects any load attempt to /bin/true, which does nothing. It is a harder block.
This blacklist file survives reboots, which is useful as a temporary safety net but also something you need to remember to remove once the patched kernel is actually running. Otherwise you permanently disable a module you might need.
For more detail on verifying that a blacklist rule is actually effective, especially for the algif_aead case, see Belum Bisa Reboot untuk Patch Copy Fail? Verifikasi Blacklist Modul algif_aead.
Why this catches people off guard
yum update kernel or apt upgrade linux-image-* finishes, the admin checks the package version, and the ticket gets closed. Scanners that only check package versions will also show green. The gap is between what is installed and what is running.
With core kernel code, the gap is obvious: you need a reboot to load the new kernel. Most teams know this. But with modules, the mental model breaks. People assume the kernel update replaced everything. It did replace the files on disk. It did not touch what is already loaded in memory. The Linux kernel does not hot-swap modules on package upgrade. That is by design: yanking a module out from under running processes would be far more dangerous than leaving the old one loaded.
LPE vulnerabilities make this especially dangerous because they require only a local unprivileged shell. An attacker who already has a low-privilege foothold, maybe through a compromised web application or a stolen SSH key, can run the exploit locally. The window between "patch installed" and "reboot completed" is exactly the window where this matters.
The architectural fix: reboot into the patched kernel
uname -rshows the patched kernel version.modinfo algif_aead(or whichever module was vulnerable) shows thefilename:path under the new kernel's module directory.- Run the scanner or PoC again. It should fail.
BASH
sudo rm /etc/modprobe.d/blacklist-algif-aead.confBuilding this into your patch process
- After installing a kernel update, check
lsmodoutput against the advisory to see if the vulnerable module is loaded. - If it is loaded and you cannot reboot yet, unload it with
modprobe -rand blacklist it. - Track the blacklist file so it gets removed after the reboot.
- After reboot, verify with
uname -randmodinfothat the running kernel and its modules match the patched version. - Re-run the scanner or a safe diagnostic check to confirm the vulnerability is no longer exploitable.
lsmod, not just rpm -q.