TwentyOne

First Flight #29
Beginner FriendlyGameFiFoundrySolidity
100 EXP
View results
Submission Details
Severity: high
Invalid

Anyone can view the dealer's hand count.

Summary

There are no restrictions on dealersHand, allowing anyone to view the dealer's hand.

Vulnerability Details

https://github.com/Cyfrin/2024-11-TwentyOne/blob/a4429168302722d14a5e5996d25d6fc5be22a899/src/TwentyOne.sol#L43

he function is marked as public, which allows anyone to freely view the dealer's hand count. This enables players to compare their hand's value with the dealer's in advance, giving them the opportunity to gain an unfair advantage.

Impact

The game becomes unfair.

Tools Used

Manual review

Recommendations

"Check if the caller is the dealer

function dealersHand(address player) public view returns (uint256) {
uint256 dealerTotal = 0;
// Assuming the dealer's address is the one calling the function
address dealer = msg.sender;
// Ensure the caller is the dealer
require(dealer == player, "Only the dealer can check the dealer's hand");
//...
}
Updates

Lead Judging Commences

inallhonesty Lead Judge 11 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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