CVE-2021-39176
JavaScript vulnerability analysis and mitigation

Overview

detect-character-encoding is a package for detecting character encoding using ICU. In versions 0.3.0 and earlier, a memory leak vulnerability was identified where allocated memory was not properly released. This vulnerability was assigned CVE-2021-39176 and was discovered in August 2021. The vulnerability affects all versions of detect-character-encoding up to and including version 0.3.0 (GitHub Advisory).

Technical details

The vulnerability stems from a failure to properly close the charsetDetector after its creation and use. According to ICU documentation, failure to close a charset detector when finished can result in memory leaks in the application. The issue was specifically related to the missing call to ucsdet_close() function, which is required to release storage and other resources owned by the charset detector (GitHub Commit). The vulnerability received a CVSS v3.1 base score of 7.5 (High) and temporal score of 7.2 (High) (GitHub Advisory).

Impact

When the vulnerable code is implemented in a program accessible over the internet, it can lead to memory leaks that eventually cause the application to become unavailable. The vulnerability primarily affects the availability of the system, with no direct impact on confidentiality or integrity. A proof of concept demonstrated that making repeated requests to an endpoint using the vulnerable package causes the Node.js process to consume increasingly more memory (GitHub Advisory).

Mitigation and workarounds

The vulnerability has been patched in detect-character-encoding version 0.3.1. The fix involves properly closing the charsetDetector by adding calls to ucsdet_close() at appropriate points in the code (GitHub PR). Users should upgrade to version 0.3.1 or later to address this vulnerability.

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-66456CRITICAL9.1
  • JavaScriptJavaScript
  • elysia
NoYesDec 09, 2025
CVE-2025-66457HIGH7.5
  • JavaScriptJavaScript
  • elysia
NoYesDec 09, 2025
CVE-2025-65849MEDIUM6.9
  • JavaScriptJavaScript
  • altcha
NoNoDec 08, 2025
CVE-2025-66202MEDIUM6.5
  • JavaScriptJavaScript
  • astro
NoYesDec 09, 2025
CVE-2025-14284MEDIUM5.1
  • JavaScriptJavaScript
  • @tiptap/extension-link
NoYesDec 09, 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