The increase function in the veRAACToken contract contains a critical bug where the additional locked amount (amount) is double-counted when calculating voting power. This results in incorrect voting power calculations and over-minting of veTokens.
The vulnerability is located in the increase function:
Double-Counting of amount:
The _lockState.increaseLock function increases the user's locked amount (userLock.amount) by amount.
Immediately after, the calculateAndUpdatePower function is called with userLock.amount + amount, which effectively adds amount twice:
Once in _lockState.increaseLock.
Again in the calculateAndUpdatePower call.
This results in the voting power being calculated based on lastLock + amount + amount instead of lastLock + amount.
Incorrect Minting Logic:
The _mint function is called with newPower - balanceOf(msg.sender), where newPower is derived from the double-counted amount.
This leads to over-minting of veTokens, as the voting power is artificially inflated.
Over-Minting of veTokens:
The double-counting of amount results in newPower being larger than it should be, leading to more veTokens being minted than intended.
Economic Exploitation:
An attacker could exploit this bug to mint excessive veTokens, gaining disproportionate voting power or rewards.
Manual Code Review
To fix the double-counting issue, the calculateAndUpdatePower function should be called with userLock.amount (amount).
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.