@@ -51,22 +51,26 @@ def check_host(_ip)
51
51
end
52
52
53
53
def run_host ( ip )
54
- case check_host ( ip )
54
+ status = check_host ( ip )
55
+ case status
55
56
when Exploit ::CheckCode ::Appears
56
- print_good ( "#{ peer } is vulnerable" )
57
57
when Exploit ::CheckCode ::Detected
58
- print_good ( "#{ peer } uses a vulnerable version" )
58
+ when Exploit ::CheckCode ::Vulnerable
59
+ print_good ( "#{ peer } #{ status . last } " )
59
60
else
60
61
vprint_status ( "#{ peer } is not vulnerable" )
61
62
end
62
63
end
63
64
65
+ # Fingerprints the provided HTTP response and returns
66
+ # Exploit::CheckCode::Appears if it is a vulnerable version of RomPager,
67
+ # otherwise returns the provided fall-back status.
64
68
def check_response_fingerprint ( res , fallback_status )
65
69
fp = http_fingerprint ( response : res )
66
70
if /RomPager\/ (?<version>[\d \. ]+)/ =~ fp
67
71
vprint_status ( "#{ peer } is RomPager #{ version } " )
68
72
if Gem ::Version . new ( version ) < Gem ::Version . new ( '4.34' )
69
- return Exploit ::CheckCode ::Detected
73
+ return Exploit ::CheckCode ::Appears
70
74
end
71
75
end
72
76
fallback_status
@@ -84,7 +88,7 @@ def find_canary
84
88
# in most cases, the canary URI will not exist and will return a 404, but
85
89
# if everything under TARGETURI is protected by auth, that may be fine
86
90
# too
87
- return canary if res . code == 401 || res . code == 404
91
+ return canary if res && ( res . code == 401 || res . code == 404 )
88
92
end
89
93
nil
90
94
end
@@ -127,27 +131,27 @@ def test_misfortune
127
131
128
132
unless res . code == 404
129
133
vprint_status ( "#{ full_uri } unexpected HTTP code #{ res . code } response" )
130
- return check_response_fingerprint ( res , Exploit ::CheckCode ::Unknown )
134
+ return check_response_fingerprint ( res , Exploit ::CheckCode ::Detected )
131
135
end
132
136
133
137
unless res . body
134
138
vprint_status ( "#{ full_uri } HTTP code #{ res . code } had no body" )
135
- return check_response_fingerprint ( res , Exploit ::CheckCode ::Unknown )
139
+ return check_response_fingerprint ( res , Exploit ::CheckCode ::Detected )
136
140
end
137
141
138
142
# If that canary *value* shows up in the *body*, then there are two possibilities:
139
143
#
140
144
# 1) If the canary cookie *name* is also in the *body*, it is likely that
141
145
# the endpoint is puppeting back our request to some extent and therefore
142
146
# it is expected that the canary cookie *value* would also be there.
143
- # return Exploit::CheckCode::Unknown
147
+ # return Exploit::CheckCode::Detected
144
148
#
145
149
# 2) If the canary cookie *name* is *not* in the *body*, return
146
- # Exploit::CheckCode::Appears
150
+ # Exploit::CheckCode::Vulnerable
147
151
if res . body . include? ( canary_value )
148
152
if res . body . include? ( canary_cookie_name )
149
153
vprint_status ( "#{ full_uri } HTTP code #{ res . code } response contained test cookie name #{ canary_cookie_name } " )
150
- return check_response_fingerprint ( res , Exploit ::CheckCode ::Unknown )
154
+ return check_response_fingerprint ( res , Exploit ::CheckCode ::Detected )
151
155
else
152
156
vprint_good ( "#{ full_uri } HTTP code #{ res . code } response contained canary cookie value #{ canary_value } as URI" )
153
157
report_vuln (
@@ -156,7 +160,7 @@ def test_misfortune
156
160
name : name ,
157
161
refs : references
158
162
)
159
- return Exploit ::CheckCode ::Appears
163
+ return Exploit ::CheckCode ::Vulnerable
160
164
end
161
165
end
162
166
0 commit comments