AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Moderate 55 Bitcoin

Avoid over-allocating when reading corrupted lengths for `HashMap`s

Public commit record

What the developer wrote

Authored by Matt Corallo

73/100 · Adequate
Avoid over-allocating when reading corrupted lengths for `HashMap`s

Luckily this was only used in `ChannelManager` and scorer
deserialization, though we anticipate occasionally fetching the
second from an only semi-trusted source.
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
The short version

What changed, and why it matters

This commit fixes a denial-of-service risk when rust-lightning reads saved data containing HashMaps. A corrupted or malicious length field could previously trick the program into reserving a huge amount of memory before it had read any actual entries. The patch now caps the initial allocation to a safe maximum based on the largest buffer size the code is willing to handle. The commit message says the affected deserialization paths were mainly ChannelManager and scorer data, with scorer data sometimes coming from a semi-trusted source.

Recommended action

Treat this as a security hardening fix and include it in the next maintenance release. Review whether other collection deserialization macros (Vec, arrays, custom maps) have the same over-allocation issue and apply consistent MAX_BUF_SIZE-based caps. If scorer data can be loaded from network or user-controlled sources, consider additional input validation or sandboxing.

Security signals we found

01

memory allocation controlled by external length field

02

deserialization of semi-trusted scorer data

03

denial-of-service via corrupted length

04

initial capacity capped by MAX_BUF_SIZE-derived limit

Risk score

Why this scored 55/100

Our methodology →
Potential impact 14/30
Exploitability 12/25
Stealth signal 8/15
Affected reach 10/15
Confidence 7/10
Evidence quality 4/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.