[31187] in bugtraq

home help back first fref pref prev next nref lref last post

Re: MSBlast complete recode / analysis

daemon@ATHENA.MIT.EDU (H D Moore)
Thu Aug 14 17:11:17 2003

From: H D Moore <sflist@digitaloffense.net>
To: "Rolles, Rolf" <rolf.rolles@ncf.edu>, bugtraq@securityfocus.com
Date: Thu, 14 Aug 2003 15:39:24 -0500
In-Reply-To: <47061C4B43396347A1936F79E30D1F15154323@bishop.network.ncf.edu>
MIME-Version: 1.0
Content-Type: text/plain;
  charset="utf-8"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Message-Id: <200308141539.24727.sflist@digitaloffense.net>

On Thursday 14 August 2003 01:19 am, Rolf Rolles wrote:
> MSBlast was compiled with LCC 1.x, which made it particularly easy to
> analyze. The exploit encrypts itself via XOR.  A few simple
> modifications to the "Ripper" IDC on datarescue's site takes care of
> this "protection".

The "encryption" only exists to prevent certain characters from ending up 
in the payload. The source code for the xor encoder is public and part of 
the Pex.pm module in the Releases section of the metasploit.com web site.

> The shellcode binds cmd.exe to 135, and the attacker sends the

Not so, the shellcode creates a new socket on port 4444 and binds cmd.exe.

> And the analysis of the exploit itself:  (the comments became sparse
> when I realized that the code was ripped from HalVar (URL is below)). 

The code was not ripped from HalVar, but the universal loader code was 
borrowed from a friend (and tweaked). As you can see from the comments 
below, the ScanForApi stuff wasn't originally from HalVar or even LSD. 
The hashing algorithm I use has four-byte keys, HalVar used two-byte 
keys. There are a number of other huge differences in the bindshell code 
(since I wrote mine from scratch). 

----
.FindKernel32Base:
    mov         eax, [fs:ecx]           
; find kernelbase
    mov         eax,[eax+0x0C]          
; stolen from LSD who stole it from VX... it's a pity
----

The shellcode and xor encoder source code is available from the 
metasploit.com web site. The relevant URL's are:

(slightly different from the version used in dcom.c)
http://www.metasploit.com/sc/win32_bind.asm

(the LongXorDecoder routine)
http://www.metasploit.com/tools/Pex.pm

Blah. Worms suck.

-HD


On Thursday 14 August 2003 11:49 am, Rolles, Rolf wrote:
> since bugtraq is slow in accepting this, here it is.\
>
> Rolf


home help back first fref pref prev next nref lref last post