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-27569]-[CVE-2023-27570] Improper neutralization of SQL parameters in Profileo : Tracking et Conversions (eo_tags) module for PrestaShop
In the module Tracking et Conversions (eo_tags) prior to version 1.4.19, an anonymous user can perform an SQL injection attack.
Summary
- CVE ID: CVE-2023-27569, CVE-2023-27570
- Published at: 2023-03-15
- Advisory source: security.profileo.com
- Platform: PrestaShop
- Product: eo_tags
- Impacted release: >=1.2.0 and <1.4.19 (1.4.19 fixed the vulnerability)
- Product author: Profileo
- Weakness: CWE-89
- Severity: critical (9.8)
Description
From version 1.2.0 published on Nov 17, 2017 to 1.4.18 published on Feb 21, 2023 (fixed in 1.4.19, published on Feb 28, 2023), an HTTP request can be forged with a compromized _ga
cookie in order to exploit an insecure parameter in function saveGanalyticsCookie()
and gaParseCookie()
, which could lead to a SQL injection.
From version 1.2.0 published on Nov 17, 2017 to 1.2.19 published on Oct 22, 2019 (fixed in 1.3.0), an HTTP request can be forged with a compromised User-Agent or Referer in order to exploit insecure parameters in trackReferrer()
function, which could lead to a SQL injection. As from 1.2.1, the code has been migrated to classes/EoTagsStats.php (EoTagsStats::setNewGuest()
) and the vulnerability now requires Privileges (PR) and user interaction (UI) to be exploited, reducing the severity to 8.0.
This exploit uses cookies (and referer) to perform the attack, therefore the module name will be hidden during the exploit, so you won’t be able to identify this vulnerability in your conventional frontend logs. You will only see “GET /” or “POST /” inside your conventional frontend logs.. The compromized referer will be visible in your access logs, however you’ll not be able to see the compromized cookie.
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
- Technical and personal data leaks
Patch
If present in eo_tags.php
--- a/eo_tags.php
+++ b/eo_tags.php
@@ -1495,8 +1495,8 @@ class Eo_Tags extends Module
$old_cid = $this->getAnalyticsCID($this->context->cart->id);
$data = array(
'id_cart' => $this->context->cart->id,
- 'cid' => $cid,
- 'cookie' => serialize($_COOKIE['_ga']),
+ 'cid' => pSQL($cid),
+ 'cookie' => pSQL(serialize($_COOKIE['_ga'])),
);
if (!$old_cid) {
Db::getInstance()->insert('eo_tags_ga_cookie', $data);
--- a/eo_tags.php
+++ b/eo_tags.php
@@ -1356,11 +1356,11 @@ class Eo_Tags extends Module
';
if ($referral = Db::getInstance()->getRow($sql2)) {
$data = array(
- 'id_guest' => $cookie->id_guest,
+ 'id_guest' => (int)$cookie->id_guest,
'ip_address' => $referral['ip_address'],
- 'http_referer' => $referral['http_referer'],
- 'request_uri' => $referral['request_uri'],
- 'user_agent' => $user_agent,
+ 'http_referer' => pSQL($referral['http_referer']),
+ 'request_uri' => pSQL($referral['request_uri']),
+ 'user_agent' => pSQL($user_agent),
'date_add' => $referral['date_add'],
);
}
@@ -1397,11 +1397,11 @@ class Eo_Tags extends Module
$request_uri = substr($request_uri, 0, 255);
$data = array(
- 'id_guest' => $cookie->id_guest,
+ 'id_guest' => (int)$cookie->id_guest,
'ip_address' => $ip_address,
- 'http_referer' => $http_referer,
- 'request_uri' => $request_uri,
- 'user_agent' => $user_agent,
+ 'http_referer' => pSQL($http_referer),
+ 'request_uri' => pSQL($request_uri),
+ 'user_agent' => pSQL($user_agent),
'date_add' => date('Y-m-d H:i:s'),
);
}
If present in classes/EoTagsStats.php
EoTagsStats::setNewGuest()
--- a/classes/EoTagsStats.php
+++ b/classes/EoTagsStats.php
@@ -26,7 +26,7 @@ class EoTagsStats {
$data = array(
'id_customer' => $id_customer,
'ip_address' => $ip_address,
- 'user_agent' => $user_agent,
+ 'user_agent' => pSQL($user_agent),
'date_add' => date('Y-m-d H:i:s'),
);
Profileo thanks TouchWeb.fr for its help discovering the vulnerability. Feel free to contact security/at/profileo.com if you wish to receive a PHP script to automatically detect and patch this vulnerability on your website.
Other recommendations
- To help improve the security of your PrestaShop installation, we recommend upgrading to the latest version. One of the benefits of upgrading is that it will disable the use of multiquery executions (separated by semicolons). However, please be aware that this will not protect your shop against SQL injection attacks that use the UNION clause to steal data. Additionally, it’s important to note that PrestaShop includes a function called pSQL, which includes a strip_tags function. This helps protect your shop against Stored XSS (also known as XSS T2) of Category 1. If a pSQL function is missing, it could potentially expose your project to critical Stored XSS vulnerabilities due to edge cases. Therefore, it’s crucial to ensure that all relevant functions are properly implemented and used consistently throughout your project.
- Change the default database prefix ps_ by a new longer arbitrary prefix. Nevertheless, be warned that this is useless against blackhats with DBA senior skill 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 |
---|---|
2023-02-24 | Discovery of the vulnerability by TouchWeb.fr |
2023-02-25 | Vulnerability confirmed by Profileo |
2023-02-28 | Patch created by Profileo and release of version 1.4.19 fixing the issue |
2023-03-01 | Patch released to customers |
2023-03-15 | Publication on security.profileo.com |
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