solana/core/tests
behzad nouri ae91270961
implements ping-pong packets between nodes (#12794)
https://hackerone.com/reports/991106

> It’s possible to use UDP gossip protocol to amplify DDoS attacks. An attacker
> can spoof IP address in UDP packet when sending PullRequest to the node.
> There's no any validation if provided source IP address is not spoofed and
> the node can send much larger PullResponse to victim's IP. As I checked,
> PullRequest is about 290 bytes, while PullResponse is about 10 kB. It means
> that amplification is about 34x. This way an attacker can easily perform DDoS
> attack both on Solana node and third-party server.
>
> To prevent it, need for example to implement ping-pong mechanism similar as
> in Ethereum: Before accepting requests from remote client needs to validate
> his IP. Local node sends Ping packet to the remote node and it needs to reply
> with Pong packet that contains hash of matching Ping packet. Content of Ping
> packet is unpredictable. If hash from Pong packet matches, local node can
> remember IP where Ping packet was sent as correct and allow further
> communication.
>
> More info:
> https://github.com/ethereum/devp2p/blob/master/discv4.md#endpoint-proof
> https://github.com/ethereum/devp2p/blob/master/discv4.md#wire-protocol

The commit adds a PingCache, which maintains records of remote nodes
which have returned a valid response to a ping message, and on-the-fly
ping messages pending a pong response from the remote node.

When handling pull-requests, those from addresses which have not passed
the ping-pong check are filtered out, and additionally ping packets are
added for addresses which need to be (re)verified.
2020-10-28 17:03:02 +00:00
..
client.rs Remove unused pubkey::Pubkey imports 2020-10-21 19:08:13 -07:00
cluster_info.rs Run `codemod --extensions rs Pubkey::new_rand solana_sdk::pubkey::new_rand` 2020-10-21 19:08:13 -07:00
crds_gossip.rs implements ping-pong packets between nodes (#12794) 2020-10-28 17:03:02 +00:00
fork-selection.rs Tiny cleanups in preparation for persistent tower (#10805) 2020-06-25 18:24:16 +09:00
gossip.rs Add --gossip-validator argument 2020-09-14 20:18:27 -07:00
ledger_cleanup.rs Track votes from gossip for optimistic confirmation (#11209) 2020-07-28 09:33:27 +00:00
rpc.rs Remove unused pubkey::Pubkey imports 2020-10-21 19:08:13 -07:00
snapshots.rs Support Debug Bank (#13017) 2020-10-21 01:05:45 +09:00