Proof Portal

Projects

jsonparser

ProbeLabs36 findings · 123 requirements
Back to findings
Known issueKI-5

decodeSingleUnicodeEscape length guard too small — OOB read + panic on a truncated \uXX escape

OpenOpenHigh

High-severity issue, currently open.

Introduced

When and where this issue first entered the codebase — the commit it traces back to.

Inception (latent from the first version)

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.

Reachability

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

HighRated severity — the impact if this issue is exploited or hit.
why this rating
Reproducer-confirmed
risk area
Availability
Security classification
Security-relevant
CVSS
CVSS 7.5· Highv3.1CVSS: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.

Known issue reproducedprovesSYS-REQ-060
Run it yourself
go test -run TestDemoKI5 -count=1 .
Covers (3)
Last run Aug 3, 2026, 11:00 AM

Reproduction steps

Technical steps for your engineers to confirm the issue by hand.

  1. Check out the proof-demo showcase branch and build the package (go build ./...).
  2. Call jsonparser.GetString([]byte(`{"k":"\u00"}`), "k") — or run: go test -run TestDemoKI5 -count=1 .
  3. Observe an index-out-of-range panic from decodeSingleUnicodeEscape instead of a clean MalformedStringEscapeError.
  4. 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.

Tracing blast radius…

Touch this finding and you re-check 3 requirements · 3 code files · 8 tests.

Code files (3)
  • parser.go
  • escape.go
  • fuzz.go
Tests (8)
  • 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.

Implementing code (1)
  • parser.go
    ParseString
Tests & evidence (4)
  • README.md
  • deep_spec_test.go
  • mcdc_spec_witnesses_test.go
  • obligation_evidence_test.go
Proof obligations (1)
truncated_escape_sequence
  • nominal (required)obligation_evidence_test.go:472
Implementing code (3)
  • escape.go
    Escape
  • fuzz.go
    FuzzParseString
  • parser.go
    ParseString
Tests & evidence (8)
  • README.md
  • dead_code_audit_test.go
  • escape_test.go
  • fuzz_native_test.go
  • mcdc_spec_witnesses_test.go
  • mcdc_supplement_test.go
  • obligation_evidence_test.go
  • parser_test.go
Proof obligations (1)
encoding_safety

Behavior specified for encoding and decoding round-trips.

  • nominal (required)obligation_evidence_test.go:198
Implementing code (1)
  • parser.go
    ParseString
Tests & evidence (3)
  • README.md
  • mcdc_spec_witnesses_test.go
  • parser_test.go

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.

Sign in to discuss this with the proof team.Sign in