DEV Community

Testing Shirudo on AWS to Mitigate a Linux Kernel Vulnerability Without Rebooting

When managing SBOMs with Dependency-Track, I often come across critical vulnerabilities. However, security patches are not always available yet, which makes it difficult to decide how to address them.

Recently, an open-source project called Shirudo was released. It appears to provide a way to apply protections called Shields to a running Linux system as a mitigation until a security patch can be deployed.

In this article, I applied an official Linux kernel Shield on AWS and compared the system's behavior before, during, and after its application. I wanted to see whether I could restrict operations required to exploit a vulnerability while allowing necessary operations to continue, and whether I could subsequently remove those restrictions without rebooting.

This article is simply a record of my experience applying and removing an official sample Shield. I did not create a custom Shield or conduct any testing against a production service.

Adding a Shield to the Kernel

For this experiment, I built and signed an official BPF program and loaded it into the kernel of a test VM. I did not modify any application source code or binaries.

I used the Shield for CVE-2026-31431 provided in the official guide. A fix for this CVE is already available, but for this experiment, I used the official test kernel to evaluate the operational restrictions provided by the mitigation.

What Operations Does the Shield Block?

The target is AF_ALG, a socket interface for accessing Linux kernel cryptographic functionality. Exploitation of this vulnerability involves zero-copy transmission using splice.

The core logic of the official Shield source code consists of the following conditions:

if (BPF_CORE_READ(sock, sk, __sk_common.skc_family) != AF_ALG)
    return 0;
if (BPF_CORE_READ(msg, msg_flags) & MSG_SPLICE_PAGES)
    return -EACCES;
Enter fullscreen mode Exit fullscreen mode

When sending data to an AF_ALG socket, the program returns an access-denied error if the zero-copy transmission flag is set. Regular copy-based transmission is not blocked by these conditions.

This check is attached to lsm/socket_sendmsg, a kernel security hook invoked when sending messages through sockets. Even when an application invokes the same operation as before, operations that meet specific conditions are now blocked at the OS level.

Rather than fixing the vulnerable code itself, the Shield restricts the execution path required to exploit the vulnerability.

Applying the Shield

1. Preparing the Test VM

I used an EC2 m8i.2xlarge instance running Ubuntu 26.04 as the host and launched a dedicated QEMU/KVM VM. The VM runs the official test kernel, which includes the features required by Shirudo.

EC2 host: Build and sign the BPF source code
    ↓ Read-only file sharing
Test VM: Load the signed Shield into the kernel
Enter fullscreen mode Exit fullscreen mode

To use KVM inside the EC2 instance, I enabled nested virtualization.

I prepared the compatible kernel and Shirudo runtime in advance, and then loaded the Shield into the VM once the environment was ready. I did not apply the Shield to the EC2 host kernel.

2. Building and Signing the Official BPF Source Code

On the host, I ran make build. This prepared Shirudo itself and the bundle for the VM, and generated the shield.upatch file from the official cve-2026-31431-alg-splice-block.bpf.c source file.

The following is an excerpt from the main part of the build script. source_file refers to the path of the BPF source file mentioned above, and keys refers to the directory containing the signing keys used for this experiment.

shirudo build "${source_file}" \
  --name cve-2026-31431-alg-splice-block \
  --keys-dir "${keys}" \
  --vmlinux vendor/linux/vmlinux.h \
  -o build/kernel-lab/shield.upatch
Enter fullscreen mode Exit fullscreen mode

This .upatch file is a signed artifact intended to be loaded by the runtime. It is not a diff patch applied to application source code.

In the official VM setup, signing keys are generated for testing, and the corresponding certificate is registered inside the VM. For this experiment, I used those keys to sign the Shield and configured the VM so that it could verify the signature.

3. Loading the Shield Inside the Test VM

The artifacts generated on the host are accessible from inside the VM under /workspace/shirudo. I ran the following commands inside the VM:

cd /workspace/shirudo
/usr/local/bin/shirudo-runtime upatch load build/kernel-lab/shield.upatch
Enter fullscreen mode Exit fullscreen mode

After the signature is verified, the loader is executed and the BPF program is loaded into the kernel.

From this point on, the Shield's checks are enforced whenever the relevant operations are performed. There is no need to rebuild or redeploy the application.

4. Verifying the Behavior and Removing the Shield with a Signed Artifact

Using the official Python probe, I performed the same operations three times in each of the following phases: before applying the Shield, while the Shield was active, and after removing it. The probe attempts regular copy-based transmission followed by splice on the same cryptographic socket.

I used the following command to remove the Shield:

/usr/local/bin/shirudo-runtime upatch unload build/kernel-lab/shield.unload.upatch
Enter fullscreen mode Exit fullscreen mode

Removing the Shield detaches the checks that were added when it was loaded. The VM was not rebooted at any point between applying and removing the Shield.

Comparing the Results Before, During, and After Shield Application

State Regular copy-based transmission splice
Before applying the Shield Allowed in all 3 attempts Allowed in all 3 attempts
While the Shield was active Allowed in all 3 attempts Blocked in all 3 attempts
After removal using a signed artifact Allowed in all 3 attempts Allowed in all 3 attempts

SPLICE_BLOCKED indicates that regular copy-based transmission succeeded, while only splice was blocked. The boot UUID remained identical across all phases, confirming that I was able to introduce and remove the restriction without rebooting the VM.

Final Thoughts

In this experiment, I tested both the operations I wanted to block and those I wanted to keep working. Legitimate applications would also be affected if they used the same zero-copy transmission mechanism with AF_ALG. Therefore, it is necessary to compare the behavior of actual applications before and after applying a Shield.

After identifying a critical vulnerability in Dependency-Track, the next step would be to check whether a Shield is available for that particular vulnerability. If no Shield is available, it may also be necessary to investigate which conditions should be restricted and create a Shield accordingly. This experiment only covered an existing Shield targeting a Linux kernel vulnerability.

The motivation behind this experiment was to explore whether Shirudo could be used as a temporary mitigation while waiting for patches for vulnerabilities identified by Dependency-Track.

I was able to verify that a Shield could be applied and removed on a compatible kernel. However, before using Shirudo in the container environments I typically work with, I would also need to investigate the requirements at the node level.

Top comments (0)

The discussion has been locked. New comments can't be added.