Closed code423n4 closed 1 year ago
This is expected behavior. The contract is designed to never store funds. However, since it's also designed to receive intermediate funds during multi-pool swaps: https://github.com/code-423n4/2022-12-Stealth-Project/blob/fc8589d7d8c1d8488fd97ccc46e1ff11c8426ac2/router-v1/contracts/Router.sol#L151 And it can be a recipient of funds: https://github.com/code-423n4/2022-12-Stealth-Project/blob/fc8589d7d8c1d8488fd97ccc46e1ff11c8426ac2/router-v1/contracts/Router.sol#L170 The functions mentioned in the report are intentionally made public so that users could withdraw any leftovers from the contract after swaps.
Also, the Router contract is a permissionless contract that doesn't implement access control, so there's no way to identify who will be the owner of tokens accumulated in the contract.
kirk-baird marked the issue as primary issue
As @Jeiwan said, this is the expected behavior and is not a bug.
gte620v marked the issue as sponsor disputed
kirk-baird marked the issue as nullified
This is intended functionality of the router and therefore I'm going to nullify these issues. Furthermore, it is expected the users of the router to sweep tokens at the end of a call.
Lines of code
https://github.com/code-423n4/2022-12-Stealth-Project/blob/fc8589d7d8c1d8488fd97ccc46e1ff11c8426ac2/router-v1/contracts/Router.sol#L59-L82
Vulnerability details
Impact
Router.unwrapWETH9/refundETH/sweepToken is used to withdraw WETH/ETH/ERC20 tokens in the Router contract, but these three functions do not implement access control, which allows anyone to call these three functions to withdraw the cryptocurrency in the Router contract
Note: In Router.removeLiquidity/exactOutputInternal, when recipient == 0, tokens will be sent to the Router contract
Proof of Concept
https://github.com/code-423n4/2022-12-Stealth-Project/blob/fc8589d7d8c1d8488fd97ccc46e1ff11c8426ac2/router-v1/contracts/Router.sol#L59-L82 https://github.com/code-423n4/2022-12-Stealth-Project/blob/fc8589d7d8c1d8488fd97ccc46e1ff11c8426ac2/router-v1/contracts/Router.sol#L295-L306 https://github.com/code-423n4/2022-12-Stealth-Project/blob/fc8589d7d8c1d8488fd97ccc46e1ff11c8426ac2/router-v1/contracts/Router.sol#L121-L122
Tools Used
None
Recommended Mitigation Steps
Consider adding access control to Router.unwrapWETH9/refundETH/sweepToken