receive_str() has no size limit — potential memory exhaustion DoS #72

Closed
opened 2026-07-20 17:14:37 +02:00 by TapTap · 0 comments
Owner

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

## 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
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: TapTap/FastSync#72