-
Notifications
You must be signed in to change notification settings - Fork 465
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug Report: Denial of Nethermind's Txpool Service by Latent Invalid Transactions (Z) #3173
Labels
Comments
Also, pls inform if there is a bug bounty program for nethermind. |
@matilote is in the process of setting up a bug bounty now |
@mous314anony you can send an email to tomasz@nethermind.io so we can retroactively contribute and discuss any future reports |
12 tasks
Agreed, we can move the discussion to email. |
@marcindsobczak what is the state of this one? |
PR is waiting for approve and merge (or request for changes) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug Report: Denial of Ethereum Txpool Service by Latent Invalid Transactions (Z)
Summary
The attacker node can send crafted invalid transactions to a victim Nethermind node to purge all pending transactions in its txpool and make the victim node's miner read zero or very few transactions. This attack incurs little Gas per block.
The root cause of this attack is that what we call latent invalid transactions submitted to a txpool can evict the valid pending transactions there. For instance, sending three transactions tx1, tx2, tx3 of the same sender s, each spending the full balance s to a txpool. These three transactions at high Gas price are admitted to txpool, potentially evicting other transactions in txpool. However, tx2 and tx3 are overdrafts and will be invalidated by miners, making their (high) Gas price uncollectible.
In the mitigation scheme, the txpool should limit the number of the exploited evictions, namely the evictions of valid pending transactions by invalid transactions.
Background
Consider txpool on one node receives a message that contains multiple transactions from a remote node. Assume the current size of txpool reaches 1024. The txpool will select the one from existing transactions that bids the lowest Gas price and compare its Gas price with the newly received one. If the new transaction bids a higher Gas price, the selected one will be evicted. Besides, the number of transactions that belong to the same account cannot exceed 17.
Since any neighbors can send a message that contains many transactions to a victim node, a malicious node can use 61 accounts to prepare 1024 transactions with each of them fully transfer the sender's balance and bids extremely high Gas price, then the malicious node can wrap them up in one message and send it to a victim Nethermind node. In all of the transactions, only the first pending transaction of each account is valid, the rest of them are invalid and overdraft. On the victim node, when receiving such 1024 transactions that fully transferred their sender's balance and processing them in txpool, it will evict all of the existing transactions (including pending and future transactions). Since invalid transactions will not be propagated or included by the miner, only one transaction(the first pending transaction) of each account will be included in blocks. The cost of this attack is 0.021 * 61 = 1.281 Ether.
One can exploit this vulnerability to attack the mining nodes in the mainnet and testnets and cause the block mined by them includes very few transactions.
Technical details
The attack works by sending one message with crafted 1024 invalid transactions (with high Gas price, e.g., 1000 Gwei) to a victim mining node, such 1024 invalid transactions can purge all of the existing transactions in the victim node's txpool (including both pending and future transactions). The root cause is that when adding a new transaction into txpool, an overdraft transaction with a higher Gas price can evict an existing pending transaction with a lower Gas price.
More specifically, the attack works as follows.
Proof of Concept
You can verify this by running three nodes in a private network with three nodes, a normal node that generates regular pending transactions, a victim Nethermind node, and an attacker node.
Mitigation
To mitigate such a DoS attack, we propose the following defensive schemes.
The text was updated successfully, but these errors were encountered: