Remote Exploit Forums

Go Back   Remote Exploit Forums > Specialist Topics > Pentesting


Pentesting Specific topics related to legal penetration testing

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-01-2009, 04:34 AM
New Member
 
Join Date: Oct 2009
Posts: 1
Default BoF Exploit Windows XP SP0

Hi,

Sorry for double-posting in the other thread! I missed the fact that my posts have to be approved by a mod and thought my first post would have been lost.

I have the task to demonstrate a buffer overflow with Windows XP (NO service pack installed). There are several tutorials on how to do this on the net. So I just wrote some vulnerable piece of C++ server code including:

char test[20];
...
strcpy( test, attackerstring);

where "attackerstring" is the ordinary much too long string passed by the client (some hundred "A" characters). The BoF seems to work and will crash the application. I am also able to overwrite both EAX and ECX (take a look at the screenshot below). However, I am not able to overwrite the crucial EIP, regardless how ridiculously long the string of "A" characters is. 100 do not work, 500 do not work, 2000+ do not work. It doesn't help either to let OllyDbg pass the exception to my programme.

SCREENSHOT: img101.imageshack.us/img101/5986/ollydbg.jpg

The exploit is running on VMWare Player 2.53 & Windows XP SP 0. All tutorials and forum posts I have browsed require me to access the EIP. Does anybody have an idea why it is not working for me? I'm really despaired by now.

Thanks for your efforts, m.
Reply With Quote
  #2 (permalink)  
Old 11-01-2009, 05:35 AM
lupin's Avatar
Moderator
 
Join Date: Mar 2009
Location: Australia
Posts: 945
Default

Make sure the overflow occurs inside a function and not inside main, as demonstrated in the code below. This will ensure that the overflow occurs on the stack which allows the return address fed to EIP when the function exits to be overwritten.

A buffer of 28 A characters will overwrite EIP for the code below.

Code:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

void function(char *input) {
	char buffer[20];
	strcpy(buffer, input);  //overflow here, when function returns to main the return address can be overwritten
}

int main(int argc, char *argv[]) {
	function(argv[1]);
	return 0;
}
__________________
Nancy Astor: If I were your wife I would put poison in your coffee!
Winston Churchill: Madam, if I were your husband I would drink it.

Last edited by lupin; 11-01-2009 at 05:51 AM.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 09:33 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2