CVE-2022-31116
Incorrect handling of invalid surrogate pair characters in ujson
Reported by github_m · Published July 5, 2022
ujson is fixed in 5.4.0 (PyPI)
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.
Fixed versions
Upgrade to a fixed version or later. Language registries are listed first, then Linux distributions, then vendor products.
| Package | Ecosystem | Fixed in |
|---|---|---|
| ujson | PyPI | 5.4.0 |
| ultrajson | ultrajson_project | 5.4.0 |
Risk scores
Affected products
| Vendor | Product | Versions |
|---|---|---|
| ultrajson | ultrajson | < 5.4.0 |
| PyPI | ujson | 0 |
| alpine | py3-ujson | 0 |
| ultrajson | ultrajson | 0 |
Timeline
- Jul 5, 2022 CVE Published
- Jul 5, 2022 PoC Published
- Jul 6, 2022 EPSS Score (30 in total, the first dated here)
- Mar 9, 2026 Security Advisory (20 in total, the first dated here)
- Mar 20, 2026 Distribution Patch (17 in total, the first dated here)
- Jun 25, 2026 Coalition ESS Score
Query this with the API
The same record, from the CLI:
vulnetix vdb vuln CVE-2022-31116
vulnetix vdb fixes CVE-2022-31116
Or with curl, using the org id and key from your account page:
curl -s -H "Authorization: ApiKey ${VULNETIX_ORG_ID}:${VULNETIX_API_KEY}" \
"https://api.vdb.vulnetix.com/v2/vuln/CVE-2022-31116/fixes/registry"
The Community plan is free and allows 50 queries a day. Get a free API key · API quickstart
References
- x_refsource_CONFIRM
- x_refsource_MISC
- FEDORA-2022-1b2b8d5177 vendor-advisoryx_refsource_FEDORA
- FEDORA-2022-33e816bc37 vendor-advisoryx_refsource_FEDORA
- https://nvd.nist.gov/vuln/detail/CVE-2022-31116 advisory
- https://github.com/advisories/GHSA-wpqr-jcpx-745r advisory