> For the complete documentation index, see [llms.txt](https://d4rk1337.gitbook.io/the-pentesters-cheat-sheet/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://d4rk1337.gitbook.io/the-pentesters-cheat-sheet/exploitation/buffer-overflow/02-linux.md).

# Linux

## Related

[General](/the-pentesters-cheat-sheet/exploitation/buffer-overflow/01-general.md)

## General

### Deny traffic to vulnerable port from outside

```bash
iptables -A INPUT -p tcp --destination-port 1337 \! -d 127.0.0.1 -j DROP
iptables -A INPUT -p tcp --destination-port 4444 \! -d 127.0.0.1 -j DROP 
```

### Start app attached to EDB

```bash
edb --run /usr/games/crossfire/bin/crossfire
```

### Find offset

```bash
/usr/share/metasploit-framework/tools/exploit/pattern_create.rb -l 4379
/usr/share/metasploit-framework/tools/exploit/pattern_offset.rb -l 4379 -q 46367046
```

### Find opcode

```bash
/usr/share/metasploit-framework/tools/exploit/nasm_shell.rb
add eax,12
jmp eax
```
