The point rewards system is based on an off-chain stateful subscriber which allocates points to wallets based on the Staked(amount, onBehalfOf) events emitted from the users' interaction with the Steaking contract on-chain, however this mechanism has a flawed and a malicious user can exploit it to mint unlimited points to themselves.
The Steaking contract provides stake
function for staking ether and another unstake
function for unstaking ether. The off-chain subscriber is only aware of the former and ommits the Unstaked(by, amount) event.
Here is a scenario in which a malicious attacker can game the system.
User stakes 1 ether in Steaking.
Off-chain subscriber awards 1000 points to the user.
User unstakes that 1 ether from Steaking.
User stakes the same 1 ether in Steaking, again.
Off-chain subscriber awards another 1000 points to the user, amounting to the total of 2000 points.
The same sequence can be repeated ad infinitum.
A malicious user can award themselves infinite points and break the invariant that the total points awarded must be proportional to the total ether staked in Steaking contract.
High impact as it is a fundamental disruption of functionality, however given that the mitigation is possible by fixing the bug on the server and replaying the blockchain history to recalculate the points I am downgrading to medium impact.
Manual Review
Fix the bug by handling the antagonist Unstaked(by, amount) event on the off-chain stateful subscriber in a similar way to the Staked(amount, onBehalfOf) event and reduce the points awarded when ether is unstaked from the Steaking contract on-chain.
Update the main loop of the server in main.js
:
However, depending on the implementation and the method used for querying (e.g., across different nodes or using filters), there might be inconsistencies or reordering. This is more likely when querying events across multiple blocks or when dealing with a large number of events.
If a block is part of a chain reorganization (reorg), the events from that block could be invalidated or re-emitted in a different order in the finalized block that replaces it.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.