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

(Actually) remove incorrect `*mut` cast in net-tokio

Public commit record

What the developer wrote

Authored by Matt Corallo

73/100 · Adequate
(Actually) remove incorrect `*mut` cast in net-tokio

In ae62fa377a0a139d937ce2c7d87d3eb1612732af we removed an incorrect
`&mut`, but failed to actually resolve the mut aliasing bug - there
remained a deref of a `*mut` which is similarly invalid. Here we
actually fix the bug and also DRY up code marginally.

Reported by Project Loupe.
✓ 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 Rust unsafe-code bug in the lightning-net-tokio networking module. The previous patch removed an `&mut` reference but left a `*mut` pointer dereference that still created aliasing mutable access to the same memory, which is undefined behavior in Rust. The fix removes the duplicate unsafe dereference and reuses an existing safe helper function instead. The bug was reported by Project Loupe, an external security research group.

Recommended action

Treat as a security-relevant correctness fix. Users building or running LDK with the Tokio networking backend should upgrade to a release containing this commit. If backporting, ensure the earlier incomplete fix (ae62fa377a0a139d937ce2c7d87d3eb1612732af) is also present. Consider auditing other unsafe raw-pointer casts in lightning-net-tokio for similar aliasing issues.

Security signals we found

01

Undefined behavior via invalid `*mut` dereference and mutable aliasing in unsafe Rust

02

Concurrent waker clones may access the same raw pointer

03

External security researcher/group credited (Project Loupe)

04

Follow-up to a previous incomplete fix (ae62fa377a0a139d937ce2c7d87d3eb1612732af)

Risk score

Why this scored 59/100

Our methodology →
Potential impact 18/30
Exploitability 12/25
Stealth signal 10/15
Affected reach 8/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.