Skip to content

Commit eef1d34

Browse files
committed
Adds more comprehensive check, updates build instructions
1 parent 8c43583 commit eef1d34

File tree

2 files changed

+36
-3
lines changed

2 files changed

+36
-3
lines changed

documentation/modules/exploit/linux/local/sudo_chroot_cve_2025_32463.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,36 @@
33

44
Sudo before version 1.9.14-1.9.17p1 allows user to use `chroot` option, when executing command. The option is intended to run a command with user-selected root directory (if sudoers file allow it). Change in version 1.9.14 allows resolving paths via `chroot` using user-specified root directory when sudoers is still evaluating. This allows the attacker to trick Sudo into loading arbitrary shared object. As target shared object, Name Service Switch (NSS) operations are trigged before resolving sudoers, but after running `chroot` syscall. The module requires existing session and requires compiler on target machine (e.g. `gcc`).
55

6-
Installation of vulnerable sudo:
6+
## Installation
77

8+
1. Create `Dockerfile`:
89
```
9-
wget https://www.sudo.ws/dist/sudo-1.9.16p2.tar.gz && \
10+
# ----- Dockerfile -----
11+
FROM ubuntu:24.04
12+
13+
ENV DEBIAN_FRONTEND=noninteractive
14+
15+
RUN apt-get update && \
16+
apt-get install -y build-essential wget libpam0g-dev libselinux1-dev zlib1g-dev \
17+
pkg-config libssl-dev git ca-certificates && \
18+
rm -rf /var/lib/apt/lists/*
19+
20+
WORKDIR /opt
21+
RUN wget https://www.sudo.ws/dist/sudo-1.9.16p2.tar.gz && \
1022
tar xzf sudo-1.9.16p2.tar.gz && \
1123
cd sudo-1.9.16p2 && \
1224
./configure --disable-gcrypt --prefix=/usr && make && make install
25+
26+
RUN useradd -m -s /bin/bash msfuser
27+
28+
USER msfuser
29+
WORKDIR /home/msfuser
30+
31+
CMD ["/bin/bash"]
1332
```
33+
1. `docker build -t sudo-chroot .`
34+
1. `docker run -it --rm --privileged sudo-chroot`
35+
1436

1537
## Verification Steps
1638

modules/exploits/linux/local/sudo_chroot_cve_2025_32463.rb

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,19 @@ def initialize(info = {})
6969
]
7070
end
7171

72+
# borrowed from exploits/linux/local/sudo_baron_samedit.rb
73+
def get_version
74+
versions = {}
75+
output = cmd_exec('sudo --version')
76+
if output
77+
version = output.split("\n").first.split(' ').last
78+
versions[:sudo] = version if version =~ /^\d/
79+
end
80+
versions[:sudo].gsub(/p/, '.')
81+
end
82+
7283
def check
73-
sudo_version = installed_package_version('sudo')
84+
sudo_version = installed_package_version('sudo') || get_version
7485

7586
return CheckCode::Unknown('Could not identify the version of sudo.') if sudo_version.blank?
7687

0 commit comments

Comments
 (0)