CVEfocus › CVE database › CVE-2024-45389

CVE-2024-45389Pagefind DOM clobbering could escalate to Cross-site Scripting (XSS)

CVSS 6.4 MediumEPSS 0.7% (higher than 48% of CVEs)Published 2024-09-03Updated 2024-09-03Assigner: GitHub_M

Pagefind, a fully static search library, initializes its dynamic JavaScript and WebAssembly files relative to the location of the first script the user loads. This information is gathered by looking up the value of `document.currentScript.src`. Prior to Pagefind version 1.1.1, it is possible to "clobber" this lookup with otherwise benign HTML on the page. This will cause `document.currentScript.src` to resolve as an external domain, which will then be used by Pagefind to load dependencies. This exploit would only work in the case that an attacker could inject HTML to a 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 cross-site scripting vector. Pagefind has tightened this resolution in version 1.1.1 by ensuring the source is loaded from a valid script element. There are no reports of this being exploited in the wild via Pagefind.

CWE-79

What to do

Fixed builds are available from crates.io, npm: see the table below for the fixed version per release.

Is your server affected? One read-only command checks every installed package against this CVE and all others, using each vendor's fixed versions. Get started or get a free API key.

curl -sS "https://api.cvefocus.com/v1/check?format=text" -H "Authorization: Bearer $CVEFOCUS_KEY" \
  -H "Content-Type: text/plain" --data-binary @inventory.txt

Vendor status at a glance

5Fixed

Status by vendor and release

From each vendor's own security data and VEX statements. "Fixed" means a fixed build is published for that release.

ReleasePackageStatusFixed versionAdvisory
npm library@pagefind/default-uiFixed1.1.1GHSA-gprj-6m2f-j9hx
npm library@pagefind/modular-uiFixed1.1.1GHSA-gprj-6m2f-j9hx
crates.io librarypagefindFixed1.1.1GHSA-gprj-6m2f-j9hx
npm librarypagefindFixed1.1.1GHSA-gprj-6m2f-j9hx
npm librarywebpackFixed5.94.0GHSA-4vvj-4cpr-p986

What the vendor says

As published in the CVE record by GitHub_M, the CVE's assigner (usually the vendor). Check the vendor's advisory before acting.

References

About this page

Compiled by CVEfocus from the CVE List, the security data and VEX statements of Ubuntu, Debian, Red Hat, AlmaLinux, Rocky Linux and Microsoft, CISA's Known Exploited Vulnerabilities catalog and FIRST EPSS, refreshed several times a day (data status). Information only; see the disclaimer. Official record: cve.org · NVD.