The Vault
contract uses block.timestamp
to check whether the claim period is active. This introduces a potential vulnerability since miners can manipulate block.timestamp
within a range of approximately 15 minutes (900 seconds), potentially leading to undesired outcomes. The contract should use block.number
for more reliable time-based calculations, minimizing the risk of manipulation by miners.
In the original implementation, block.timestamp
is used to determine whether the claim period is active
Miners can manipulate block.timestamp
within a small range, which may allow them to gain unfair advantages, such as making the claim period appear shorter or longer than intended.
The impact of this vulnerability is that miners may manipulate the outcome of time-based events, such as:
- Extending or shortening the claim period by exploiting block.timestamp
.
- Potentially locking funds in the contract longer than expected.
- Disrupting the normal functioning of the vault, affecting participants interacting with the staking contract.
Manual Review
To prevent block.timestamp
manipulation, use block.number
for time-sensitive logic, combined with an estimate of block times. Below is the recommended change:
This approach mitigates the vulnerability by using the more stable block.number
for time comparisons and reduces the risk of miners manipulating the contract’s logic.
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.