CVE-2025-62366
JavaScript vulnerability analysis and mitigation

Overview

A HTML injection vulnerability (CVE-2025-62366) was discovered in mailgen, a Node.js package that generates responsive HTML e-mails for sending transactional mail. The vulnerability affects versions through 2.0.30 and was discovered by Edoardo Ottavianelli. The issue lies in the generatePlaintext method when processing user-generated content, where HTML tags provided as encoded entities bypass the security filters (GitHub Advisory).

Technical details

The vulnerability exists in the generatePlaintext function within index.js, which attempts to strip HTML content to produce plaintext output. The function fails to properly handle encoded HTML tags, as it only searches for and removes unencoded HTML tags. When encoded HTML tags are provided, they bypass the removal process and are later decoded, resulting in active HTML content in the supposed plaintext output. This can lead to successful injection of HTML tags with event handlers, such as img tags with onerror attributes (GitHub Advisory). The vulnerability has been assigned a CVSS 4.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 (NVD).

Impact

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

Mitigation and workarounds

The vulnerability has been fixed in version 2.0.31 and later. No known workarounds exist for affected versions, making it crucial for users to upgrade to the patched version (NVD).

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

GHSA-j44m-5v8f-gc9cHIGH7.7
  • JavaScriptJavaScript
  • flowise
NoYesOct 10, 2025
CVE-2025-11183MEDIUM6.9
  • JavaScriptJavaScript
  • qwc2
NoYesOct 13, 2025
CVE-2025-62374MEDIUM6.4
  • JavaScriptJavaScript
  • parse
NoYesOct 14, 2025
GHSA-fhwm-pc6r-4h2fMEDIUM6.1
  • JavaScriptJavaScript
  • commandkit
NoYesOct 13, 2025
CVE-2025-62366LOW2.9
  • JavaScriptJavaScript
  • mailgen
NoYesOct 14, 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