The trigger_demand function normally generates a pseudo-random number to determine the quantity of items a customer requests. This randomness is intended to simulate variable customer demand based on the company's reputation.
The specific issue is that the pseudo-randomness relies on block.timestamp and msg.sender, which can be predicted or manipulated by miners or front-running users. This allows attackers to forecast the demand and exploit the system.
Likelihood:
Users observing the blockchain can calculate the seed for their own addresses at the current timestamp.
Automated scripts can front-run transactions to influence which pseudo-random number is generated.
Impact:
Attackers can consistently request the maximum allowed items, gaining more benefits than intended.
Reputation-based reward mechanisms can be unfairly exploited, breaking the intended simulation dynamics.
Explanation: The attacker computes the exact requested items for their transaction before sending it, ensuring maximum items requested and exploiting the game's pseudo-random logic.
Use a verifiable randomness source, such as Chainlink VRF, or a commit-reveal scheme to generate unpredictable demand.
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.