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

Incorrect/Insufficient validation of market locking timestamp #80

Closed
code423n4 opened this issue Jun 16, 2021 · 2 comments
Closed

Incorrect/Insufficient validation of market locking timestamp #80

code423n4 opened this issue Jun 16, 2021 · 2 comments
Labels
2 (Med Risk) bug Something isn't working duplicate This issue or pull request already exists

Comments

@code423n4
Copy link
Contributor

Handle

0xRajeev

Vulnerability details

Impact

Three timestamps are used during market creation to indicate market opening, locking and oracle resolution times. The validation of these timestamps is performed in RCFactory during market creation.

The validation for market locking _timestamp[1] is performed only if maximumDuration is != 0 where the default value is 0 and is set only if setMaximumDuration() is called. Even in that validation, the use of block.timestamp should really be _timestamps[0] (market opening timestamp) because the market opening-locking duration should be counted from _timestamp[0] and not block.timestamp at createMarket() time. _timestamp[0] could be in the past. This check also doesn't account for advancedWarning aspect of market opening.

Impact: Incorrect/Insufficient validations of all possible market opening/locking configurations could affect user interactions with the market by breaking assumed invariants in the code.

Proof of Concept

https://github.com/code-423n4/2021-06-realitycards/blob/86a816abb058cc0ed9b6f5c4a8ad146f22b8034c/contracts/RCFactory.sol#L530-L535

https://github.com/code-423n4/2021-06-realitycards/blob/86a816abb058cc0ed9b6f5c4a8ad146f22b8034c/contracts/RCFactory.sol#L519-L528

Tools Used

Manual Analysis

Recommended Mitigation Steps

Specify all possible market opening/locking invariants and validate correctly against all variations of them.

@code423n4 code423n4 added 2 (Med Risk) bug Something isn't working labels Jun 16, 2021
code423n4 added a commit that referenced this issue Jun 16, 2021
@Splidge Splidge added the duplicate This issue or pull request already exists label Jun 18, 2021
@Splidge
Copy link
Collaborator

Splidge commented Jun 18, 2021

Duplicate of #61

@Splidge Splidge marked this as a duplicate of #61 Jun 18, 2021
@Splidge Splidge closed this as completed Jun 18, 2021
@dmvt
Copy link
Collaborator

dmvt commented Jul 10, 2021

duplicate of #61

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2 (Med Risk) bug Something isn't working duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

3 participants