Beginner FriendlyFoundryNFT
100 EXP
View results
Submission Details
Severity: high
Invalid

H1: Any address can mint unlimited amount of Rapper NFTs using the OneShot::mintRapper() function and can block the `RapBattle::goOnStageOrBattle`

Summary

The OneShot::mintRapper() function allows for unlimited minting of Rapper NFTs. This function can then mint multiple NFTs, stake them for a certain period, unstake them, and receive CredTokens. These can then be used in battles. This effectively allows accumulating the CredTokens on a single NFT, which may then use the power of all remaining NFTs to stake and earn more CredTokens, while the CredToken-richest NFT can place a bet so high, that any other user would not be able to participate in a rapBattle due to the require(defenderBet == _credBet, "RapBattle: Bet amounts do not match"); in the RapBattle::_battle function that requires both rapperNFTs to deposit the same amount in CredToken. With a power of >50% (that may be achieved using bots), this has the potential to disrupt the work of the protocol. This is rather close to a 51% attack where the actor controlling over 51% of the assets may effectively cause the system to break.

Vulnerability Details

The OneShot::mintRapper() function allows any address to mint an unlimited number of Rapper NFTs. All these NFTs can be stacked to be eligible for the CredToken. These NFTs can then participate in RapBattle::goOnStageOrBattle and use an elimination system (16 NFTs with 1 CredToken fighting in doubles => 8 NFTs with 2 Cred tokens => 4 NFTs with 4 CredTokens => 2 NFTs with 8 CredTokens => 1 NFT with 16 CredToken) spiral to one NFT that would have the CredTokens. Remaining NFTs may be staked again to earn more CredTokens while the "richest one" can enter the RapBattle::goOnStageOrBattle, betting all CredTokens it has and if there are sufficient NFTs that backed the richest, there would be no eligible player that would be able to stake equal amount of CredTokens as required by the RapBattle::_battle function. This process of "slave" NFTs can not only be repeated to enrich the richest, but more NFTs can be minted to the same address which can increase the ability of malicious users to earn more CredToken and repeat the whole process.

The holder of multiple NFTs does not even have to make them battle in the end since the CredToken contract keeps all the Cred tokens under the same address. This can lead to one account unlimitedly minting new NFTs, staking them, and earning CredToken that can at a certain point be used to block the RapBattle::goOnStageOrBattle. Once another of the actor's NFTs can match the bet, the two NFTs may battle. The winnings will go to the malicious address that can then do the same thing again.

Impact

Evaluated as high impact, medium/high likelihood since the unlimited opportunity to mint NFTs, the option to repeatedly stake and unstake them, making them battle against each other and build one NFT that would have >50% of the tokens minted. Other users would then have to either do the same, or the malicious user may use the remaining NFTs and continuously attack the functionality (possible to do so using bots and given the unlimited option to mint NFTs). Such behavior can knock down the operability of the protocol.

Tools Used

Static analysis, local testing (possibility to mint multiple NFTs for same address and make them battle against each other)

Recommendations

Require that at least the same address cannot be onStage with another of its NFTs. Vividly recommended is to limit the maximum bet that can be placed in order to make deterministic threshold of the maximum bet that can be matched by other users.

Updates

Lead Judging Commences

inallhonesty Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Design choice
awacs Submitter
over 1 year ago
inallhonesty Lead Judge
over 1 year ago
inallhonesty Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Design choice

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.