TwentyOne::call If the randomness in the call function is broken, it could significantly impact the fairness and predictability of the game.Description: The randomness relies on factors like block.timestamp or msg.sender, a malicious party could influence the randomness by:
1. Controlling the timing of their transaction (block.timestamp).
2. Using alternate accounts (msg.sender).
Impact: Since the randomness is derived from on-chain data, an attacker monitoring the network could predict the next standThreshold and submit a tailored transaction before others (front-running), gaining an advantage.
Proof of Concept:
Validators can know ahead of time the block.timstamp and block.difficulty and use that to predict when/how to participate. See the [solidity blog on prevrandao] (https://soliditydeveloper.com/prevrandao).`block.difficulty` was recently replaced with prevrandao.
Users can mine/manipulate their msg.sender value to result in the their address being used to generate the winner!
Users can revert their selectWinner transcation if they don't like the winner or resulting puppy.
Using on-chain values as a randomness seed is a well-documented attack vector in the blockchain space.
Recommended Mitigation:
Use a Secure Source of Randomness: Replace block.timestamp and block.prevrandao with a reliable source like Chainlink VRF (Verifiable Random Function), which provides tamper-proof randomness.
Delay-Based Randomness: Introduce a commit-reveal scheme where randomness is determined over multiple blocks, making it harder for attackers to predict or manipulate the outcome.
Manual Review
Slither and aderyn: Static analysis tool to identify common vulnerabilities like reentrancy.
Randomness Manipulation: The randomness mechanism relies on block.timestamp, msg.sender, and block.prevrandao, which may be predictable in certain scenarios. Consider using Chainlink VRF or another oracle for more secure randomness.
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.