CVE-2025-62366
JavaScript vulnerability analysis and mitigation

Overview

Mailgen, a Node.js package for generating responsive HTML emails, was found to contain an HTML injection vulnerability (CVE-2025-62366) affecting versions through 2.0.30. The vulnerability exists in the generatePlaintext method when processing user-generated content. The issue was discovered and reported by Edoardo Ottavianelli (@edoardottt) and was disclosed on October 14, 2025 (GitHub Advisory).

Technical details

The vulnerability stems from a logical flaw in the Mailgen.prototype.generatePlaintext function where HTML tags are stripped before HTML entities are decoded. When HTML tags are provided as encoded entities, they bypass the initial stripping process and are later decoded into active HTML content. For example, a payload like '<img src=xyz onerror=alert(1)>' can bypass the security measures. The vulnerability has been assigned a CVSS v4.0 score of 2.9 (LOW) with the vector string 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 and is classified as CWE-79 (Cross-site Scripting) (NVD, GitHub Advisory).

Impact

When the plaintext message is rendered in contexts that interpret HTML, the vulnerability can lead to arbitrary JavaScript code execution in the victim's browser. This could potentially result in the theft of sensitive information or secrets contained within the email message (GitHub Advisory).

Mitigation and workarounds

The vulnerability has been patched in version 2.0.31 of Mailgen. The fix involves reversing the order of operations in the generatePlaintext function, first decoding HTML entities and then stripping HTML tags. No known workarounds exist for affected versions, and users are advised to upgrade to version 2.0.31 or later (GitHub Advisory).

Additional resources


SourceThis report was generated using AI

Related JavaScript vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2025-67731HIGH8.7
  • JavaScriptJavaScript
  • servify-express
NoYesDec 12, 2025
CVE-2025-67718HIGH8.7
  • JavaScriptJavaScript
  • formio
NoYesDec 11, 2025
CVE-2025-8083HIGH8.6
  • JavaScriptJavaScript
  • vuetify
NoYesDec 12, 2025
CVE-2025-67750HIGH8.4
  • JavaScriptJavaScript
  • lightning-flow-scanner
NoYesDec 12, 2025
CVE-2025-8082MEDIUM6.3
  • JavaScriptJavaScript
  • vuetify
NoYesDec 12, 2025

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management