receive_str() has no size limit — potential memory exhaustion DoS #72
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
In lines 150-164, reads a length from the wire and then allocates that many bytes:
A malicious (or buggy) sender could send a very large value (e.g., ), causing to either fail (hopefully) or cause the receiver to allocate enormous amounts of memory (if is close to , wraps to 0 on overflow, and returns a valid pointer).
Impact
An attacker controlling the server or a man-in-the-middle could crash or exhaust memory on the client or vice versa.
Location
Suggested Fix
Add a maximum reasonable string length check:
Severity
Medium
Category
Security