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

- Severity: High 7.5 (CVSS:3.1, scored by GitHub_M) `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 2.07%, higher than 81% of CVEs (2026-12-01)
- Public exploit code or proof of concept: 2 links below, marked "exploit"
- Published: 2021-08-24T18:15:11.000Z
- Modified: 2026-07-08T06:29:33.959Z
- Also known as: GHSA-jqfh-8hw5-fqjr
- Weaknesses: CWE-755
- Assigned by: GitHub_M

## 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.

(As written by CVE List.)

## Affected

- sonicdoe detect-character-encoding: < 0.7.0
- detect-character-encoding (npm): before 0.7.0
- detect-character-encoding_project detect-character-encoding: before 0.7.0

## Every score

- GitHub_M: CVSS:3.1 7.5 High `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H`
- GitHub: CVSS:3.1 7.5 High `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H`
- NVD: CVSS:3.1 7.5 High `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H`
- NVD: CVSS:2.0 5.0 Medium `AV:N/AC:L/Au:N/C:N/I:N/A:P`

## References

- <https://github.com/sonicdoe/detect-character-encoding/security/advisories/GHSA-jqfh-8hw5-fqjr> (exploit, third-party-advisory, web)
- <https://github.com/sonicdoe/detect-character-encoding/issues/15> (exploit, third-party-advisory, web)
- <https://github.com/sonicdoe/detect-character-encoding/commit/992a11007fff6cfd40b952150ab8d30410c4a20a> (patch, third-party-advisory, web)
- <https://nvd.nist.gov/vuln/detail/CVE-2021-39157> (advisory)
- <https://github.com/sonicdoe/detect-character-encoding> (package)
- <https://github.com/sonicdoe/detect-character-encoding/releases/tag/v0.7.0> (web)

## Sources

- CVE List: [CVE-2021-39157](https://www.cve.org/CVERecord?id=CVE-2021-39157), CVE Terms of Use, modified 2024-08-04
- GitHub Advisory Database: [GHSA-jqfh-8hw5-fqjr](https://github.com/advisories/GHSA-jqfh-8hw5-fqjr), CC-BY-4.0, modified 2026-07-08
- NVD: [CVE-2021-39157](https://nvd.nist.gov/vuln/detail/CVE-2021-39157), Public domain, modified 2026-06-17

---

Page: https://cve.day/CVE-2021-39157 · Whole record: https://cve.day/CVE-2021-39157.json · Rebuilt by cve.day 2026-11-25T22:58:03.481Z
