LiveActive security incident?Get immediate response
CVE Record

CVE-2021-39157: Improper Handling of Exceptional Conditions in detect-character-encoding

detect-character-encoding is an open source character encoding inspection library. In detect-character-encoding v0.6.0 and earlier, data matching no charset causes the Node.js process to crash. The problem has been patched in [detect-character-encoding v0.7.0](https://github.com/sonicdoe/detect-character-encoding/releases/tag/v0.7.0). No workaround are available and all users should update to resolve this issue.

HighCVSS 7.5Not KEV-listedUpdated
Glexia's TakeAutomated analysishigh

Security readout for executives and security teams

Plain-English summary

Applications using detect-character-encoding before 0.7.0 can be crashed by data the library cannot classify. The impact is denial of service, not data theft or code execution based on the supplied sources. Internet-facing services that analyze user-supplied files should treat this as urgent.

Executive priority

High priority for any service that parses user-controlled content because a crash can interrupt availability. The fix path is straightforward: update the dependency. There is no sourced evidence of data compromise or active exploitation.

Technical view

CVE-2021-39157 is CWE-755 in sonicdoe/detect-character-encoding. Versions 0.6.0 and earlier, reported as <0.7.0, mishandle exceptional input where no charset matches, causing the Node.js process to crash. CVSS 3.1 is 7.5 with unauthenticated availability impact only. Fixed in v0.7.0.

Likely exposure

Exposure exists where Node.js applications directly or transitively depend on detect-character-encoding <0.7.0 and process untrusted or externally supplied content. The bundle does not identify specific downstream products.

Exploitation context

The provided sources describe a crash condition and do not show active exploitation. CISA KEV status is false in the bundle. Treat exploitation as plausible for exposed parsing paths, but not confirmed as observed in the wild.

Researcher notes

The advisory links the fault to unmatched charset handling and the fix commit. Sources do not provide broader ecosystem impact or exploitation telemetry. Validate real exposure by dependency resolution and whether attacker-controlled content reaches this library.

Mitigation direction

  • Upgrade detect-character-encoding to v0.7.0 or later.
  • Regenerate lockfiles so vulnerable transitive copies are removed.
  • Redeploy affected Node.js services after dependency updates.
  • If upgrade timing is constrained, consult vendor guidance; no workaround is named.
  • Prioritize services processing uploads, email, archives, or external text content.

Validation and detection

  • Check package manifests and lockfiles for detect-character-encoding versions below 0.7.0.
  • Inspect SBOM and dependency scan results for transitive vulnerable copies.
  • Confirm production builds resolve to detect-character-encoding 0.7.0 or later.
  • Review logs for unexplained Node.js process crashes in content-processing paths.
  • Run the project’s normal regression tests after updating dependencies.
Prepared
Confidence
high
Sources
5

Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.

Potential ATT&CK relevance

Conservative CVE-to-ATT&CK context

These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.

ATT&CK lookup starting points

Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.

cwe · low confidence lookup

CWE-755: Exact CWE lookup

Use the exact CWE identifier as the starting point before reviewing related ATT&CK behavior. Open the exact CWE lookup page first, then review the ATT&CK searches from that MITRE weakness context. This is a Glexia lookup hint, not an official ATT&CK mapping.

Open ATT&CK lookup
cve · low confidence lookup

CVE-2021-39157 mapping review

Open the CVE-to-ATT&CK bridge for reviewed, inferred, or future official mappings tied to this CVE.

Open ATT&CK lookup
Vulnerability profileCVE Program record
Severity
High
CVSS
7.5 (3.1)
Known Exploited
No
Published

Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

Official CVE source material

CNA and ADP enrichment extracted from CVE v5

These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.

1CVSS vectors
0Timeline events
0ADP providers
4Source links

CVSS vector scores

1 official score

We collect every scored CVSS vector available in the official CNA and ADP containers. When more than one version is present, the table keeps the source vectors side by side instead of collapsing them into the highest score.

ScoreVersionSeverityVectorExploitImpactSource
7.5CVSS 3.1HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H3.93.6Primary CVE score

Vulnerability scoring details

Base CVSS 3.1 score

7.5High
CVSS 3.1 vector shape for CVE-2021-39157Attack VectorAttack ComplexityPrivileges RequiredUser InteractionScopeConfidentiality ImpactIntegrity ImpactAvailability Impact

Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

Attack Vector
NetworkAdjacentLocalPhysical
Attack Complexity
LowHigh
Privileges Required
NoneLowHigh
User Interaction
NoneRequired
Scope
ChangedUnchanged
Confidentiality Impact
HighLowNone
Integrity Impact
HighLowNone
Availability Impact
HighLowNone
Affected products

Products and packages named in the record

VendorProductVersion / packageStatus
sonicdoedetect-character-encoding< 0.7.0Listed
Weakness

CWE details

CWE links open Glexia weakness intelligence pages with official CWE context, developer remediation guidance, and related CVE mappings.

CWE-755 · source CWE mapping

Improper Handling of Exceptional Conditions

Improper Handling of Exceptional Conditions represents a recurring weakness pattern that can create exploitable paths when design, validation, or implementation controls are missing.