Open code423n4 opened 1 year ago
141345 marked the issue as primary issue
Keref marked the issue as sponsor acknowledged
Cannot remove to
from param list as the stated goal is to be compatible with uniswap v2 interface
Keref marked the issue as sponsor confirmed
Keref marked the issue as disagree with severity
Although it looks like a severe issue, in our case this was actually on purpose as this is a compatibility module used for OPM only, where it's always msg.sender == to
, and to avoid potential spam under GE banner (ppl swapping spam tokens to famous addresses).
So it's not a high risk issue, maybe low only
gzeon-c4 marked the issue as satisfactory
gzeon-c4 marked the issue as selected for report
gzeon-c4 changed the severity to 2 (Med Risk)
recommend to restrict caller to OPM
We could have several (out of this audit scope) contracts that need to swap, restricting to msg.sender is enough
right, so may be checking msg.sender == to ?
Lines of code
https://github.com/code-423n4/2023-08-goodentry/blob/71c0c0eca8af957202ccdbf5ce2f2a514ffe2e24/contracts/helper/V3Proxy.sol#L112-L194
Vulnerability details
Impact
The functions above can be used to swap tokens, however the swaps are not sent to the provided address. Instead they are sent to the msg.sender. This could cause issues if the user has been blacklisted on a token. Or if the user has a compromised signature/allowance of the target token and they attempt to swap to the token, the user looses all value even though they provided an destination adress
Proof of Concept
Here is one of the many functions with this issue, As we can see after the swap is completed, tokens are sent back to the msg.sender from the router not to the
to
addressTools Used
Manual Review. Uniswap Router: https://github.com/Uniswap/v3-periphery/blob/main/contracts/SwapRouter.sol
Recommended Mitigation Steps
The uniswap router supports inputting of a destination address. Hence the router should be called with the to address not the msg.sender. Else remove the
address to
from the parameter listAssessed type
Uniswap