Visual header graphic representing FreePBX security vulnerabilities, including authentication bypass, SQL injection, and remote code execution risks.

The FreePBX Rabbit Hole: CVE-2025-66039 and others

Noah King
December 11, 2025

Examining multiple vulnerabilities in FreePBX

TL;DR

We discovered an authentication bypass affecting the webserver authentication type (CVE-2025-66039), numerous authenticated SQL injections (CVE-2025-61675) and an authenticated file upload leading to remote code execution (CVE-2025-61678) in FreePBX. These vulnerabilities are easily exploitable and enable authenticated/unauthenticated remote attackers to achieve remote code execution on vulnerable FreePBX instances. These issues are patched in FreePBX versions 16.0.42, 16.0.92, 17.0.6, 17.0.22. It is important to note that the authentication bypass is not vulnerable in the default configuration of FreePBX.

Background

The product at the center of the issue is FreePBX. FreePBX is an open source IP PBX management tool which is a modern phone system for businesses that use VoIP to make and receive phone calls. 

Given the nature of the product, FreePBX installations have a lot of moving parts and require relatively open access and availability. This makes it an ideal target for attackers.

Back in October, when a security advisory came out for FreePBX indicating an authentication bypass leading to SQL injection and remote code execution, aka CVE-2025-57819, researchers at Horizon3.ai started investigating since the issue was being exploited in the wild. It also was added to the CISA KEV list due to exposure and impact. For a while, nobody knew the exploit and AI slop exploits were doing their rounds on GitHub, which led to a spray and pray of exploits that were not the actual exploit.

What’s interesting, however, is that during our research, what we first thought was the authentication bypass and SQL injection leading to remote code execution actually turned out to be new vulnerabilities and were unrelated to CVE-2025-57819. We disclosed these new findings to FreePBX, which resulted in three separate advisories. A list of all recent vulnerabilities for FreePBX can be found here at FreePBX’s GitHub Security Reporting.

As of today, the authentication bypass that does not rely on auth type webserver CVE-2025-57819 has gained the most attention and exploitation for good reason. It’s vulnerable in the default configuration of FreePBX and is an authentication bypass that leads to SQL injection and Remote Code Execution by inserting OS commands into the MySQL cron_jobs table. Therefore, any SQL injections found can also result in remote code execution. Other payloads included adding users to the ampusers table or exfiltrating sensitive data.

Is my FreePBX vulnerable?

After discovering these vulnerabilities, we checked our customer base for exposure and did not find any customers vulnerable to these newly discovered issues. The main pre-requisite for unauthenticated exploitation is having FreePBX configured with either “webserver” authentication type or no authentication at all, but who would do that?😏

Checking exposure on Shodan for FreePBX yields the following results:
http.title:"freepbx" 11,907 results 
http.favicon.hash:"-1908328911" 10,977 results
http.favicon.hash:"1574423538" 398 results
http.title:"freepbx administration" 9,648

Based on our assessment of customer environments the authentication bypass does not look widespread since default FreePBX instances come with usermanager as the authentication type. The SQL injections and file upload exist regardless of authentication type, but a valid PHPSESSID is still required.

Detecting a FreePBX instance with an auth type webserver can be done by making a simple request without an Authorization header. Resulting in a verbose error message indicating we are missing the Authorization header.

CVE-2025-61675 – Multiple SQL Injections

During our research, we found four unique endpoints and 11 affected parameters vulnerable to SQL injection. Each issue allows for the same read and write access to the SQL database.

SQL Injection Basestation

A SQL injection vulnerability exists in the FreePBX Endpoint Management module affecting multiple parameters in the basestation configuration functionality. While authentication is required, the aforementioned authentication bypass is sufficient to exploit this issue. A known username appears to be required, though the default admin user appears sufficient.

Vulnerable Parameters

name, brand, template, ac

Request

Response

SQL Injection Firmware
A SQL injection vulnerability exists in the FreePBX Endpoint Management module affecting multiple parameters in the firmware configuration functionality. While authentication is required, the aforementioned authentication bypass is sufficient to exploit this issue. A known username appears to be required, though the default admin user appears sufficient.

Vulnerable Parameters
brand

Request

Response

SQL Injection Model Basefile
A SQL injection vulnerability exists in the FreePBX Endpoint Management module affecting multiple parameters in the model configuration functionality. While authentication is required, the aforementioned authentication bypass is sufficient to exploit this issue. A known username appears to be required, though the default admin user appears sufficient.

Vulnerable Parameters
model, brand, id, template, OID

Request

Response

SQL Injection Custom Extension
A SQL injection vulnerability exists in the FreePBX Endpoint Management module affecting the custom extension configuration functionality. While authentication is required, the aforementioned authentication bypass is sufficient to exploit this issue. A known username appears to be required, though the default admin user appears sufficient.

Vulnerable Parameters
id

Request

Response

Adding a user to the ampusers table.

Remote code execution by inserting into cron_jobs table as seen in CVE-2025-57819.

CVE-2025-66039 – Auth Type Webserver Authentication Bypass via Forged Authorization Header leading to SQL Injection

Now that we have some SQL injections, we need a way to trigger them without authentication. While looking for the auth bypass described in CVE-2025-57819, we noticed the advanced settings contain a handful of authentication types. The auth types include database, none, user manager, and webserver. FreePBX explains what each other type means, and webserver stuck out as an interesting one to dive into further since it relies on security at the apache level. It is important to note that the authorization type webserver is not the default configuration of FreePBX.

If you don’t see Authorization Type make sure you set the following to true to display them

With the pre-requisite configuration taken care of, we started looking for endpoints with the Endpoint Manager module since this is where the authentication bypass for CVE-2025-57819 was discovered. After browsing through the UI and using the provided features we grabbed an authenticated request and sent the same request but with the webserver type. The first error we got back indicated our authentication was incorrect.

Request

Response

This is an interesting and helpful error, let’s check the code for more information on this file gui_auth.php . On line 38 we encounter an undefined array key for the PHP_AUTH_USER. Searching this keyword further we find in another file ServerBag.php it is expecting an Authorization header with base64 encoded username and password.

Once we add an authorization header with our username and random password we are granted access. 

Request

Response

Aha! We’ve just proven that we are able to successfully gain SQL Injection by only supplying an Authorization header with a valid username admin  and a invalid password. From here, it’s possible to leverage SQLmap and extract any data from the database or insert as well. For example, if we wanted to insert a user into the ampusers table we can issue a request like so and even though we get a 401 unauthorized, the user is still added to the database.

Request

Response

Proof our user was added

We confirmed the SQL Injections work with any authorization type, other authorization types require a valid PHPSESSID, but since the webserver auth type expects the Apache layer to handle the authorization FreePBX blindly trusts any request that contains a valid username in the Authorization header. We are able to leverage this for all the other SQL injections and upload a file that leads to remote code execution.

CVE-2025-61678 –  Auth Type Webserver Authentication Bypass via Forged Authorization Header & Arbitrary File Upload Vulnerability

Now that we have a mechanism to bypass authentication under the webserver authorization type. We also noticed some other interesting endpoints. Such as the firmware upload endpoint. This provides the user a way to upload custom phone firmware. After issuing a few legitimate requests to see where the files are uploaded and what path, we noticed firmware is uploaded to the /tftpboot/customfw/ folder on the server. However, we were able to manipulate the file path as to where the file is stored as well as the contents not being validated which enabled us to upload any file types we desire. In this case, we figured a PHP webshell would be a great approach since FreePBX is written in PHP. Based on testing, it is required that a user has already uploaded a firmware file. If one wasn’t uploaded, the request fails.

We can issue the following requests to upload a PHP webshell

Issue a GET request to retrieve a valid PHPSESSID PHPSESSID=ubm0aqss91m258sf7p1um91to2;

Request

Response

Issue a POST request to upload the file with an arbitrary username and password such as random:random. A valid username is not required.

Request

Response

Let’s confirm it’s accessible and provides remote code execution

Response

And there it is!

Remediation and Disclosure Timelines

These issues were disclosed in accordance with Horizon3.ai’s Vulnerability Disclosure Policy. For more information, please refer to FreePBX’s advisories: SQL Injection, File Upload, Auth Bypass. FreePBX has stated that the SQL injection and file upload issues are mitigated in versions 16.0.92 & 17.0.6.

The authentication bypass received the following mitigations in versions 16.0.42 & 17.0.22. The option to choose authentication provider is now removed from their advanced settings and requires you to set it manually with fwconsole setting AUTHTYPE webserver. Once this is set a security warning is displayed on the dashboard warning the user with the following message.

It’s important to note that the underlying vulnerable code is still present and relies on authentication layers in front to provide security and access to the FreePBX instance. It still requires passing an Authorization header with a Basic base64 encoded username:password. Depending on the endpoint, we noticed a valid username was required. In other cases such as the file upload shared above, a valid username is not required and you can achieve remote code execution with a few steps as outlined. It is best practice not to use the authentication type webserver as it appears to be legacy code. 

Coverage for these issues is already available in NodeZero. To see how the NodeZero platform can help uncover and remediate critical vulnerabilities like this in your environment, visit our NodeZero Platform page or speak with an expert by requesting a demo.

Indicators of Compromise

  • Unknown or suspicious entries in the ampusers table.
  • Unknown or suspicious entries in the cron_jobs table.
  • Webshells or other files uploaded to /var/www/html.

Disclosure Timeline

CVE-2025-61675 SQL Injections

  • September 15, 2025 – Horizon3.ai discloses issue to FreePBX.
  • September 15, 2025 – FreePBX acknowledges and begins triage.
  • October 1, 2025 – FreePBX provides a preview patch.
  • October 1, 2025 – Horizon3.ai confirms some SQL injection parameters unpatched.
  • October 3, 2025 – FreePBX provides a preview patch.
  • October 3, 2025 – Horizon3.ai confirms some SQL injection parameters still unpatched.
  • October 7, 2025 – FreePBX provides a preview patch.
  • October 8, 2025 – Horizon3.ai confirms all SQL injections patched
  • October 14, 2025 – CVE-2025-61675 assigned.
  • October 14, 2025 – FreePBX releases patch and advisory.
  • December 11, 2025 – This write-up.

CVE-2025-61678 File Upload

  • September 15, 2025 – Horizon3.ai discloses issue to FreePBX.
  • September 15, 2025 – FreePBX acknowledges and begins triage.
  • October 1, 2025 – FreePBX provides a preview patch.
  • October 1, 2025 – Horizon3.ai confirms that the original PoC no longer works after applying the patch.
  • October 14, 2025 – CVE-2025-61675 assigned.
  • October 14, 2025 – FreePBX releases patch and advisory.
  • December 11, 2025 – This write-up.

CVE-2025-66039 Auth Bypass

  • September 15, 2025 – Horizon3.ai discloses issue to FreePBX.
  • September 15, 2025 – FreePBX acknowledges and begins triage.
  • October 1, 2025 – FreePBX provides a preview patch.
  • October 1, 2025 – Horizon3.ai confirms that the original PoC no longer works after applying the patch.
  • October 30, 2025 – Horizon3 follows up on status.
  • November 25, 2025 – CVE-2025-66039 assigned.
  • December 9, 2025 – FreePBX releases patch and advisory.
  • December 11, 2025 – This write-up.
How can NodeZero help you?
Let our experts walk you through a demonstration of NodeZero®, so you can see how to put it to work for your organization.
Get a Demo
Share: