This repository has been archived by the owner on May 26, 2023. It is now read-only.
GimelSec - Refunding NFT doesn't decrease the length of nftDeposits. A malicious user can block other users from depositing any NFT. #483
Labels
Duplicate
A valid issue that is a duplicate of an issue with `Has Duplicates` label
Medium
A valid Medium severity issue
Reward
A payout will be made for this issue
Sponsor Confirmed
The sponsor acknowledged this issue is valid
Will Fix
The sponsor confirmed this issue will be fixed
GimelSec
high
Refunding NFT doesn't decrease the length of nftDeposits. A malicious user can block other users from depositing any NFT.
Summary
nftDepositLimit
is hardcoded in all four kinds of bounty. AndreceiveNft()
checksnftDeposits.length < nftDepositLimit
. The problem is that refunding an NFT won’t decreasenftDeposits.length
. A malicious user can deposit a NFT, then refund it. The user can do it repeatedly to fill upnftDeposits
. After that, no one is able to deposit any NFT.Vulnerability Detail
nftDepositLimit
is hardcoded in all four kinds of bounty.https://github.com/sherlock-audit/2023-02-openq/blob/main/contracts/Bounty/Implementations/AtomicBountyV1.sol#L49
And
receiveNft
would checknftDeposits.length < nftDepositLimit
https://github.com/sherlock-audit/2023-02-openq/blob/main/contracts/Bounty/Implementations/AtomicBountyV1.sol#L133
However, refunding NFT won’t decrease the length of
nftDeposits[]
. So a malicious user can do the following things to block other users from depositing any NFT.receiveNft
always reverts)Impact
A malicious user can block other users from depositing any NFT.
Code Snippet
https://github.com/sherlock-audit/2023-02-openq/blob/main/contracts/Bounty/Implementations/AtomicBountyV1.sol#L133
https://github.com/sherlock-audit/2023-02-openq/blob/main/contracts/Bounty/Implementations/AtomicBountyV1.sol#L49
https://github.com/sherlock-audit/2023-02-openq/blob/main/contracts/Bounty/Implementations/OngoingBountyV1.sol#L49
https://github.com/sherlock-audit/2023-02-openq/blob/main/contracts/Bounty/Implementations/TieredFixedBountyV1.sol#L49
https://github.com/sherlock-audit/2023-02-openq/blob/main/contracts/Bounty/Implementations/TieredPercentageBountyV1.sol#L48
Tool used
Manual Review
Recommendation
There are two things that need to be fixed. First,
nftDepositLimit
should not be hardcoded, it should be decided by the issuers. And don’t usenftDeposits.length
in the check whennftDeposits.length
can only increase. Use a new variable likenftDepositCount
to record the actual amount of nftDeposit.Duplicate of #262
The text was updated successfully, but these errors were encountered: