Absence of signature deduplication for receipt in the binary_repair_oos_accounts P2P handler
The binary_repair_oos_accounts peer-to-peer handler verifies receipt signatures but does not check for duplicates, so a single valid signature can be repeated to meet the minimum signature threshold. An attacker running one active node can therefore submit a forged receipt and set any account balance to an arbitrary value, which the network accepts.
Originally disclosed on Immunefi
- Disclosed after under an hour
#35531 [BC-Critical] Absence of signature deduplication for receipt in the binary_repair_oos_account
Submitted on Sep 26th 2024 at 15:03:22 UTC by @periniondon630 for Audit Comp | Shardeum: Core II
- Report ID: #35531
- Report Type: Blockchain/DLT
- Report severity: Critical
- Target: https://github.com/shardeum/shardus-core/tree/dev
- Impacts:
- Direct loss of funds
Description
Brief/Intro
The lack of signature deduplication for receipt in the binary_repair_oos_accounts handler allows an attacker to craft any necessary receipt and update the balance of any account, as long as the attacker's node is part of the execution group.
Vulnerability Details
The binary_repair_oos_accounts P2P handler calls the verifyAppliedReceipt function to validate the signatures in the receipt. However, it fails to check for duplicate signatures. This oversight allows an attacker with just one active node and a single signature to bypass the minimum signature requirement. As a result, a malicious receipt can be verified, and the account update will be successfully applied across the network."
Impact Details
An attacker can set the balance to any value for any account stored on their active node. The updated balance will be accepted as valid across the entire network.
References
https://github.com/shardeum/shardus-core/blob/23e06ded6744d8521cff9d749c1f1dd482c5fcb6/src/state-manager/AccountPatcher.ts#L490 https://github.com/shardeum/shardus-core/blob/23e06ded6744d8521cff9d749c1f1dd482c5fcb6/src/state-manager/TransactionConsensus.ts#L1714
Link to Proof of Concept
https://gist.github.com/periniondon630/e7f4488062f558b8909ed7d528446e37
Proof of Concept
Proof of Concept
I’ve added a callback for the event when a transaction is archived, following the method outlined in the documentation. Apply the patch from the gist to the attacker's node, wait for it to become active, and then send a transaction. Check the attacker's node output log—it will display a message when the transaction is archived, indicate which account will be targeted (the first one is selected). You can also observe that all the signatures are identical, yet the request is still processed successfully, and the account balance is updated.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The receipt verification counts signatures towards a minimum threshold without deduplicating them, so one signature repeated many times satisfies the requirement.
Impact
An attacker with one active node could set any account balance to any value, and the network would accept the change as valid.
What the attacker needed
Attacker runs an active node in the execution group; ability to send a transaction to the network
The fix
The handler should reject receipts that contain duplicate signatures before counting them towards the minimum threshold.
How it was found
- Apply the patch from the gist to the attacker's node.
- Wait for the attacker's node to become active.
- Send a transaction.
- Check the attacker's node output log for the archived transaction message and the targeted account.
- Observe that all signatures are identical yet the request is processed and the balance is updated.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A receipt is a record that other nodes have approved a change, and it is supposed to carry several different signatures from different nodes. The code counted signatures without noticing that they were all the same one copied many times, so one node could pretend to be many. That let the attacker change any account balance to whatever they wanted.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.