All posts

Article

Shirudo: shield a running Linux server before the patch lands

OpenAI and Cisco's open-source Shirudo blocks the code path an exploit uses while the real fix is on its way, with no restart. What it is, how to try it in a VM, how to write and load your first upatch, and what to expect.

On 23 November 2026 OpenAI and Cisco announced Shirudo (Japanese for "shield"), an open-source runtime that protects running Linux systems "without needing to wait for the patch or restarts". This guide explains what it is, who can use it today, and walks you through trying it, step by step, with the commands from its documentation.

In short. Shirudo loads small, signed eBPF programs ("upatches", or "shields") into a running kernel or application to block the code path an exploit needs, until the real patch is installed. It is open source (BSD-2-Clause) and pre-release: there is no stable release yet, and a production server needs a bpf-next kernel with extra patches and a TPM 2.0. You can try all of it today in a test VM on any Linux machine with KVM.

What Shirudo does

When a vulnerability is published, there is usually a gap of days or weeks before a fixed package reaches your server, and then a restart or reboot before the fix is live. Shirudo is meant for that gap.

A shield is a small program that sits on the vulnerable code path and refuses the input or the call an exploit relies on. In the announcement's test, a shield written by Codex added an input check to Java's Base64 decoder, attached itself to a running Elasticsearch process, and rejected the exploit attempt, all without a restart. Cisco's write-up shows Elasticsearch logging it:

"message": "Base64 guard installed on java.util.Base64$Decoder.decode0 (classfile)",
"message": "Base64 guard rejected candidate: length=65, padding=1, remainder=1, alphabet=standard",

That result is the vendors' own test. Treat it as a demonstration, not an independent audit.

The pieces have names you'll see everywhere in the docs:

Term What it is
upatch The unit Shirudo installs: a BPF program written in plain BPF C, or a Java agent, packed into a signed .upatch file. A "shield" is a upatch that blocks an exploit.
Operator host Your machine (or CI) that compiles and signs upatches. It holds the signing key.
Target The server being protected. It only loads upatches signed by a key it trusts.
Signed loader The only way BPF code gets into a target's kernel. The kernel checks the signature before the BPF verifier even runs.
TPM measurement Every load and unload is recorded in a TPM register, so you can prove afterwards what was running.

Three properties stand out:

  • Only signed code runs. Even root on the target cannot load an unsigned upatch, or remove a loaded one, without the signing key. The docs are clear about the limit: an attacker with code execution inside the kernel can still get around it.
  • Nothing listens. There is no daemon and no open port. Every operation is a one-shot command, run by hand or by a systemd timer. A target sends data only to endpoints you configure.
  • Signatures are post-quantum. Keys are ML-DSA-87, and connections use TLS 1.3 with hybrid ML-KEM key exchange.

Can you use it yet?

Probably not in production. Shirudo's own FAQ says it "is pre-release and has no stable releases". A production target needs all of this:

Requirement Details
Kernel A bpf-next kernel with the signed-loader ABI and Shirudo's carried patches. No distribution kernel has them yet; the test kernel reports 7.4.0-rc1-bpf-next+.
Boot BPF LSM enabled, bpf.keyring_unsealed=1 dm_verity.keyring_unsealed=1 on the kernel command line, and a unified kernel image booted through systemd-stub.
TPM TPM 2.0 at /dev/tpmrm0. There is no mode without one.
Userspace systemd 256 or newer, a dracut-built systemd initrd.
CPU x86-64 and arm64. riscv64 is supported in the code but has not booted a target yet.
Other BPF tools Cilium, Falco, bcc and bpftrace don't run on an enforcing target as they are: only BPF from signed loaders is admitted.

It also has no fleet inventory or remote management yet, and one instance runs per host.

So today Shirudo is for trying out, testing shields and contributing: kernel and BPF engineers, security teams, and operators who want to be ready when it ships. Everything below runs in a throwaway VM, so you can learn it without touching a server.

Try it in a test VM

The quickstart builds Shirudo from source and boots a protected test VM with its own kernel and a software TPM. You don't need root.

1. Check what your machine needs

  • Linux on x86-64 or arm64 with KVM: /dev/kvm must be readable and writable by you. On a Mac (Apple M3 or later, macOS 15 or later) follow the Lima quickstart instead.
  • An unlimited locked-memory limit: ulimit -l should print unlimited.
  • clang and LLVM 23 with the BPF target, with clang at /usr/bin/clang. Debian unstable, Fedora 45 and apt.llvm.org ship it; on Debian testing or Ubuntu 24.04, add apt.llvm.org.
  • Development files for OpenSSL 3.5 or later, libelf, zlib, libcurl 7.75 or later, tpm2-tss and LuaJIT, plus make and pkg-config.
  • QEMU and swtpm for the VM, and jq, curl, Python 3, dpkg-deb and Docker or Podman.

The quickstart page lists the exact Debian and Ubuntu package names.

2. Build Shirudo and boot the VM

git clone https://github.com/shirudo-dev/shirudo.git
cd shirudo

# Download the test kernel the VM boots
testing/vm/kernel-artifact.sh fetch

# Build shirudo and the operator helper
make
make shirudo-build
export PATH="$PWD:$PWD/tools/shirudo-build:$PATH"

# Boot the protected VM, then open a root shell in it
make -C testing vm VM_NAME=quickstart
make -C testing vm-ssh VM_NAME=quickstart

3. Check that protection is on

Inside the VM:

shirudo status

You should see Status: ok. For scripts, shirudo status --json gives the same verdict as JSON. The status also counts tamper attempts, such as a BPF program load that didn't come from a signed loader.

Some of the docs' guides run the command as shirudo-runtime inside the VM. If shirudo answers image state: Permission denied, use shirudo-runtime instead: it is the trusted copy the VM booted with.

Write and load your first upatch

This upatch counts how often the kernel's do_nanosleep function runs (every sleep calls it). It blocks nothing, which makes it a safe first step: you'll see the whole build, sign, load, read and unload cycle. It follows the docs' first upatch guide.

1. Write the program

Save this as sleep-count.bpf.c in your checkout:

// SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause
#include "vmlinux.h"
#include <bpf/bpf_helpers.h>
#include <bpf/bpf_tracing.h>

/* The kernel refuses programs without a GPL-compatible license. */
char _license[] SEC("license") = "Dual BSD/GPL";

/* One counter, readable with `shirudo upatch map`. */
struct {
	__uint(type, BPF_MAP_TYPE_ARRAY);
	__uint(max_entries, 1);
	__type(key, __u32);
	__type(value, __u64);
} calls SEC(".maps");

/* The section name is the attach point: run on every do_nanosleep(). */
SEC("fentry/do_nanosleep")
int BPF_PROG(count_nanosleep)
{
	__u32 key = 0;
	__u64 *count = bpf_map_lookup_elem(&calls, &key);

	if (count)
		__sync_fetch_and_add(count, 1);
	return 0;
}

It's ordinary libbpf-style BPF C. If you've written BPF before, nothing here is new.

2. Build and sign it (on the operator side)

shirudo build compiles the program with clang, wraps it in a signed loader and signs it with your key. In the test VM setup, the key the VM trusts is created for you:

KEYS=/tmp/shirudo-test-vm-private-$(id -u)/operator-keys/keys

shirudo build sleep-count.bpf.c \
  --keys-dir "$KEYS" \
  --vmlinux vendor/linux/vmlinux.h \
  -o sleep-count.upatch

shirudo upatch info sleep-count.upatch

upatch info should show Name: sleep-count and Type: LOAD, and the payload's SHA-256.

Build the unload directive now too. It's a separate signed file that removes exactly this build, and nothing else can remove it:

PAYLOAD=$(shirudo upatch info --json sleep-count.upatch | jq -r .payload_sha256)

shirudo build --unload sleep-count \
  --payload-sha256 "$PAYLOAD" \
  --keys-dir "$KEYS" \
  -o sleep-count.unload.upatch

Don't skip --payload-sha256: without it the directive signs an all-zero digest and every target refuses it.

3. Load it on the target

Inside the VM, from your checkout (the docs' guides find it at /workspace/shirudo):

shirudo upatch load sleep-count.upatch

What to expect: lines saying the signed loader was accepted and the loader ran with 1 map and 1 program, ending with sleep-count loaded, 1 programs, keyring …. Add --report=- to get a JSON report of each step.

Now make it count something:

sleep 1; sleep 1; sleep 1
shirudo upatch map sleep-count calls

The map shows key = 0 with the count, at least 3 (it counts every process on the VM that sleeps). Only Shirudo's own binary can read the map: the kernel refuses it to every other process, root included.

4. Unload it

shirudo upatch unload sleep-count.unload.upatch
shirudo upatch list

The upatch is gone. The TPM register doesn't roll back, though: the record that it was loaded and unloaded stays until the next boot, which is the point.

When you're done, stop and remove the VM:

make -C testing vm-stop VM_NAME=quickstart
make -C testing vm-clean VM_NAME=quickstart

What a blocking shield looks like

A shield is the same kind of program, attached where it can say no. Shirudo supports LSM hooks, kernel functions, tracepoints, userspace functions (uprobes), cgroup socket buffers and netfilter.

Here is a sketch of a common emergency mitigation as a BPF LSM program: refuse to create user namespaces, which many Linux kernel privilege-escalation exploits rely on. This example is ours, not from Shirudo's docs, so test it in the VM first:

// SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause
#include "vmlinux.h"
#include <bpf/bpf_helpers.h>
#include <bpf/bpf_tracing.h>

#define EPERM 1

char _license[] SEC("license") = "Dual BSD/GPL";

/* Runs whenever a process asks for a new user namespace. */
SEC("lsm/userns_create")
int BPF_PROG(deny_userns, const struct cred *cred, int ret)
{
	if (ret)
		return ret;	/* already refused by another check */
	return -EPERM;	/* refuse it */
}

Build, load and unload it exactly like the counter above. Then, inside the VM, unshare --user true should fail with "Operation not permitted".

This is also the best illustration of what to expect from any shield: it changes behaviour. Refusing user namespaces breaks rootless containers, some browser sandboxes and Flatpak. Before you load a shield on a server you care about, run the workloads that server runs, with the shield loaded, in a test machine. The announcement says security teams will be able to watch how a shield would affect applications before enforcing it; the current docs don't describe such a mode yet, so for now, test it in the VM first.

Java applications get shields as Java agents (shirudo build agent.jar) rather than BPF, as in the Elasticsearch demo. Expect one catch: the agent is added through JAVA_TOOL_OPTIONS, which a JVM reads only when it starts, and a JVM started by a system service or container doesn't see it unless its unit names the agent. So a Java shield usually takes effect after the next restart of that service, and the docs call it a mitigation inside the application, not a boundary the kernel enforces.

Prove what's running

Every load is measured into the TPM, and the target can produce signed evidence you check offline. With a fresh random value, so old evidence can't be replayed:

NONCE=$(openssl rand -hex 32)

# On the target
shirudo attest --nonce="$NONCE" --output=/mnt/shirudo-out/ev.json

Then, on the operator host, shirudo attest predict computes what the register should hold and shirudo attest verify (with --evidence, --nonce, --ak-name and --expect-chain) checks the evidence against it. It ends with verdict: ok (exit code 0) or verdict: fail (exit code 1), so it fits in a script or a CI job.

Installing on a real server, once you have the kernel

The install guide builds two packages, one per role:

make -C packaging bindeb-pkg   # or binrpm-pkg on Fedora and RHEL

# On your signing machine
sudo apt install ./shirudo-operator_<version>_<arch>.deb
shirudo build --help

# On each server to protect
sudo apt install ./shirudo-target_<version>_<arch>.deb
sudo shirudo init --check-only

shirudo init --check-only runs 12 pre-flight checks (root, BPF LSM active, signed-loader kernel ABI, kernel LSM hooks, module signatures, your certificate, the TPM…) and prints OK or the reason for each. Installing the target package alone protects nothing: you also need the operator's certificate at /var/lib/shirudo/keys/cert.der, a signed runtime image and config image, and an initrd built with shirudo-gen-initrd. After a reboot, shirudo status should say Status: ok.

Create your own signing key on the operator host and keep it safe: anyone who has it can change what runs on your servers.

shirudo genkey --keys-dir ~/shirudo-keys

To deliver shields to many servers, push them to an OCI registry (the same kind that stores container images). Each target pulls and loads them from a systemd timer, about every minute. The registry is set in the signed config image, in etc/shirudo/bpm/registries.d/<name>.conf:

endpoint = oci://registry.example.com
key_file = /etc/shirudo/bpm/keys/<name>.der

Then on the target:

shirudo bpm repo update
shirudo bpm install <name>/<package>
shirudo bpm list

To see what your servers report, point them at an OpenTelemetry collector in the same config file (etc/shirudo/shirudo.conf):

map_export.otel_endpoint = https://collector.example.com:4318
map_export.tenant_id = my-team

One thing to know: with no destination set, the map-export timer prints maps to the journal every 5 seconds. If nothing reads them, turn it off with systemctl disable --now shirudo-map-export.timer.

What to expect

  • It doesn't replace patching. A shield covers the days until the fixed kernel or package is installed. You still update and reboot. The docs say upatches "do not replace mitigations built into the kernel".
  • Low overhead. On the docs' test VM, Shirudo's own protection runs 48 BPF LSM programs using about 196 KiB of locked memory, idles at under 1% of one CPU, and adds about 3.2 µs to a fork plus exec and 0.15 µs to an open, read and close. A small upatch is an 8.4 KiB file.
  • Shields survive a reboot. Loaded upatches are archived in /var/lib/shirudo/upatches/ and loaded again at the next boot, until you unload them.
  • A registry outage is harmless. Loaded shields keep running; the update fails and the timer tries again.
  • If something fails at boot, the boot goes on. What is enforced then depends on how far initialisation got.
  • Removing a key removes its shields. Revoking a signer, through a signed config, unloads everything it signed.
  • Root can't switch it off without the signing key, but a kernel exploit that already runs code in the kernel can.

When a load fails

Load with --report=- and read phase and category. The common ones, from the docs' debugging guide:

Category What it means What to do
signature_rejected The file wasn't signed by a key this target trusts, or changed after signing. Sign it with the target's key and copy it again.
keyring_missing shirudo init hasn't run since this boot. Check the boot and shirudo status.
already_loaded A upatch with this name is loaded. Unload it first.
verifier_rejected The kernel's BPF verifier refused the program. Read the verifier log in the report. "LSM programs must have a GPL compatible license" means the license line is missing.
attach_target_missing The function or symbol to attach to doesn't exist in this kernel. Check the hook name against the target kernel.
lsm_denied The command didn't run as Shirudo's runtime binary. In the test VM, use shirudo-runtime.
payload_mismatch (unload) The unload directive belongs to another build. Rebuild it with the digest from shirudo upatch info --json.
tampered Something changed what Shirudo protects. Don't retry: treat it as an incident.

Where this fits with UpHeron

A shield only helps if you hear about the vulnerability the day it's published and know which of your servers run the affected version. That's what UpHeron does: it checks new CVEs and advisories every 15 minutes against the software you tell it your servers and sites run (the Linux kernel, Java, Elasticsearch, nginx…), and emails you as soon as one affects you, with the version that fixes it. Shirudo can hold the line until that fixed version is installed.