Challenge
Read the flag from /home/orw/flag
.
Only open read write syscall are allowed to use.
nc chall.pwnable.tw 10001
Solution
The binary simply reads in 200 bytes and then jumps to its address, after using prctl
to prevent calling execve
:
int main(void) {
orw_seccomp();
printf("Give my your shellcode:");
read(0,shellcode,200);
(*(code *)shellcode)();
return 0;
}
By using strace
, we see that orw_seccomp
calls prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, {len = 12, filter = 0x400000020})
.
Based on this and the challenge description, it is clear that we cannot use a execve
shell code like in the previous challenge.
To assemble shellcode, I used an online x86 assembler rather than setting up nasm. We know that the flag is located in /home/orw/flag
. Our shellcode needs to accomplish the following: