Mailgen vulnerable to HTML injection and cross-site scripting via plaintext email generation
Key facts
- Attack vector
- Network
- Privileges required
- None
- User interaction
- None
- Attack complexity
- Low
- Attack requirements
- Present
- Impact type
- Cross-site scripting
- Confidentiality · integrity · availability
- None · None · None
- Fix status
- Fixed
Attack profile from CVSS 4.0 · CNA. Fix status from CNA and GitHub. Impact type from CWE-79.
Summary
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.
Why it matters now
SSVC decision points
CISA ADP · SSVC 2.0.3
- Exploitation
- Poc
- Automatable
- No
- Technical impact
- Partial
The decision (Track, Attend, Act) also depends on your mission and well-being impact; see CISA's SSVC guide.
Affected products
| Vendor | Product | Affected versions | Fixed in | Status | Source |
|---|---|---|---|---|---|
| eladnava | mailgen | before 2.0.31 | 2.0.31 | Patch available | CNA |
| — | mailgen (npm) | before 2.0.31 | 2.0.31 | Patch available | GHSA-xw6r-chmh-vpmj |
- mailgen Vendoreladnava Affected before 2.0.31 Fixed in 2.0.31 Patch available CNA
- mailgen (npm) Vendor— Affected before 2.0.31 Fixed in 2.0.31 Patch available GHSA-xw6r-chmh-vpmj
Remediation
- Fix · CNA mailgen (eladnava) Fixed in 2.0.31
- Fix · GHSA-xw6r-chmh-vpmj mailgen (npm) Fixed in 2.0.31 Advisory →
Timeline
- 2026-10-02 Threatist record created from CVE-2025-62366
- 2026-10-03 Alias added: GHSA-xw6r-chmh-vpmj
References
More eladnava vulnerabilities
- TI-2025-38647 Mailgen has HTML Injection and XSS Filter Bypass in Plaintext Emails CVSS 4.0LOW 2.9
- TI-2025-37057 Mailgen: HTML injection vulnerability in plaintext e-mails CVSS 4.0LOW 2.7
Sources
- CVE-2025-62366 · CVE Program
- CVE-2025-62366 · NVD
- FIRST EPSS
- GHSA-xw6r-chmh-vpmj · GitHub Advisory Database · CC BY 4.0
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences