Security: Delta and chunk deserialization don't validate array counts/sizes from network #170
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
Several deserialization functions trust length/count fields from the wire without validating them against the available data or a global cap:
delta_signature_deserialize()(src/shared/delta.c:86-124) readsblock_countand allocatesblock_count * sizeof(DeltaBlockSig)without a cap.delta_deserialize()(src/shared/delta.c:322-421) readsinstruction_countand allocatesinstruction_count * sizeof(DeltaInstruction)without a cap.chunk_deserialize()(src/shared/chunk.c:86-183) readspath_lenandfile_data_sizeassize_tfrom the chunk payload and allocates them directly.A malicious peer can craft small payloads with huge counts/sizes, causing OOM or allocation failures that are not handled gracefully.
Suggested fix
NULLand log an error on malformed input.Severity
Medium
Category
security
This issue was automatically generated by the issue-creator agent.