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

Challenger can participate in battles for free.

Summary

Challenger can participate in battles for free because the code on line #49 is commented.

Vulnerability Details

By commenting the code on line #49 , the challenger does not send funds to the contract.
No check is made if he even has that amount. This will cause the _battle function to revert when the defender wins:

// If random <= defenderRapperSkill -> defenderRapperSkill wins, otherwise they lose
if (random <= defenderRapperSkill) {
// We give them the money the defender deposited, and the challenger's bet
credToken.transfer(_defender, defenderBet);
credToken.transferFrom(msg.sender, _defender, _credBet);

If the challenger has not approved the contract to transfer funds or he does not have the necessary balance. Thus the challenger can participate for free.

Impact

High because the challenger can never win.

Tools Used

Recommendations

Transfer the tokens from the challenger to the contract, like the defender's tokens.

Updates

Lead Judging Commences

inallhonesty Lead Judge over 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

missing check for sufficient `_credBet_` approval

Support

FAQs

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