In the Boxtal (envoimoinscher) module from Boxtal for PrestaShop, after version 3.1.10, a SQL injection vulnerability allows remote attackers to execute arbitrary SQL commands via the key parameter in the ajax.php front controller.

DANGER : It is strongly recommended to remove the module and migrate to Boxtal Connect

Summary

  • CVE ID: CVE-2023-30151
  • Published at: 2023-06-20
  • Advisory source: Friends-Of-Presta
  • Platform: PrestaShop
  • Product: envoimoinscher
  • Impacted release: > 3.1.10,<= 3.3.8 (latest version, not fixed, deprecated module to remove or to replace by Boxtal Connect)
  • Product author: Boxtal
  • Weakness: CWE-89
  • Severity: critical (9.8)

Description

An HTTP request can be manipulated using the GET parameter key in the /envoimoinscher/controllers/front/ajax.php front controller, with push option, enabling a remote attacker to perform an anonymous SQL injection attack.

The issue is present in the latest version of the module. As of the date of publication of this advisory, Boxtal has announced they will not be releasing a new version to fix the issue. However, a patch is available for version 3.3.8 if requested from Boxtal.

Also, since the module is no longer maintained, it is strongly recommended to remove it and migrate to Boxtal Connect. In fact, the module has been deprecated since April 2019 and has been replaced with Boxtal Connect

Note that the vulnerability was not detected in version 3.1.10. However, Boxtal wasn’t able to confirm the exact version from which the vulnerability started.

This exploit uses a PrestaShop front controller, and most attackers can conceal the module controller’s path during the exploit, so you will never know within your conventional frontend logs that it exploits this vulnerability. You will only see “POST /” inside your conventional frontend logs. Activating the AuditEngine of mod_security (or similar) is the only way to get data to confirm this exploit.

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 FRONT to exposed tokens and unlock admins’ ajax scripts
  • Rewrite SMTP settings to hijack emails

Patch

Note that the module is no longer maintained, therefore, this patch might not be sufficient to fix all known security vulnerabilities in this module. It’s strongly advised to remove the module and migrate to Boxtal Connect.

--- a/includes/EnvoimoinscherModel.php
+++ b/includes/EnvoimoinscherModel.php
@@ -2756,3 +2756,3 @@ class EnvoimoinscherModel
                 JOIN ' . _DB_PREFIX_ . 'orders o ON o.id_order = eo.' . _DB_PREFIX_ . 'orders_id_order
-                WHERE eo.' . _DB_PREFIX_ . 'orders_id_order = ' . $order . ' AND eo.tracking_eor = "' . $key . '" '
+                WHERE eo.' . _DB_PREFIX_ . 'orders_id_order = ' . (int)$order . ' AND eo.tracking_eor = "' . pSQL($key) . '" '
         ) > 0;
     public function orderWithTimeoutError($order)

Other recommendations

  • Completely remove the module since it is no longer maintained, or migrate to the new “Boxtal Connect” module (link available below)
    • 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_ with 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 this set of rules.

Timeline

Date Action
2022-09-20 Discovery of the vulnerability by Profileo in version 3.3.7
2022-09-20 Contacting the editor (no reply)
2023-03-17 Contacting the editor
2023-03-20 The editor confirmed the vulnerability. No update will be released.
2023-03-22 Auditing version 3.3.8 (latest version), confirming the vulnerability
2023-04-02 Requesting a CVE ID
2023-06-20 Publish this security advisory