Closed code423n4 closed 3 years ago
This is an intentional design choice. There are code comments in the contract that say "@/dev Ensure that the pool is trusted before calling this function. The pool can steal users' tokens.".
The reason this design was taken is that using exactInput
and similar functions, an attacker can steal all user tokens in a single transaction (all tokens - usdt, dai, weth etc). Therefore, we added an extra check to save users from themselves.
On the other hand, exactInputSingle
and similar functions only allow theft of one token in the worst case. This is the same as just transferring the token to a wrong address. Therefore, for gas efficiency, we omitted the check.
As a design choice previously disclosed (through a code comment), this is not a previously unknown vulnerability.
replacing severity label with invalid
as per judges findings sheet
Handle
gpersoon
Vulnerability details
Impact
Some of the functions of TridentRouter.sol contain the check: isWhiteListed(..). This includes:
However the following similar functions don't contain isWhiteListed(..):
This doesn't seem logical.
Proof of Concept
https://github.com/sushiswap/trident/blob/master/contracts/TridentRouter.sol function exactInputSingle(ExactInputSingleParams calldata params) public payable returns (uint256 amountOut) { .. // No isWhiteListed
Tools Used
Recommended Mitigation Steps
Check if the following functions also need isWhiteListed(..) to whitelist the pool. If so, add the isWhiteListed() statement: