Electric Boogaloo是一个续集烂片的梗,《Copy Fail 2: Electric Boogaloo》就是指DirtyFrag

图片由AI生成

CVE-2026-43284

XFRM(Transform)是Linux内核中实现IPsec的框架,XFRM有管理召回范围的SPD(Security Policy Database)、定义处理方式的SAD(Security Association Database)数据库。

处理方式有包含加解密的ESP协议(Encapsulating Security Payload)、只作校验的AH(Authentication Header)协议。为了兼容NAT穿透,XFRM会将ESP协议封装进UDP中(ESP-in-UDP)。

Linux内核提供了一个Socket接口NETLINK_XFRM供用户态访问,通过skb_to_sgvec函数将Socket Buffer(SKB)结构体转换为Scatterlist(SGL)结构体,进行高效的Zero-CopyIn-place加解密。

xfrm-ESP页缓存覆写

具备CAP_NET_ADMIN权限时配置SAD规则,数据最终流向相同的crypto_authenc_esn_decrypt函数,SKB->frags[]会被映射到SGL指针,用户可控的Payload(seqno_lo)再次在In-place机制加持下完成对Page Cache的覆写。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
static void esp_input_set_header(struct sk_buff *skb, __be32 *seqhi)
{
struct xfrm_state *x = xfrm_input_state(skb);
struct ip_esp_hdr *esph;

/* For ESN we move the header forward by 4 bytes to
* accommodate the high bits. We will move it back after
* decryption.
*/
if ((x->props.flags & XFRM_STATE_ESN)) {
esph = skb_push(skb, 4);
*seqhi = esph->spi;
esph->spi = esph->seq_no;
esph->seq_no = XFRM_SKB_CB(skb)->seq.input.hi;
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
udp_rcv(skb) 
xfrm4_udp_encap_rcv(sk, skb)
xfrm_input(skb, IPPROTO_ESP, spi, 0)
esp_input(x, skb)
pskb_may_pull(skb, sizeof(esp_hdr) + ivlen)
if (!skb_cloned(skb) && !skb_has_frag_list(skb)) // Vulnerable branch: frag(page=P) preserved
goto skip_cow;
esp_input_set_header(skb, seqhi)
skb_push(skb, 4);
esph->seq_no = XFRM_SKB_CB(skb)->seq.input.hi;
skb_to_sgvec(skb, sg, 0, skb->len)
aead_request_set_crypt(req, sg, sg, elen+ivlen, iv)
crypto_aead_decrypt(req)
crypto_authenc_esn_decrypt(req)
scatterwalk_map_and_copy(tmp+1, dst, assoclen+cryptlen, 4, /*out=*/1)
memcpy(page_address(P) + i*4, &tmp[1], 4); // 4 byte STORE: page P[i*4..i*4+3] = patch_seqhi

Patch

Zero-Copy场景下增加SKBFL_SHARED_FRAG标记,改为Copy-on-Write而非In-place方式进行加解密。

CVE-2026-43500

Andrew File System(AFS)是一种分布式文件系统,使用基于UDP的RxRPC网络协议。Linux内核集成并提供了了一个AF_RXRPC Socket接口供用户态访问。

rxkad是基于Kerberos v4的RxRPC协议安全机制,提供校验(RXRPC_SECURITY_PLAIN)、认证(RXRPC_SECURITY_AUTH)、加密(RXRPC_SECURITY_ENCRYPT)功能,采用基于DES-pcbcfcrypt算法,密钥长度仅有56位。

RxRPC页缓存覆写

rxkad进行pcbc(fcrypt)解密时也会使用相同SGL(In-place),输入是目标文件、密钥可控、IV为0(pcbc_decrypt(C, K, IV=0)),需要通过暴破K来翻转目标文件字节实现篡改,shellcode理论爆破次数为N*2^56或更大,想实战中覆写shellcode来提权或者容器逃逸几乎不可能。

因此作者选择了翻转/etc/passwd文件中root用户行部分字节的方式,降低暴破复杂度实现本地提权。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
static int rxkad_verify_packet_1(struct rxrpc_call *call, struct sk_buff *skb,
rxrpc_seq_t seq,
struct skcipher_request *req)
{

[...]

/* Decrypt the skbuff in-place. TODO: We really want to decrypt
* directly into the target buffer.
*/
sg_init_table(sg, ARRAY_SIZE(sg));
ret = skb_to_sgvec(skb, sg, sp->offset, 8);
if (unlikely(ret < 0))
return ret;

/* start the decryption afresh */
memset(&iv, 0, sizeof(iv));

skcipher_request_set_sync_tfm(req, call->conn->rxkad.cipher);
skcipher_request_set_callback(req, 0, NULL, NULL);
skcipher_request_set_crypt(req, sg, sg, 8, iv.x); // <=[4]
ret = crypto_skcipher_decrypt(req); // <=[5]

Container Escape

xfrm-ESP对于Payload受限少,但存在命名空间权限要求。RxRPC对于权限要求少,但Payload会受限于暴破复杂度只能篡改有限字节数。

两个漏洞的结合利用可以规避部分AppArmor策略限制,扩大本地提权可攻击范围;但对于容器逃逸而言,xfrm-ESP需要满足命名空间系统调用条件,RxRPC只可能在一些极其特殊的场景下利用。

Last Word

大家可以看看年初公布的CVE-2026-23060,会有一些有意思的发现。

Reference

  1. https://github.com/V4bel/dirtyfrag

  2. https://github.com/0xdeadbeefnetwork/Copy_Fail2-Electric_Boogaloo

  3. https://github.com/Percivalll/Dirty-Frag-Kubernetes-PoC

  4. https://github.com/torvalds/linux/commit/f4c50a4034e62ab75f1d5cdd191dd5f9c77fdff4

  5. https://github.com/advisories/GHSA-34wc-9m9j-23pc