Skip to content
Heist/ feed
Back to feed
Low

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

Type: advisorySources: OSV

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.

Products
Not specified
Affected versions
Not specified
Fixed versions
Not specified
CVEs
CVE-2025-62366
Confirmed fixed CVEs
Not specified
Updated in this feed
7 Nov 2026, 03:53 UTC · Revision 1

Source evidence

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

core-osv · Original source

Published 14 Oct 2025, 15:23 UTC

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.

osv:CVE-2025-62366
Complete source record
{
  "id": "67ccd78f67a3c28f8f2b396ddbefe7dd39b9b981345ccc74991d6a2e1bb2d324",
  "url": "https://osv.dev/vulnerability/CVE-2025-62366",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "Mailgen vulnerable to HTML injection and cross-site scripting via plaintext email generation",
    "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.",
    "evidence": "osv:CVE-2025-62366",
    "products": [],
    "severity": "low",
    "structured": {
      "id": "CVE-2025-62366",
      "aliases": [
        "CVE-2025-62366",
        "GHSA-xw6r-chmh-vpmj"
      ],
      "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": "7279a983481d05c51aa451e86146f98aaa42fee9"
                }
              ],
              "database_specific": {
                "extracted_events": [
                  {
                    "range": [
                      {
                        "fixed": "7279a983481d05c51aa451e86146f98aaa42fee9"
                      }
                    ],
                    "source": "REFERENCES_COMMIT"
                  }
                ]
              }
            }
          ],
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2025-62366.json"
          }
        }
      ],
      "modified": "2026-10-28T02:30:49.616243607Z",
      "provider": "osv",
      "references": [
        "https://github.com/CVEProject/cvelistV5/tree/main/cves/2025/62xxx/CVE-2025-62366.json",
        "https://github.com/eladnava/mailgen/security/advisories/GHSA-xw6r-chmh-vpmj",
        "https://nvd.nist.gov/vuln/detail/CVE-2025-62366",
        "https://github.com/eladnava/mailgen/commit/7279a983481d05c51aa451e86146f98aaa42fee9"
      ],
      "provider_metadata": {
        "cwe_ids": [
          "CWE-79"
        ],
        "cna_assigner": "GitHub_M",
        "unresolved_ranges": [
          {
            "extracted_events": [
              {
                "range": [
                  {
                    "fixed": "2.0.31"
                  }
                ],
                "source": "AFFECTED_FIELD",
                "strategy": "StringRangeExpression"
              }
            ]
          },
          {
            "extracted_events": [
              {
                "range": [
                  {
                    "last_affected": "2.0.30"
                  }
                ],
                "source": "DESCRIPTION"
              }
            ]
          }
        ],
        "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2025/62xxx/CVE-2025-62366.json"
      }
    },
    "related_cves": [
      {
        "value": "CVE-2025-62366",
        "evidence": "/id"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/severity/0/score"
  },
  "source_id": "core-osv",
  "document_id": 517911,
  "published_at": "2025-10-14T15:23:47.6+00:00"
}