It looks like you're new here. If you want to get involved, click one of these buttons!
# exit.s
# Sh3llc0d3 - exit shellcode tutorial
.section .text
.globl _start
_start:
movl $0, %ebx
movl $1, %eax
int $0x80
as exit.s -o exit.o
ld exit.o -o exit
objdump -d exit
Disassembly of section .text:
08048054 <_start>:
8048054: bb 00 00 00 00 mov $0x0,%ebx
8048059: b8 01 00 00 00 mov $0x1,%eax
804805e: cd 80 int $0x80
// exit_shellcode.c
char shellcode[] = \"\xbb\x00\x00\x00\x00\"
\"\xb8\x01\x00\x00\x00\"
\"\xcd\x80\";
int main()
{
int *ret;
ret = (int *)&ret + 2;
(*ret) = (int)shellcode;
}
gcc -o exit_shellcode exit_shellcode.c
strace ./exit_shellcode
Pretty nice guide, this is how I wrote my /bin/dash shellcode. Also it's great to learn the system calls.
http://bluemaster.iu.hio.no/edu/dark/li ... calls.html
execve is a good system call for executing commands.
Lol thanks xin, glad you like it, short n simple example :) I'll write a more detailed/advanced one at some point.