# Critical FreePBX Flaws Enable Unauthenticated RCE (UCP Socket.IO Auth Bypass) and SQL Injection Leading to Admin Takeover

> Two critical, unauthenticated FreePBX flaws let a remote attacker with no credentials compromise internet-facing PBX deployments: a socket.io namespace authentication-bypass in the User Control Panel (UCP) Node server that enables arbitrary command execution via Asterisk Manager Interface (AMI) action injection (GHSA-37j8-fhxx-9vhp), and an unescaped SQL injection in the missedcall module's Caller ID name handling reachable via a crafted SIP From header that can corrupt the database and hijack administrator control-panel credentials (GHSA-g27h-xf3q-h3rm). Both score CVSS v4 9.3, require no authentication or user interaction, and patches are already available.

- **Published:** 2026-07-23T00:00:00Z
- **Last reviewed:** 2026-07-23T00:00:00Z
- **Canonical:** https://intel.threadlinqs.com/threat/TL-2026-1688
- **Card image:** https://intel.threadlinqs.com/og/threat/threat-intel-freepbx-ucp-namespace-bypass-tl-2026-1688.webp?v=df4e1fd3 (Threadlinqs threat intel: GHSA-37j8-fhxx-9vhp FreePBX UCP RCE: Detection & IOCs (TL-2026-1688) — Critical severity, 25 IOCs, 9 detection rules.)
- **ID:** TL-2026-1688
- **Severity:** CRITICAL (CVSS 9.3)
- **Category:** VULNERABILITY
- **Status:** PATCHED
- **Detections:** 9 (1 shown free below) · **IOCs:** 25 (2 shown free below)

## Description

On 2026-07-16, FreePBX's security-reporting team published two critical advisories affecting Sangoma's FreePBX open-source PBX platform.

The first, GHSA-37j8-fhxx-9vhp, affects the FreePBX 17 User Control Panel (UCP) module prior to version 17.0.9. The UCP Node server listens on port 8001 (non-TLS) and port 8003 (TLS) and is designed to gate every socket.io connection with an `io.use(checkAuth)` middleware. A behavioral change in socket.io v4 altered how namespaces are handled — each namespace is now treated as its own independent channel — which caused the intended `checkAuth` authorization gate to no longer apply per-namespace. This lets an unauthenticated remote attacker open a raw socket.io connection to the UCP Node server and send crafted namespace events that are relayed into the Asterisk Manager Interface (AMI), resulting in arbitrary command execution with the privileges of the `asterisk` service account. The flaw is tracked as CWE-862 (Missing Authorization), carries a Red provider-urgency rating, and was reported by researcher mil1200, coordinated by chrsmj, analyzed by push143smart, with the fix engineered by Sangoma-Heera. Administrators can confirm patch status by inspecting the UCP login page HTML source for the `x-pjax-version` meta tag (patched builds show `v17.0.9`).

The second, GHSA-g27h-xf3q-h3rm, affects the FreePBX missedcall module — versions before 16.0.11 on FreePBX 16 and before 17.0.6 on FreePBX 17. The module performs an INSERT into the database every time a call to a monitored extension goes unanswered, and that INSERT concatenates the caller's inbound Caller ID Name (CNAM), taken directly from the SIP `From` header, straight into the SQL string with no escaping or parameterization (CWE-89). Because inbound SIP CNAM fields are not length-restricted the way legacy PSTN CNAM is, an attacker who can place a call to a monitored extension — via an open/anonymous SIP endpoint, a compromised SIP trunk, or direct internet calling — can inject a caller name containing SQL metacharacters that corrupts the database and rewrites administrator control-panel credentials, yielding full unauthorized access to the FreePBX Administrator Control Panel. FreePBX rated this issue Amber urgency (versus Red for the UCP flaw) because the missedcall module is not universally deployed, but the CVSS v4 base score is identical at 9.3, and the same reporter/coordinator pair (mil1200/chrsmj) is credited.

Neither advisory has an assigned CVE ID as of this writing (tracked only via their GHSA identifiers) and neither vendor nor independent researchers have reported confirmed in-the-wild exploitation, so this threat is classified DISCLOSED rather than ACTIVE. However, both bugs are remotely reachable pre-auth, require zero user interaction, and are chainable in principle — RCE via the UCP flaw could be used to further manipulate the same database the missedcall SQLi corrupts, and either flaw alone is sufficient for a full administrative compromise of an internet-facing FreePBX system. The FreePBX Community Forum thread on the missedcall SQLi (started 2026-07-16) also surfaced a public exploitability debate: community member James Finstrom initially argued the practical attack chain — requiring a crafted-CNAM call to go unanswered on a monitored extension — was so improbable it was like "playing your local lottery," before conceding real-world risk factors (stolen SIP credentials, unencrypted UDP exposure, SBC/firewall misconfiguration) could still make it exploitable.

FreePBX's own security-reporting bundle (surfaced the same week by the Canadian Centre for Cyber Security in advisory AV26-711) also shipped four additional, separately-tracked advisories in the same July 2026 release train, all requiring an existing authenticated FreePBX administrator account (unlike the two unauthenticated flaws documented here): GHSA-hg3v-m857-mvw9 (TTS module AGI command injection via the TTS destination name, tts < 16.0.6 on FreePBX 16 / < 17.0.6 on FreePBX 17), GHSA-p97w-rq48-p8q2 (Music module RCE via mpg123 and crafted Asterisk call files, music < 17.0.7 on FreePBX 17), and a `framework` module hardening bump to 16.0.47 (FreePBX 16) / 17.0.30 (FreePBX 17) with no distinct CVE-level vulnerability details published for the framework bump itself. These authenticated-only issues are out of scope for this unauthenticated-RCE/SQLi threat record but confirm Sangoma ran a broader coordinated hardening pass that week.

Mitigation is straightforward: patch the `ucp` module to 17.0.9+ and the `missedcall` module to 16.0.11+ (FreePBX 16) or 17.0.6+ (FreePBX 17); until patched, use the FreePBX Firewall module's Responsive Firewall feature to restrict UCP ports 8001/8003 to IPs with a successfully registered SIP endpoint, restrict inbound calling to trusted SIP trunks, and deploy a Session Border Controller (SBC) to sanitize SIP From headers before they reach FreePBX.

## MITRE ATT&CK

- T1595 Active Scanning
- T1592 Gather Victim Host Information
- T1190 Exploit Public-Facing Application
- T1133 External Remote Services
- T1059 Command and Scripting Interpreter
- T1211 Exploitation for Stealth
- T1098 Account Manipulation
- T1136 Create Account
- T1078 Valid Accounts
- T1046 Network Service Discovery
- T1565 Data Manipulation
- T1106 Native API
- T1556 Modify Authentication Process
- T1068 Exploitation for Privilege Escalation
- T1588 Obtain Capabilities

## Free detection (Splunk SPL, Microsoft KQL, Sigma)

**FreePBX ampusers Credential Manipulation via missedcall SIP-CNAM SQL Injection — SPL** (`TL-2026-1688-SPL-003`)

Detects unauthorized INSERT/UPDATE writes to the FreePBX `ampusers` administrator-credentials table that are not correlated with an authenticated admin.php web session, together with inbound SIP Caller-ID Name (CNAM) values containing SQL metacharacters/keywords on calls to monitored extensions — the exploitation and impact chain of the unauthenticated missedcall SQL injection (GHSA-g27h-xf3q-h3rm) that rewrites administrator credentials for account takeover.

- **Languages:** Splunk SPL, Microsoft KQL, Sigma
- **ATT&CK:** T1565.001, T1098, T1136.001, T1078, T1556
- **Data sources:** mysql_audit_log (freepbx_db), asterisk_full_log (SIP signaling), azure_mysql_flexible_server_audit_logs (AzureDiagnostics)
- **Severity:** critical
- **Confidence:** high

### Splunk SPL

```spl
index=freepbx_db sourcetype="mysql_audit" db_table="ampusers" db_operation IN ("INSERT","UPDATE") earliest=-24h@h latest=now
| where source_process!="admin.php"
| eval detection_reason="unauthorized_ampusers_write"
| table _time host db_table db_operation source_process detection_reason
| append
    [ search index=asterisk sourcetype="asterisk:full" earliest=-24h@h latest=now
      | rex field=_raw "From:\s*\"(?<cnam>[^\"]+)\""
      | search cnam=*
      | regex cnam="(?i)(--|;|'|\bDROP\b|\bINSERT\b|\bUNION\b|\bSELECT\b)"
      | eval detection_reason="malicious_cnam_sip_header"
      | table _time host cnam detection_reason ]
| sort - _time
```

### Microsoft KQL

```kql
let SuspiciousCNAM = Syslog
    | where TimeGenerated > ago(24h)
    | where ProcessName =~ "asterisk"
    | where SyslogMessage has "From:" and SyslogMessage matches regex @"(--|;|'|\bDROP\b|\bINSERT\b|\bUNION\b|\bSELECT\b)"
    | project TimeGenerated, Computer, Reason = "malicious_cnam_sip_header", Detail = SyslogMessage;
let UnauthorizedAmpusersWrites = AzureDiagnostics
    | where TimeGenerated > ago(24h)
    | where Category == "MySqlAuditLogs"
    | where event_class_s == "table_access" and event_subclass_s in ("INSERT","UPDATE")
    | where OBJECT_NAME_s =~ "ampusers"
    | where not(TargetProcess_s has "admin.php")
    | project TimeGenerated, Computer = LogicalServerName_s, Reason = "unauthorized_ampusers_write", Detail = strcat(event_subclass_s, " on ", OBJECT_NAME_s);
SuspiciousCNAM
| union UnauthorizedAmpusersWrites
| sort by TimeGenerated desc
```

### Sigma

```yaml
title: FreePBX ampusers Table Manipulation via missedcall SQL Injection (SIP CNAM)
id: 7a1e4b90-2f3d-4c8a-b6e1-1688a1003003
status: experimental
description: Detects INSERT/UPDATE writes to the FreePBX ampusers administrator-credentials table that are not correlated with an authenticated admin.php session, and inbound SIP Caller-ID Name (CNAM) values containing SQL metacharacters/keywords on calls to monitored extensions — the exploitation and impact artifacts of the unauthenticated missedcall SQL injection (GHSA-g27h-xf3q-h3rm) leading to administrator account takeover.
references:
    - https://github.com/FreePBX/security-reporting/security/advisories/GHSA-g27h-xf3q-h3rm
author: Threadlinqs Team
date: 2026-07-25
tags:
    - attack.impact
    - attack.t1565.001
    - attack.persistence
    - attack.t1098
    - attack.t1136.001
    - attack.privilege-escalation
    - attack.t1078
    - attack.credential-access
    - attack.t1556
    - cve.2026.ghsa-g27h-xf3q-h3rm
logsource:
    product: freepbx
    category: database_write
detection:
    selection_db:
        db.table: 'ampusers'
        db.operation:
            - 'INSERT'
            - 'UPDATE'
    filter_admin_ui:
        source_process: 'admin.php'
    selection_cnam:
        sip.from_display_name|re: ".*(--|;|'|DROP\\s|INSERT\\s|UNION\\s|SELECT\\s).*"
    condition: (selection_db and not filter_admin_ui) or selection_cnam
falsepositives:
    - Bulk user-provisioning scripts run by administrators outside the web UI
    - Legitimate caller names that happen to contain an apostrophe (rare, but possible)
level: critical
```

**Known false positives:**

- Bulk user-provisioning scripts run by administrators outside the web UI
- Legitimate caller names that happen to contain an apostrophe (rare, but possible)

**Tuning notes:** Maintain an exception list of known non-interactive provisioning scripts/service accounts that legitimately write to ampusers outside admin.php; tighten the CNAM regex to the specific metacharacter set observed in the environment's SIP trunk traffic to avoid flagging rare but legitimate apostrophes in caller names, and correlate a subsequent Administrator Control Panel login (T1078) within minutes of either signal to raise this to a confirmed-compromise alert.

### 8 more detection rules (Splunk SPL, Microsoft KQL, Sigma), unlock with TL Creds

- Unauthenticated [indicator] Namespace Connection to FreePBX [indicator] Node Server (Ports 8001/8003) — KQL (locked: unlock with TL Creds)
- Unauthenticated AMI Originate/Command Action Injected via FreePBX [indicator] Node Process — KQL (locked: unlock with TL Creds)
- FreePBX ampusers Credential Manipulation via [indicator] SIP-CNAM SQL Injection — KQL (locked: unlock with TL Creds)
- Unauthenticated [indicator] Namespace Connection to FreePBX [indicator] Node Server (Ports 8001/8003) — Sigma (locked: unlock with TL Creds)
- Unauthenticated AMI Originate/Command Action Injected via FreePBX [indicator] Node Process — Sigma (locked: unlock with TL Creds)
- FreePBX ampusers Credential Manipulation via [indicator] SIP-CNAM SQL Injection — Sigma (locked: unlock with TL Creds)
- Unauthenticated [indicator] Namespace Connection to FreePBX [indicator] Node Server (Ports 8001/8003) — SPL (locked: unlock with TL Creds)
- Unauthenticated AMI Originate/Command Action Injected via FreePBX [indicator] Node Process — SPL (locked: unlock with TL Creds)

Sign up free to unlock the detection rules: https://threadlinqs.com/?modal=signup

## Sample indicators (2 of 25)

Defanged, TLP:CLEAR.

- URL: `hxxps://github[.]com/FreePBX/security-reporting/security/advisories/GHSA-37j8-fhxx-9vhp`
- URL: `hxxps://github[.]com/FreePBX/security-reporting/security/advisories/GHSA-g27h-xf3q-h3rm`

Full set of 25 indicators unlocks with TL Creds: https://threadlinqs.com/tl-creds

## Sources

- [Critical FreePBX Flaws Let Unauthenticated Attackers Execute Code and Take Over Administrator Accounts](https://gbhackers.com/critical-freepbx-flaws/)
- [GHSA-37j8-fhxx-9vhp: Unauthenticated remote code execution in FreePBX UCP via socket.io namespace authentication bypass and AMI action injection](https://github.com/FreePBX/security-reporting/security/advisories/GHSA-37j8-fhxx-9vhp)
- [GHSA-g27h-xf3q-h3rm: Unauthenticated SQL injection in FreePBX missedcall via inbound Caller ID name leads to administrator takeover](https://github.com/FreePBX/security-reporting/security/advisories/GHSA-g27h-xf3q-h3rm)
- [Unauthenticated remote code execution in FreePBX UCP via socket.io namespace auth bypass and AMI action injection (community discussion)](https://community.freepbx.org/t/unauthenticated-remote-code-execution-in-freepbx-ucp-via-socket-io-namespace-auth-bypass-and-ami-action-injection/109905)
- [Unauthenticated SQL injection in FreePBX missedcall via inbound Caller ID name leads to administrator takeover (community discussion)](https://community.freepbx.org/t/unauthenticated-sql-injection-in-freepbx-missedcall-via-inbound-caller-id-name-leads-to-administrator-takeover/109906)
- [Critical FreePBX Flaws Let Unauthenticated Attackers Execute Commands and Hijack Admin Accounts](https://cyberpress.org/critical-freepbx-flaws-commands-hijack-admin-accounts/)
- [FreePBX security advisory (AV26-711)](https://www.cyber.gc.ca/en/alerts-advisories/freepbx-security-advisory-av26-711)
- [GHSA-hg3v-m857-mvw9: Authenticated TTS AGI Command Injection Through TTS Name](https://github.com/FreePBX/security-reporting/security/advisories/GHSA-hg3v-m857-mvw9)
- [GHSA-p97w-rq48-p8q2: Authenticated FreePBX Music RCE via mpg123 and Asterisk Call Files](https://github.com/FreePBX/security-reporting/security/advisories/GHSA-p97w-rq48-p8q2)

## Full data

The other 8 detection rules (Splunk SPL / Microsoft KQL / Sigma) unlock with TL Creds; a free account includes daily creds: https://threadlinqs.com/?modal=signup
Indicator values unlock with TL Creds, at a lower price on Red and Purple; AI agents can query rules and IOCs through the Threadlinqs MCP server (Purple): https://intel.threadlinqs.com/mcp

Canonical: https://intel.threadlinqs.com/threat/TL-2026-1688
