The go_on_stage_or_battle function in the battle_addr::rap_battle module does not validate the bet_amount parameter before processing it. Specifically, it fails to check if bet_amount is positive (i.e., greater than zero).
When a first player initially submits bet_amount = 0, the transaction will proceed without depositing any CRED into the prize pool. Then when the next player calls the function, he will have to submit the same zero value as bet_amount, as the game requires the two players match equal CRED bets.
Likelihood:
The likelihood of this bug being exploited is high, as the go_on_stage_or_battle
function is a public entry point, accessible to any user interacting with the contract, and there are no barriers (e.g., access control) preventing a user from submitting a bet_amount of zero.
Impact:
This will result to the winner gaining zero CRED coin when the battle ends, disrupting the intended game mechanics.
Add a validation check for a positive bet amount in go_on_stage_or_battle
function before processing the bet:
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.
The contest is complete and the rewards are being distributed.