Insights

Kernel Patched but Exploit Still Works? Check if the Vulnerable Module Is Still Loaded

December 1, 2026
0:00
You installed the patched kernel package, confirmed the new version with 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.
The pattern shows up most often with local privilege escalation (LPE) flaws that live inside a loadable kernel module rather than in the core kernel itself. A loadable kernel module is a chunk of code the kernel pulls in on demand, things like filesystem drivers, cryptographic algorithm implementations, or hardware drivers. Once loaded, a module stays resident in memory until something explicitly removes it or the machine reboots. When the vulnerability sits in one of these modules, installing a patched kernel package puts the fixed .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.
Step one is checking whether the vulnerable module is present in the running kernel. lsmod lists every module currently loaded.
BASH
lsmod | grep algif_aead
If you get output, the module is loaded. If the line is blank, the module is not in memory and the patched .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_aead
Look at the filename: 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.
If you cannot reboot immediately, which is common on production servers mid-shift, you have two actions: unload the module from memory, then prevent it from being loaded again before the reboot happens. Unloading the module. modprobe -r removes a module from the running kernel, but only if nothing is currently using it.
BASH
sudo modprobe -r algif_aead
If this returns silently, the module is gone. Verify with lsmod | 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.conf
Why install 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.
Most patch workflows focus on packages. 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.
Blacklisting and unloading are mitigations. The real fix is rebooting into the new kernel so that every module loads from the patched module directory. After reboot, verify:
  1. uname -r shows the patched kernel version.
  2. modinfo algif_aead (or whichever module was vulnerable) shows the filename: path under the new kernel's module directory.
  3. Run the scanner or PoC again. It should fail.
Once confirmed, remove the blacklist file you created earlier so the module can load normally from its patched version:
BASH
sudo rm /etc/modprobe.d/blacklist-algif-aead.conf
If you do not need the module at all, keeping the blacklist is a valid hardening choice. Reducing the kernel's attack surface by not loading unnecessary modules is a well-established practice. But make that a deliberate decision, not an accident left over from an incident.
The gap described here is not exotic. It shows up every time a kernel CVE targets a loadable module and the server is not rebooted promptly. A few additions to your patch checklist close it:
  • After installing a kernel update, check lsmod output against the advisory to see if the vulnerable module is loaded.
  • If it is loaded and you cannot reboot yet, unload it with modprobe -r and blacklist it.
  • Track the blacklist file so it gets removed after the reboot.
  • After reboot, verify with uname -r and modinfo that 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.
The core lesson is short: a kernel patch on disk is not a kernel patch in memory. Modules make that gap narrower and easier to miss than a full kernel version mismatch. Check lsmod, not just rpm -q.

Join My Newsletter & Get Updates!

Get notified whenever a new technical guide, server infrastructure breakdown, or personal reflection goes live, plus a curated weekly digest.