CVE-2025-62366
Mailgen vulnerable to HTML injection and cross-site scripting via plaintext email generation
Also known as GHSA-xw6r-chmh-vpmj
Mitigation
- Upgrade mailgen to 2.0.31 or later.
Who should check
- Projects that depend on npm package mailgen (< 2.0.31)
- Anyone running eladnava mailgen < 2.0.31
Vulnerability facts
- Affected
- mailgen < 2.0.31
- Fixed in
- 2.0.31
- Exploited in the wild
- Not in CISA KEV
- Public exploit / PoC
- None known
- Remote exploitation
- Remote, no login needed
- CVSS
- 2.9 (v4.0, CNA)CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N/E:POpen in CVSS calculator
Show all 12 CVSS metrics
- Attack vector: Network
- Attack complexity: Low
- Attack requirements: Present
- Privileges required: None
- User interaction: None
- Confidentiality impact: None
- Integrity impact: None
- Availability impact: None
- Confidentiality impact on other systems: Low
- Integrity impact on other systems: Low
- Availability impact on other systems: None
- Exploit maturity: Proof of concept
- EPSS
- 0.75% chance of exploitation in 30 days (percentile 51, 2026-11-26)
- CWE
- CWE-79
- Modified
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.
Affected and fixed versions
Check your systems with an agent
Paste this into Claude Code, Cursor or another coding agent. It only reads; it changes nothing.
Check whether anything I run is affected by CVE-2025-62366. Work read-only: do not install, upgrade, delete or change anything. Details: https://flawdb.com/CVE-2025-62366.md Affected: mailgen < 2.0.31 Fixed in: 2.0.31 Steps: 1. Search this machine and project for mailgen (npm), eladnava mailgen: dependency manifests and lockfiles, installed packages, container images and running services. 2. For each match, note the installed version and whether it is inside the affected range. 3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
References
Vendor advisories
FAQ
Is CVE-2025-62366 being exploited?
There is no confirmed exploitation: CVE-2025-62366 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.75% chance of exploitation in the next 30 days (as of 2026-11-26).
How serious is CVE-2025-62366?
Low: CVSS 2.9 (v4.0, scored by CNA). Remote, no login needed.
Which versions are affected by CVE-2025-62366?
mailgen < 2.0.31.
Is there a fix for CVE-2025-62366?
Yes. Fixed in 2.0.31. Upgrade mailgen to 2.0.31 or later.
How do I check if I'm affected by CVE-2025-62366?
Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.