Advanced Buffer Overflow #3

microprocessor ownership

How to make the microprocessor make what you want? Who owns the Instruction Pointer, owns the execution flow, and that's what we need. All bytes are composed of bits, but some of them are just numbers, and some of them are addresses to code. Jump! Geronimoooooooooo...


/* abo3.c                                       *
 * specially crafted to feed your brain by gera */

/* This'll prepare you for The Next Step        */

int main(int argv,char **argc) {
	extern system,puts; 
	void (*fn)(char*)=(void(*)(char*))&system;
	char buf[256];

	fn=(void(*)(char*))&puts;
	strcpy(buf,argc[1]);
	fn(argc[2]);
	exit(1);
}

buf is in the stack, and after it are some bits you can change, that you've learnt in abo1.

In case you wonder why we put that there, is so the linker doesn't remove it.

{Previous} {index} {Next}