Skip to content

CVE-2025-62366 Mailgen vulnerable to HTML injection and cross-site scripting via plaintext email generation

LowCVSS 2.9 EPSS 0.43%
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.

PackageAffectedFixed inStatus
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

ProductAffected versionsFixed 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