Improper Control of Resources Affecting detect-character-encoding package, versions <0.3.1


Severity

Recommended
0.0
high
0
10

CVSS assessment made by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of concept
EPSS
0.32% (71st percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about Improper Control of Resources vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-JS-DETECTCHARACTERENCODING-1579267
  • published1 Sept 2021
  • disclosed1 Sept 2021
  • creditUnknown

Introduced: 1 Sep 2021

CVE-2021-39176  (opens in a new tab)
CWE-401  (opens in a new tab)

How to fix?

Upgrade detect-character-encoding to version 0.3.1 or higher.

Overview

detect-character-encoding is a Detect character encoding using ICU.

Affected versions of this package are vulnerable to Improper Control of Resources. Missing closure of charsetDetector leads to a memory leak.

PoC

const express = require("express");
const detectCharacterEncoding = require("detect-character-encoding");

const app = express();

app.get("/", (req, res) => {
  detectCharacterEncoding(Buffer.from("somewhere"));
  res.end();
});

app.listen(3000);

CVSS Scores

version 3.1