CVE-2022-31181: PrestaShop eval injection possible if shop vulnerable to SQL injection
Impact Eval injection possible if the shop is vulnerable to an SQL injection.
Patches The problem is fixed in version 1.7.8.7
Workarounds Delete the MySQL Smarty cache feature by removing these lines in the file config/smarty.config.inc.php lines 43-46 (PrestaShop 1.7) or 40-43 (PrestaShop 1.6): php if (Configuration::get('PSSMARTYCACHINGTYPE') == 'mysql') { include PSCLASSDIR.'Smarty/SmartyCacheResourceMysql.php'; $smarty->cachingtype = 'mysql'; }
Other sources
PrestaShop eval injection possible if shop vulnerable to SQL injection
— Packagist
PrestaShop is an Open Source e-commerce platform. In versions from 1.6.0.10 and before 1.7.8.7 PrestaShop is subject to an SQL injection vulnerability which can be chained to call PHP's Eval function on attacker input. The problem is fixed in version 1.7.8.7. Users are advised to upgrade. Users unable to upgrade may delete the MySQL Smarty cache feature.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
composer/prestashop/prestashopto a version that resolves this vulnerability.Fixed in 1.7.8.7 - Upgrade
Upgrade
PrestaShopto a version that resolves this vulnerability.Fixed in 1.7.8.7 - Configuration
Delete the MySQL Smarty cache feature from config/smarty.config.inc.php by removing lines 43-46 in PrestaShop 1.7 or lines 40-43 in PrestaShop 1.6, including the code that loads SmartyCacheResourceMysql.php when PS_SMARTY_CACHING_TYPE is mysql.
PrestaShop MySQL Smarty cache $smarty->caching_type / PS_SMARTY_CACHING_TYPE = disabled (not mysql)
Event History
Frequently Asked Questions
What is CVE-2022-31181?
CVE-2022-31181 is an SQL injection vulnerability in PrestaShop versions from 1.6.0.10 to 1.7.8.6, which can be used to call PHP's Eval function on attacker input.
What is the severity of CVE-2022-31181?
CVE-2022-31181 has a severity rating of 9.8 (Critical).
How does CVE-2022-31181 affect PrestaShop?
CVE-2022-31181 affects PrestaShop versions from 1.6.0.10 to 1.7.8.6, allowing SQL injection attacks and execution of arbitrary PHP code.
How can I fix the SQL injection vulnerability in PrestaShop?
To fix the SQL injection vulnerability in PrestaShop, you should upgrade to version 1.7.8.7 or later.
Where can I find more information about CVE-2022-31181?
You can find more information about CVE-2022-31181 in the following references: [Link 1](https://github.com/PrestaShop/PrestaShop/commit/b6d96e7c2a4e35a44e96ffbcdfd34439b56af804), [Link 2](https://github.com/PrestaShop/PrestaShop/releases/tag/1.7.8.7), [Link 3](https://github.com/PrestaShop/PrestaShop/security/advisories/GHSA-hrgx-p36p-89q4).