hey JaPH
My english is quite bad. :( I hope you understand me.
U can change the excutive flow by overwriting some func`s return address with your own code.
So basic BoF needs 2 points. Return address and shellcode`s one.
1.Check the program`s stack layout. usually EBP + 4 is Return address.
esp is the edge of the stack. (ex. In GDB, by typing "X/16x $esp", u can see stack)
2. I made it.
3. Actually, the first line is shellcode.
"\x8d\x4c\x24\x04\x83\xe4\xf0\xff\x71\xfc\x55\x..."
Let`s look below the line
void main()
{
int *ret; //declare variable
ret =(int *)&ret + 2;
// &ret means ret`s address and casted to integer point
// so "+2" ---> "+(int *)x2" -------> "+(4bytes)x2" = "+8bytes."
// Think it as stack
high address
--------------
return address +8
--------------
ebp +4
--------------
ret here is ret
---------------
low address
// U got it? It overwrites Main function`s return address.
*ret = shell;
// return address is pointed by ret. so shellcode will be excuted.
}
This source is just for test that shellcode is whether to work or not.
'Sabzil' 카테고리의 다른 글
Ubuntu 12.10 에서 libboost1.48-all-dev 가 설치 되지 않을 때 (3) | 2013.02.14 |
---|---|
how to set debug environment for android (0) | 2012.09.14 |
oracle sql injection with rownum (0) | 2011.09.01 |
Shellcode site (0) | 2009.09.29 |
hey JJAAPPPHH ~ (4) | 2009.08.17 |
6회 kisa 해킹방어대회 6번 (0) | 2009.07.09 |
ABI (Application Binary Interface) (0) | 2009.03.17 |
Nefif_rx (0) | 2009.03.17 |
usleep에 대해서 (0) | 2009.01.08 |
strtok_r (0) | 2008.09.29 |