Repository navigation
fix(deps): update dependency com.google.guava:guava to v33 [security] - #522
Open
renovate[bot] wants to merge 1 commit into
Open
renovate[bot] wants to merge 1 commit into
renovate[bot] wants to merge 1 commit into
Conversation
Contributor
Author
|
renovate
Bot
requested review from
gibson9583,
jonbartels,
kayyagari,
kpalang,
mgaffigan,
ssrowe and
tonygermano
October 27, 2026 23:03
tonygermano
requested changes
Oct 28, 2026
tonygermano
left a comment
Member
There was a problem hiding this comment.
build failed... android version?
Contributor
|
Alternative: #519 removes Guice. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
32.0.1-jre→33.7.2-androidGoogle Guava: CompactHashMap/CompactHashSet/MapMakerInternalMap deserialization triggers uncontrolled memory allocation
CVE-2026-102554 / GHSA-xxph-c9ww-hj94
More information
Details
CompactHashMap/CompactHashSet/MapMakerInternalMap native deserialization triggers uncontrolled memory allocation
Summary
CompactHashMap,CompactHashSet, andMapMakerInternalMapimplementreadObject(ObjectInputStream)by reading an attacker-controlledelementCountorinitialCapacityfrom the stream. On the very first insertion during or after deserialization (for theCompactHash*collections, insideallocArrays()) or immediately during deserialization (forMapMakerInternalMap), the implementation eagerly allocates arrays sized to that full, unvalidated value (up toCompactHashing.MAX_SIZE= 2^30-1, ~1.07 billion, for example) before the rest of the stream's actual content has been consumed. A 72-byte malicious serialized stream containing a single tiny element can force a multi-gigabyte allocation and crash a JVM withOutOfMemoryError, dynamically confirmed against the current release.Details
CompactHashMap.readObject()(guava/src/com/google/common/collect/CompactHashMap.java):elementCountis only checked for being non-negative; there is no upper bound and no relationship enforced between the declared count and how much data actually follows in the stream.init(elementCount)(line 251) just stores the value (clamped to[1, CompactHashing.MAX_SIZE], i.e. up to 2^30-1):The real allocation is deferred to
allocArrays(), which fires lazily on the firstput()call — i.e. after only one key/value pair has actually been read off the wire:With
expectedSizenearCompactHashing.MAX_SIZE(2^30-1), this single call allocates a hashtableplus threeexpectedSize-length arrays — multiple gigabytes — triggered by a stream that has, at that point, only supplied one small real element.CompactHashSet.readObject()/allocArrays()have the identical shape.CompactLinkedHashMap/CompactLinkedHashSetextend these classes and inherit the same unguarded path.The problem with
MapMakerInternalMapis similar, with a size read from the serialized data and stored in aMapMakerinstance for later user during deserialization, when theMapMakeris passed back toMapMakerInternalMapand segments are allocated by callingnewSegment, whose implementations (example) createSegmentinstances (example) that allocate arrays of the requested capacity through thenewTablehelper.This is the same amplification shape as the already-fixed CVE-2018-10237 (
AtomicDoubleArray/CompoundOrdering: attacker declares a large size, library eagerly allocates before validating against actual stream content). That fix rewroteAtomicDoubleArray.readObject()to grow anImmutableLongArray.Builderincrementally per element actually read, rather than pre-allocating from the declared size — Guava's ownHashBiMap.readObject()documents the same defensive principle explicitly in a comment:init(16); // resist hostile attempts to allocate gratuitous heap.CompactHashMap/CompactHashSetdo not follow either of these two patterns already present elsewhere in the same codebase.Reachability: All classes are top-level,
implements ... Serializable, and require no special classpath setup beyond Guava being present (near-ubiquitous on JVM backends). A native Java deserialization attacker names the class directly in a hand-crafted stream — no particular Guava factory method needs to have been used by the victim application, exactly as with the precedent CVE.PoC
Full source and run instructions in the attached
poc-guava-compacthash-dos.zip(Maven project,guava:33.7.1-jre— the current latest release — as the only dependency). The PoC:CompactHashSetinstance (it is package-private; a real attacker does not need this step, since they craft the serialized bytes directly rather than calling Guava's own serialization code).elementCountfield (byte-precise, not guessed).1to0x3FFFFFFF(CompactHashing.MAX_SIZE), leaving the rest of the 72-byte stream (one real"A"element) untouched.new ObjectInputStream(...).readObject()call against the real, unmodifiedguava-33.7.1-jre.jar.Actual run output:
A 72-byte input forces ~4.1 GB of real allocation before failing on an 8 GB heap, and crashes a 128 MB heap in 24 ms — over 50,000x amplification between input size and forced allocation.
To reproduce:
mvn -q compile dependency:build-classpath -Dmdep.outputFile=cp.txt && java -Xmx128m -cp "target/classes:$(cat cp.txt)" poc.PocImpact
Uncontrolled resource consumption (CWE-770 / CWE-400) via native Java deserialization: any application that runs
ObjectInputStream.readObject()on data reachable by an attacker, and has Guava on its classpath (true for a large fraction of the JVM ecosystem), can be crashed with a single ~72-byte payload, regardless of what type the application itself expected to deserialize.Severity
CVSS 3.1:
AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H— identical vector to CVE-2018-10237, the precedent this is a sibling of. Recomputed with the full formula: exploitability = 8.22×0.85×0.44×0.85×0.85 = 2.221; ISS = 1-(1×1×0.44) = 0.56; impact = 6.42×0.56 = 3.595; base = roundup(5.816) = 5.9 (Medium).Affected
com.google.guava:guava, all editions (-jre/-android) — confirmed on the current latest release, 33.7.1-jre.CompactHashMap/CompactHashSet/CompactLinkedHashMap/CompactLinkedHashSethave had this samereadObject/allocArraysshape for a long time (probably since they were added in Guava 23.6), and similarly forMapMakerInternalMap(which was introduced in Guava 4.0); not tested against older individual releases.Suggested fix
Apply the same defense already used elsewhere in this codebase: either clamp the initial
init()capacity to a small constant regardless of the declaredelementCount(asHashBiMap.readObject()already does —init(16); // resist hostile attempts to allocate gratuitous heap) and grow incrementally as elements are actually read, or grow the backing arrays incrementally per iteration of the deserialization loop (as the fixedAtomicDoubleArray.readObject()does viaImmutableLongArray.Builder) instead of eagerly sizing to the full attacker-declared count on first insert.Severity
CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:NReferences
This data is provided by OSV and the GitHub Advisory Database (CC-BY 4.0).
Configuration
📅 Schedule: (in timezone America/New_York)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, 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.