39944 [W&A-Insight] incorrect default configuration leading to dead code
#39944 [W&A-Insight] Incorrect Default Configuration Leading to Dead Code
Submitted on Feb 11th 2025 at 12:08:13 UTC by @Blockian for Audit Comp | Shardeum: Ancillaries III
Report ID: #39944
Report Type: Websites and Applications
Report severity: Insight
Target: https://github.com/shardeum/archive-server/tree/itn4
Impacts:
Direct theft of user funds
Description
Shardeum Ancillaries
Incorrect Default Configuration Leading to Dead Code
Description
Discussions with the Shardeum team revealed that certain key features of the Archiver are currently unused. This suggests that the default configuration is incorrect, preventing critical functionality from being executed.
Example
When receiving receipt data from validators, storeReceiptData
is triggered. Depending on the Archiver's configuration, several execution flows are possible. The most important one involves calling Utils.robustQuery
to verify that the receipt matches on at least five nodes within the execution group.
However, in the current default configuration, this flow is inaccessible due to the following reasons:
config.newPOQReceipt === false
During
verifyReceiptData
, execution enters theif (config.newPOQReceipt === false)
block, preventing it from reachingverifyReceiptMajority
.
Even if
config.newPOQReceipt === true
, execution does reachverifyReceiptMajority
, but another issue arises:
Since
config.useRobustQueryForReceipt
is undefined,!undefined
evaluates totrue
, leading toverifyReceiptOffline
being executed instead ofverifyReceiptWithValidators
.As a result,
robustQuery
is never called, making it effectively dead code.
Impact
By skipping a crucial step in receipt verification, attackers gain more flexibility to bypass validation checks and exploit vulnerabilities. For instance, similar issues were demonstrated in report #39872.
Proposed Fix
Update the default configuration to align with the intended behavior of the Archiver, ensuring robustQuery
is executed as expected.
Proof of Concept
Proof of Concept
Apply the following
git diff
on the Archiver, we'll check the logs to see that this code isn't reached:
Add the following wallet to the
genesis.json
file:
Run the following code to execute a transaction which will yield a receipt
Inspect the Archiver logs and search for "BLOCKIAN". No logs will be found indicating the code is unreachable in the current state.
Was this helpful?