CVE-2025-62366 Mailgen vulnerable to HTML injection and cross-site scripting via plaintext email generation
- Published
- Updated
- Exploit status
- No public exploit known
- CISA SSVC
- Proof of concept public · automatable: no · technical impact: partial
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.
Upgrade path
2 packages: 1 fixed.
| Package | Affected | Fixed in | Status |
|---|---|---|---|
| npm mailgen(npm) | < 2.0.31; <= 2.0.30 | 2.0.31 | Fixed |
| eladnava mailgen | = < 2.0.31 | No fix listed | Versions listed |
Affected products
| Product | Affected versions | Fixed in |
|---|---|---|
| npm mailgen(npm) | <= 2.0.30 | No fix listed |
| eladnava mailgen | = < 2.0.31 | No fix listed |
| npm mailgen(npm) | < 2.0.31 | 2.0.31 |
References
- https://github.com/eladnava/mailgen/security/advisories/GHSA-xw6r-chmh-vpmj vendor-advisory
- nvd.nist.gov third-party-advisory vendor-advisory
- https://github.com/eladnava/mailgen/commit/7279a983481d05c51aa451e86146f98aaa42fee9 patch
- github.com
- github.com product