Skip to content
SQL injection Write-up Advanced

You Already Have Our Personal Data, Take Our Phone Calls Too (FreePBX CVE-2025-57819)

An unauthenticated SQL injection in the commercial Endpoint module of FreePBX could be reached by abusing the framework's class autoloader to include module PHP files without a session. Attackers used it to insert a backdoor administrator account and then chain further steps toward root-level access on internet-exposed phone systems.

labs.watchtowr.com

Published on labs.watchtowr.com

This research is a glimpse into the capability powering the watchTowr Platform, a Preemptive Exposure Management solution. We enable organizations to autonomously validate and mitigate their exposure to emerging threats, ahead of in-the-wild exploitation.

The author, on labs.watchtowr.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the Endpoint module concatenated unsanitised request parameters into SQL, and the framework's autoloader passed an attacker-controlled module name into class_exists, which included arbitrary module PHP files before any authentication check ran.

Impact

An unauthenticated attacker could create an administrator account and, per the vendor summary, chain further steps to potentially gain root-level access, exposing calls, voicemails and recordings; the vendor notes only systems directly exposed to the internet with inadequate IP filtering were affected.

What the attacker needed

Target reachable from the internet; no IP filtering on the admin panel; commercial Endpoint module installed

The fix

The vendor issued an out-of-band patch to the Endpoint module and advised restricting admin panel access with IP whitelisting or firewall rules.

How it was found

  1. Send a request to the ajax handler with a module value that begins with the framework's module namespace and points at a module PHP file, to confirm the file is included without a session.
  2. Send a request to the Endpoint module's ajax file with a quote in a parameter to confirm the SQL error.
  3. Send the same request with an injected statement that inserts a new administrator row into the users table.
  4. Log in with the newly created backdoor account.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

FreePBX is a web control panel for a phone system. A part of it that builds database queries out of user input failed to clean that input, so a stranger could slip extra database commands in. Worse, a quirk in how the software loads code files let a stranger reach that code without logging in at all, so they could quietly create their own admin account.

What is SQL injection?

Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.

Similar reports

View all

Same bug class and techniques, clearest first.

SQL injection

The lesson behind this report.

Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.