CVE Catalog

CVE-2025-62366

LowCVSS 2.9
Published: Updated: Translated: NVD NIST

Exploitation Probability (EPSS)

Low risk
0.43%

35th percentile - higher than 35% of all known CVEs

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.

Risk Assessment

HTML injection can lead to execution of malicious JavaScript in the recipient's browser, potentially stealing session data or other attacks. This may harm reputation and user security.

Recommendation

Update mailgen to version 2.0.31 or later. Avoid rendering the generated plaintext as HTML without additional sanitization.

Other vulnerabilities in mailgen

Original NVD description (English source)

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.

Vulnerability data from NVD (NIST) · CISA KEV · EPSS