fix(deps): update dependency com.fasterxml.jackson.core:jackson-core to v2.18.8 [security] - #10240
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request performs a crucial dependency upgrade for Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request updates the com.fasterxml.jackson.core:jackson-core dependency to version 2.18.6 to remediate a security vulnerability (GHSA-72hv-8253-57qq). The version update in iap/pom.xml is correct. On a related note, the parent POM com.google.cloud.samples:shared-configuration is at version 1.2.0. Per repository guidelines, this should be kept up-to-date. Please consider creating a separate PR to update it to the latest version.
cc75e0c to
d38633e
Compare
d38633e to
5153462
Compare
5153462 to
360a7a7
Compare
…to v2.18.8 [security]
360a7a7 to
c48d8d2
Compare
This PR contains the following updates:
2.16.1→2.18.8Warning
Some dependencies could not be looked up. Check the Dependency Dashboard for more information.
jackson-core: Async parser maxNumberLength bypass via chunked digit accumulation (incomplete fix for GHSA-72hv-8253-57qq)
GHSA-r7wm-3cxj-wff9
More information
Details
Summary
The fix released in jackson-core
2.18.6and2.21.1for GHSA-72hv-8253-57qq (Number Length Constraint Bypass in Async Parser, published 2026-02-28) is incomplete. The fix commitb0c428e6(#1555) wiredvalidateIntegerLengthinto a new_setIntLengthhelper and called it at every place where the integer portion of a number is decided (terminator byte arrived,./e/Eseen, end-of-feed inside a fully-buffered value). It did not call it on the much more attacker-relevant path: "ran out of input while still insideMINOR_NUMBER_INTEGER_DIGITS, returnNOT_AVAILABLEto caller".As a result, an attacker who streams JSON to a non-blocking parser in many small chunks, without ever sending a terminator byte, can keep the parser inside
MINOR_NUMBER_INTEGER_DIGITSindefinitely._textBuffer.expandCurrentSegment()grows on every chunk, andvalidateIntegerLengthis never invoked. The accumulator is only gated bymaxStringLength(20 MiB default) — a ~20,000x amplification of the documentedmaxNumberLength(1000 default).This is the same vulnerability class, same advisory wording ("Memory Exhaustion: Unbounded allocation in TextBuffer from excessively long numbers"), same parser class — just the streaming path the original fix didn't cover. The fix to the fraction path is correct (see
_finishFloatFractionat line 1834-1837 ofNonBlockingUtf8JsonParserBase.javain 2.18.6, where_setFractLength(fractLen)IS called before theNOT_AVAILABLEreturn); the equivalent call is missing from every integer-digit path.Affected versions
Verified on the patched releases:
com.fasterxml.jackson.core:jackson-core2.18.6com.fasterxml.jackson.core:jackson-core2.21.1Structurally identical code in
tools.jackson.core3.0.x / 3.1.x — sameNonBlockingUtf8JsonParserBaseclass, same_setIntLengthrollout, same NOT_AVAILABLE returns without validation. Not retested but presumed vulnerable.Affected code
src/main/java/com/fasterxml/jackson/core/json/async/NonBlockingUtf8JsonParserBase.javain 2.18.6 / 2.21.1.Site 1 —
_startPositiveNumber(int ch)lines 1320-1330:Site 2 —
_finishNumberIntegralPartlines 1691-1727:The pattern recurs at lines 1297, 1329, 1343, 1365, 1395, 1409, 1437, 1467, 1481, 1586, 1644, 1698 — every "ran out of input mid-integer" exit returns to the caller without validating the accumulator length.
Compare with the fraction path that is correct
_finishFloatFractionlines 1827-1838:Impact
Reactive frameworks (Spring WebFlux / Reactor, Quarkus, Helidon, Vert.x JSON, anything wrapping
JsonFactory.createNonBlockingByteArrayParser()orcreateNonBlockingByteBufferParser()) feed inbound HTTP/gRPC bytes to the async parser as they arrive. Operators who setStreamReadConstraints.builder().maxNumberLength(N)on the assumption that this caps memory per number value are not getting that guarantee in chunked-feed scenarios. The parser silently accumulates digits up tomaxStringLength(20 MiB default) per concurrent connection. Multiply by attacker-controlled concurrency to OOM the JVM.The synchronous parsers (
UTF8StreamJsonParser,ReaderBasedJsonParser) and the async parser on complete input are not affected — those paths go through_setIntLengthorParserBase._reportTooLongIntegralcorrectly.CWE-770 (Allocation of Resources Without Limits or Throttling), CVSS roughly the same as the parent advisory (Network / Low complexity / High availability impact). The parent advisory was scored CVSS 8.7 High.
Proof of concept
Standalone PoC, no Maven required:
Observed output against
jackson-core-2.18.6:Observed output against
jackson-core-2.21.1: identical.The 9.83 MB figure is purely a function of the loop bound (600 chunks * 16 KiB). The actual ceiling is
maxStringLength = 20 MiB. With the strict policy declared asmaxNumberLength = 1000, the parser permits 9830x more allocation than the policy allows. WithmaxStringLengthleft at the default 20 MiB, an attacker can drive a single connection to 40 MiB ofchar[]heap (chars are 2 bytes each) before the validator finally fires on terminator/endOfInput(). Multiply by concurrent connections.End-to-end reproduction through real HTTP
Supplements the standalone PoC with a running Spring Boot WebFlux server,
driving the same bug through the actual reactor-netty + Jackson2JsonDecoder
streaming-decode path that production reactive endpoints use.
Setup:
com.fasterxml.jackson.core:jackson-core:2.18.7(latest published)2.18.8-SNAPSHOTbuilt from the fix branchJsonFactoryconfigured withStreamReadConstraints.builder().maxNumberLength(1000).build()Endpoint under test exposes the
Flux<DataBuffer>request body directly toJackson2JsonDecoder.decode(Flux, ResolvableType, ...)so the parser sees oneHTTP chunk per
feedInput(the same pattern used for any@RequestBody Flux<...>/ streaming JSON decoder in WebFlux). A raw-socketHTTP/1.1 chunked client streams
{"v":1then 250 chunks of 200 digit byteseach (50,000 digits total) at 20ms intervals, then writes the closing
}.VULN — jackson-core 2.18.7:
Server-side controller trace (250 DataBuffer arrivals elided):
Server held all 50,000 digit characters in
_textBufferfor 6.5 seconds withmaxNumberLength=1000declared. The validator never fires during streaming;it only fires at value-completion when the closing
}arrives.PATCHED — jackson-core 2.18.8-SNAPSHOT (fix branch):
Server-side controller trace:
Patched server raises
StreamConstraintsExceptionat 155ms after only 5DataBuffers, exactly when the accumulated digit count crosses
maxNumberLength=1000. The connection is reset mid-stream rather than theparser silently consuming the rest of the attacker's payload.
Side-by-side:
Note on the default
@RequestBody Mono<JsonNode>path: that path cannotdistinguish the two builds because Spring's
decodeToMonojoins allDataBuffers into one before parsing. The exploitable shape is the
streaming-decode path (
Flux<JsonNode>/@RequestBody Flux<...>/WebSocket / SSE / any direct
decoder.decode(Flux<DataBuffer>, ...)call),which is also what
Jackson2Tokenizeruses for any streaming JSONdeserialization in WebFlux and Quarkus reactive REST.
Suggested fix
Mirror the pattern already used in
_finishFloatFraction. At every site that returns_updateTokenToNA()(orJsonToken.NOT_AVAILABLE) with_minorState = MINOR_NUMBER_INTEGER_DIGITS, call_setIntLength(outPtr + negMod)first. Concretely, the diff toNonBlockingUtf8JsonParserBase.javawould be:protected JsonToken _finishNumberIntegralPart(char[] outBuf, int outPtr) throws IOException { int negMod = _numberNegative ? -1 : 0; while (true) { if (_inputPtr >= _inputEnd) { _minorState = MINOR_NUMBER_INTEGER_DIGITS; _textBuffer.setCurrentLength(outPtr); + _streamReadConstraints.validateIntegerLength(outPtr + negMod); return _updateTokenToNA(); }Note:
_setIntLengthitself can't be used as-is because it also assigns_intLength, and_intLengthmust not be set until the integer is truly complete (subsequent fraction handling reads_intLength). The minimal fix is to call only the validator, as shown.Apply the same one-line insertion before each
return _updateTokenToNA();that exits with_minorState = MINOR_NUMBER_INTEGER_DIGITS. The sites are listed above (12 lines total).Alternatively, a heavier refactor: also gate
_textBuffer.expandCurrentSegment()calls inside the digit-accumulation loops onoutPtr < maxNumberLengthso that the validator fires at the moment the buffer would be enlarged past the limit, rather than waiting for the next chunk boundary. Either approach is sufficient.Credit
Reported by
tonghuaroot(tonghuaroot@gmail.com). Variant hunt against the Feb 2026 fix for GHSA-72hv-8253-57qq.Severity
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:NReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
jackson-core: Number Length Constraint Bypass in Async Parser Leads to Potential DoS Condition
GHSA-72hv-8253-57qq
More information
Details
Summary
The non-blocking (async) JSON parser in
jackson-corebypasses themaxNumberLengthconstraint (default: 1000 characters) defined inStreamReadConstraints. This allows an attacker to send JSON with arbitrarily long numbers through the async parser API, leading to excessive memory allocation and potential CPU exhaustion, resulting in a Denial of Service (DoS).The standard synchronous parser correctly enforces this limit, but the async parser fails to do so, creating an inconsistent enforcement policy.
Details
The root cause is that the async parsing path in
NonBlockingUtf8JsonParserBase(and related classes) does not call the methods responsible for number length validation._finishNumberIntegralPart) accumulate digits into theTextBufferwithout any length checks._valueComplete(), which finalizes the token but does not callresetInt()orresetFloat().resetInt()/resetFloat()methods inParserBaseare where thevalidateIntegerLength()andvalidateFPLength()checks are performed.maxNumberLengthconstraint is never enforced in the async code path.PoC
The following JUnit 5 test demonstrates the vulnerability. It shows that the async parser accepts a 5,000-digit number, whereas the limit should be 1,000.
Impact
A malicious actor can send a JSON document with an arbitrarily long number to an application using the async parser (e.g., in a Spring WebFlux or other reactive application). This can cause:
TextBufferto store the number's digits, leading to anOutOfMemoryError.getBigIntegerValue()orgetDecimalValue(), the JVM can be tied up in O(n^2)BigIntegerparsing operations, leading to a CPU-based DoS.Suggested Remediation
The async parsing path should be updated to respect the
maxNumberLengthconstraint. The simplest fix appears to ensure that_valueComplete()or a similar method in the async path calls the appropriate validation methods (resetInt()orresetFloat()) already present inParserBase, mirroring the behavior of the synchronous parsers.NOTE: This research was performed in collaboration with rohan-repos
Severity
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:NReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
Configuration
📅 Schedule: (UTC)
🚦 Automerge: Enabled.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.