# CVE-2024-43370: gettext.js vulnerable to cross-site scripting (XSS)

> An attacker can execute arbitrary scripts in the browser if gettext.js processes corrupted .po dictionary files, affecting applications using this library.

- **Severity:** High 7.2 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:L/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 15 Aug 2024
- **Updated:** 16 Aug 2024
- **Also known as:** DEBIAN-CVE-2024-43370, GHSA-vwhg-jwr4-vxgg, UBUNTU-CVE-2024-43370

## What is CVE-2024-43370?

CVE-2024-43370 is a high-severity cross-site scripting vulnerability in guillaumepotier gettext.js, published on 15 Aug 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

gettext.js is a GNU gettext port for node and the browser. There is a cross-site scripting (XSS) injection if `.po` dictionary definition files are corrupted. This vulnerability has been patched in version 2.0.3. As a workaround, control the origin of the definition catalog to prevent the use of this flaw in the definition of plural forms.

Weakness: CWE-79 (Improper Neutralization of Input During Web Page Generation)

## Which versions are affected by CVE-2024-43370?

2 open source packages ship an affected version, including gettext.js.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `gettext.js` | npm | All versions | 2.0.3 |
| `gettext.js` | npm | All versions | 2.0.3 |

## How do I fix CVE-2024-43370?

Upgrade gettext.js to 2.0.3 or later.

## Is CVE-2024-43370 being exploited?

There is no known exploitation of CVE-2024-43370 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2024-43370 and fix it if it is affected.

What it is: CVE-2024-43370 is a high-severity cross-site scripting vulnerability in guillaumepotier gettext.js, published on 15 Aug 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2024-43370 in the wild and no public exploit code.

Affected packages and fixed versions:
- gettext.js (npm): affected all versions; fixed in 2.0.3
- gettext.js (npm): affected all versions; fixed in 2.0.3

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2024-43370/ (Markdown: https://insights.sbomify.com/CVE-2024-43370/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2024-43370
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2024-43370
- OSV: https://osv.dev/vulnerability/CVE-2024-43370

---
From sbomify Insights: https://insights.sbomify.com/CVE-2024-43370/
Summaries are generated and may contain mistakes; the official description above is the record.
