← Templates / Security 8 min read

How to Run Shirudo Shields on Codiedev

A step-by-step guide to going from a CVE to a signed, TPM-verified Shield, with the prompts we used along the way.

Hand this guide to your AI agentCopies the full guide as markdown, ready to paste into your coding agent.

On November 23, 2026, OpenAI and Cisco released Shirudo, an open-source runtime designed to protect Linux systems while a patch is still being rolled out.

Shirudo works by shipping small, signed protections it calls Shields, which attach to a running kernel or Java process and watch or block the exact behavior a vulnerability depends on.

Why it's interesting

This is interesting due to the speed at which vulnerabilities are currently being discovered and exploited.

At Codiedev, we work directly with mid-market software engineering teams, and many are still on 3 month release cycles.

This led us to ask a simple question.

Could a legacy engineering team approve and automate a temporary fix, to compromise against their traditional internal processes?

Here's how we built it on Codiedev...

What you're building

The idea is that a CVE advisory triggers an agent on Codiedev, which writes a Shield with an approved model, checks it, and compiles it.

The agent then puts the Shield in your approval queue.

Once a human approves it, your operator machine signs the Shield, loads it on the target, and verifies it with the target's TPM.

What you need

You'll need a Linux machine with KVM.

You'll also need a Codiedev account with Agents turned on and at least one approved model, and we used GLM 5.3.

We used GLM 5.3 because we found that Claude and Codex models both refused cybersecurity protections (they instead prompted to contact enterprise sales to get access).

We started developing this utilizing Claude Code, but its cybersecurity safeguards flagged the work and moved our session down to Opus 4.8.

This degraded the dev performance, so we finished in Codex.

So the major LLM providers bit in 2 spots; building the agent, and running the agent.

If you have cyber issues with the major LLM providers, try Codiedev's own harnesses, Codie (OpenCode) or codie --pi, with an open model like GLM 5.3.

Step 1: Build a Shirudo lab

Shirudo needs a kernel carrying its own patches plus a TPM.

The easiest place to start is its test target, which is a VM with a software TPM that will only load Shields signed by your key.

We didn't want to touch our host machine, so we ran everything inside a throwaway VM with nested virtualization and followed Shirudo's quickstart from there.

Paste this into your coding agent:

Prompt for your coding agent
I have a Linux box I can SSH into that supports nested virtualization.
Set up a Shirudo lab on it without changing the box itself: create a
throwaway Ubuntu VM on it, build Shirudo from github.com/shirudo-dev/shirudo
inside that VM by following its quickstart guide, and boot Shirudo's
protected test target. Show me the target's status when it's up.

The first boot builds a disk image, a verified runtime image, and a throwaway signing key, so expect it to take a while.

In our case it failed twice…

The first failure was DNS, because Shirudo's image builder ignores Ubuntu's local resolver, so we had our agent point the build at a public DNS server instead.

The second was that the image build had no network at all, because Ubuntu's AppArmor blocks the network helper the builder relies on.

We learned that Shirudo's own CI turns that profile off, so we had our agent do the same inside the lab VM only, never on the host.

When it finally works, you'll see something like this:

Output
Status:                ok
  LsmAttached        OK      lsm/bpf link present and pinned
  KeyringSealed      OK      bpf serial 454658307, dm-verity serial 416935953, pins match
  TpmMeasured        OK      NV index 0x01818E00 readable

Step 2: Create the agent

On Codiedev, an agent is a folder with an entrypoint that runs in a fresh cloud sandbox every time it's triggered.

Model access, tracing, and approvals are already wired in.

Paste this into your coding agent:

Prompt for your coding agent
Create a new Python agent on Codiedev called shirudo-shield.

It should take a CVE advisory and the kernel function to watch, and use our
default approved model to write one read-only Shirudo Shield: a small eBPF
detector that counts every call to that function, and separately counts the
calls that match the dangerous shape described in the advisory. It must never
write to kernel memory, send signals, change return values, or contain
exploit code.

Before a human ever sees it, check the Shield against those rules and compile
it inside the agent's sandbox. If either check fails, send the problems back
to the model and let it try again, up to three times.

When it passes, put it in my Codiedev approval queue with the source attached
and stop. If I approve it, save it so my operator machine can pick it up and
let me know. If I reject it, do nothing.

Cap the agent's budget at $5 a month, and test it on my machine before you
deploy it.

Most of the work in the agent comes down to three pieces.

The first is the set of rules the model gets in its system prompt, which spell out what a Shield is allowed to be:

Agent system prompt
- Defensive only.
- Read-only: count events in BPF_MAP_TYPE_PERCPU_ARRAY maps named `activity`
  (every call) and `hits` (calls matching the dangerous shape). No writes to
  kernel memory, no signals, no return-value overrides.

We found pretty quickly that a prompt alone wasn't enough.

So the second piece is a check that fails any Shield using one of these outright:

Agent code
FORBIDDEN = [
    "bpf_probe_write_user", "bpf_override_return", "bpf_send_signal",
    "bpf_send_signal_thread", "bpf_sys_bpf", "bpf_copy_from_user_task",
    "fmod_ret", "SEC(\"lsm", "bpf_skb_store_bytes", "bpf_xdp_adjust",
]

The third piece is the approval itself, which is where the agent ends its run and waits for a human:

Agent code
approval = agents.request_approval(
    f"Approve read-only Shirudo Shield for {task['cve']}?",
    details=f"lint + BPF compile: passed\n\n```c\n{shield['source']}```",
    context={"cve": task["cve"], "function": task["function"], "source": shield["source"]},
)

When someone makes a decision, Codiedev starts a second run of the same agent with that decision as its input.

Step 3: Trigger it with a CVE

We used CVE-2026-31431, which is a memory corruption bug in the kernel's AF_ALG crypto sockets.

Paste this into your coding agent:

Prompt for your coding agent
Deploy shirudo-shield to Codiedev and run it on CVE-2026-31431.

The function to watch is af_alg_sendmsg. Here's the advisory: memory
corruption in the algif_aead copy-failure path. When an AEAD operation fails,
the kernel scrubs the source pages of the socket's send list. That only
corrupts memory the socket doesn't own when those pages were spliced in with
zero-copy, meaning the send carried the kernel-internal MSG_SPLICE_PAGES flag.
Ordinary sends copy their data in and are safe.

Show me the run's cost and the Shield it wrote.

If you'd rather this happen on its own, you can ask your agent to give shirudo-shield a webhook and point your vulnerability feed at it, so every new advisory starts a run.

Our run took about a minute and a half, and on its first attempt the model made a mistake with its counters.

The checks caught it and sent it back, and the second attempt passed both the checks and the compile.

The model cost for the whole run came out to $0.0009.

Step 4: Approve it

The Shield then shows up in your Codiedev approval queue with the full source, the hook it uses, and the model's reasoning.

Once you approve it, the agent stores the Shield.

Step 5: Sign, load, and verify it

This part runs on your operator machine, since that's where the signing key lives.

We had our agent write a test script first, and then check its own work against the Shirudo source before running anything.

Paste this into your coding agent:

Prompt for your coding agent
Write a script for my Shirudo operator machine that tests one Shield end to
end. It should build and sign the Shield, load it on the test target, check
the target is still healthy, read both counters, send some ordinary crypto
traffic, read the counters again, then get signed evidence from the target's
TPM and verify it here. Always unload the Shield at the end, even if
something fails. Count it as a pass if the activity counter moved. Never
use zero-copy splicing anywhere in it.

Before you run it, check it against the Shirudo source in this checkout:
make sure every Shirudo command it uses really exists, and that it uses the
trusted Shirudo binary on the target. Tell me what you changed.

That last paragraph of the prompt ended up mattering more than we expected, because two things are easy to get wrong without reading the source.

The first is that inside a non-interactive shell on the target, plain shirudo is a decoy that Shirudo deliberately blocks, so the script has to call shirudo-runtime instead.

The second is that a pass condition waiting for the danger counter to move will never pass, because normal traffic should never move it.

Once you've approved the Shield, paste this into your coding agent:

Prompt for your coding agent
Pull the Shield I just approved from shirudo-shield and run it through
the test script on the target. Show me the load, the TPM verdict and
the unload.

Here's what ours printed:

Output
upatch load: signed loader accepted, keyring 454658307, 172 instructions
upatch load: program 0 (fentry) pinned at /run/shirudo/bpffs/upatches/cve-2026-31431-shield/link
upatch load: cve-2026-31431-shield measured, register ded0eeacab08...

  OK    quote: ECDSA signature by the attestation key
  OK    eventlog: 2 records replay to the certified value
  OK    state: register equals the expected value
  NOTE  event after boot: upatch_load cve-2026-31431-shield
verdict: ok

upatch unload: cve-2026-31431-shield detached and unpinned

The kernel checked the Shield's signature against its sealed keyring before accepting it.

The TPM then signed evidence of the load, and the operator verified it offline.

Step 6: Prove the detector fires

Shirudo's test kernel turned out to be pretty stripped down, with no kprobes, no netem, and no AEAD crypto algorithms.

So to test the detection logic itself, we ran the same compiled Shield on the lab VM's stock Ubuntu kernel instead.

Paste this into your coding agent:

Prompt for your coding agent
Load the approved Shield on the lab VM's normal Ubuntu kernel, outside
Shirudo, just to test the detection logic. Read both counters, send 50
ordinary AES-GCM encryption requests through the kernel's crypto sockets
with no zero-copy splicing, read the counters again, then remove it.
Output
before: activity=1  hits=0
sent 50 ordinary AES-GCM encrypt requests (50 replies)
after:  activity=51 hits=0

Fifty ordinary sends moved the activity counter by exactly fifty, while the danger counter stayed at zero.

That's what you're looking for.

Where to take it next

Once the loop works for one CVE, most of what's left is wiring.

The first thing we'd do is give the agent a webhook and point a vulnerability feed at it.

That way new CVEs show up in your approval queue without anyone typing a prompt.

From there, it makes sense to move the signing key into a hardware security module and let your build system sign approved Shields, rather than keeping a key file on the operator.

You'd also want to publish signed Shields to an OCI registry and let targets pull them, which is how Shirudo is designed to deliver in the first place.

Shirudo can also export map contents to an OpenTelemetry collector, so a hits count above zero can page someone or trigger another agent.

If you have any questions on how to implement this reach out to support in the portal and we can help you set this up for your repos.

Build it on Codiedev

Build your own agent next.

Start from this template or from scratch. Models, sandboxes, approvals and traces are built in, so you describe the agent to your coding agent and Codiedev runs it.

Request a demo