Anyone can transfer approved LP tokens
The Pool.transferLPs function can be called by any address to transfer LP tokens that have been approved for transfer, rather than only by the token owner or the approved address. This allows an attacker to move a lender's LP tokens to the approved address at an inappropriate time, disrupting the lender's position management strategy.
Source: https://github.com/sherlock-audit/2023-01-ajna-judging/issues/156
Found by
Jeiwan
Summary
Anyone can call the Pool.transferLPs function and transfer previously approved LP tokens to the approved address.
Vulnerability Detail
The Pool.transferLPs function allows to transfer LP tokens from one address to another. Even though it requires approving a transfer, actual transferring is left at the discretion of the approved address: approving allows the approved address to transfer LP tokens when appropriate. However, since the Pool.transferLPs function can be called by any address, the owner of the tokens may be impacted.
Impact
Lender's LP tokens may be transferred to an approve address at an inappropriate time, impacting the position management strategy of the lender.
Code Snippet
Tool used
Manual Review
Recommendation
Consider allowing calling the Pool.transferLPs function only to the owner or newOwner_.
Discussion
grandizzy
removing will fix label, will address after Sherlock contest
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 Pool.transferLPs function lacks an access control check to ensure the caller is either the token owner or the approved address.
Impact
A lender's LP tokens could be transferred to an approved address at an inappropriate time, potentially disrupting the lender's position management strategy.
What the attacker needed
LP tokens must be approved for transfer
The fix
The Pool.transferLPs function should be restricted so that only the owner or the newOwner_ can call it.
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.
LP tokens represent a share in a pool. Normally, only the owner can move their tokens, or someone they have explicitly approved. Here, the function that moves tokens does not check who is calling it, so anyone can trigger a transfer to the approved address, even if the owner did not intend it at that moment.
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.