Users may unintentionally remove liquidity under a phishing attack.
The removeLiquidity function uses tx.origin to identify the caller, assuming it is always invoked via the router. Under a phishing attack, a user could be tricked into calling the function directly, unintentionally removing their liquidity.
Vader Protocol contest
Originally disclosed on Code4rena
The removeLiquidity function in Pools.sol uses tx.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 unintentionally remove liquidity.
Referenced code: Pool.sol#L77-L79
Recommend consider making the function _removeLiquidity external, which can be utilized by the router, providing information of which person removes his liquidity.
strictly-scarce (vader) acknowledged:
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.
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
Likely the function relies on tx.origin for authorisation instead of using an explicit caller parameter, allowing a phishing site to trigger the function directly.
Impact
A phishing attack could lead to unintentional removal of liquidity, resulting in loss of user funds.
What the attacker needed
User is phished; user interacts with malicious site
The fix
The function should be made external and require the caller to specify which user is removing liquidity, so the router can pass the correct 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.
This smart contract function uses tx.origin to check who is calling it, but that can be spoofed if a user is tricked into signing a transaction on a malicious site. The user might then remove their own liquidity without meaning to.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.