Detect David-Crty Databasement Toast Trait Template Injection / Code Execution (CVE-2026-138223) in Sumo Logic CSE
Detects exploitation attempts and post-exploitation indicators for CVE-2026-138223, a critical (CVSS 10.0) vulnerability in David-Crty Databasement up to and including version 1.7.12. The flaw resides in the toast() function of app/Traits/Toast.php. The weakness is categorized as CWE-791 (incomplete filtering of special elements) and CWE-1336 (improper neutralization of special elements used in a template engine), indicating that attacker-controlled input flowing into the toast notification/flash-message mechanism can be interpreted by the underlying template engine (server-side template injection) leading to arbitrary code execution. Exploitation is currently theoretical (no public PoC), but the fix in v1.7.13 (commit 713f71f5336663493e8c4dc07e7f3e96a291775b) confirms the sink. This detection looks for suspicious template-expression payloads reaching Databasement web endpoints and anomalous child processes spawned by the PHP/web runtime hosting the application.
MITRE ATT&CK
- Tactic
- Initial Access Execution
Sumo Detection Query
// df00tech DF00-1a9be87617 · https://df00tech.com/detections/CVE-2026-138223 · licence: https://df00tech.com/detections/licence
_sourceCategory=*web* (databasement OR toast OR flash)
| urldecode(url_query) as decoded
| where decoded matches /(\{\{|\}\}|\{%|%\}|\$\{|__class__|_self|shell_exec|system\(|passthru\()/
| fields _messagetime, src_ip, method, url_path, decoded, status, host
| sort by _messagetime desc Surfaces Databasement toast/flash requests in Sumo Logic web feeds that contain SSTI meta-characters or command-execution functions.
Data Sources
Required Tables
False Positives & Tuning
- Developers testing notification templates with literal braces
- Approved security scans against the endpoint
- User-generated content legitimately containing template-like tokens
Other platforms for CVE-2026-138223
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 further down this page.
- Test 1 SSTI probe against toast endpoint
Expected signal: Web server access log entry with URL query containing {{7*7}} to the toast endpoint.
- Test 2 SSTI RCE primitive payload
Expected signal: Web access/body log containing shell_exec/system/@php tokens targeting the toast sink.
- Test 3 Web runtime spawns shell (post-exploitation)
Expected signal: Process-creation event showing bash/id/whoami with parent php-fpm/apache under the web service account.
References (6)
- https://github.com/David-Crty/databasement/
- https://github.com/David-Crty/databasement/commit/713f71f5336663493e8c4dc07e7f3e96a291775b
- https://github.com/David-Crty/databasement/pull/605
- https://github.com/David-Crty/databasement/releases/tag/v1.7.13
- https://github.com/David-Crty/databasement/security/advisories/GHSA-76f6-wp5v-23c2
- https://vuldb.com/cve/CVE-2026-138223
Response Playbook
Triage
- Confirm the Databasement application version in scope; versions <= 1.7.12 are vulnerable and must be upgraded to 1.7.13 or later.
- Decode the flagged HTTP request parameter and determine whether the payload contains an executable template expression (e.g., {{7*7}}, ${...}, _self.env, registerUndefinedFilterCallback) versus benign brace content.
- Correlate the source IP's request history to establish whether this is a single probe, a scan, or a sustained exploitation attempt.
- Check the web/application logs for the HTTP response status and size returned to the suspicious request to gauge whether injection was reflected or evaluated.
Containment
- Deploy a WAF rule or reverse-proxy filter blocking template meta-characters ({{, ${, _self, __class__) on Databasement toast/flash parameters as an immediate mitigation.
- Upgrade affected Databasement instances to v1.7.13 or later, which remediates the toast() sink; if upgrade is not immediately possible, take the exposed endpoint offline.
- Isolate any host where a web-runtime-spawned shell process was observed until forensic review completes.
Evidence Collection
- Preserve raw web server access logs (IIS/Apache/Nginx) covering the suspicious requests, including full URL query strings and bodies.
- Capture the application's PHP error/debug logs and any flash-message/session storage that may contain the rendered payload.
- Collect endpoint process-creation telemetry and command-line arguments for any child process of php/php-fpm/httpd during the suspected exploitation window.
Escalation Criteria
- !Escalate to incident response immediately if a shell, interpreter, or reconnaissance binary was spawned by the web runtime following the suspicious request.
- !Escalate if evidence shows the template expression was evaluated (e.g., response reflects computed arithmetic or system command output), indicating confirmed RCE.
Investigation Guide
Forensic Artifacts
- >
Web server access logs containing the injected template payload in the URL/query/body - >
PHP-FPM / Apache process-creation events showing anomalous child shell processes - >
Application flash-message/session artifacts persisting the attacker-supplied toast content
Tuning Guidance
Baseline legitimate use of curly braces in your Databasement content before enabling blocking. In environments with active security scanning, exclude known scanner source IPs. Tighten the KQL/SPL web-log rules to match only the specific toast/flash parameter names used by your deployment, and pair the web-log detections with the EQL/CQL process-spawn rules to escalate confirmed code execution over mere probing.
Hunting Queries
Identifies source IPs repeatedly sending template-injection candidate payloads, indicative of fuzzing or exploitation.
// df00tech DF00-1a9be87617 · https://df00tech.com/detections/CVE-2026-138223 · licence: https://df00tech.com/detections/licence
W3CIISLog | where cs_uri_query has_any ('{{','${','_self','shell_exec') | summarize count() by cIP, bin(TimeGenerated, 1h) | where count_ > 5 ``` df00tech DF00-1a9be87617 · https://df00tech.com/detections/CVE-2026-138223 · licence: https://df00tech.com/detections/licence ```
index=web (uri_query="*{{*" OR uri_query="*${*" OR uri_query="*_self*") | stats count by src_ip | where count>5 Atomic Red Team Tests
Sends a benign arithmetic template expression to the Databasement toast/flash parameter to simulate an SSTI probe.
Command
curl -s 'http://localhost:8080/databasement/toast?message=%7B%7B7*7%7D%7D' Cleanup
echo 'No cleanup required; stateless GET request.' Expected Telemetry
Web server access log entry with URL query containing {{7*7}} to the toast endpoint.
Expected Detection
KQL/SPL/QRadar/Sumo/Chronicle web-log rules flag the request for template meta-characters.
Sends a template payload invoking a PHP command-execution function to simulate attempted code execution.
Command
curl -s --data 'message=${@php(system("id"))}' 'http://localhost:8080/databasement/toast' Cleanup
echo 'No cleanup required; stateless POST request.' Expected Telemetry
Web access/body log containing shell_exec/system/@php tokens targeting the toast sink.
Expected Detection
Web-log detections match the RCE primitive keywords and raise a critical alert.
Simulates the post-exploitation signal of the PHP runtime spawning a shell, as would occur after successful toast() injection.
Command
sudo -u www-data bash -c 'id; whoami' Cleanup
echo 'No persistent changes made.' Expected Telemetry
Process-creation event showing bash/id/whoami with parent php-fpm/apache under the web service account.
Expected Detection
Elastic EQL sequence and CrowdStrike CQL process rules detect the web-runtime-spawned shell.