Mailgen has HTML Injection and XSS Filter Bypass in Plaintext Emails
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.
- Products
- Not specified
- Affected versions
- Not specified
- Fixed versions
- Not specified
- CVEs
- CVE-2025-62380
- Confirmed fixed CVEs
- Not specified
- Updated in this feed
- 3 Nov 2026, 07:17 UTC · Revision 1
Source evidence
Mailgen has HTML Injection and XSS Filter Bypass in Plaintext Emails
core-osv · Original sourcePublished 15 Oct 2025, 16:52 UTC
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.
osv:CVE-2025-62380
Complete source record
{
"id": "7ad670b560acf6373a167184329ffe9edd6c998123420d372fb7ba67ec2b0aca",
"url": "https://osv.dev/vulnerability/CVE-2025-62380",
"method": "structured",
"payload": {
"kind": "advisory",
"title": "Mailgen has HTML Injection and XSS Filter Bypass in Plaintext Emails",
"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.",
"evidence": "osv:CVE-2025-62380",
"products": [],
"severity": "low",
"structured": {
"id": "CVE-2025-62380",
"aliases": [
"CVE-2025-62380",
"GHSA-q4w9-x3rv-4c8j"
],
"metrics": [
{
"type": "CVSS_V4",
"score": "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:P"
}
],
"affected": [
{
"ranges": [
{
"repo": "https://github.com/eladnava/mailgen",
"type": "GIT",
"events": [
{
"introduced": "0"
},
{
"fixed": "7a791a424ff3a3f7783f8750919f1e98639924a8"
}
],
"database_specific": {
"extracted_events": [
{
"range": [
{
"fixed": "7a791a424ff3a3f7783f8750919f1e98639924a8"
}
],
"source": "REFERENCES_COMMIT"
}
]
}
}
],
"database_specific": {
"source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2025-62380.json"
}
}
],
"modified": "2026-10-28T02:30:26.841592644Z",
"provider": "osv",
"references": [
"https://github.com/CVEProject/cvelistV5/tree/main/cves/2025/62xxx/CVE-2025-62380.json",
"https://github.com/eladnava/mailgen/security/advisories/GHSA-q4w9-x3rv-4c8j",
"https://nvd.nist.gov/vuln/detail/CVE-2025-62380",
"https://github.com/eladnava/mailgen/commit/7a791a424ff3a3f7783f8750919f1e98639924a8"
],
"provider_metadata": {
"cwe_ids": [
"CWE-79"
],
"cna_assigner": "GitHub_M",
"unresolved_ranges": [
{
"extracted_events": [
{
"range": [
{
"fixed": "2.0.32"
}
],
"source": "AFFECTED_FIELD",
"strategy": "StringRangeExpression"
}
]
},
{
"extracted_events": [
{
"range": [
{
"last_affected": "2.0.31"
}
],
"source": "DESCRIPTION"
}
]
}
],
"osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2025/62xxx/CVE-2025-62380.json"
}
},
"related_cves": [
{
"value": "CVE-2025-62380",
"evidence": "/id"
}
],
"security_relevant": true,
"severity_evidence": "/severity/0/score"
},
"source_id": "core-osv",
"document_id": 493332,
"published_at": "2025-10-15T16:52:39.407+00:00"
}