Anyone can list anchors / curate tokens
The Router.listAnchor and replaceAnchor functions lack proper access control, allowing anyone to add or replace anchor tokens by exploiting a weak check that can be bypassed with a minimal liquidity addition. An attacker could manipulate which pools receive rewards and potentially disrupt the protocol's economics.
Vader Protocol contest
Originally disclosed on Code4rena
The Router.listAnchor function can be called by anyone and tokens can be added. The only check is that require(iPOOLS(POOLS).isAnchor(token)); but this can easily be set by calling Pools.addLiquidity(VADER, token, _) once even without actually sending any tokens to the contract. This makes it an essentially useless check.
This only works initially as long as the anchorLimit has not been reached yet. However, the replaceAnchor can be used in the same way and flash loans can be used to get around the liquidity restrictions and push another anchor token out of the price range as these checks use the current reserves.
Anchored pools are automatically curated pools and determine if a pool receives rewards. An attacker can remove rewards of a curated pool this way and add rewards to their own pool with a custom token they control.
After a pool has been anchored through flash loans, liquidity can be withdrawn which could make the anchor price easy to manipulate in the next block and launch other attacks.
Recommend revisiting the _isAnchor[token] = true; statement in addLiquidity, it seems strange without any further checks. Consider making listAnchor / replaceAnchor DAO-only functions and make them flash-loan secure. One should probably use time-weighted prices for these pools for the bounds check.
strictly-scarce (vader) disputed:
The protocol is intended to be launched with 5 anchors so it can only be attacked by using
replaceAnchor(), in which case slip-based fees apply for attacks and thwart the attack path.
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 access control on listAnchor and replaceAnchor is missing, and the anchor check relies on a flag that can be set by anyone through addLiquidity without proper validation.
Impact
An attacker could remove rewards from a curated pool and add rewards to their own pool, and potentially manipulate anchor prices for further attacks; however, the protocol disputes this, stating that with 5 anchors only replaceAnchor is possible and slip-based fees thwart the attack.
What the attacker needed
None
The fix
The functions listAnchor and replaceAnchor should be restricted to DAO-only and made flash-loan secure, possibly using time-weighted prices for bounds checks.
How it was found
- Call Pools.addLiquidity with the VADER token and the attacker's token to set the anchor flag for that token.
- Call Router.listAnchor with the attacker's token to add it as an anchor (if anchorLimit not reached).
- Alternatively, use flash loans to meet liquidity requirements and call replaceAnchor to swap out an existing anchor.
- Withdraw liquidity after anchoring, potentially making the anchor price easy to manipulate.
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, certain tokens are designated as 'anchors' to decide which pools get rewards. The function to set an anchor was supposed to be restricted, but anyone could call it because the only requirement was that the token had been added to the pool at least once, which is easy to fake. So an attacker could make their own token an anchor and steal rewards from legitimate pools.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.