IMPORTANT NOTICE: DO NOT REPORT VULNERABILITIES SOLELY TO THE AUTHOR OR MARKETPLACE.
We urge you to report any vulnerabilities directly to us. Our mission is to ensure the safety and security of the PrestaShop ecosystem. Unfortunately, many module developers may not always recognize or acknowledge the vulnerabilities in their code, whether due to lack of awareness, or inability to properly evaluate the associated risk, or other reasons.
Given the rise in professional cybercrime networks actively seeking out these vulnerabilities, it's crucial that any potential threats are promptly addressed and the community is informed. The most effective method to do this is by publishing a CVE, like the one provided below.
Should you discover any vulnerabilities, please report them to us at: report[@]security-presta.org or visit https://security-presta.org for more information.
Every vulnerability report helps make the community more secure, and we are profoundly grateful for any information shared with us.
[CVE-2021-37538] Improper neutralization of SQL parameter in SmartBlog module from SmartDataSoft for PrestaShop
Multiple SQL injection vulnerabilities in SmartDataSoft SmartBlog for PrestaShop before 4.0.6 allow a remote unauthenticated attacker to execute arbitrary SQL commands via the day, month, or year parameter to the controllers/front/archive.php
archive controller, or the id_category parameter to the controllers/front/category.php
category controller.
Summary
- CVE ID: CVE-2021-37538
- Published at: 2021-08-24
- Advisory source: sorcery.ie
- Vendor: PrestaShop
- Product: SmartBlog
- Impacted release: <4.0.6
- Product author: SmartDataSoft
- Weakness: CWE-89
- Severity: critical (9.8)
Description
In this smartblog module for PrestaShop, sorcery.ie discovered two SQLis.
In controllers/front/archive.php we can see that the day, month and year parameters are passed to the getArchiveResult() function without sanitisation.
CVSS base metrics
- Attack vector: network
- Attack complexity: low
- Privilege required: none
- User interaction: none
- Scope: unchanged
- Confidentiality: high
- Integrity: high
- Availability: high
Vector string: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Possible malicious usage
- Obtain admin access
- Remove data from the associated PrestaShop
- Copy/paste data from sensitive tables to the FRONT to exposed tokens and unlock admins’ ajax scripts
- Rewrite SMTP settings to hijack emails
Proof of concept
https://site.com/module/smartblog/archive?month=1&year=1&day=1 UNION ALL SELECT NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,(SELECT group_concat(name) FROM ps_module),NULL,NULL,NULL,NULL,NULL,NULL,NULL-- -
Patch
Other recommendations
- Upgrade the module to the most recent version
- Upgrade PrestaShop to the latest version to disable multiquery execution (separated by “;”) - be warned that this functionality WILL NOT protect your SHOP against injection SQL which uses the UNION clause to steal data.
- Change the default database prefix
ps_
by a new longer arbitrary prefix. Nevertheless, be warned that this is useless against blackhats with DBA senior skills because of a design vulnerability in DBMS - Activate OWASP 942’s rules on your WAF (Web application firewall), be warned that you will probably break your backoffice and you will need to pre-configure some bypasses against these set of rules.
Timeline
Date | Action |
---|---|
22-06-2021 | Issue discovered during a pentest |
13-07-2021 | Reported issue to SmartDataSoft |
15-07-2021 | SmartDataSoft patched the issue in version 4.0.6 |
26-07-2021 | Number CVE-2021-37538 assigned |
21-08-2021 | Blog post released |
24-08-2021 | pajoda made a Nuclei template for this CVE |
Links
DISCLAIMER: The French Association Friends Of Presta (FOP) acts as an intermediary to help hosting this advisory. While we strive to ensure the information and advice provided are accurate, FOP cannot be held liable for any consequences arising from reported vulnerabilities or any subsequent actions taken.
This advisory and patch is licensed under CC BY-SA 4.0