# CVE-2022-31116: Incorrect handling of invalid surrogate pair characters in ujson

- 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.54%, higher than 85% of CVEs (2026-12-01)
- Public exploit code or proof of concept: one link below, marked "exploit"
- Published: 2022-07-05T17:35:11.000Z
- Modified: 2026-07-07T11:56:38.194Z
- Also known as: GHSA-wpqr-jcpx-745r, PYSEC-2026-1057
- Weaknesses: CWE-670
- SSVC (CISA-ADP): exploitation poc, automatable yes, technical impact partial
- Assigned by: GitHub_M

## Description

UltraJSON is a fast JSON encoder and decoder written in pure C with bindings for Python 3.7+. Affected versions were found to improperly decode certain characters. JSON strings that contain escaped surrogate characters not part of a proper surrogate pair were decoded incorrectly. Besides corrupting strings, this allowed for potential key confusion and value overwriting in dictionaries. All users parsing JSON from untrusted sources are vulnerable. From version 5.4.0, UltraJSON decodes lone surrogates in the same way as the standard library's `json` module does, preserving them in the parsed output. Users are advised to upgrade. There are no known workarounds for this issue.

(As written by CVE List.)

## Affected

- ultrajson ultrajson: < 5.4.0
- ujson (PyPI): before 5.4.0
- ultrajson_project ultrajson: before 5.4.0
- fedoraproject fedora: 35; 36

## 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`
- PyPA Advisory Database: 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`

## References

- <https://github.com/ultrajson/ultrajson/security/advisories/GHSA-wpqr-jcpx-745r> (exploit, third-party-advisory, web)
- <https://github.com/ultrajson/ultrajson/commit/67ec07183342589d602e0fcf7bb1ff3e19272687> (patch, third-party-advisory, web)
- <https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/OPPU5FZP3LCTXYORFH7NHUMYA5X66IA7/> (vendor-advisory)
- <https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/NAU5N4A7EUK2AMUCOLYDD5ARXAJYZBD2/> (vendor-advisory)
- <https://nvd.nist.gov/vuln/detail/CVE-2022-31116> (advisory)
- <https://github.com/ultrajson/ultrajson> (package)
- <https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/NAU5N4A7EUK2AMUCOLYDD5ARXAJYZBD2> (web)
- <https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/OPPU5FZP3LCTXYORFH7NHUMYA5X66IA7> (web)
- <https://pypi.org/project/ujson> (package)
- <https://github.com/advisories/GHSA-wpqr-jcpx-745r> (advisory)

## Sources

- CVE List: [CVE-2022-31116](https://www.cve.org/CVERecord?id=CVE-2022-31116), CVE Terms of Use, modified 2025-04-22
- GitHub Advisory Database: [GHSA-wpqr-jcpx-745r](https://github.com/advisories/GHSA-wpqr-jcpx-745r), CC-BY-4.0, modified 2026-07-07
- NVD: [CVE-2022-31116](https://nvd.nist.gov/vuln/detail/CVE-2022-31116), Public domain, modified 2026-06-17
- PyPA Advisory Database: [PYSEC-2026-1057](https://osv.dev/vulnerability/PYSEC-2026-1057), CC-BY-4.0, modified 2026-07-07

---

Page: https://cve.day/CVE-2022-31116 · Whole record: https://cve.day/CVE-2022-31116.json · Rebuilt by cve.day 2026-11-25T22:58:12.715Z
