Hawk High

First Flight #39
Beginner FriendlySolidity
100 EXP
View results
Submission Details
Impact: medium
Likelihood: medium
Invalid

Uses `block.timestamp` for comparisons is Dangerous comparisons

Summary

usage of `block.timestamp` can be manipulated by someone,Which will lead to Reviews can be given many times per week !

Vulnerability Details

<details><summary>code</summary>
``` javascript
function giveReview(address _student, bool review) public onlyTeacher {
if (!isStudent[_student]) {
revert HH__StudentDoesNotExist();
}
require(reviewCount[_student] < 5, "Student review count exceeded!!!");
@> require(block.timestamp >= lastReviewTime[_student] + reviewTime, "Reviews can only be given once per week");
if (!review) {
studentScore[_student] -= 10;
}
```
</details>

Impact

Any student can influance the result of review
<details><summary>code</summary>
``` javascript
require(block.timestamp >= lastReviewTime[_student] + reviewTime, "Reviews can only be given once per week");
```
</details>

Tools Used

Foundry

Recommendations

Avoid relying on `block.timestamp` .

Use a secure and decentralized source of comparaison, such as Chainlink VRF.


Updates

Lead Judging Commences

yeahchibyke Lead Judge 7 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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

Give us feedback!