Skip to content

Commit

Permalink
network/tx: Ban peers with tx that fail to decode (paritytech#5002)
Browse files Browse the repository at this point in the history
A malicious peer can submit random bytes on transaction protocol.
In this case, the peer is not disconnected or reported back to the
peerstore.

This PR ensures the peer's reputation is properly reported.

Discovered during testing:
- paritytech#4977


cc @paritytech/networking

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
  • Loading branch information
lexnv authored and jpserrat committed Jul 18, 2024
1 parent e15e2da commit 0154a9f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion substrate/client/network/transactions/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,8 @@ where
{
self.on_transactions(peer, m);
} else {
warn!(target: "sub-libp2p", "Failed to decode transactions list");
warn!(target: "sub-libp2p", "Failed to decode transactions list from peer {peer}");
self.network.report_peer(peer, rep::BAD_TRANSACTION);
}
},
}
Expand Down

0 comments on commit 0154a9f

Please sign in to comment.