In V3Utils::execute, users can Execute instruction by pulling approved NFT instead of direct safeTransferFrom call from owner. However there is no validation whether the caller is the owner of the tokenId or approved address.
Proof of Concept
As we can see in executeWithPermit, there is a validation:
if (nonfungiblePositionManager.ownerOf(tokenId) != msg.sender) {
revert Unauthorized();
}
But there is no such check in execute or a check if the msg.sender is approved.
Consider the following scenario:
User A approves nonfungiblePositionManager.
User A calls execute with his instructions.
User B sees the tx and frontruns User A, but with different instructions.
Tools Used
Manual Review
Recommended Mitigation Steps
Add validation if the msg.sender is owner or approved.
Lines of code
https://github.com/code-423n4/2024-03-revert-lend/blob/main/src/transformers/V3Utils.sol#L115-L352
Vulnerability details
Impact
In
V3Utils::execute
, users canExecute instruction by pulling approved NFT instead of direct safeTransferFrom call from owner
. However there is no validation whether the caller is the owner of the tokenId or approved address.Proof of Concept
As we can see in
executeWithPermit
, there is a validation:But there is no such check in
execute
or a check if themsg.sender
is approved.Consider the following scenario:
nonfungiblePositionManager
.execute
with his instructions.Tools Used
Manual Review
Recommended Mitigation Steps
Add validation if the
msg.sender
is owner or approved.Assessed type
Access Control