Proof Portal
jsonparser
ProbeLabs36 findings · 123 requirementsdecodeUnicodeEscape lone-high-surrogate guard reads in[6]/in[7] with a too-small length check — OOB panic
High-severity issue, currently open.
Introduced
When and where this issue first entered the codebase — the commit it traces back to.
Affected requirements
The requirement(s) this issue violates — click through to the spec.
What this means for you
Plain-language impact — what this issue could mean for your users and your system, before any of the technical detail.
A lone high-surrogate escape at the end of attacker-controlled JSON crashes the consuming service (denial of service) rather than decoding to the U+FFFD replacement character. Intentional demo defect on the proof-demo showcase branch; never shipped.
Reachable via any Unescape/ParseString/Get* call on attacker-controlled JSON whose final escape is a lone high surrogate with no room for a trailing low-surrogate escape.
Technical description
decodeUnicodeEscape (escape.go) handles a high surrogate by peeking at the next escape at in[6]/in[7] to test for a `\u` low-surrogate continuation, guarded by a length check. On the proof-demo showcase branch the lone-high-surrogate guard was weakened from `len(in) < 8` to `len(in) < 6` (escape.go:146), so when only six bytes remain the short-circuit no longer protects in[6]/in[7], which are then read past the end of the slice — a CWE-125 Out-of-bounds Read. The Go runtime turns the read into an index-out-of-range panic instead of substituting U+FFFD for the unpaired surrogate. Intentional demo defect on the proof-demo showcase branch; never shipped.
Severity, explained
Why this is rated the way it is — and the scoring signals behind the rating (each ⓘ explains the term).
- why this rating
- Reproducer-confirmed
- risk area
- Availability
- CVSS
- CVSS 7.5· Highv3.1
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H - CVE surface
- Likely
Where it is
The code the issue lives in — peek the affected function inline to see it in context.
- decodeUnicodeEscape
How it's proven
The reproducer — an actual test that drives the real code and shows the issue happening. Run it yourself, or peek the test and the source it covers.
go test -run TestDemoKI8 -count=1 .
Reproduction steps
Technical steps for your engineers to confirm the issue by hand.
- Check out the proof-demo showcase branch and build the package.
- Call jsonparser.GetString on a value ending in `\uD834` — or run: go test -run TestDemoKI8 -count=1 .
- Observe an index-out-of-range panic from decodeUnicodeEscape rather than a clean U+FFFD substitution.
go test -run TestDemoKI8 -count=1 . go test ./... -count=1
How it can be triggered
The input or condition that sets this issue off.
a high-surrogate escape sitting at the very end of the buffer, e.g. {"k":"\uD834"}
What protects you, and the fix
What limits your exposure today, and the planned remediation.
What protects you now
Bound untrusted input and recover around parse calls until the guard is restored; validating that surrogate escapes are well-paired before parsing avoids the boundary read.
The fix
Restore the 8-byte minimum-length check in the lone-high-surrogate branch of decodeUnicodeEscape (escape.go:146, `len(in) < 6` -> `len(in) < 8`) so a high surrogate at end-of-buffer substitutes U+FFFD instead of indexing past the buffer. Closes CWE-125 Out-of-bounds Read; cf. RFC 8259 section 7 on unpaired surrogates.
Blast radius
If you touch this issue, what else may need re-checking — the requirements it affects and the code and tests that hang off them.
These requirements have no implementing code to trace into — that absence is itself the risk. The graph shows the finding and the requirements it affects, but there is no code path to follow. (Tests may exist; without implementing code there is still nothing to trace into.)
Per-requirement evidence
For each requirement this finding touches: the implementing code, verifying tests, and proof obligations that discharge it.
Per-requirement evidence
For each requirement this finding touches: the implementing code, verifying tests, and proof obligations that discharge it.
Evidence trail
The raw evidence manifests behind this finding — superseded by the resolved reproducer above, kept here for traceability.
Evidence trail
The raw evidence manifests behind this finding — superseded by the resolved reproducer above, kept here for traceability.
- proof/evidence/KI-8-reproducer.yaml
Discussions
Discuss this with the proof team. Nothing changes in your audit automatically — you open a request and a staff member records any outcome inside the thread.