The buyer of the the NFT position can be front-run by the seller #196
Labels
bug
Something isn't working
downgraded by judge
Judge downgraded the risk level of this issue
grade-c
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
unsatisfactory
does not satisfy C4 submission criteria; not eligible for awards
Lines of code
https://github.com/code-423n4/2023-05-ajna/blob/main/ajna-core/src/PositionManager.sol#L352
Vulnerability details
Impact
Position owners are able to list an NFT that represents their position on secondary markets. When a buyer purchases this NFT the owner of it is able to front-run the transaction and call
redeemPositions()
. By calling this the owner is able to transfer all of the lp from the contract to themselves. At this point the NFT has lost most all of its value yet the buyer will still end up buying it. Loss of funds for the buyer.Proof of Concept
The value of this NFT is derived from the value of that the position holds. Which allows the following to be possible:
Alice owns a position that is worth 10
eth
Alice mints an NFT to represent her position
Alice offers her nft on a secondary market for 9
eth
Bob sees the good deal and makes a transaction to buy the position for 9
eth
Alice front-runs Bob and calls
redeemPositions()
Alice no has the 10
eth
worth of lpBob's transaction completes and he gets a worthless NFT
Alice gets Bobs 9
eth
Alice 19 eth
Bob 0 eth and a worthless NFT
Tools Used
Manual Analysis
Recommended Mitigation Steps
One solution would be to automatically burn the NFT when the position has been redeemed.
Assessed type
Timing
The text was updated successfully, but these errors were encountered: