Lack of input validation in replacePool() allows curated pool limit bypass in Router.sol
The replacePool() function in Router.sol does not check that the old token exists and is curated, so a caller can pass a non-existent old token (even the zero address) and have a new token marked as curated. This bypasses the curated pool limit that is only enforced in curatePool().
Vader Protocol contest
Originally disclosed on Code4rena
There is no input validation in replacePool() function to check if oldToken exists and is curated. Using a non-existing oldToken (even 0 address) passes the check on L236 (because Pools.getBaseAmount() will return 0 for the non-existing token) and newToken will be made curated. This can be used to bypass the curatedPoolLimit enforced only in curatePool() function.
Recommend checking if oldToken exists and is curated as part of input validation in replacePool() function.
strictly-scarce (vader) confirmed:
Valid
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 replacePool() function lacks input validation to confirm that oldToken exists and is curated before allowing the replacement.
Impact
An attacker could bypass the curatedPoolLimit and add more tokens to the curated list than intended, potentially disrupting the intended token curation.
What the attacker needed
Ability to call replacePool()
The fix
The replacePool() function should be fixed by adding input validation to check that oldToken exists and is curated.
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.
A smart contract has a function that lets someone swap one token for another in a list of approved tokens. The contract forgot to check that the token being replaced is actually in that list. So someone can name a token that does not exist, and the contract will still add their new token to the list, getting around the limit on how many tokens can be added.
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.