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

fulfillRandomWords should never revert #307

Closed
code423n4 opened this issue Mar 9, 2023 · 2 comments
Closed

fulfillRandomWords should never revert #307

code423n4 opened this issue Mar 9, 2023 · 2 comments
Labels
bug Something isn't working downgraded by judge Judge downgraded the risk level of this issue duplicate-445 grade-b QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax

Comments

@code423n4
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2023-03-wenwin/blob/91b89482aaedf8b8feb73c771d11c257eed997e8/src/VRFv2RNSource.sol#L33-L35

Vulnerability details

As per chainlink's security considerations, fulfillRandomWords must not revert. However, the callback contains a revert in the case that randomWords.length != 1.

// fulfillRandomWords() - VRFv2RNSource.sol:L33-35
if (randomWords.length != 1) {
	revert WrongRandomNumberCountReceived(requestId, randomWords.length);
}

This pattern is unecessary since we're using randomWords[0] regardless, and >1 randomWords.length would not cause any issues.

// fulfillRandomWords() - VRFv2RNSource.sol:L37
fulfill(requestId, randomWords[0]);
@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 Mar 9, 2023
code423n4 added a commit that referenced this issue Mar 9, 2023
@c4-judge
Copy link
Contributor

thereksfour marked the issue as duplicate of #445

@c4-judge c4-judge added downgraded by judge Judge downgraded the risk level of this issue QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax and removed 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value labels Mar 21, 2023
@c4-judge
Copy link
Contributor

thereksfour changed the severity to QA (Quality Assurance)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working downgraded by judge Judge downgraded the risk level of this issue duplicate-445 grade-b QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
Projects
None yet
Development

No branches or pull requests

3 participants