> For the complete documentation index, see [llms.txt](https://itszaiden.gitbook.io/pentesting/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://itszaiden.gitbook.io/pentesting/writeups/dockerlabs/easy/extraviado.md).

# Extraviado

<figure><img src="https://438683079-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIbHEScEP34huXd5EXNdb%2Fuploads%2FmA7X6efEYbyEhaUKzgY4%2Fimage.png?alt=media&amp;token=6a0aca25-52ba-47d8-87ca-53b7c3be3407" alt=""><figcaption></figcaption></figure>

## 1 - Reconnaissance

We begin with a fast Nmap scan to identify open ports:

`nmap 172.17.0.2 -p- --open -sS -Pn --min-rate 5000 -T5`

**Result: ports 22 and 80 are open.**

## 2 - Enumeration

Now we run a service/version detection scan, targeting only the open ports we found on the previous scan:

`nmap 172.17.0.2 -p 22,80 -sS -Pn -sCV`

<figure><img src="https://438683079-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIbHEScEP34huXd5EXNdb%2Fuploads%2F4jDkY7GU3yKRzJYHdA3F%2Fimage.png?alt=media&amp;token=4550e7dd-d677-41a8-b182-1c984e1d001d" alt=""><figcaption></figcaption></figure>

We tried to find exploits or shellcodes using `searchsploit` but there wasn't any. Our next step will be directory enumeration. Using our tool `ffuf-dir`:

```
ffuf-dir () { ffuf -u $1 -w /usr/share/wordlists/dirb/big.txt ${@: 2} -e .html,.php,.txt }
```

we ran `ffuf-dir http://172.17.0.2/FUZZ` and we just found `/index.html` so we will browse it.

We found an Apache2 default page, but we found those 2 base64 encoded strings:<br>

<figure><img src="https://438683079-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIbHEScEP34huXd5EXNdb%2Fuploads%2Fbby8z5ZoNcQFcqJtMGj2%2Fimage.png?alt=media&amp;token=da9ea311-e678-4e16-bfb4-7a5b722c0fba" alt=""><figcaption></figcaption></figure>

After decoding them we get the following credentials: `daniela:focaroja`, so we will log in through SSH with them.

## 3 - Privilege Escalation

We can find in `/home` a folder named `.secreto` containing the following:

<figure><img src="https://438683079-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIbHEScEP34huXd5EXNdb%2Fuploads%2Fbsd3nmxgvB0vRYR5aHUM%2Fimage.png?alt=media&amp;token=6e735706-c39e-4f22-9562-a2b85b34ed58" alt=""><figcaption></figcaption></figure>

Trying to login as diego using `diego:YmFsbGVuYW5lZ3Jh` won't work, so we pass it through cyberchef, revealing it's Base64 again. The plaintext credentials are `diego:ballenanegra`.

At diego's `/home` we found again a folder named `.passroot` containing the following:

<figure><img src="https://438683079-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIbHEScEP34huXd5EXNdb%2Fuploads%2FBn6raPmnOlYtbBf3pons%2Fimage.png?alt=media&amp;token=2aed04e8-c25c-4bec-b0e6-8e0a6d991bb9" alt=""><figcaption></figcaption></figure>

Sadly, after decoding it from Base64 we find it says `acatampocoesta`, meaning the password is not there. As this machine is hiding lots of files, we ran `find / -name ".*" 2>/dev/null` finding this:

<figure><img src="https://438683079-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIbHEScEP34huXd5EXNdb%2Fuploads%2FXvWqPYPNbaJL78tuWCAU%2Fimage.png?alt=media&amp;token=a8eb88c1-a714-42ab-8396-16b1923700d2" alt=""><figcaption></figcaption></figure>

<figure><img src="https://438683079-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIbHEScEP34huXd5EXNdb%2Fuploads%2FxMNbzF3xhVfs3I20Nbak%2Fimage.png?alt=media&amp;token=4ba85919-6645-4bbb-862c-23316a14a346" alt=""><figcaption></figcaption></figure>

After asking ChatGPT to solve this riddle, it came out with the password `osoazul`.

<figure><img src="https://438683079-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIbHEScEP34huXd5EXNdb%2Fuploads%2FS4QOqmTOOsZnyRZjGg2I%2Fimage.png?alt=media&amp;token=e24124b4-6ec8-497d-840a-69e896a54156" alt=""><figcaption></figcaption></figure>
