Description: The code utilizes block.timestamp
as a source of randomness for determining reward distribution. However, block.timestamp
is deterministic and publicly visibile, making it predictable and susceptible to manipulation. This approach lacks cryptographic strength. As a result, malicious actors could exploit this vulnerability by strategically timing their interactions with the contract to maximize rewards or manipulate outcomes in their favor. This undermines the fairness and integrity of the reward system, potentially leading to LoveToken
losses.
Impact: This vulnerability can lead to exploitable behaviour, compromising the integrity of reward distribution and potentially enabling malicious actors to game the system.
Proof of Concept:
The _depositSoulmateAndAttackerTokenToStake
function deposits tokens for both a regular user and the attacker in the staking contract.
The attacker alters the block.timestamp
to simulate a longer staking duration than actual.
By invoking Staking::claimRewards
function, the attacker attempts to exploit the vulnerability.
Assertion verifies whether the attacker's balance matches the expected value, which is the product of weekOfStaking
and balancePerSoulmates
, indicating successful manipulation of rewards.
Place the following into the StakingTest.t.sol
Recommended Mitigation: Utilize oracles for unbiased randomness to prevent manipulation.
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.