CVE-2024-21627: Prestashop/prestashop :isCleanHTML Method Vulnerability

HIGH
Advisory Identifier: GHSA-xgpm-q3mq-46rq
CVSS 8.1
CWE-20 CWE-79
Published
Advisory Summary

CVE-2024-21627 is a HIGH (CVSS 8.1) :iscleanhtml method vulnerability (CWE-20: Improper Input Validation) affecting Prestashop/prestashop libraries in the Packagist ecosystem. The issue involves :iscleanhtml method. Remediation is available by upgrading affected packages to version 8.1.3, 1.7.8.11.

CVE-2024-21627 at a Glance

CVE Identifier CVE-2024-21627
GHSA Identifier GHSA-xgpm-q3mq-46rq
Severity HIGH
CVSS v3.1 Base Score 8.1
CWE Classification CWE-20: Improper Input Validation
Affected Product Prestashop/prestashop
Package Ecosystem Packagist
Published Date
Last Updated

Security Impact

CVSS: 8.1

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:H/I:H/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required High (PR:H)
User Interaction Required (UI:R)
Scope Changed (S:C)
Confidentiality High (C:H)
Integrity High (I:H)
Availability None (A:N)

How to Fix CVE-2024-21627

To remediate this vulnerability, upgrade all affected Prestashop/prestashop dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

prestashop/prestashop fixed: 8.1.3
Upgrade prestashop/prestashop to 8.1.3
prestashop/prestashop fixed: 1.7.8.11
Upgrade prestashop/prestashop to 1.7.8.11
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for prestashop/prestashop

How to Check if You Are Affected

To determine whether your application is affected by CVE-2024-21627, inspect your project dependencies for Prestashop/prestashop:

inspect dependencies for prestashop/prestashop

Analyze the terminal output to locate any version of Prestashop/prestashop in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 8.1.3), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-20: Improper Input Validation, where the product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly. In Prestashop/prestashop, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Description Some event attributes are not detected by the isCleanHTML method ### Impact Some modules using the isCleanHTML method could be vulnerable to xss ### Patches 8.1.3, 1.7.8.11 ### Workarounds The best workaround is to use the `HTMLPurifier` library to sanitize html input coming from users. The library is already available as a dependency in the PrestaShop project. Beware though that in legacy object models, fields of `HTML` type will call `isCleanHTML`. ### Reporters Reported by Antonio Russo (@Antonio-R1 on GitHub) and Antonio Rocco Spataro (@antoniospataro on GitHub).

CVE-2024-21627 Affected Prestashop/prestashop Versions

2 component(s)
Fixed Versions:
8.1.31.7.8.11
Product / Package Ecosystem Affected Versions Fixed Version
prestashop/prestashop
Packagist
≥ 8.0.0-beta.1
< 8.1.3
8.1.3
prestashop/prestashop
Packagist
< 1.7.8.11
1.7.8.11

References

Frequently Asked Questions

What is CVE-2024-21627?
CVE-2024-21627 is a security vulnerability in Prestashop/prestashop involving :isCleanHTML method under CWE-20: Improper Input Validation.
Which Prestashop/prestashop versions are affected?
Affected versions include releases prior to 8.1.3, 1.7.8.11 across affected packages: prestashop/prestashop.
What version fixes CVE-2024-21627?
Upgrading to 8.1.3, 1.7.8.11 (or the latest patched release for your respective branch) resolves the vulnerability.
Is prestashop/prestashop affected?
Yes, prestashop/prestashop is affected in releases prior to 8.1.3, 1.7.8.11. Upgrade your dependency to 8.1.3, 1.7.8.11 or later.
What is the CVSS score of CVE-2024-21627?
CVE-2024-21627 has a CVSS v3.1 base score of 8.1 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:H/I:H/A:N.
What CWE is associated with CVE-2024-21627?
CVE-2024-21627 is classified under CWE-20: Improper Input Validation (The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.).
How can I check Packagist dependencies for CVE-2024-21627?
Run the dependency tree command: 'inspect dependencies for prestashop/prestashop'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-xgpm-q3mq-46rq",
  "modified" : "2024-01-03T21:41:14Z",
  "published" : "2024-01-03T21:41:14Z",
  "aliases" : [ "CVE-2024-21627" ],
  "summary" : "PrestaShop some attribute not escaped in Validate::isCleanHTML method",
  "details" : "### Description\nSome event attributes are not detected by the isCleanHTML method\n\n### Impact\nSome modules using the isCleanHTML method could be vulnerable to xss\n\n### Patches\n8.1.3, 1.7.8.11\n\n### Workarounds\nThe best workaround is to use the `HTMLPurifier` library to sanitize html input coming from users. The library is already available as a dependency in the PrestaShop project. Beware though that in legacy object models, fields of `HTML` type will call `isCleanHTML`.\n\n### Reporters\n\nReported by Antonio Russo (@Antonio-R1 on GitHub) and Antonio Rocco Spataro (@antoniospataro on GitHub).\n\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:H/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "prestashop/prestashop"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "8.0.0-beta.1"
      }, {
        "fixed" : "8.1.3"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "prestashop/prestashop"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.7.8.11"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/PrestaShop/PrestaShop/security/advisories/GHSA-xgpm-q3mq-46rq"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-21627"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/PrestaShop/PrestaShop/commit/0ed1af8de500538490f88e9e794e2e8113fb8df7"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/PrestaShop/PrestaShop/commit/73cfb44666818eefd501b526a894fe884dd12129"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/PrestaShop/PrestaShop/commit/ba06d18466df5b92cb841d504cc7210121104883"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/PrestaShop/PrestaShop/commit/f799dcff564cd1b7ead932ffc3343b675107dbce"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/PrestaShop/PrestaShop"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-20", "CWE-79" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-01-03T21:41:14Z",
    "nvd_published_at" : "2024-01-02T21:15:10Z"
  }
}