On this page · 4 sections
TL;DR
- Template injection is when data a user controls is treated as template code instead of plain text.
- In Adobe Commerce (Magento 2) the engines at risk are
.phtmltemplates, the email template engine with{{var}}and{{block}}directives, and CMS content filters. - Escaping protects the output, but template injection happens before there’s any output to escape. Never pass user input through a directive filter, and keep the roles that can edit templates tight.
In September 2026 Adobe fixed CVE-2026-75650 (bulletin APSB26-146, CVSS 10), a critical flaw in Adobe Commerce classed as CWE-1336, “improper neutralization of special elements used in a template engine”. It needed no login, and Adobe said it was being exploited. I won’t speculate about the exact bug. The class of problem matters more anyway, because the same mistake can live in custom code too.
What template injection is
A template engine turns a template plus some data into output. Adobe Commerce (Magento 2) uses several: .phtml templates, the email template engine with its {{var}} and {{block}} directives, and CMS content filters. Template injection happens when data a user controls is treated as template code instead of as plain text. Then the attacker isn’t filling in a blank. They’re writing part of the program.
Escaping protects the output. Template injection happens before there’s any output to escape.
Where it hides in Adobe Commerce code
- Directive processing on user input. Passing customer-supplied text (a name, a review, an address line) through a filter that understands
{{...}}directives. - Building templates from strings. Concatenating input into a template string, then rendering it.
- Admin-editable content that renders on the storefront. Fine for trusted admins, dangerous if any lower-privileged path can write to it.
Habits that prevent it
- Treat every directive filter as a code interpreter. Only feed it content from trusted authors.
- Render user input as data: escape it with
$escaper->escapeHtml()in templates, and never run it throughfilter(). - Keep admin roles tight. If an editor role can change email templates or CMS blocks, that role is effectively a developer.
- Patch quickly (my runbook). Attackers go after known, already-fixed flaws because so many stores stay unpatched. Six weeks after the SessionReaper fix, on the day the attacks started, Sansec counted 62% of Magento stores still vulnerable.
Checking your own code
Search custom modules for places that pass variables into template filters, and review each one.
grep -rnE --include=*.php -e '->filter\(|setVariables\(|processTemplate\(' app/code | less
A match isn’t a bug. It’s a place to read carefully: where does the input come from, and who can change it?


