BlockStrap — Magento Template-Engine Directive Injection to Conditional RCE (CVE-2026-103849)
Published: 2026-11-25 • Researcher: dinosn (Nicolas Krassas) — lab/PoC author; Sansec — BlockStrap research; Adobe PSIRT — APSB26-153 advisory
- Severity
- Critical
- CVE
- CVE-2026-103849 (Adobe APSB26-153)
- Category
- web
- Affected product
- Adobe Commerce / Magento Open Source (email template filter, customer address formatter and BlockStrap layout block dispatch)
- Affected versions
- Not enumerated in NVD (empty product and version ranges). The lab reproduces on Magento Open Source 2.4.9 at revision 755e34dd689021c5165db9d35ecff74f7dc51527 with the September VULN-39341 hotfix applied and the October APSB26-153 BlockStrap fix absent; confirm the exact Commerce edition, version and patch level against Adobe APSB26-153 (see references)
- Disclosed
- 2026-11-25
- Patch status
- Patched
Tags
References
- https://nvd.nist.gov/vuln/detail/CVE-2026-103849
- https://www.adobe.com/trust/security/products/commerce/apsb26-153.html
- https://sansec.io/research/blockstrap-magento-rce
- https://github.com/dinosn/cve-2026-103849-blockstrap-lab
- https://github.com/mage-os/mageos-magento2/pull/365
- https://cwe.mitre.org/data/definitions/1336.html
Archive entry
intelseclab/poc-archiveOn this page
Metadata
| Field | Value |
|---|---|
| Date Added | 2026-11-25 |
| Last Updated | 2026-10-18 |
| Author / Researcher | dinosn (Nicolas Krassas) — lab/PoC author; Sansec — BlockStrap research; Adobe PSIRT — APSB26-153 advisory |
| CVE / Advisory | CVE-2026-103849 (Adobe APSB26-153) |
| Category | web |
| Severity | Critical |
| CVSS Score | 10.0 (NVD; the CVSS vector is not present in the supplied worklist/NVD data — see references) |
| Status | PoC |
| Tags | RCE, Magento, Adobe Commerce, template-injection, CWE-1336, unauthenticated, GraphQL, directive-injection, BlockStrap, PHP |
| Related | N/A |
Affected Target
| Field | Value |
|---|---|
| Software / System | Adobe Commerce / Magento Open Source (email template filter, customer address formatter and BlockStrap layout block dispatch) |
| Versions Affected | Not enumerated in NVD (empty product and version ranges). The lab reproduces on Magento Open Source 2.4.9 at revision 755e34dd689021c5165db9d35ecff74f7dc51527 with the September VULN-39341 hotfix applied and the October APSB26-153 BlockStrap fix absent; confirm the exact Commerce edition, version and patch level against Adobe APSB26-153 (see references) |
| Language / Platform | PHP 8.3 (php:8.3-fpm-bookworm) behind nginx 1.27, with MariaDB 11.4, OpenSearch 2.19 and Redis 7 in Docker Compose |
| Authentication Required | No |
| Network Access Required | Yes |
Summary
Adobe Commerce and Magento Open Source are affected by an improper neutralization of special elements used in a template engine (CWE-1336) that can result in arbitrary code execution in the context of the current user; exploitation requires no user interaction and the scope is changed. The public lab PoC reproduces the BlockStrap second-pass directive-injection primitive on Magento Open Source 2.4.9: an anonymous guest GraphQL flow stores a recursive template carrier in the billing address, a declined Payflow response enters the failed-payment notification path, and the resulting email filter rescans a signed block directive that a nested framework filter returned unchanged. In the vulnerable state the stock Text block is dispatched through the email filter’s block directive handler, and the lab’s explicitly labeled gadget then runs a fixed id command as www-data. The packaged command track is conditional: it requires an explicitly installed, non-stock gadget block, and the repository does not claim a stock full remote-code-execution chain.
Vulnerability Details
Root Cause
Magento’s template filter resolves directives, then generically rescans directives that nested filters signed. At filtering depth greater than one, the engine signs every matched directive whose processor returned the original text unchanged — including directives the child filter never understood. A weaker child (the base framework filter used while formatting a customer address) therefore hands an attacker-shaped {{block ...}} back as “deferred”, the root email filter trusts the request-scoped signature, and Magento\Email\Model\Template\Filter::blockDirective() dispatches it. blockDirective() builds the caller-selected class through Layout with flat string data and invokes the selected zero-argument output= method. Adobe’s October fix (APSB26-153) removes the generic signed rescan; only directives registered by deferToParent() in the new DeferredDirectiveRegistry can be resolved by the root.
Attack Vector
A single unauthenticated HTTP request sequence against public guest GraphQL operations and the PayPal Payflow mutation: createEmptyCart, setGuestEmailOnCart, setBillingAddressOnCart with a recursive address-format carrier in the visible company field, then handlePayflowProResponse with a declined payload (RESULT=12&RESPMSG=Declined). Address formatting reaches a nested base-filter pass that leaves the unknown {{block}} unchanged and signs it; the value is stored as billingAddressHtml; a later failed-payment email pass shares the request signature, recognizes it and dispatches the block. The address renderer HTML-encodes quotes, so the working carrier uses the template language’s unquoted parameter form.
Impact
Attacker-selected block construction and method invocation in the web tier, reached from an anonymous request with no user interaction. On its own the stock primitive invokes a legitimate block method (the lab’s non-destructive oracle is Magento\Framework\View\Element\Text::getCacheKey() returning CUSTOM_BLOCK_<nonce>), which proves dispatch but not code execution. When a deployment also exposes a compatible BlockInterface class with a zero-argument command sink, the same dispatcher yields command execution as the PHP-FPM user — the lab demonstrates this with its own module, which runs id as www-data. Adobe rates the underlying issue CVSS 10.0 with scope changed.
Environment / Lab Setup
OS: Linux amd64 (Docker Engine 20.10.25, Compose v2.26.1); other
architectures are not covered by the recorded evidence
Target: Magento Open Source 2.4.9 (commit 755e34dd689021c5165db9d35ecff74f7dc51527)
in Docker Compose with the September VULN-39341 hotfix applied and
the APSB26-153 BlockStrap engine fix absent (vulnerable state)
Attacker: Host-side Python 3.10+ (standard library only)
Tools: Docker Compose, Bash, GNU Make, Python 3, PHP CLI (static checks), curl
Oracle: MailHog on 127.0.0.1:18097; Magento gateway on 127.0.0.1:18096 only
Resources: >= 8 GB RAM, 10-15 GB free disk, internet access for the image build;
Linux needs vm.max_map_count >= 262144 for OpenSearchSetup Steps
| |
All commands below are run from that checkout; the paths under poc/, gadget/, scripts/, compose.yaml and Makefile are the same files archived in this entry.
Patch provenance is checksum-pinned; scripts/set-state.sh refuses to touch a source tree matching neither known patch state. python3 scripts/verify-patch-provenance.py --vuln-archive ... --october-archive ... reproduces and compares the shipped patches byte-for-byte.
Proof of Concept
Step-by-Step Reproduction
- Build the pinned stack —
make fullruns the static verifier, starts the digest-pinned Compose stack and waits for the Magento 2.4.9 first boot to finish. - Select the vulnerable state —
make vulnerableapplies only the September VULN-39341 hotfix, leaving the APSB26-153 BlockStrap engine fix absent. - Install the labeled lab gadget —
make gadget-installcopiesgadget/BlockStrapLab_Gadgetintoapp/code, enables it and confirms its exact file hashes. The module is authored for this lab and runs only the fixed commandid. - Send the unauthenticated chain —
python3 poc/http_rce_probe.py --expect vulnerablecreates a guest cart, stores the recursive address carrier, submits the declined Payflow response, and waits for one nonce-correlated failed-payment email in MailHog. - Confirm both oracles — the captured email must contain
RCEGADGET:<nonce>:<base64 id output>:RCEGADGET, and the same output must exist in the nonce-named marker file undervar/export. The patched state must capture the same failure email but show neither marker nor marker file. - Restore — the A/B wrapper’s exit trap re-applies the October patch, deletes validated marker paths and removes the gadget module.
Exploit Code
See
poc/http_rce_probe.pyfor the full chain,poc/http_primitive_probe.pyfor the shared GraphQL/carrier helpers,poc/http_file_trigger.pyfor the bounded stock side-effect probe, andgadget/BlockStrapLab_Gadget/Block/Rce.phpfor the labeled gadget. A/B orchestration is inscripts/run-rce-ab.sh.
The carrier shape (from the probe; the directive text is stored in the billing address company attribute):
| |
The gadget is deliberately non-steerable: it validates nonce against /\ABS[0-9a-f]{24}\z/D, runs shell_exec('id 2>&1'), writes the output to var/export/rce-<nonce>.txt and returns the base64 marker above.
Expected Output
| |
The stock, gadget-free tracks instead report CUSTOM_BLOCK_<nonce> in the email (component and HTTP A/B), and one four-byte var/export/<32-hex>.csv with SHA-256 b42f2099187886def637d6aa840022266e05cb6c987a9394e708e23cd505eb46 in the file A/B; both disappear after the October fix. Recorded runs: VALIDATION.md; the raw run logs are in the upstream repository’s evidence/ directory, which was not copied.
Detection & Indicators of Compromise
- Unauthenticated guest GraphQL sequences
createEmptyCart→setGuestEmailOnCart→setBillingAddressOnCart→handlePayflowProResponsefrom one client, where the billingcompanyfield contains{{block,{{var,{{ifor nested directive syntax. - Declined Payflow payloads (
RESPMSG=Declined,RESULT=12) that are followed immediately by a failed-payment email carrying template syntax orCUSTOM_BLOCK_/RCEGADGET:markers. - Outbound email (or MailHog/SMTP capture) whose body contains
{{block class=or a base64 blob wrapped inRCEGADGET:...:RCEGADGET. - New files in
var/export/with an unexpected 32-hex.csvname, and unexpectedrce-*.txtfiles; Magentovar/exportshould normally contain only operator-initiated exports. - PHP-FPM / application logs showing layout block construction failures (“Invalid block type”, layout generation errors) or
shell_execactivity from the frontend pool in production mode. - Requests or emails whose quoted attributes survive HTML encoding as unquoted template parameters (
class=,output=,cache_key=), a strong sign of deliberate carrier crafting.
SIEM / IDS rule (example):
| |
Remediation
| Action | Detail |
|---|---|
| Patch | Apply Adobe APSB26-153 for CVE-2026-103849 through the supported Composer/patch process, or upgrade to a fixed Commerce/Open Source release; the repository’s patches/APSB26-153_BlockStrap_249-monorepo.patch is a path-mapped lab artifact for the 2.4.9 public monorepo and must not be applied to a production install. Flush caches and confirm the vendor-identified control points, including that a nested filter’s unchanged {{block}} no longer renders. |
| Workaround | If patching is delayed, disable guest checkout and/or the Magento_PaypalGraphQl module if unused, and put a WAF/reverse proxy rule in front of Magento that rejects {{block, {{var, {{if and {{template sequences in JSON bodies, query strings and address fields. Neither measure removes the root cause. |
| Config Hardening | Run production mode, keep the PHP-FPM user unprivileged with a read-only code tree and a separate writable var/, restrict var/export to operator use, remove unused block/extension classes that expose zero-argument command sinks, restrict egress from the web tier, and alert on template directives correlated with guest-cart traffic. |
References
Notes
Auto-ingested from https://github.com/dinosn/cve-2026-103849-blockstrap-lab on 2026-11-25. Review verdict: a real, working PoC-lab — not a detector or scanner — but deliberately limited, so Status is PoC rather than Weaponized. It proves the stock directive-injection primitive, a stock unauthenticated GraphQL-to-email carrier (oracle CUSTOM_BLOCK_<nonce> in a local MailHog message) and a bounded stock side effect (one fixed-content CSV in var/export). Command execution is conditional: the repository’s own BlockStrapLab_Gadget module supplies the otherwise missing block-sink precondition and runs only the fixed command id; the authors explicitly do not claim a stock Magento full-RCE chain, and a bounded search on 2026-10-18 found no public full-RCE PoC. The upstream re-analysis (REANALYSIS.md, not copied) records that no compatible stock command gadget was validated in the reviewed 2.4.9 subset.
Operational limits: the quote address company column caps the carrier at 255 characters (the hardened gadget carrier is 208 ASCII bytes), so arbitrary real-world gadget classes and parameter sets may not fit; the MailHog oracle is local and a remote attacker normally cannot read the merchant failure email; the lab assumes Magento_PaypalGraphQl enabled, guest checkout allowed, a visible company attribute and the default HTML address format.
License: the repository is MIT (Copyright 2026 Nicolas Krassas), archived here with attribution for authorized research only. The bundled Magento patch artifacts are path-mapped lab derivatives; Adobe’s complete October patch and the Magento 2.4.9 source (OSL-3.0) are not redistributed in this entry. Files not copied: .git, .env/.env.example (lab default credentials), the Docker/PHP/nginx build files (php/, nginx/), patches/, the remaining A/B wrappers and verify-release.sh, the evidence/ logs, and the upstream REANALYSIS.md; the full lab build therefore needs the upstream repository. EPSS at ingestion was 0.01349; the CVE is not in CISA KEV. Do not execute this code against systems you do not own or lack written authorization to test.