Quick answers
- Is CVE-2025-59526 exploited in the wild?
- No. Junglewise Threat Intelligence has no report of CVE-2025-59526 being exploited in the wild.
- How severe is CVE-2025-59526?
- Low severity, with a CVSS score of 3.1, published 22 September 2025.
- Which products and versions are affected?
- mailgen (npm) SEMVER:introduced=0,fixed=2.0.30.
- Is there a fix for CVE-2025-59526?
- Yes. mailgen (npm): upgrade to 2.0.30 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
- How is CVE-2025-59526 attacked?
- It is attacked over the network.
- Am I affected by CVE-2025-59526?
- Check whether you run mailgen (npm) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.
How to fix
- mailgen (npm): upgrade to 2.0.30 or later
npm install mailgen@2.0.30
Technical details
The vulnerability is an HTML injection flaw in the generatePlaintext() function caused by incorrect filter ordering. The code first converts HTML break tags to newlines, then attempts to strip all HTML tags with a regex. By nesting an HTML tag inside a break tag (e.g., <img<br> src=xyz onerror=alert(1)>), attackers can bypass the HTML tag removal regex. The vulnerability requires the application to pass user-generated content directly to generatePlaintext() without prior sanitization. An attacker can inject JavaScript payloads that execute in email clients supporting HTML rendering. The issue was patched in version 2.0.30 (commit 741a019).
Affected products
- Mailgen Mailgen < 2.0.30
Identifiers
- CVE-2025-59526
- GHSA-j2xj-h7w5-r7vp
Timeline
- 2025-09-22: disclosed
- 2025-09-22: patched: Version 2.0.30 released to npm