Deployments.sol uses the wrong address for UNIV2 router which causes all Uniswap V2 calls to fail
The contract Deployments.sol incorrectly set the UNIV2_ROUTER constant to the Uniswap V3 router address instead of the V2 router address. As a result, all calls to Uniswap V2 functions would revert, making Uniswap V2 unusable.
Source: https://github.com/sherlock-audit/2022-09-notional-judging/issues/32
Found by
0x52
Summary
Deployments.sol accidentally uses the Uniswap V3 router address for UNIV2_ROUTER which causes all Uniswap V2 calls to fail
Vulnerability Detail
IUniV2Router2 internal constant UNIV2_ROUTER = IUniV2Router2(0xE592427A0AEce92De3Edee1F18E0157C05861564);
The constant UNIV2_ROUTER contains the address for the Uniswap V3 router, which doesn't contain the "swapExactTokensForTokens" or "swapTokensForExactTokens" methods. As a result, all calls made to Uniswap V2 will revert.
Impact
Uniswap V2 is totally unusable
Code Snippet
Tool used
Manual Review
Recommendation
Change UNIV2_ROUTER to the address of the V2 router:
IUniV2Router2 internal constant UNIV2_ROUTER = IUniV2Router2(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
Discussion
jeffywu
@weitianjie2000 I believe this has been fixed subsequently
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
The constant UNIV2_ROUTER was assigned the Uniswap V3 router address instead of the V2 router address.
Impact
Uniswap V2 functionality is completely unusable because all calls revert.
What the attacker needed
None
The fix
The UNIV2_ROUTER constant should be changed to the correct Uniswap V2 router address.
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 uses a fixed address to talk to Uniswap, a service for swapping tokens. The developer accidentally used the address for the newer version (V3) instead of the older version (V2). Because the newer version doesn't have the same functions, every attempt to use V2 fails.
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.