Back to Intelligence

FreePBX 17.0.2 Unauthenticated Remote Code Execution: Detection, Hardening, and Remediation Guide

SA
Security Arsenal Team
September 3, 2026
11 min read

A public proof-of-concept exploit for an unauthenticated code execution vulnerability in FreePBX 17.0.2 has been published to Exploit-DB (exploit ID 52681), and if your organization runs FreePBX — especially with any portion of the web interface reachable from the internet — this should be treated as an emergency change window, not a routine patch cycle.

FreePBX sits in a uniquely sensitive position in enterprise environments: it terminates SIP trunks, bridges the public telephone network to internal users, and typically runs on Linux hosts with the Asterisk daemon operating with elevated privileges. A pre-authentication RCE on this platform doesn't just give an attacker a shell — it gives them your phone system: call interception, toll fraud, vishing infrastructure, and a beachhead inside your network perimeter.

I've responded to enough VoIP compromises to tell you the pattern: exploitation begins within days of public PoC availability, the initial goal is usually toll fraud and call rerouting, and the cleanup is far more expensive than the patch. This write-up gives you the detection logic, hunt queries, and hardening steps to act on today.

Technical Analysis

Affected Product

  • Product: FreePBX (Sangoma's open-source PBX management platform built on Asterisk)
  • Affected version: 17.0.2 (other versions should be assumed vulnerable until verified against Sangoma advisories)
  • Platform: Linux — typically deployed as the FreePBX Distro (Sangoma OS / CentOS or Debian-based) or installed atop existing Asterisk builds
  • Attack vector: Network, via the FreePBX web administration interface (commonly TCP 80/443, also exposed on TCP 8080/8443 in many builds)
  • Authentication required: None — this is a pre-auth flaw, which is what makes it critical

How the Attack Works — Defender's View

Based on the published exploit and the consistent architecture of this platform, the exploitation chain follows a pattern we've seen repeatedly in FreePBX and Asterisk-adjacent vulnerabilities:

  1. Reconnaissance: The attacker fingerprints FreePBX by requesting distinctive paths (/admin/, /recordings/, favicon hashes) and reading version strings from HTTP responses or page content.
  2. Trigger: A crafted unauthenticated HTTP request is sent to a vulnerable endpoint in the web application. The request reaches backend PHP logic that fails to properly validate or sanitize input, ultimately passing attacker-controlled data to a system-level execution context.
  3. Code execution: Commands execute in the context of the web server user (typically asterisk or www-data). Critically, on most FreePBX deployments, the asterisk user has passwordless sudo rights or broad capabilities over system services — meaning the jump from web shell to root is often trivial.
  4. Post-exploitation: Typical follow-on behaviors we observe in PBX compromises include:
    • Dropping PHP web shells into the webroot (/var/www/html/ and subdirectories such as admin/assets/, recordings/, or module directories)
    • Modifying Asterisk dialplan configuration to enable fraudulent outbound calling (international premium-rate toll fraud)
    • Installing persistence via cron, systemd units, or modifications to FreePBX module hooks
    • Exfiltrating SIP credentials from /etc/asterisk/ to enable direct registration and call fraud even if the web shell is removed

Exploitation Status

  • Public PoC: Yes — a working exploit is publicly available on Exploit-DB. Public PoC availability for a pre-authentication RCE on an internet-facing appliance is the single strongest predictor of imminent mass scanning and exploitation.
  • CISA KEV: Not listed at time of writing. Do not wait for KEV inclusion — telephony infrastructure is historically under-monitored, and exploitation of this class of bug routinely precedes KEV entry.
  • CVE status: The news item does not reference a CVE identifier, and we will not speculate on one. Track Sangoma's security advisories for the authoritative identifier and patch guidance.

Why FreePBX Is a High-Value Target

FreePBX systems are frequently deployed by organizations with limited security staffing — small businesses, clinics, call centers — and are often exposed to the internet for remote worker softphone access or SIP trunking with the admin UI left reachable. Attackers know this. Automated scanners continuously sweep for /admin/config.php and similar paths. Once compromised, a PBX generates immediate monetization (toll fraud can run tens of thousands of dollars overnight) and a quiet foothold — VoIP servers rarely have EDR coverage.

Detection & Response

The highest-fidelity detections for this threat focus on what happens after the web request: the web server process spawning unexpected children, new files appearing in the FreePBX webroot, and anomalous activity from the asterisk user. These behaviors are durable regardless of how the specific exploit payload is obfuscated.

Sigma Rules

YAML
---
title: FreePBX Web Server Spawning Shell or Command Interpreter
id: 3f8a2c1e-7b94-4d51-a6e2-9c1d5f8b3a47
status: experimental
description: Detects the Apache/PHP web server process on a FreePBX host spawning shell interpreters or common post-exploitation tools, consistent with web application RCE exploitation.
references:
  - https://www.exploit-db.com/exploits/52681
  - https://attack.mitre.org/techniques/T1059/
author: Security Arsenal
date: 2026/01/15
tags:
  - attack.execution
  - attack.t1059.004
  - attack.t1190
logsource:
  category: process_creation
  product: linux
detection:
  selection_parent:
    ParentImage|endswith:
      - '/httpd'
      - '/apache2'
      - '/php-fpm'
      - '/php'
  selection_child:
    Image|endswith:
      - '/bash'
      - '/sh'
      - '/dash'
      - '/zsh'
      - '/curl'
      - '/wget'
      - '/nc'
      - '/ncat'
      - '/python'
      - '/python3'
      - '/perl'
  condition: selection_parent and selection_child
falsepositives:
  - FreePBX module updates executed via the web UI may legitimately invoke some utilities; tune against known maintenance windows and verify the full command line.
level: high
---
title: Suspicious File Creation in FreePBX Webroot
id: 8c1d4e62-2a73-4f09-b5d8-6e3a7c9f2b15
status: experimental
description: Detects creation of PHP or script files in FreePBX web-accessible directories, indicative of web shell deployment following remote code execution.
references:
  - https://www.exploit-db.com/exploits/52681
  - https://attack.mitre.org/techniques/T1505/003/
author: Security Arsenal
date: 2026/01/15
tags:
  - attack.persistence
  - attack.t1505.003
logsource:
  category: file_event
  product: linux
detection:
  selection_path:
    TargetFilename|contains:
      - '/var/www/html/admin/'
      - '/var/www/html/recordings/'
      - '/var/www/html/ucp/'
      - '/var/www/html/modules/'
      - '/var/www/html/assets/'
  selection_ext:
    TargetFilename|endswith:
      - '.php'
      - '.phtml'
      - '.sh'
      - '.py'
  filter_known_paths:
    TargetFilename|contains:
      - '/var/www/html/admin/modules/'
  condition: selection_path and selection_ext and not filter_known_paths
falsepositives:
  - Legitimate FreePBX module installations and updates write PHP files; correlate with fwconsole/module activity and maintenance windows.
level: high

KQL — Microsoft Sentinel / Defender

FreePBX hosts are Linux, so the relevant telemetry arrives in Sentinel via Syslog/CEF ingestion (auditd process execution) or via a third-party EDR feeding DeviceProcessEvents. The first query hunts for web-server-spawned command interpreters via Syslog/auditd; the second hunts for HTTP scanning and exploit probing against FreePBX paths ingested from your perimeter firewall or WAF via CommonSecurityLog.

KQL — Microsoft Sentinel / Defender
// Hunt 1: Web server / asterisk user spawning shells on FreePBX hosts (auditd via Syslog)
Syslog
| where TimeGenerated > ago(7d)
| where ProcessName in~ ("bash", "sh", "dash", "zsh", "curl", "wget", "nc", "ncat", "python", "python3", "perl")
| where SyslogMessage has_any ("httpd", "apache", "php-fpm")  // parent context from auditd EXECVE/PROCTITLE
   or HostIP in (dynamic(["<your-freepbx-host-ips>"]))        // optionally scope to known PBX hosts
| summarize FirstSeen=min(TimeGenerated), LastSeen=max(TimeGenerated), Count=count()
    by Computer, ProcessName, SyslogMessage
| order by FirstSeen desc;

// Hunt 2: External probing of FreePBX web paths (firewall/WAF via CommonSecurityLog)
CommonSecurityLog
| where TimeGenerated > ago(24h)
| where RequestURL has_any ("/admin/", "/recordings/", "/config.php", "/ucp/", "/modules/")
| where DeviceAction in ("Allow", "allowed", "Accept") or isnull(DeviceAction)
| summarize Requests=count(), DistinctPaths=dcount(RequestURL)
    by SourceIP, DestinationIP
| where Requests > 5 or DistinctPaths > 3
| order by Requests desc;

Tune Hunt 1 by scoping to your actual PBX hosts and validating against known maintenance. Hunt 2 will surface both scanners and exploitation attempts — any source IP hitting multiple FreePBX-specific paths from the internet deserves immediate scrutiny.

Velociraptor VQL

This artifact is designed for rapid triage of a suspected-compromised FreePBX host: it enumerates recently created/modified script files in web-accessible directories (potential web shells) and enumerates running shell processes with their parentage.

VQL — Velociraptor
-- FreePBX RCE triage: webroot file artifacts and suspicious process lineage
LET webroot_hits = SELECT FullPath, Mtime, Ctime, Size
FROM glob(globs=['/var/www/html/**/*.php', '/var/www/html/**/*.sh', '/var/www/html/**/*.py'])
WHERE Ctime > now() - 604800
  AND NOT FullPath =~ '/var/www/html/admin/modules/'
ORDER BY Ctime DESC

LET suspicious_procs = SELECT Pid, Ppid, Name, Exe, CommandLine, Username, CreateTime
FROM pslist()
WHERE Name =~ '(?i)bash|sh$|curl|wget|nc$|ncat|python|perl'
  AND Username =~ '(?i)asterisk|www-data|apache|nginx'

SELECT * FROM webroot_hits
UNION ALL
SELECT * FROM suspicious_procs

Note: if the UNION produces column-shape friction in your Velociraptor version, run the two LET queries as separate artifacts — both results stand alone as triage views.

Bash Remediation & Verification Script

Run this on FreePBX hosts to (1) confirm version exposure, (2) sweep for web shell artifacts and unauthorized persistence, and (3) verify the admin interface is not internet-reachable. It makes no destructive changes — review output before taking action.

Bash / Shell
#!/bin/bash
# FreePBX RCE exposure and compromise assessment - Security Arsenal
# Run as root. Read-only assessment; no changes made.

echo "===== [1] FreePBX Version ====="
fwconsole --version 2>/dev/null || grep -r "version" /etc/freepbx.conf 2>/dev/null || echo "FreePBX CLI not found - verify installation path"
rpm -qa 2>/dev/null | grep -i freepbx || dpkg -l 2>/dev/null | grep -i freepbx

echo "===== [2] Web shell sweep: recently modified scripts in webroot (last 30 days) ====="
find /var/www/html -type f \( -name "*.php" -o -name "*.phtml" -o -name "*.sh" -o -name "*.py" \) -mtime -30 -ls 2>/dev/null

echo "===== [3] Known web shell patterns in webroot ====="
grep -rlE "eval\s*\(\s*(base64_decode|gzinflate|str_rot13)|shell_exec\s*\(\s*\$_(GET|POST|REQUEST)|passthru\s*\(\s*\$_" /var/www/html 2>/dev/null | head -50

echo "===== [4] Web server spawning shells (current processes) ====="
ps -eo pid,ppid,user,comm,args | grep -E "(httpd|apache2|php-fpm)" | grep -v grep
ps aux | grep -E "^(asterisk|www-data|apache).*\b(bash|sh|nc|python|perl|curl|wget)\b" | grep -v grep

echo "===== [5] Persistence review: cron and systemd ====="
crontab -l -u asterisk 2>/dev/null
crontab -l -u root 2>/dev/null
ls -la /etc/cron.d/ /var/spool/cron/ 2>/dev/null
systemctl list-unit-files --type=service --state=enabled 2>/dev/null | grep -viE "asterisk|freepbx|httpd|mariadb|sshd|network|firewalld|fail2ban|cron|rsyslog|systemd"

echo "===== [6] Asterisk user sudo rights (post-exploitation escalation risk) ====="
sudo -l -U asterisk 2>/dev/null
grep -r "asterisk" /etc/sudoers /etc/sudoers.d/ 2>/dev/null

echo "===== [7] Listening web interfaces - confirm NONE are internet-reachable ====="
ss -tlnp | grep -E ":(80|443|8080|8443|8088|8089)\b"

echo "===== [8] Recent successful logins and unusual outbound connections ====="
last -20 2>/dev/null
ss -tnp state established | grep -vE ":(5060|5061|5160|5038)\b" | head -30

echo "===== Assessment complete. Review anomalies before remediation. ====="

Remediation

Act in this order. If you suspect active compromise, treat steps 3 onward as part of an incident response engagement — don't just patch and move on; SIP credentials and call detail records may already be exfiltrated.

  1. Remove internet exposure of the FreePBX web interface immediately. The admin UI (/admin/) should never be reachable from untrusted networks. Restrict it to management subnets or VPN-only access via firewall rules or Apache access controls. If remote provisioning is required, use the FreePBX Responsive Firewall and explicitly whitelist source IPs. This is the single most effective compensating control regardless of patch status.

  2. Upgrade FreePBX. Check Sangoma's official channels for the fixed release:

  3. Hunt before you patch. A patch closes the door but does nothing about an intruder already inside. Run the detection content above — process lineage, webroot file sweep, cron/systemd persistence — before and after patching.

  4. Rotate SIP and trunk credentials. Assume /etc/asterisk/sip.conf, pjsip.conf, and the FreePBX database (which stores trunk and extension secrets) are compromised on any exploited host. Rotate all trunk provider credentials, extension secrets, AMI credentials, and the FreePBX admin password. Check your trunk provider's portal for call activity you don't recognize — international premium-rate calls are the hallmark of PBX toll fraud.

  5. Audit the Asterisk dialplan and module state. Review /etc/asterisk/extensions*.conf for unauthorized dialplan entries enabling outbound relaying, and run fwconsole ma list to identify any unfamiliar or recently changed modules. Compare file integrity under /var/www/html/ and /etc/asterisk/ against a known-good backup if available.

  6. Instrument the host going forward. FreePBX boxes are almost never covered by EDR — fix that. At minimum, deploy auditd with process-execution logging forwarding to your SIEM (this is what powers the Sigma and KQL content above), enable the FreePBX Responsive Firewall with fail2ban, and ensure Syslog from the PBX reaches your central log platform.

  7. Network-segment the PBX. Telephony infrastructure should live on a dedicated VLAN with egress filtering. A compromised PBX should not be able to reach your domain controllers, file servers, or crown-jewel applications.

Conclusion

Unauthenticated RCE against an internet-facing PBX with a public PoC is a worst-case combination: trivial exploitation, high monetization value, and typically zero endpoint visibility. If you run FreePBX 17.0.2, assume you are being scanned right now — because you are. Pull the admin interface off the internet, patch, hunt for existing compromise, and rotate credentials. The organizations that absorb five-figure toll fraud bills from this class of vulnerability are the ones that treated a phone system as an afterthought. Don't be one of them.

Related Resources

Security Arsenal Penetration Testing Services AlertMonitor Platform Book a SOC Assessment vulnerability-management Intel Hub

Is your security operations ready?

Get a free SOC assessment or see how AlertMonitor cuts through alert noise with automated triage.