CVE-2022-31181: PrestaShop eval injection possible if shop vulnerable to SQL injection

Published Jul 29, 2022
·
Updated

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

3 affected componentsFixes available
Prestashop PrestaShop>=1.6.0.10<1.7.8.7
composer/prestashop/prestashop>=1.6.0.10, <1.7.8.7
1.7.8.7
composer/prestashop/prestashop>=1.6.0.10<1.7.8.7
1.7.8.7

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade composer/prestashop/prestashop to a version that resolves this vulnerability.

    Fixed in 1.7.8.7
  2. Upgrade

    Upgrade PrestaShop to a version that resolves this vulnerability.

    Fixed in 1.7.8.7
  3. 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

Jul 26, 2022
Exploit Published
via GitHub·05:55 AM
Jul 29, 2022
Advisory Published
via GitHub·10:27 PM
Data Sourced
via GitHub·10:27 PM
DescriptionSeverityWeaknessAffected Software
Data Sourced
via Packagist·10:27 PM
DescriptionSeverityAffected Software
Aug 1, 2022
CVE Published
via MITRE·07:30 PM
Data Sourced
via MITRE·07:30 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·08:15 PM
RemedyDescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

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.

2

What is the severity of CVE-2022-31181?

CVE-2022-31181 has a severity rating of 9.8 (Critical).

3

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.

4

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.

5

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).

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203