> For the complete documentation index, see [llms.txt](https://burple.gitbook.io/burple/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://burple.gitbook.io/burple/thehackerslabs/medio/debugsec.md).

# Debugsec

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

## Fase de reconocimiento

Primero iniciamos con un escaneo de nmap, encontramos los puertos 22 (ssh) y 80 (http) abiertos, y despues lanzamos un whatweb para ver que tenemos en el puerto 80 y nos da error, vamos a añadir a /etc/hosts la IP y el dominio, en este caso "debugsec.thl"

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

```
nmap -sSVC -Pn -min-rate 5000 -vvv -open IP
```

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

Vamos a ver que hay adentro de la pagina (si no os carga y os va a buscar los resultados envede la pagina web, teneis que poner explicitamente "<http://debugsec.thl>", lo digo porque yo cuando empece tenia muchos errores en los write-ups no lo explicaban bien para los nuevos)

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

## Fase de intrusión

Nos enfrentamos a un wordpress, asi que vamos a hacer uso de la herramienta wpscan en busqueda de plugins vulnerables, y nos encontramos un plugin vulnerable, busco en google y encuentro en github un exploit en .py

<figure><img src="/files/53Xkq8cLYxxvbZO1kpkd" alt=""><figcaption></figcaption></figure>

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

```
wpscan --url debugsec.thl
```

Lo descargamos y editamos el parametro de url

<figure><img src="/files/jWqZzu5PpEkVco68bePX" alt=""><figcaption><p>(git clone URL)</p></figcaption></figure>

<figure><img src="/files/81puMXXPqE7DsuLWKLFs" alt=""><figcaption></figcaption></figure>

Ya hemos obtenido el hash, ahora vamos a desencriptarlo con hashcat o tambien lo podemos hacer con john, a mi me ha ido mucho mas rapido con john

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

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

Iniciamos sesion en "wp-admin" wordpress:mcartney

<figure><img src="/files/1uduWLb9SQj1kUs3bdx7" alt=""><figcaption></figcaption></figure>

Ahora he intentado cambiar algun .php para añadir un cmd pero no me deja, voy a subir una revershell como si fuera un plugin, para hacer esto hare uso de la herramienta wordpwn, este exploit hace uso de un modulo de metasploit, asi que tambien podrias hacer solo uso de metasploit para obtener shell. El codigo de github que he descargado no me funciona, asi que voy a directamente usar el metasploit y me quito de rollos jajajaj.

Abrimos metasploit con "msfconsole" y buscamos el modulo

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

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

Introducimos "options" y configuramos las opcciones haciendo uso de "set", ejemplo "set PASSWORD mcarney"

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

<figure><img src="/files/SPLha6VLcSPrHvJKJk7A" alt=""><figcaption><p>(Revisamos los usuarios)</p></figcaption></figure>

Si navegamos a /opt podemos encontrar un id\_rsa, lo pasamos a nuestra maquina atacante, ahora vamos a pasar con ssh2john el hash y con john vamos a proporcionarle el rockyou y el hash

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

Con la contraseña que hemos obtenido, vamos a iniciar sesion por el puerto ssh (22), el cual antes en el escaneo de nmap vimos que estaba abierto, como decia, vamos a inciar sesion haciendo uso del id\_rsa y la contraseña q hemos conseguido con john.

Antes de iniciar sesion debemos darle permisos 600 al id\_rsa

## Escalación de privilegios

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

Hacemos un sudo -l que nos releva que root puede ejecutar gmic

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

Ejecutamos este comando y hubieramos conseguido root

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

Las flags como siempre estan en /root y /home/user (en este caso debugsec)

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


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://burple.gitbook.io/burple/thehackerslabs/medio/debugsec.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
