Skip to content
Memory corruption Write-up Advanced

The skb that wasn't freed - the Fragnesia primitive via Open vSwitch

Open vSwitch's kernel datapath strips the SKBFL_SHARED_FRAG marker from a packet it is still forwarding, so a later in-place ESP decrypt writes attacker-chosen bytes into the page cache of a root-owned file. An unprivileged user with a user namespace could therefore overwrite read-only file contents and escalate to root.

blog.doyensec.com

Published on blog.doyensec.com

Earlier this year a small family of Linux kernel bugs appeared, starting with Copy Fail. Unlike standard memory corruption, their defining feature was that an unprivileged user could overwrite read-only memory mappings simply through legitimate operations, without any race condition or strict timing.

Norbert Szetei, on blog.doyensec.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the OVS datapath clears the skb shared-frag flag on a packet it continues to forward, so the in-place decrypt consumer no longer sees the shared-frag marker and writes over shared page-cache pages.

Impact

A deterministic local privilege escalation to root on default installs of several major distributions, provided unprivileged user namespaces and OVS autoloading are available.

What the attacker needed

Unprivileged user namespaces enabled; openvswitch module autoloadable; stock kernel with the Fragnesia fix

The fix

The issue was fixed in mainline and shipped in stable, and the fix was coordinated with the Open vSwitch maintainers.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

The kernel marks certain network packets as 'shared' so that code which decrypts them in place first makes a private copy instead of writing over memory someone else owns. Open vSwitch, a software switch, was dropping that mark while still passing the packet along, so the decrypt wrote into the cached copy of a root-owned file. Because an ordinary user can set up this switch inside their own namespace, they could change protected files and become root.

What is Memory corruption?

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.