#37427 [SC-Critical] Delegation is not updated on slash and unlock
Submitted on Dec 4th 2024 at 14:44:39 UTC by @shadowHunter for Audit Comp | Celo
Report ID: #37427
Report Type: Smart Contract
Report severity: Critical
Target: https://github.com/celo-org/celo-monorepo/blob/release/core-contracts/12/packages/protocol/contracts/governance/LockedGold.sol
Impacts:
Manipulation of governance voting result deviating from voted outcome and resulting in a direct change from intended effect of original results
Description
Brief/Intro
It was observed that delegation is not updated on slashing for reporter and caller in unlock operation. This causes incorrect balance accounting
Vulnerability Details
Observe the 'slash' function and 'unlock` function
Both of this function calls
_incrementNonvotingAccountBalance
and_decrementNonvotingAccountBalance
which changes the non voting balance and thusAccountTotalLockedGold
Lets say User A is unlocking or calling slash on another User B then it is always required to call
_updateDelegatedAmount
on both Users so that delegated balance gets updated correctly as per new total lockedBut the same is missing in both functions
Impact Details
Delegated balance power will be incorrect
References
In unlock
call _updateDelegatedAmount(msg.sender);
In slash
call _updateDelegatedAmount(reporter);
Proof of Concept
Proof of Concept
Was this helpful?