CVE-2022-21686:
Server Side Twig Template Injection
9.1
CVSS Score
3.1
Basic Information
CVE ID
GHSA ID
EPSS Score
0.68297%
CWE
Published
1/27/2022
Updated
2/3/2023
KEV Status
No
Technology
PHP
Technical Details
CVSS Vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:H
Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
---|---|---|---|
prestashop/prestashop | composer | >= 1.7.0.0, <= 1.7.8.2 | 1.7.8.3 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability stems from how legacy layouts were processed in getLegacyLayout()
. The original implementation used simple string replacement without proper context-aware escaping, particularly for header and footer sections. The security patch introduced: 1) Splitting layout into components, 2) Added escapeSmarty()
method to apply Twig raw filter with proper escaping, 3) Structured template assembly to prevent injection points. The pre-patch code's str_replace
approach allowed unescaped user-controlled content to be interpreted as Twig code when rendering admin templates, enabling server-side template injection.