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

Miners Can manipulate the VRF Output to Game the Protocol #205

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

Miners Can manipulate the VRF Output to Game the Protocol #205

code423n4 opened this issue Mar 9, 2023 · 6 comments
Labels
bug Something isn't working downgraded by judge Judge downgraded the risk level of this issue duplicate-445 edited-by-warden grade-c QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax unsatisfactory does not satisfy C4 submission criteria; not eligible for awards

Comments

@code423n4
Copy link
Contributor

code423n4 commented Mar 9, 2023

Lines of code

https://github.com/code-423n4/2023-03-wenwin/blob/main/src/Lottery.sol#L140

Vulnerability details

Impact

Bad actors can take advantage end up winning lotterys that they did not deserve to win. essentially stealing from other users/protocol.

Proof of Concept

Miners are able to alter chain histroy if the vrf output is not one of their winning combinations. For example:

  • A miner buys a hand ful of lotto tickets
  • a vrf request is made to retrieve a random number.
  • the miner / user sees that the random number does not result in any winnings for the miner.
  • The miner wants another chance to win so they include the random number in the next block. This creates a whole new vrf. This is done by re-orging the chain.
  • The miner can only substain this for a few blocks however by doing so they gave their tickets x more chances to win.
  • The likely hood of this happening is low but the impact would be very and and this attack vertor very possible.
  • The attack could either be a miner or someone who pays miners to do this for them.

A very similar issue was accepted as a high here:code-423n4/2021-10-pooltogether-findings#56

However I feel like with the likely hood being lower than an average attack it is closer to a medium.

Tools Used

Manual Analysis

Recommended Mitigation Steps

Consider adding a confirmation time between when the actual VRF request was made and when it was later fulfilled on-chain. This would mitigate re-orging the chain to a attackers advantage.

@code423n4 code423n4 added 3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working labels Mar 9, 2023
code423n4 added a commit that referenced this issue Mar 9, 2023
@code423n4 code423n4 added 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value and removed 3 (High Risk) Assets can be stolen/lost/compromised directly labels Mar 9, 2023
@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 10, 2023
@c4-judge
Copy link
Contributor

thereksfour changed the severity to QA (Quality Assurance)

@c4-judge
Copy link
Contributor

This previously downgraded issue has been upgraded by thereksfour

1 similar comment
@c4-judge
Copy link
Contributor

This previously downgraded issue has been upgraded by thereksfour

@c4-judge c4-judge added 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value and removed 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 labels Mar 10, 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)

@c4-judge c4-judge added grade-c unsatisfactory does not satisfy C4 submission criteria; not eligible for awards labels Mar 21, 2023
@c4-judge
Copy link
Contributor

thereksfour marked the issue as grade-c

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 edited-by-warden grade-c QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax unsatisfactory does not satisfy C4 submission criteria; not eligible for awards
Projects
None yet
Development

No branches or pull requests

2 participants