CVE-2024-37297
JSON

5.4medium

WooCommerce has a Cross-Site Scripting Vulnerability in checkout & registration forms

Severity
5.4medium CVSS:3.1 by GitHub_M
Exploit likelihood
0.48% (higher than 43% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-cv23-q6gh-xfrf

Description

WooCommerce is an open-source e-commerce platform built on WordPress. 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. Versions 8.8.5 and 8.9.3 contain a patch for the issue. As a workaround, one may disable the Order Attribution feature.

Affected

Product or packageVersionsReported by
woocommerce woocommerce>= 8.8.0, < 8.8.5, >= 8.9.0, < 8.9.3, from 8.8 before 8.8.5, from 8.9.0 before 8.9.3CVE List, NVD
woocommerce/woocommerce (Packagist)from 8.8.0 before 8.8.5, from 8.9.0 before 8.9.3GitHub Advisory Database

All scores

GitHub_M5.4medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N
GitHub5.4medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N
NVD5.4medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N

Classification

CWE-79CWE-80

SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial.

What each source says

CVE List

WooCommerce is an open-source e-commerce platform built on WordPress. 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. Versions 8.8.5 and 8.9.3 contain a patch for the issue. As a workaround, one may disable the Order Attribution feature.

GitHub Advisory Database
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 --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/

NVD (es)

WooCommerce es una plataforma de comercio electrónico de código abierto construida sobre WordPress. Una vulnerabilidad introducida en WooCommerce 8.8 permite cross-site scripting. Un mal actor puede manipular un enlace para incluir contenido HTML y JavaScript malicioso. Si bien el contenido no se guarda en la base de datos, los enlaces pueden enviarse a las víctimas con fines maliciosos. El JavaScript inyectado podría secuestrar el contenido y los datos almacenados en el navegador, incluida la sesión. El contenido de la URL se lee a través de la librería `Sourcebuster.js` y luego se inserta sin la sanitización adecuada en los formularios clásicos de pago y registro. Las versiones 8.8.5 y 8.9.3 contienen un parche para el problema. Como workaround, se puede desactivar la función de atribución de pedidos.

References

Sources

SourceRecordLicence
CVE ListCVE-2024-37297 changed 2024-08-02CVE Terms of Use
GitHub Advisory DatabaseGHSA-cv23-q6gh-xfrf changed 2026-09-10CC-BY-4.0
NVDCVE-2024-37297 changed 2026-06-17Public domain