CVE-2025-59526 Mailgen: HTML injection vulnerability in plaintext e-mails

Low 2.7 Published Updated

Attacker can inject HTML into plaintext emails via user input, potentially leading to XSS or data theft in applications using Mailgen.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2025-59526?

CVE-2025-59526 is a low-severity cross-site scripting vulnerability in eladnava mailgen, published on 22 Sep 2025. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

mailgen is a Node.js package that generates responsive HTML e-mails for sending transactional mail. Prior to version 2.0.30, there is an HTML injection vulnerability in plaintext e-mails generated by Mailgen. Projects are affected if the Mailgen.generatePlaintext(email) method is used and given user-generated content. This vulnerability has been patched in version 2.0.30. A workaround involves stripping all HTML tags before passing any content into Mailgen.generatePlaintext(email).

Weakness: CWE-79

Which versions are affected by CVE-2025-59526?

2 open source packages ship an affected version, including mailgen.

PackageAffectedFixed in
mailgen npmAll versions2.0.30
mailgen npmAll versions2.0.30

How do I fix CVE-2025-59526?

Upgrade mailgen to 2.0.30 or later.

Escape output for the context it lands in and set a strict Content Security Policy. Upgrading the affected component is the real fix. More about Cross-site scripting.

Is CVE-2025-59526 being exploited?

There is no known exploitation of CVE-2025-59526 in the wild and no public exploit code.

Sources

Also known as GHSA-j2xj-h7w5-r7vp.

Is CVE-2025-59526 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free