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

Uninitialized referenceContractAddress may be used #81

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

Uninitialized referenceContractAddress may be used #81

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

Comments

@code423n4
Copy link
Contributor

Handle

0xRajeev

Vulnerability details

Impact

referenceContractAddress is 0 (default value) until set by setReferenceContractAddress(). Possible to createMarket() before that is set correctly by the deployment script in which case Clones.clone(0) is called which possibly results in unexpected behavior or leads to reverts later in the code.

Proof of Concept

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

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

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

Tools Used

Manual Analysis

Recommended Mitigation Steps

Add a zero-address check before the call to Clones.clone(referenceContractAddress).

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

Splidge commented Jun 18, 2021

before that is set correctly by the deployment script

Our deployment script, which sets this correctly.

@dmvt dmvt added the duplicate This issue or pull request already exists label Jul 10, 2021
@dmvt
Copy link
Collaborator

dmvt commented Jul 11, 2021

duplicate of #56

@dmvt dmvt closed this as completed Jul 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 (Low Risk) bug Something isn't working duplicate This issue or pull request already exists sponsor disputed
Projects
None yet
Development

No branches or pull requests

3 participants