Proof Portal
jsonparser
ProbeLabs36 findings · 123 requirementsdecodeSingleUnicodeEscape length guard too small — OOB read + panic on a truncated \uXX escape
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 consumer parsing attacker-controlled JSON can be crashed (denial of service) by a single truncated `\u` escape — one malformed byte sequence aborts the request/goroutine handling it. Intentional demo defect on the proof-demo showcase branch; never shipped in a released jsonparser.
Reachable via any Get*/ParseString/Unescape call on attacker-controlled JSON that contains a `\u` escape truncated near the end of the input buffer.
Technical description
decodeSingleUnicodeEscape (escape.go) decodes a `\uXXXX` escape by reading four hex digits at in[2..5] after a minimum-length guard. On the proof-demo showcase branch that guard was weakened from `if len(in) < 6` to `if len(in) < 4` (escape.go:88), so a truncated escape such as `\u00` — only four bytes available — passes the check and the decoder indexes in[4] and in[5] one and two bytes past the end of the backing slice. This is a textbook CWE-125 Out-of-bounds Read: the boundary condition (fewer than the six bytes the escape requires) is no longer rejected before the indexed reads. The Go runtime turns the out-of-bounds index into an index-out-of-range panic, so any caller parsing the input is crashed — a denial of service. 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.
- decodeSingleUnicodeEscape
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 TestDemoKI5 -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 (go build ./...).
- Call jsonparser.GetString([]byte(`{"k":"\u00"}`), "k") — or run: go test -run TestDemoKI5 -count=1 .
- Observe an index-out-of-range panic from decodeSingleUnicodeEscape instead of a clean MalformedStringEscapeError.
- Revert escape.go:88 back to `if len(in) < 6` and re-run; the reproducer now returns the malformed-escape error.
go test -run TestDemoKI5 -count=1 . go test ./... -count=1
How it can be triggered
The input or condition that sets this issue off.
a JSON string value whose `\u` escape is truncated at end-of-buffer, e.g. {"k":"\u00"}
What protects you, and the fix
What limits your exposure today, and the planned remediation.
What protects you now
Recover from parser panics at the call boundary, cap incoming JSON size, and validate or reject untrusted input before parsing so a single malformed escape cannot abort the handler.
The fix
Restore the 6-byte minimum-length guard in decodeSingleUnicodeEscape (escape.go:88, `if len(in) < 4` -> `if len(in) < 6`) so a truncated `\uXX` returns (RuneError, false) before any indexed read. Closes CWE-125 Out-of-bounds Read; cf. RFC 8259 section 7 on `\uXXXX` escapes.
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.
Touch this finding and you re-check 3 requirements · 3 code files · 8 tests.
- parser.go
- escape.go
- fuzz.go
- deep_spec_test.go
- mcdc_spec_witnesses_test.go
- obligation_evidence_test.go
- dead_code_audit_test.go
- escape_test.go
- fuzz_native_test.go
- mcdc_supplement_test.go
- parser_test.go
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-5-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.