Skip to main content
Menu
Advisories

jackson-dataformat-protobuf denial of service

GHSA-WW35-763R-JG22Published Updated GitHub

Description

An eager-allocation denial-of-service in jackson-dataformats-binary's Protobuf parser (latest, 3.2.2 / tools.jackson line), where a bytes length prefix from untrusted input is used to allocate a byte[] before the body is read and without any upper bound. This is the same class as the HIGH-rated CBOR CVE-2020-28491 in this library, which was fixed with a LONGEST_NON_CHUNKED_BINARY guard; the Protobuf parser never received the equivalent guard. Reporter: apvxlab (AppViewX security research).

Per the maintainer's request this advisory now covers only the Protobuf issue. The async-Smile issue that was originally reported here has been filed separately as GHSA-h3c2-2m49-r49w.

File: protobuf/src/main/java/tools/jackson/dataformat/protobuf/ProtobufParser.java (_finishBytes, ~line 2363).

For a length-delimited bytes field, _decodeLength() returns a fully attacker-controlled positive int up to Integer.MAX_VALUE, stored in _decodedLength with no bounds check against the remaining input or the enclosing message end offset (the _currentEndOffset checks apply only to embedded MESSAGE fields, not BYTES). _finishBytes then does byte[] b = new byte[len] before reading any body.

Impact. A ~6-byte message forces a ~2 GB allocation per request; sizes in the few-hundred-MB range reliably exhaust the heap under light concurrency. The resulting OutOfMemoryError is an Error, not a JacksonException, so it escapes the parser contract and crashes request threads (denial of service).

Reproduction (exact bytes).

  • Schema message Foo { optional bytes data = 1; }, POJO class Foo { public byte[] data; }.
  • Wire bytes: { 0x0A, 0xFF, 0xFF, 0xFF, 0xFF, 0x07 } — tag 0x0A (field 1, wire type 2) + varint 0x7FFFFFFF (= 2147483647) + zero payload bytes.
  • new ProtobufMapper().readerFor(Foo.class).with(schema).readValue(payload) → _finishBytes(2147483647) runs new byte[2147483647] before reading the (absent) body → OOM. Use a mid-size length such as the varint for ~300,000,000 for a reliable heap-exhaustion DoS under a few concurrent requests.

Fix. Bound _decodedLength against the remaining input / a configurable maximum before allocating, mirroring the CBOR LONGEST_NON_CHUNKED_BINARY / _finishLongContiguousBytes fix (CVE-2020-28491).

Code-verified against the 3.2.2 source with the exact reproduction input above. Happy to provide a runnable harness and coordinate the fix.

Affected versions

References

GitHub · FasterXML/jackson-dataformats-binary