Mailgen has HTML Injection and XSS Filter Bypass in Plaintext Emails
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.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.
Why it matters now
SSVC decision points
CISA ADP · SSVC 2.0.3
- Exploitation
- Poc
- Automatable
- Yes
- 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.32 | 2.0.32 | Patch available | CNA |
| — | mailgen (npm) | before 2.0.32 | 2.0.32 | Patch available | GHSA-q4w9-x3rv-4c8j |
- mailgen Vendoreladnava Affected before 2.0.32 Fixed in 2.0.32 Patch available CNA
- mailgen (npm) Vendor— Affected before 2.0.32 Fixed in 2.0.32 Patch available GHSA-q4w9-x3rv-4c8j
Remediation
- Fix · CNA mailgen (eladnava) Fixed in 2.0.32
- Fix · GHSA-q4w9-x3rv-4c8j mailgen (npm) Fixed in 2.0.32 Advisory →
Timeline
- 2026-10-02 Threatist record created from CVE-2025-62380
- 2026-10-03 Alias added: GHSA-q4w9-x3rv-4c8j
References
More eladnava vulnerabilities
- TI-2025-38634 Mailgen vulnerable to HTML injection and cross-site scripting via plaintext email generation CVSS 4.0LOW 2.9
- TI-2025-37057 Mailgen: HTML injection vulnerability in plaintext e-mails CVSS 4.0LOW 2.7
Sources
- CVE-2025-62380 · CVE Program
- CVE-2025-62380 · NVD
- FIRST EPSS
- GHSA-q4w9-x3rv-4c8j · 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