Open code423n4 opened 3 years ago
If a user has been phished, consider all their funds already stolen.
Vader's security assumption is a user is not phished.
Our decision matrix for severity:
0: No-risk: Code style, clarity, off-chain monitoring (events etc), exclude gas-optimisations 1: Low Risk: UX, state handling, function incorrect as to spec 2: Funds-Not-At-Risk, but can impact the functioning of the protocol, or leak value with a hypothetical attack path with stated assumptions, but external requirements 3: Funds can be stolen/lost directly, or indirectly if a valid attack path shown that does not have handwavey hypotheticals.
Recommended: 0
This is reasonably easy to mitigate as an issue and failure to do so does leave an attack vector open. If exploited it will result in a loss of user funds.
Handle
shw
Vulnerability details
Impact
The
removeLiquidity
function inPools.sol
usestx.origin
to determine the person who wants to remove liquidity. However, such a design is dangerous since the pool assumes that this function is called from the router, which may not be true if the user is under a phishing attack, and he could unintendedly remove liquidity.Proof of Concept
Referenced code: Pool.sol#L77-L79
Tools Used
None
Recommended Mitigation Steps
Consider making the function
_removeLiquidity
external, which can be utilized by the router, providing information of which person removes his liquidity.