CVE-2022-21686: CWE-94: Improper Control of Generation of Code ('Code Injection') in PrestaShop PrestaShop
PrestaShop is an Open Source e-commerce platform. Starting with version 1.7.0.0 and ending with version 1.7.8.3, an attacker is able to inject twig code inside the back office when using the legacy layout. The problem is fixed in version 1.7.8.3. There are no known workarounds.
AI Analysis
Technical Summary
CVE-2022-21686 is a code injection vulnerability classified under CWE-94 (Improper Control of Generation of Code) affecting PrestaShop, an open-source e-commerce platform widely used for online retail. The vulnerability exists in PrestaShop versions starting from 1.7.0.0 up to, but not including, 1.7.8.3. It specifically allows an attacker to inject arbitrary Twig template code within the back office interface when the legacy layout is in use. Twig is a templating engine used by PrestaShop to render dynamic content. By injecting malicious Twig code, an attacker could execute arbitrary code on the server, potentially leading to unauthorized access, data leakage, or manipulation of the e-commerce platform. The vulnerability arises due to insufficient sanitization or validation of user input that is processed as Twig code, allowing the attacker to control code generation improperly. This flaw is particularly dangerous because the back office typically has elevated privileges and access to sensitive business and customer data. The issue was addressed and fixed in PrestaShop version 1.7.8.3. No known workarounds exist, and no exploits have been reported in the wild as of the published date. The vulnerability requires the attacker to have access to the back office interface, which may require authentication or exploitation of other weaknesses to gain initial access. However, once inside, the attacker can leverage this vulnerability to escalate privileges or execute arbitrary commands on the server hosting the PrestaShop instance.
Potential Impact
For European organizations using affected versions of PrestaShop, this vulnerability poses a significant risk to the confidentiality, integrity, and availability of their e-commerce platforms. Successful exploitation could lead to unauthorized code execution, allowing attackers to manipulate product listings, steal customer data including payment information, or disrupt online sales operations. This can result in financial losses, reputational damage, and regulatory penalties under GDPR due to potential data breaches. Given that many small and medium-sized enterprises (SMEs) in Europe rely on PrestaShop for their online storefronts, the impact could be widespread, especially for businesses that have not updated to the patched version. The lack of known exploits in the wild suggests limited active targeting, but the medium severity indicates that the vulnerability could be leveraged in targeted attacks or combined with other vulnerabilities for more severe compromises. The absence of workarounds increases the urgency for patching. Additionally, disruption or compromise of e-commerce platforms can affect supply chains and customer trust, which is critical in the European digital economy.
Mitigation Recommendations
1. Immediate upgrade of all PrestaShop installations to version 1.7.8.3 or later to apply the official patch addressing this vulnerability. 2. Restrict access to the back office interface by implementing network-level controls such as VPNs, IP whitelisting, or firewall rules to limit exposure only to trusted administrators. 3. Enforce strong authentication mechanisms, including multi-factor authentication (MFA), to reduce the risk of unauthorized access to the back office. 4. Conduct regular audits of user accounts and permissions to ensure that only necessary personnel have back office access. 5. Monitor logs and implement intrusion detection systems to identify suspicious activities related to template code injection or unusual back office behavior. 6. For organizations unable to immediately patch, consider disabling the legacy layout feature if feasible, or isolate the back office environment to minimize risk. 7. Educate administrators and developers on secure coding practices and the risks associated with template injection vulnerabilities to prevent similar issues in custom modules or themes. 8. Maintain regular backups of the PrestaShop environment to enable rapid recovery in case of compromise.
Affected Countries
France, Germany, United Kingdom, Italy, Spain, Netherlands, Belgium, Poland, Sweden, Austria
CVE-2022-21686: CWE-94: Improper Control of Generation of Code ('Code Injection') in PrestaShop PrestaShop
Description
PrestaShop is an Open Source e-commerce platform. Starting with version 1.7.0.0 and ending with version 1.7.8.3, an attacker is able to inject twig code inside the back office when using the legacy layout. The problem is fixed in version 1.7.8.3. There are no known workarounds.
AI-Powered Analysis
Technical Analysis
CVE-2022-21686 is a code injection vulnerability classified under CWE-94 (Improper Control of Generation of Code) affecting PrestaShop, an open-source e-commerce platform widely used for online retail. The vulnerability exists in PrestaShop versions starting from 1.7.0.0 up to, but not including, 1.7.8.3. It specifically allows an attacker to inject arbitrary Twig template code within the back office interface when the legacy layout is in use. Twig is a templating engine used by PrestaShop to render dynamic content. By injecting malicious Twig code, an attacker could execute arbitrary code on the server, potentially leading to unauthorized access, data leakage, or manipulation of the e-commerce platform. The vulnerability arises due to insufficient sanitization or validation of user input that is processed as Twig code, allowing the attacker to control code generation improperly. This flaw is particularly dangerous because the back office typically has elevated privileges and access to sensitive business and customer data. The issue was addressed and fixed in PrestaShop version 1.7.8.3. No known workarounds exist, and no exploits have been reported in the wild as of the published date. The vulnerability requires the attacker to have access to the back office interface, which may require authentication or exploitation of other weaknesses to gain initial access. However, once inside, the attacker can leverage this vulnerability to escalate privileges or execute arbitrary commands on the server hosting the PrestaShop instance.
Potential Impact
For European organizations using affected versions of PrestaShop, this vulnerability poses a significant risk to the confidentiality, integrity, and availability of their e-commerce platforms. Successful exploitation could lead to unauthorized code execution, allowing attackers to manipulate product listings, steal customer data including payment information, or disrupt online sales operations. This can result in financial losses, reputational damage, and regulatory penalties under GDPR due to potential data breaches. Given that many small and medium-sized enterprises (SMEs) in Europe rely on PrestaShop for their online storefronts, the impact could be widespread, especially for businesses that have not updated to the patched version. The lack of known exploits in the wild suggests limited active targeting, but the medium severity indicates that the vulnerability could be leveraged in targeted attacks or combined with other vulnerabilities for more severe compromises. The absence of workarounds increases the urgency for patching. Additionally, disruption or compromise of e-commerce platforms can affect supply chains and customer trust, which is critical in the European digital economy.
Mitigation Recommendations
1. Immediate upgrade of all PrestaShop installations to version 1.7.8.3 or later to apply the official patch addressing this vulnerability. 2. Restrict access to the back office interface by implementing network-level controls such as VPNs, IP whitelisting, or firewall rules to limit exposure only to trusted administrators. 3. Enforce strong authentication mechanisms, including multi-factor authentication (MFA), to reduce the risk of unauthorized access to the back office. 4. Conduct regular audits of user accounts and permissions to ensure that only necessary personnel have back office access. 5. Monitor logs and implement intrusion detection systems to identify suspicious activities related to template code injection or unusual back office behavior. 6. For organizations unable to immediately patch, consider disabling the legacy layout feature if feasible, or isolate the back office environment to minimize risk. 7. Educate administrators and developers on secure coding practices and the risks associated with template injection vulnerabilities to prevent similar issues in custom modules or themes. 8. Maintain regular backups of the PrestaShop environment to enable rapid recovery in case of compromise.
For access to advanced analysis and higher rate limits, contact root@offseq.com
Technical Details
- Data Version
- 5.1
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2021-11-16T00:00:00.000Z
- Cisa Enriched
- true
Threat ID: 682d9842c4522896dcbf22be
Added to database: 5/21/2025, 9:09:22 AM
Last enriched: 6/23/2025, 6:18:17 PM
Last updated: 8/15/2025, 1:20:52 AM
Views: 19
Related Threats
CVE-2025-6625: CWE-20 Improper Input Validation in Schneider Electric Modicon M340
HighCVE-2025-57703: CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') in Delta Electronics DIAEnergie
MediumCVE-2025-57702: CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') in Delta Electronics DIAEnergie
MediumCVE-2025-57701: CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') in Delta Electronics DIAEnergie
MediumCVE-2025-57700: CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') in Delta Electronics DIAEnergie
HighActions
Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.
External Links
Need enhanced features?
Contact root@offseq.com for Pro access with improved analysis and higher rate limits.