> For the complete documentation index, see [llms.txt](https://exabsurdo.gitbook.io/home/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://exabsurdo.gitbook.io/home/writeups/htb-machines/usage.md). Agents can also search and read this documentation through its [MCP server](https://exabsurdo.gitbook.io/home/~gitbook/mcp).

# Usage

(SQLi Detected (Intercept Web Request > feed it to SQLMap > SQLMap Database Enumeration) > RevShell Upload > Local Enumeration > Symblic Link Escalation)

{% stepper %}
{% step %}

## Scanning and Discovery

![](https://content.gitbook.com/content/67B8OH0XaKnskKYPbd9f/blobs/sMeRjR4Z4ArsgzmVQicz/1*HHY6anqeoEckwFFdo%20bgBQ.png)

## Website Exploration

![](https://miro.medium.com/v2/resize:fit:1400/1*5pc1gntN_cfCufDRF6DSQ.png)

Recognizing the potential for SQL injection vulnerabilities, we scrutinize the forms for susceptibility. ***After testing each form, the password reset feature exhibits signs of SQL injection vulnerability, evidenced by error responses to single quotes.***

![](https://content.gitbook.com/content/67B8OH0XaKnskKYPbd9f/blobs/bkPmg0V6RMneY442bJjO/1*xVtqFCB1pjMQytAJzL0cAA.png)
{% endstep %}

{% step %}

## Exploitation Phase

Employing Burp Suite, we intercept requests to the password reset feature, revealing HTTP POST requests.

![](https://content.gitbook.com/content/67B8OH0XaKnskKYPbd9f/blobs/3R43MXHgavYLbxqG99Fz/1*mbn9T_Ofg18F8Yj9_TJCdg.png)

Utilizing SQLMap, we automate the injection process by **providing the intercepted request in a text file** and execute the following command:

```bash
sqlmap -r request.txt -p email --level 5 --risk 3 --batch --threads 10 --dbs
```

This yields a successful exploitation, divulging the presence of a MySQL database and facilitating further exploration.

![](https://content.gitbook.com/content/67B8OH0XaKnskKYPbd9f/blobs/o66XT0KsHX5Jb7inywMt/1*bdPq1TcKma1EZNaWq0cPtg.png)

sqlmap results
{% endstep %}

{% step %}

## Database Exploitation

We proceed to extract database information using SQLMap, obtaining a list of databases, including “usage\_blog.”

```bash
sqlmap -r request.txt -p email --level 5 --risk 3 --threads 10 -D database_name --tables
```

![](https://content.gitbook.com/content/67B8OH0XaKnskKYPbd9f/blobs/DTLUaaClWfFB4QxkBnSR/1*O3OW215jwyNHtnXKw9rsaw.png)

![](https://content.gitbook.com/content/67B8OH0XaKnskKYPbd9f/blobs/VkmXZYyB24VXpCQoufhM/1*zRwxg0QIaegUbAw3uq6BKQ.png)

Continuing our reconnaissance, we extract table information and subsequently retrieve data from the “admin\_users” table.

![](https://content.gitbook.com/content/67B8OH0XaKnskKYPbd9f/blobs/SipiWeWGB1esDe4RLRb6/1*hy%20R8cx9_AtyR7h8kUxmfQ.png)

![](https://content.gitbook.com/content/67B8OH0XaKnskKYPbd9f/blobs/eVxdM2BhVEfbRm95fsUb/1*aFNSWIA1VgaLt4fsQ4Xeeg.png)

```bash
john hash.txt --wordlist=/usr/share/wordlists/rockyou.txt -show
```

Alternatively, you can use:

```bash
john hash.txt -show
```

{% endstep %}

{% step %}

## User Credentials and Dashboard Access

With obtained credentials, we gain access to the admin dashboard, unveiling insights into the web application’s technologies and versions.

![](https://content.gitbook.com/content/67B8OH0XaKnskKYPbd9f/blobs/o6t2A3DjNsUli2kTcBaX/1*7MC9AgIgw4QvPG1uGZESuw.png)

Further investigation unveils a potential vulnerability associated with the profile picture upload feature, leading us to exploit it by uploading a PHP reverse shell payload.

[**CVE-2023-24249 : An arbitrary file upload vulnerability in laravel-admin v1.8.19 allows attackers…CVE-2023-24249 : An arbitrary file upload vulnerability in laravel-admin v1.8.19 allows attackers to execute arbitrary…**](https://www.cvedetails.com/cve/CVE-2023-24249/?source=post_page-----16397895490f--------------------------------)

```bash
nc -lvnp [port]
```

Once the reverse shell setup is complete, proceed with the file upload process. Intercept the upload request using Burp Suite to modify the file name back to “.php.jpg.php”. This manipulation ensures that the web server recognizes the uploaded file as a PHP script and executes the reverse shell payload accordingly.

![](https://content.gitbook.com/content/67B8OH0XaKnskKYPbd9f/blobs/K63HQOru2lovsVINTCgz/1*W6eg2rvPmFIxbbMK3jJ9mw.png)

![](https://content.gitbook.com/content/67B8OH0XaKnskKYPbd9f/blobs/pJVlhBbildgDccRI65eA/1*mwN7a7iwYzcg5iB9YHe20Q.png)
{% endstep %}

{% step %}

## Privilege Escalation Exploration

After uncovering the user flag, our curiosity drives us to delve deeper into the user’s dashboard. Among the intriguing findings, one item piques our interest: the “.monitrc” file. Intrigued by its contents, I decide to explore further, hoping to uncover something of significance.

![](https://content.gitbook.com/content/67B8OH0XaKnskKYPbd9f/blobs/uM8yHgUyrbva0IDFLGsn/1*IJ_vbtpQRo59zMdg7OtOHQ.png)

Upon examining the “.monitrc” file, I notice something intriguing. Eager to explore its implications, I opt to initiate an SSH connection to user Xander based on the insights gleaned from the “.monitrc”.

![](https://content.gitbook.com/content/67B8OH0XaKnskKYPbd9f/blobs/ShAfmxwXOjRK1l5J76F2/1*iGAYyzBA_vnvjMn7GNjOaQ.png)

![](https://content.gitbook.com/content/67B8OH0XaKnskKYPbd9f/blobs/ersbDDANI8y9HFeWSF2Y/1*8giI4ZuLSuF_NkUe%20xCzbw.png)

![](https://content.gitbook.com/content/67B8OH0XaKnskKYPbd9f/blobs/7dDGYyAc3cqU400bADU1/1*mv4SypQQVVm55zsR8SMlCw.png)

Exploring the options within, I focus on the “Project Backup” option. Despite the limited information provided, I recall that this is a custom website. Thus, I decide to explore its default directories, starting with “/var/www/html”.

As our objective is to elevate privileges to root, acquiring the “id\_rsa” file becomes imperative. To achieve this, I execute the following commands within the “/var/www/html” directory:

```bash
touch @id_rsa
ln -s /root/.ssh/id_rsa id_rsa
```

![](https://content.gitbook.com/content/67B8OH0XaKnskKYPbd9f/blobs/s1BdQLKvReuUGNeEO0ph/1*9GfJTXmuDC4cHxYjCORX2w.png)

![](https://content.gitbook.com/content/67B8OH0XaKnskKYPbd9f/blobs/zoQYdHGbMkU5Te2FazBa/1*e4g7kvNem4ldtcfBxdeHqQ.png)
{% endstep %}

{% step %}

## Root Access

Upon obtaining the SSH private key, the next step is exploitation. Here, I copy the hash portion of the private key and save it in my original directory as “id\_rsa”.

Next, I adjust the permissions of the “id\_rsa” file to ensure its confidentiality and integrity:

```bash
chmod 600 id_rsa
```

With the necessary permissions granted, I proceed to establish an SSH connection using the obtained private key:

```bash
ssh -i id_rsa root@IP
```

This command initiates an SSH connection to the target system, utilizing the “id\_rsa” private key for authentication.

![](https://content.gitbook.com/content/67B8OH0XaKnskKYPbd9f/blobs/74QaYAswmKbHiBTok4rC/1*P9FUCq0kfa6y6ZqcELK3dQ.png)

and we are in.

![](https://content.gitbook.com/content/67B8OH0XaKnskKYPbd9f/blobs/WtMWrd6B4v4BQk0EEw9E/1*YRGFox%206ZD%20FhOZUNhTkuw.png)
{% endstep %}
{% endstepper %}
