Codecfault
Oct 23 2003, 07:19 AM
Does anyone know the whereabouts of any info on how to write shellcode for windows. I am looking to understand how various exploits work and hopefully to write my own.
Thank you for your time
Codecfault
pr0t0type
Oct 23 2003, 12:16 PM
Been trying to learn myself. I posted a good into into into buffer overflows in the sticky above and I've found
this article to be really helpfull. I'd be interested if anyones got anmy good asm tuts
Codecfault
Oct 24 2003, 06:09 AM
great link thanks pr0t0type
SLiM577
Dec 6 2003, 07:20 PM
thanks alot guys im also trying to learn to code /etc
nazinofix
Dec 20 2003, 06:03 AM
Buluemoon
Dec 25 2003, 09:53 PM
Thanks to all who posted links on this subject, the last 2 look very useful, and have to go and read them, been looking around but never saw these.
Codecfault
Dec 28 2003, 05:28 AM
thanks a lot nazinofix great link
skorpio
Dec 28 2003, 12:55 PM
thx nazinofix
very interesting link

byee
[_0z_]
Jan 7 2004, 04:15 PM
great work.
Hexboy
Jan 8 2004, 01:49 AM
http://www.shellcode.com.ar has some windows shell code. I've learned a few sweet tricks from code available there.
BillyJawz
Jan 9 2004, 08:30 PM
nipagini
Feb 8 2004, 07:22 PM
wow thx m8!!! that's a realy good documentation about buffer overflows!!
riotz
Feb 10 2004, 04:30 PM
these 2 pdfs are a real nice reading..
thnx for shaing
archphase
Feb 10 2004, 10:11 PM
Windows shellcode is a bitch too write. All of those win32 shellcode papers show how to get it by SEH or you can get it by using the TEB block i think or whatever is at fs:[30]..but i think the more code efficent way is like this..or atleast i think it is.
| CODE |
mov ebx, ebp mov eax, esp sub eax, ebx; eax = amount of bytes on stack mov ecx, [esp+eax]; ecx = somewhere in k32..search
loopme: cmp word ptr [ecx], 'M' + 'Z' jz foundMZ dec ecx jmp loopme
foundMZ: nop; found if we find mz header.
|
I think that'll work on a typicall vc++ app which builds the stack frame..just an idea.
nazinofix
Feb 12 2004, 02:20 AM
The 'Understanding Windows Shellcode' paper cited earlier in this thread covers the technique of walking down in increments of 16 pages (64KB) to locate the MZ header associated with kernel32 by taking an address that is known to be inside kernel32. It applies this technique with both walking the SEH list to the last handler as well as using a known offset from the top of the stack which is in the TEB. The latter ends up being about 25 bytes all told. Is this what you're describing?
beenal
Feb 12 2004, 06:15 AM
archphase
Feb 13 2004, 02:26 AM
| QUOTE (nazinofix @ Feb 12 2004, 02:20 AM) |
| The 'Understanding Windows Shellcode' paper cited earlier in this thread covers the technique of walking down in increments of 16 pages (64KB) to locate the MZ header associated with kernel32 by taking an address that is known to be inside kernel32. It applies this technique with both walking the SEH list to the last handler as well as using a known offset from the top of the stack which is in the TEB. The latter ends up being about 25 bytes all told. Is this what you're describing? |
Naw..i mailed HDM but havent got a response.
When windows spawns a new process it calls CreateProcess which makes a call after the pe loader has done everything. So that means esp on entry is = to somewhere in kernel32. So if the compiler builds a stack frame like most vc++ apps then it'll do like:
| CODE |
push ebp mov ebp, esp
|
which means that you can do:
| CODE |
mov eax, [esp+4]; account for push ebp
|
and youll find somewhere in kernel32 where i just decriment 1 byte and check for MZ signiture then you can go from there.
like that code above i think would generate 15 bytes vs. 25 if you were trying to find the base.
nazinofix
Feb 13 2004, 06:17 AM
Yeah, I understand what you're saying. The concept you're describing is discussed under the TOPSTACK method in the PDF. The difference is that instead of making use of the TEB you're using a constant offset. While technically useful, and indeed smaller, this method is vulnerability dependant and thus not as robust. It also relies on the fact that the vulnerability is realized through a constant call stack (which generally speaking is the case, so this point isn't a big one). Granted, robustness isn't really a big concern in the exploit world, but the lack of robustness is the reason it isn't covered in such a fashion in the PDF, but rather is discussed in the context of a more reliable approach.
The method you describe is definitely viable, just pointing out why it is approached differently in general.
archphase
Feb 14 2004, 12:36 AM
oh yeh i just scanned that thing and didn't see it. woops :-/
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.