If auction price goes to 0, NFT might become unclaimable/ stuck forever
Some ERC20 tokens revert on zero-value transfers. If an NFT auction price reaches zero, claiming the NFT always reverts, leaving it stuck forever.
Source: https://github.com/sherlock-audit/2023-02-kairos-judging/issues/17
Found by
GimelSec, Koolex, Vagner, chaduke, deadrxsezzz
Summary
There are certain ERC20 tokens which revert on zero value transfers (e.g. LEND). If an NFT's price drops down to 0, nobody will be able to claim it as the transaction will always revert.
Vulnerability Detail
The time of loan.auction.duration passes. The NFT's price is 0. Alice tries to purchase/ claim it, however the ERC20 token on which the auctions is going reverts on 0 value transfers. The NFT becomes stuck forever and no one can take the rights of it.
Consider the following scenarios: 1.
The ERC20 used in the auction is pausable Throughout the auction, the token gets paused. Now, the auction is still going, the price is dropping and no one is able to claim it. The ERC20 doesn't get unpaused up until the auction ends. Since no one was able to purchase the NFT during the auction, its price now is 0. Since the token reverts on zero value transfers, the NFT is stuck forever.
Alice is looking at NFT auction which is coming near its end. Alice is looking to purchase the NFT for as little as possible and starts monitoring the mempool, so in case someone tries to buy it, she can front-run the transaction and get the NFT herself. At this point Alice getting the NFT should be guaranteed However, there aren't many other active users/ they aren't paying attention to said NFT. Little time goes by, auction ends and price is set to 0. Alice is happy she can claim the NFT for free. However, the token reverts on 0 value transfers and now no one can claim it and the NFT is lost forever.
Impact
NFT might be lost forever
Code Snippet
Tool used
Manual Review
Recommendation
Address ERC20 tokens which revert on 0 value transfers. Auctions which are run with such tokens should have a minimal price of 1 wei ( instead of 0)
Discussion
npasquie
fix: https://github.com/kairos-loan/kairos-contracts/pull/49
IAm0x52
Fixes look good. Now uses SafeERC20 and skips zero transfers
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 auction contract does not handle ERC20 tokens that revert on zero-value transfers, and allows the price to reach zero.
Impact
The NFT could be lost forever because no one can claim it.
What the attacker needed
Auction uses ERC20 that reverts on zero transfers; auction price reaches zero
The fix
The fix uses SafeERC20 and skips zero transfers, as confirmed in the discussion.
How it was found
- An NFT auction runs with an ERC20 token that reverts on zero-value transfers.
- The auction ends with the price at zero.
- A user tries to claim the NFT, but the zero-value transfer reverts.
- The NFT remains stuck and cannot be claimed.
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.
An NFT auction lowers the price over time. If the price reaches zero, the system tries to transfer zero tokens, but some tokens reject zero transfers. This makes the NFT impossible to claim.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.