p2p: Prevent block index fingerprinting by sending additional getheaders messages #24571 #14
Replies: 1 comment 2 replies
-
SummaryA node will send This PR allows node to send additional What is the block index and what is it used for? (Hint: look at the usage of m_block_index)Block index is an indexing system of the blockchain which contains in memory data for a block to quickly This index is defined in
/** The block chain is a tree shaped structure starting with the
* genesis block at the root, with each block potentially having multiple
* candidates to be the next block. A blockindex may have multiple pprev pointing
* to it, but at most one of them can be part of the currently active branch.
*/
class CBlockIndex
{
public:
//! pointer to the hash of the block, if any. Memory is owned by this CBlockIndex
const uint256* phashBlock{nullptr};
//! pointer to the index of the predecessor of this block
CBlockIndex* pprev{nullptr};
//! pointer to the index of some further predecessor of this block
CBlockIndex* pskip{nullptr};
//! height of the entry in the chain. The genesis block has height 0
int nHeight{0};
//! Which # file this block is stored in (blk?????.dat)
int nFile GUARDED_BY(::cs_main){0};
//! Byte offset within blk?????.dat where this block's data is stored
unsigned int nDataPos GUARDED_BY(::cs_main){0};
...
It is used for all seek-and-find operations on the block, as well as getting various metadata like Why and how can the block index be used for fingerprinting? (Hint: it has to do with stale blocks/headers)When a peer sends us a chain of block on top of a stale chain (a chain not part of the global active) and depending on wether Why do we keep stale blocks in the block index?Stale blocks are kept for security reasons and are required in case of a large reorg. But it is also conceivable to remove In your own words, how does the fingerprinting technique outlined in the PR work?A malicious peer crafts a fake chain on top of a known stale blockchain. If the receiving node contains the stale blocks in it's block index Does the fingerprinting technique outlined in the PR work across restarts of the target node?Yes because restarting the node keeps it's block indexes intact. This commit introduces a new parameter to PeerManagerImpl::BlockRequestAllowed. Why is that necessary?This is used to check whether to send a requested block to a peer which is not older than 1 month of equivalent time. /**
* To prevent fingerprinting attacks, only send blocks/headers outside of
* the active chain if they are no more than a month older (both in time,
* and in best equivalent proof of work) than the best header chain we know
* about and we fully-validated them at some point.
*/
bool BlockRequestAllowed(const CBlockIndex* pindex) EXCLUSIVE_LOCKS_REQUIRED(cs_main); |
Beta Was this translation helpful? Give feedback.
-
Session Details
[net][net_processing]
[c++][python]
Summary
This PR adds extra logic in the net processing module to increase resistance against a particular network fingerprinting attack.
Learnings
Beta Was this translation helpful? Give feedback.
All reactions