Note that this binary is **statically linked**, so we can't use ret2libc. In addition, this binary is **stripped**, so we know nothing about the function names.
```shell
$ checksec chall
'/root/Dropbox/Pwnie-Island-Wargame/zer0pts_CTF/Pwn/hipwn/chall'
Arch: amd64-64-little
RELRO: Partial RELRO
Stack: No canary found
NX: NX enabled
PIE: No PIE (0x400000)
```
Since **NX** is the only protection turned on, this challenge can be solved with some ROP technique.
## Source Code
```c=1
#include <stdio.h>
int main(void) {
char name[0x100];
puts("What's your team name?");
gets(name);
printf("Hi, %s. Welcome to zer0pts CTF 2020!\n", name);
return 0;
}
```
Obviously `gets(name);` triggers stack overflow that allows us to control EIP.
## Analysis
Since the binary is statically linked and stripped, the first thing we should try is **ret2syscall**. To learn more about ret2syscall, check out [ret2syscall Cheat Sheet](https://hackmd.io/@pwnie-island/ret2syscall-cheat-sheet).
Let's look for necessary ROP gadgets:
![ROPgadget](
[zer0pts CTF 2020] hipwn
)
However, the string `/bin/sh` is not inside the binary:
![No "/bin/sh"](
[zer0pts CTF 2020] hipwn
)
This makes the challenge slightly difficult. What we have to do here is to pass the string `"/bin/sh"` to the `.bss` section. The address of `.bss` can be easily found using Pwntools (`bss = elf.bss()`). Since the binary contains the function `gets`, we can call `gets(bss)` to open a STDIN session and pass the string `"/bin/sh"` from here.
Next, we need to find the address of `gets`. But the binary is stripped, so how do deduce the location of this address? First **disassemble** the binary: