CVE-2024-37297: Woocommerce/woocommerce Remote Code Execution Vulnerability

MODERATE
Advisory Identifier: GHSA-cv23-q6gh-xfrf
CVSS 5.4
CWE-80 CWE-79
Published
Advisory Summary

CVE-2024-37297 is a MODERATE (CVSS 5.4) remote code execution vulnerability (CWE-80: Improper Neutralization of Script-Related HTML Tags in a Web Page (Basic XSS)) affecting Woocommerce/woocommerce libraries in the Packagist ecosystem. The issue involves woocommerce has a cross-site scripting (xss) vulnerability in checkout & registration forms. Remediation is available by upgrading affected packages to version 8.8.5, 8.9.3.

CVE-2024-37297 at a Glance

CVE Identifier CVE-2024-37297
GHSA Identifier GHSA-cv23-q6gh-xfrf
Severity MODERATE
CVSS v3.1 Base Score 5.4
CWE Classification CWE-80: Improper Neutralization of Script-Related HTML Tags in a Web Page (Basic XSS)
Affected Product Woocommerce/woocommerce
Package Ecosystem Packagist
Published Date
Last Updated

Security Impact

CVSS: 5.4

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

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

How to Fix CVE-2024-37297

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

woocommerce/woocommerce fixed: 8.8.5
Upgrade woocommerce/woocommerce to 8.8.5
woocommerce/woocommerce fixed: 8.9.3
Upgrade woocommerce/woocommerce to 8.9.3
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 woocommerce/woocommerce

How to Check if You Are Affected

To determine whether your application is affected by CVE-2024-37297, inspect your project dependencies for Woocommerce/woocommerce:

inspect dependencies for woocommerce/woocommerce

Analyze the terminal output to locate any version of Woocommerce/woocommerce in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 8.8.5), 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-80: Improper Neutralization of Script-Related HTML Tags in a Web Page (Basic XSS), where the product receives input from an upstream component, but it does not neutralize or incorrectly neutralizes special characters such as "<", ">", and "&" that could be interpreted as web-scripting elements when they are sent to a downstream component that processes web pages. In Woocommerce/woocommerce, 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

### Impact A vulnerability introduced in WooCommerce 8.8 allows for cross-site scripting. A bad actor can manipulate a link to include malicious HTML & JavaScript content. While the content is not saved to the database, the links may be sent to victims for malicious purposes. The injected JavaScript could hijack content & data stored in the browser, including the session. The URL content is read through the Sourcebuster.js library and then inserted without proper sanitization to the classic checkout and registration forms. ### Patches ```diff diff --git a/plugins/woocommerce/client/legacy/js/frontend/order-attribution.js b/plugins/woocommerce/client/legacy/js/frontend/order-attribution.js index 79411e928e1..25eaa721c54 100644 --- a/plugins/woocommerce/client/legacy/js/frontend/order-attribution.js +++ b/plugins/woocommerce/client/legacy/js/frontend/order-attribution.js @@ -155,12 +155,16 @@ * but it's not yet supported in Safari. */ connectedCallback() { - let inputs = ''; + this.innerHTML = ''; + const inputs = new DocumentFragment(); for( const fieldName of this._fieldNames ) { - const value = stringifyFalsyInputValue( this.values[ fieldName ] ); - inputs += `<input type="hidden" name="${params.prefix}${fieldName}" value="${value}"/>`; + const input = document.createElement( 'input' ); + input.type = 'hidden'; + input.name = `${params.prefix}${fieldName}`; + input.value = stringifyFalsyInputValue( ( this.values && this.values[ fieldName ] ) || '' ); + inputs.appendChild( input ); } - this.innerHTML = inputs; + this.appendChild( inputs ); } /** ``` ### Workarounds Disabling the Order Attribution feature ### References A8C SIRT: p3btAN-2L2-p2 (internal) Public disclosure: https://developer.woocommerce.com/2024/06/10/developer-advisory-xss-vulnerability-8-8-0/

CVE-2024-37297 Affected Woocommerce/woocommerce Versions

2 component(s)
Fixed Versions:
8.8.58.9.3
Product / Package Ecosystem Affected Versions Fixed Version
woocommerce/woocommerce
Packagist
≥ 8.8.0
< 8.8.5
8.8.5
woocommerce/woocommerce
Packagist
≥ 8.9.0
< 8.9.3
8.9.3

References

Frequently Asked Questions

What is CVE-2024-37297?
CVE-2024-37297 is a security vulnerability in Woocommerce/woocommerce involving WooCommerce has a Cross-Site Scripting (XSS) Vulnerability in checkout & registration forms under CWE-80: Improper Neutralization of Script-Related HTML Tags in a Web Page (Basic XSS).
Which Woocommerce/woocommerce versions are affected?
Affected versions include releases prior to 8.8.5, 8.9.3 across affected packages: woocommerce/woocommerce.
What version fixes CVE-2024-37297?
Upgrading to 8.8.5, 8.9.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is woocommerce/woocommerce affected?
Yes, woocommerce/woocommerce is affected in releases prior to 8.8.5, 8.9.3. Upgrade your dependency to 8.8.5, 8.9.3 or later.
What is the CVSS score of CVE-2024-37297?
CVE-2024-37297 has a CVSS v3.1 base score of 5.4 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N.
What CWE is associated with CVE-2024-37297?
CVE-2024-37297 is classified under CWE-80: Improper Neutralization of Script-Related HTML Tags in a Web Page (Basic XSS) (The product receives input from an upstream component, but it does not neutralize or incorrectly neutralizes special characters such as "<", ">", and "&" that could be interpreted as web-scripting elements when they are sent to a downstream component that processes web pages.).
How can I check Packagist dependencies for CVE-2024-37297?
Run the dependency tree command: 'inspect dependencies for woocommerce/woocommerce'. 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-cv23-q6gh-xfrf",
  "modified" : "2024-07-24T15:10:12Z",
  "published" : "2024-06-12T19:40:16Z",
  "aliases" : [ "CVE-2024-37297" ],
  "summary" : "WooCommerce has a Cross-Site Scripting (XSS) Vulnerability in checkout & registration forms",
  "details" : "### Impact\nA vulnerability introduced in WooCommerce 8.8 allows for cross-site scripting. A bad actor can manipulate a link to include malicious HTML & JavaScript content. While the content is not saved to the database, the links may be sent to victims for malicious purposes. The injected JavaScript could hijack content & data stored in the browser, including the session.\nThe URL content is read through the Sourcebuster.js library and then inserted without proper sanitization to the classic checkout and registration forms.\n\n### Patches\n```diff\ndiff --git a/plugins/woocommerce/client/legacy/js/frontend/order-attribution.js b/plugins/woocommerce/client/legacy/js/frontend/order-attribution.js\nindex 79411e928e1..25eaa721c54 100644\n--- a/plugins/woocommerce/client/legacy/js/frontend/order-attribution.js\n+++ b/plugins/woocommerce/client/legacy/js/frontend/order-attribution.js\n@@ -155,12 +155,16 @@\n \t\t * but it's not yet supported in Safari.\n \t\t */\n \t\tconnectedCallback() {\n-\t\t\tlet inputs = '';\n+\t\t\tthis.innerHTML = '';\n+\t\t\tconst inputs = new DocumentFragment();\n \t\t\tfor( const fieldName of this._fieldNames ) {\n-\t\t\t\tconst value = stringifyFalsyInputValue( this.values[ fieldName ] );\n-\t\t\t\tinputs += `<input type=\"hidden\" name=\"${params.prefix}${fieldName}\" value=\"${value}\"/>`;\n+\t\t\t\tconst input = document.createElement( 'input' );\n+\t\t\t\tinput.type = 'hidden';\n+\t\t\t\tinput.name = `${params.prefix}${fieldName}`;\n+\t\t\t\tinput.value = stringifyFalsyInputValue( ( this.values && this.values[ fieldName ] ) || '' );\n+\t\t\t\tinputs.appendChild( input );\n \t\t\t}\n-\t\t\tthis.innerHTML = inputs;\n+\t\t\tthis.appendChild( inputs );\n \t\t}\n \n \t\t/**\n```\n\n### Workarounds\nDisabling the Order Attribution feature \n\n### References\nA8C SIRT: p3btAN-2L2-p2 (internal)\nPublic disclosure: https://developer.woocommerce.com/2024/06/10/developer-advisory-xss-vulnerability-8-8-0/\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "woocommerce/woocommerce"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "8.8.0"
      }, {
        "fixed" : "8.8.5"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "woocommerce/woocommerce"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "8.9.0"
      }, {
        "fixed" : "8.9.3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/woocommerce/woocommerce/security/advisories/GHSA-cv23-q6gh-xfrf"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-37297"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/woocommerce/woocommerce/commit/0e9888305d0cb9557e58f558526ab11cb3bcc4b4"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/woocommerce/woocommerce/commit/915e32a42762916b745a7e663c8b69a698da8b67"
  }, {
    "type" : "WEB",
    "url" : "https://developer.woocommerce.com/2024/06/10/developer-advisory-xss-vulnerability-8-8-0"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/woocommerce/woocommerce"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-79", "CWE-80" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-06-12T19:40:16Z",
    "nvd_published_at" : "2024-06-12T15:15:52Z"
  }
}