Vulnerabilities in pkg:npm/@pagefind/default-ui
PACKAGECVE-2024-45389 is a MODERATE (CVSS 6.4) cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Pagefind libraries in the npm ecosystem. The issue involves dom clobbering could escalate to cross-site scripting (xss). Remediation is available by upgrading affected packages to version 1.1.1.
pkg:npm/@pagefind/default-ui
Vulnerability advisories affecting package pkg:npm/@pagefind/default-ui. Select an advisory below to view technical details or fixes.
| Advisory ID | CVE / NVD | Severity | Summary |
|---|---|---|---|
| GHSA-gprj-6m2f-j9hx | CVE-2024-45389 | MODERATE | DOM clobbering could escalate to Cross-site Scripting (XSS) |
CVE-2024-45389 at a Glance
Security Impact
CVSS: 6.4
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:H).
How to Fix CVE-2024-45389
To remediate this vulnerability, upgrade all affected Pagefind dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install pagefind@1.1.1
npm install @pagefind/default-ui@1.1.1
npm install @pagefind/modular-ui@1.1.1
Upgrade pagefind to 1.1.1
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls pagefind
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2024-45389, inspect your project dependencies using npm:
npm ls pagefind
Analyze the terminal output to locate any version of Pagefind in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.1.1), your application is affected.
Note: The npm ls pagefind command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where the product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. In Pagefind, 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
CVE-2024-45389 Affected Pagefind Versions
4 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
pagefind
|
npm |
< 1.1.1
|
1.1.1
|
|
@pagefind/default-ui
|
npm |
< 1.1.1
|
1.1.1
|
|
@pagefind/modular-ui
|
npm |
< 1.1.1
|
1.1.1
|
|
pagefind
|
crates.io |
< 1.1.1
|
1.1.1
|
References
Frequently Asked Questions
What is CVE-2024-45389?
Which Pagefind versions are affected?
What version fixes CVE-2024-45389?
Is pagefind affected?
Is @pagefind/default-ui affected?
What is the CVSS score of CVE-2024-45389?
What CWE is associated with CVE-2024-45389?
How can I check npm dependencies for CVE-2024-45389?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-gprj-6m2f-j9hx",
"modified" : "2024-09-12T21:38:09Z",
"published" : "2024-09-03T19:33:36Z",
"aliases" : [ "CVE-2024-45389" ],
"summary" : "DOM clobbering could escalate to Cross-site Scripting (XSS)",
"details" : "Pagefind initializes its dynamic JavaScript and WebAssembly files relative to the location of the first script you load. This information is gathered by looking up the value of `document.currentScript.src`.\n\nIt is possible to \"clobber\" this lookup with otherwise benign HTML on the page, for example:\n```html\n<img name=\"currentScript\" src=\"blob:https://xxx.xxx.xxx/ui.js\"></img>\n```\n\nThis will cause `document.currentScript.src` to resolve as an external domain, which will then be used by Pagefind to load dependencies.\n\nThis exploit would only work in the case that an attacker could inject HTML to your live, hosted, website. In these cases, this would act as a way to escalate the privilege available to an attacker. This assumes they have the ability to add some elements to the page (for example, `img` tags with a `name` attribute), but not others, as adding a `script` to the page would itself be the XSS vector.\n\nPagefind has tightened this resolution by ensuring the source is loaded from a valid script element. There are no reports of this being exploited in the wild via Pagefind.\n\n### Original Report\n\nIf an attacker can inject benign html, such as:\n`<img name=\"currentScript\" src=\"blob:https://xxx.xxx.xxx/ui.js\"></img>`\n\nthey can clobber `document.currentScript.src` leading to XSS in your library.\n\nHere is the same attack on webpack that was accepted: https://github.com/webpack/webpack/security/advisories/GHSA-4vvj-4cpr-p986",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:H"
}, {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:P/PR:L/UI:N/VC:L/VI:L/VA:H/SC:N/SI:N/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "pagefind"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.1.1"
} ]
} ]
}, {
"package" : {
"ecosystem" : "npm",
"name" : "@pagefind/default-ui"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.1.1"
} ]
} ]
}, {
"package" : {
"ecosystem" : "npm",
"name" : "@pagefind/modular-ui"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.1.1"
} ]
} ]
}, {
"package" : {
"ecosystem" : "crates.io",
"name" : "pagefind"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.1.1"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/CloudCannon/pagefind/security/advisories/GHSA-gprj-6m2f-j9hx"
}, {
"type" : "WEB",
"url" : "https://github.com/webpack/webpack/security/advisories/GHSA-4vvj-4cpr-p986"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-45389"
}, {
"type" : "WEB",
"url" : "https://github.com/CloudCannon/pagefind/commit/14ec96864eabaf1d7d809d5da0186a8856261eeb"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/CloudCannon/pagefind"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-79" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2024-09-03T19:33:36Z",
"nvd_published_at" : "2024-09-03T20:15:08Z"
}
}