Closed sherlock-admin2 closed 3 months ago
confirm that this is not strictly the best way to write the code
not a real bug because it's not the inference's base responsibility to correctly filter the incorrect block height. It is the responsibility of the chain to reject incorrect bundle data.
probably fixed in https://github.com/allora-network/allora-chain/pull/494 regardless
No real security impact
Minato7namikazi
Medium
Inconsistent
valueBundles
Data inMsgInsertBulkReputerPayload
Vulnerability Detail
The issue arises in the
SendReputerModeData
function, specifically in how thevalueBundles
slice is populated and used:The
valueBundles
slice is initially populated with allReputerValueBundle
objects received from reputers, regardless of whether theirblockCurrentHeight
matches the selectedblockCurrentHeight
. Later, a filtered slicevalueBundlesFiltered
is created, containing only the bundles with the correct block height.However, the code then proceeds to use the original, unfiltered
valueBundles
slice in theMsgInsertBulkReputerPayload
request. This means that the request might includeReputerValueBundle
objects with incorrect block heights, leading to potential inconsistencies or errors when processed on the blockchain.Why It's a Problem
valueBundles
(due to the filtering logic), it could lead to consensus issues on the blockchain.Code Snippet
https://github.com/sherlock-audit/2024-06-allora/blob/main/allora-inference-base/cmd/node/appchain.go#L635
Tool used
Manual Review
Recommendation
Key Improvements
ReputerValueBundle
objects are sent to the blockchain.PoC
Explanation:
ReputerValueBundle
objects, one withBlockHeight
10 (correct) and another withBlockHeight
20 (incorrect).BlockHeight
10.MsgInsertBulkReputerPayload
and intentionally use the unfilteredvalueBundles
slice, which contains the incorrect bundle.Expected Output:
When you run this code, you will see the output:
This output demonstrates that the original code would include the incorrect bundle in the request, confirming the bug.