View Single Post
Old 11-14-2012, 01:25 AM   PM User | #3
natv
New to the CF scene

 
Join Date: Apr 2012
Posts: 6
Thanks: 1
Thanked 0 Times in 0 Posts
natv is an unknown quantity at this point
Thanks for the replies.

I got some help from another resource, including the solution here in case this helps anyone else in the future:



1) on 64 bit Linux, size of int is 4 bytes. we're playing with the stack here so we need a 64 bit integer: the long type.

2) according to this resource: http://blog.markloiseau.com/2012/06/...nux-shellcode/

"you can no more define the shell code as a char array, because the shellcode[] character array is stored in the explicitly non-executable .rodata section of the ELF file" causing a segfault.

you have to insert it directly into the body of the main function.

3) the opcodes for x64 are different from those for x86.
the exit syscall is called differently.
the assembly for your shellcode on x64 would be:

mov rdi, 20
mov rax, 60
syscall
natv is offline   Reply With Quote