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-2023-3031] Improper Limitation of a Pathname to a Restricted Directory in Webbax - King-Avis module for PrestaShop
Improper Limitation of a Pathname leads to a Path Traversal vulnerability in the module King-Avis for Prestashop, allowing a user knowing the download token to read arbitrary local files.This issue affects King-Avis: before 17.3.15.
Summary
- CVE ID: CVE-2023-3031
- Published at: 2023-06-01
- Advisory source: borelenzo.github.io
- Platform: PrestaShop
- Product: King-Avis
- Impacted release: < 17.3.15
- Product author: Webbax
- Weakness: CWE-22
- Severity: medium (6.5)
Description
King-Avis is a Prestashop module developed by Webbax. In versions older than 17.3.15, the latter suffers from an authenticated path traversal, leading to local file read.
There was a file download.php, that could be used to download statistical reports as CSV files. To protect from unauthorised access, the download feature was protected by a token. If the token is incorrect, the file exits and no content is returned. However, if the token is correct, the path is extracted from the parameter file and used without being sanitised.
It means that administrators (supposed to know this token) can read arbitrary local files. Also, there is no need to have an active admin session to browse to this file.
CVSS base metrics
- Attack vector: network
- Attack complexity: low
- Privilege required: low
- User interaction: none
- Scope: unchanged
- Confidentiality: high
- Integrity: none
- Availability: none
Vector string: CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N
Possible malicious usage
- Stealing secrets to unlock admin controllers based on ajax script
- Exfiltrate all modules with all versions to facilitate pentesting
- Stealing table_prefix to greatly facilitate SQL injections for kiddies who don’t know how exploit DBMS design’s vulnerabilities
- Stealing database access to log in to exposed PHPMyAdmin / Adminer / etc.
- Bypass WAF / htaccess restrictions to read forbidden files (such as logs on predictable paths of banks’s modules inside /var/log/)
Patch for < 17.3.15
diff --git a/modules/kingavis/downloads/download.php b/modules/kingavis/downloads/download.php
--- a/modules/kingavis/downloads/download.php
+++ b/modules/kingavis/downloads/download.php
@@ -17 +17 @@ if($token!==_COOKIE_IV_){die('token error');}
-$file = Tools::getValue('file');
+$file = basename(Tools::getValue('file'));
Other recommendations
- Upgrade the module to the most recent version
- Upgrade PrestaShop to the latest version to disable multiquery executions (separated by “;”)
- 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 |
---|---|
24-05-2023 | Vendor notified |
25-05-2023 | Vendor acknowledged and published a patch |
26-05-2023 | NCSC notified |
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