Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MONTH_IN_SECONDS is 7 times more than the correct value #89

Closed
code423n4 opened this issue Dec 14, 2022 · 2 comments
Closed

MONTH_IN_SECONDS is 7 times more than the correct value #89

code423n4 opened this issue Dec 14, 2022 · 2 comments
Labels
2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value bug Something isn't working duplicate-273 satisfactory satisfies C4 submission criteria; eligible for awards

Comments

@code423n4
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2022-12-forgeries/blob/fc271cf20c05ce857d967728edfb368c58881d85/src/VRFNFTRandomDraw.sol#L33

Vulnerability details

Impact

This breaks the protocol invariant of

  1. REDRAW_TIMELOCK_NEEDS_TO_BE_LESS_THAN_A_MONTH()
  2. revert RECOVER_TIMELOCK_NEEDS_TO_BE_LESS_THAN_A_YEAR()

We can set redraw timelock to 7 months

We can set recover timelock to 7 years. This is extremely unnecessary.

Proof of Concept

MONTH_IN_SECONDS is currently implemented this way uint256 immutable MONTH_IN_SECONDS = (3600 * 24 * 7) * 30

We are multiplying number of seconds in a week by 30, instead of multiplying number of seconds in a day by 30. This lead to an over computation of 7 times.

The affected part of the protocols are as mentioned above as they relies on the value of MONTH_IN_SECONDS.

Tools Used

Manual Review

Recommended Mitigation Steps

Correct calculation should be

uint256 immutable MONTH_IN_SECONDS = (3600 * 24) * 30

@code423n4 code423n4 added 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value bug Something isn't working labels Dec 14, 2022
code423n4 added a commit that referenced this issue Dec 14, 2022
@c4-judge
Copy link
Contributor

gzeon-c4 marked the issue as duplicate of #273

@c4-judge c4-judge added duplicate-273 satisfactory satisfies C4 submission criteria; eligible for awards labels Dec 17, 2022
@c4-judge
Copy link
Contributor

gzeon-c4 marked the issue as satisfactory

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value bug Something isn't working duplicate-273 satisfactory satisfies C4 submission criteria; eligible for awards
Projects
None yet
Development

No branches or pull requests

2 participants