Delegators can Avoid Lock Commitments if they can Reliably get Themselves Blocked when Needed
A user with two accounts could delegate voting power from a short-lock account to a long-lock account, then get the short-lock account blocked to force undelegation and withdraw tokens early, while the long-lock account keeps extended voting power. This undermines the lock commitment incentives and could break the system.
Submitted by Respx
Users can enjoy the voting power of long lock times whilst not committing their tokens. This could cause the entire system to break down as the incentives don’t work any more.
Exploit Method
This exploit only works if a user is able to use the system and reliably get themselves blocked. Blocking policies are not in scope, so I am assuming there would be a list of bannable offences, and thus this condition could be fulfilled.
Consider a user with two accounts, called Rider and Horse.
Rider has 100,000 tokens.
Horse has 1 token.
Rider is a smart contract (required for an account to be bannable).
Rider locks for 1 week.
Horse locks for 52 weeks.
Rider delegates to Horse.
Horse can continue to extend its lock period and enjoy the maximised voting power.
Whenever the user wants their tokens back, they simply need to get the Rider account blocked.
When Rider is blocked, Blocklist.block(RiderAddress) is called, which in turn calls ve.forceUndelegate(RiderAddress).
Rider is now an undelegated account with an expired lock. It can call ve.withdraw() to get its tokens back.
The user can repeat this process with a fresh account taking the role of Rider.
Recommended Mitigation Steps
forceUndelegate() could be made to set locked_.end = fromLocked.end. This would mean that blocked users are still locked into the system for the period they delegated for. However, this does have the downside of tokens being locked in the system without the full rights of the system which other users enjoy.
Alternatively, this might be addressable through not blocking users that seem to be doing this, but of course that might have other undersirable consequences.
Proof of Concept
Please see warden’s full report for proof of concept.
lacoop6tu (FIAT DAO) confirmed, but disagreed with severity and commented:
2 — Med: Assets not at direct risk, but the function of the protocol or its availability could be impacted, or leak value with a hypothetical attack path with stated assumptions, but external requirements.
Justin Goro (judge) commented:
Well spotted by warden! The inflation of voting points may lead to an exploit, depending on possible proposals. Severity maintained.
IllIllI (warden) reviewed mitigation:
The sponsor disagreed with the severity and the judge updated the issue to be of Medium risk, and I agree with that severity. The finding was addressed via the fix for Issue 6 where the sponsor implemented the suggestion of the warden, to use the delegatee’s lock endpoint in the re-delegation to self, rather than using the delegator’s existing endpoint, since that endpoint may be far in the past. The delegate() and undelegate() functions have checks to ensure that the target for the votes always has at least as long a duration as the source of the votes. The fix enforces the same requirement for
forceUndelegate()by assigning a longer duration.
There are only two places in the code that change
LockedBalance.endto a smaller value, which could possibly violate the contract invariants: inquitLock()where the struct is never written back to storage, and inwithdraw()where it is indeed written back to storage. However, if the delegatee was able to withdraw, that means the delegator already would have been able to withdraw (since the delegatee’s timestamp must always be greater than or equal to the delegator’s when delegating or increasing), and therefore the mitigation is correct. The only extra wrinkle that the change makes, is that it now allows a malicious delegatee to front-run a delegator’s block with anincreaseUnlock(MAXTIME), but it’s not clear what advantage that would give the delegatee, and furthermore, the delegator already put his/her trust in the delegatee, so it’s something that could have occurred anyway, even without a call toforceUndelegate().
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely, the forceUndelegate function sets the delegator's lock end to its own expired end instead of the delegatee's longer end, allowing early withdrawal after being blocked.
Impact
The system's incentives could break down because users can get long-lock voting power without committing tokens for the full period, though this requires the ability to reliably get an account blocked.
What the attacker needed
Two accounts, one a smart contract; ability to get an account blocked; delegation enabled
How it was found
- Create two accounts: Rider (a smart contract with many tokens, locked for 1 week) and Horse (1 token, locked for 52 weeks).
- Rider delegates its voting power to Horse.
- Horse extends its lock period to maintain maximised voting power.
- When the user wants tokens back, get Rider blocked, which triggers forceUndelegate on Rider.
- Rider, now undelegated with an expired lock, calls withdraw() to retrieve its tokens.
- Repeat with a fresh Rider account.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
In this system, users lock tokens for a period to get voting power. Normally, a longer lock gives more power but means tokens are stuck longer. The report shows a trick: use two accounts, one with a short lock and one with a long lock, and delegate power from the short-lock account to the long-lock one. If the short-lock account gets blocked, the system forces it to undelegate, letting the user withdraw tokens early while the long-lock account still has boosted voting power.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.