security: Add max_length to zlib.decompress in uworker_io.py to prevent decompression bomb DoS#5334
Open
prasanna8585 wants to merge 1 commit into
Conversation
A compromised or malicious uworker process could upload a zlib- compressed decompression bomb to its signed GCS output URL. The trusted tworker, which explicitly treats uworker output as untrusted, was calling zlib.decompress() on this data without any size limit. This could cause an OOM crash on the tworker, disrupting ClusterFuzz orchestration. Add _MAX_UWORKER_MSG_SIZE (256 MB) as an upper bound on all three zlib.decompress() calls in uworker_io.py (lines 129, 170, 184). The existing except zlib.error blocks handle the new zlib.error that decompress raises when the limit is exceeded, so no additional error handling is required. Fixes: decompression bomb DoS via untrusted uworker output
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.
Summary
uworker_io.pycallszlib.decompress()three times without amax_lengthlimit. A compromised or malicious uworker process could upload a small zlib-compressed bomb (~4 MB) to its signed GCS output URL, causing the trusted tworker to exhaust memory when decompressing, crashing the orchestrator.The code already acknowledges the trust boundary:
But the decompression step had no corresponding size guard.
Changes
_MAX_UWORKER_MSG_SIZE = 256 * 1024 * 1024constant (256 MB)max_length=_MAX_UWORKER_MSG_SIZEto all threezlib.decompress()calls:download_and_deserialize_uworker_input()(line 129)download_input_based_on_output_url()(line 170)download_and_deserialize_uworker_output()(line 184)The existing
except zlib.errorblocks already handle decompression failures gracefully — no additional error handling is required.Attack Scenario
Fix Verification
After this patch,
zlib.decompress(data, max_length=_MAX_UWORKER_MSG_SIZE)raiseszlib.errorif the decompressed output exceeds 256 MB. The caller's existingexcept zlib.errorblock handles this as a backward-compatibility fallback, so no disruption to normal operation.