Hello,
Question
: I am unsure how the fix commit provided fixes the vulnerability in question. Details below, if some one can please explain the actual fix for the vuln, would be great.
The vulnerability speaks about -
"
A parsing issue similar to
CVE-2022-3171
, but with Message-Type Extensions in protobuf-java core and lite versions prior to 3.21.7, 3.20.3, 3.19.6 and 3.16.3 can lead to a denial of service attack. Inputs containing multiple instances of non-repeated embedded messages with repeated or unknown fields causes objects to be converted back-n-forth between mutable and immutable forms, resulting in potentially long garbage collection pauses. We recommend updating to the versions mentioned above.
"
It speaks mostly about, how if fields are marked as immutable, messages would need to be cloned, leading to more object creation and thereby long garbage pauses.
We can see the impact of it here
As per the message in the fix commit , " Change the Lite runtime to prefer merging from the wireformat into mutable messages rather than building
up a new immutable object before merging. This way results in fewer allocations and copy operations."
Doubt:
I tried generating a message structure that can potentially reproduce the vulnerability, however based on my debugging, fields are always mutable in fixed version 3.16.3 , as well as lower versions.
The problem i see is, the fields are always remaining mutable, meaning there is no flipping between mutable and immutable forms as mentioned in the vulnerability. I am not sure if its my test thats flawed, hence reaching out for help.
Attaching test case, and test data structure.
Thank you and Regards,
Somak