TwentyOne

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

Lack of Access Control Allows Unauthorized Viewing of Cards

Summary

The getPlayerCards and getDealerCards functions lack access control, allowing any user to call these functions and retrieve the cards of any player or dealer by specifying their address. This violates the principle of data confidentiality, as players should only be able to view their own cards and dealers should only access their own cards.

Impact

Unauthorized users can view sensitive game information, such as the cards held by other players and dealers.

Tools Used

Manual

Recommendations

function getPlayerCards(
address player
) public view returns (uint256[] memory) {
+ require(msg.sender == player);
return playersDeck[player].playersCards;
}
function getDealerCards(
address player
) public view returns (uint256[] memory) {
+ require(msg.sender == player);
return dealersDeck[player].dealersCards;
}
Updates

Lead Judging Commences

inallhonesty Lead Judge 6 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.