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

no time restriction in setMarketTimeRestrictions() #49

Open
code423n4 opened this issue Aug 25, 2021 · 2 comments
Open

no time restriction in setMarketTimeRestrictions() #49

code423n4 opened this issue Aug 25, 2021 · 2 comments
Labels

Comments

@code423n4
Copy link
Contributor

Handle

JMukesh

Vulnerability details

Impact

as mentioned in the comment , time must be at least this much second, but it lack those check that given time is atleast >= someTime , as a result
minimumDuration, maximumDuration are directly initialized without any check

Proof of Concept

https://github.com/code-423n4/2021-08-realitycards/blob/39d711fdd762c32378abf50dc56ec51a21592917/contracts/RCFactory.sol#L431

Tools Used

manual review

Recommended Mitigation Steps

add require condition to check those value before setting it

@code423n4 code423n4 added 1 (Low Risk) bug Something isn't working labels Aug 25, 2021
code423n4 added a commit that referenced this issue Aug 25, 2021
@Splidge
Copy link
Collaborator

Splidge commented Aug 25, 2021

This is just poor commenting from when advancedWarning, minimumDuration and maximumDuration each had their own setter functions. They were combined to avoid the Factory going over the contract size limit. However the comments weren't combined correctly.
0 seconds is a valid advancedWarning if you want the market to open immediately.
0 seconds for maximumDuration may also be used if we don't want to set a maximum.

I'll not be adding in the checks but I will update the comments.

@Splidge Splidge added sponsor confirmed Resolved Used when a fix has been implemented. labels Aug 25, 2021
@Splidge
Copy link
Collaborator

Splidge commented Sep 7, 2021

On looking back through this I may have misunderstood what the warden was proposing here. I thought the warden wanted a zero value check, but they could have been asking for the minimumDuration < maximumDuration check.
This would make more sense as if the maximum was less than the minimum it wouldn't be possible to create a new market. The same problem would happen if advancedWarning was set to be greater than the maximumDuration.
Unfortunately the Factory is right on the size limit and adding these checks would require other changes to the contract which pose the risk of introducing more problems. Given how infrequently we expect to change these values, and the fact they can be changed back again should a mistake be made, I'll be marking this issue as acknowledged.
Initial fix to add more comments was implemented here

@Splidge Splidge added sponsor acknowledged and removed sponsor confirmed Resolved Used when a fix has been implemented. labels Sep 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants