You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Missing MAX_PACKET_SIZE check in BPP layer allows memory exhaustion from malicious server #2626
The read_message() function in packet.py does not validate packet_size against a maximum value before calling read_all().
A malicious SSH server can send a BPP packet with packet_size = 0xFFFFFFFF
(4GB), causing the client to attempt reading 4GB from the socket,
resulting in indefinite blocking or memory exhaustion.
Location
paramiko/packet.py — read_message():
packet_size=struct.unpack(">I", header[:4])[0]
# No maximum size check herebuf=self.read_all(packet_size+self.__mac_size_in-len(leftover))
Suggested Fix
Add a check before allocating:
MAX_BPP_PACKET_SIZE=35000# OpenSSH defaultifpacket_size>MAX_BPP_PACKET_SIZE:
raiseSSHException(f"Packet too large: {packet_size}")
Impact
Prerequisite: connection to a malicious SSH server
Effect: client process blocks indefinitely or exhausts memory
Activity