TwentyOne

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

Weak Randomness

Weak randomness in 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:

  1. 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.

  2. Users can mine/manipulate their msg.sender value to result in the their address being used to generate the winner!

  3. 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:

  1. 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.

  2. 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.

Tools Used

  • Manual Review

  • Slither and aderyn: Static analysis tool to identify common vulnerabilities like reentrancy.

Updates

Lead Judging Commences

inallhonesty Lead Judge 11 months ago
Submission Judgement Published
Invalidated
Reason: Known issue
Assigned finding tags:

[INVALID] Known - Randomness

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.

Support

FAQs

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