Miners or Validators can potentially manipulate randomness generation when maxRequestDelay
is low
#392
Labels
bug
Something isn't working
downgraded by judge
Judge downgraded the risk level of this issue
duplicate-445
grade-c
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
satisfactory
satisfies C4 submission criteria; eligible for awards
unsatisfactory
does not satisfy C4 submission criteria; not eligible for awards
Lines of code
https://github.com/code-423n4/2023-03-wenwin/blob/main/src/RNSourceController.sol#L60-L75
Vulnerability details
Impact
Manipulation of randomness.
Proof of Concept
While executing the draw,
requestRandomNumberFromSource()
is called throughrequestRandomNumber()
method which further makes a call onsource
requesting the random number.Once the request has been made, the VRF service waits for writing a fulfillment untill a safe block confirmation time frame (
_requestConfirmations
). The_requestConfirmations
is supposed to be set in such a way that potential rewrite attacks becomes unprofitable for miners or validators [which means on a higher time frame side].Can read about it here: Chainlink VRF Docs
During this period, the Request status will be pending.
Link to code
Here's how Miners or Validators can potentially manipulate randomness generation when
maxRequestDelay
is low usingretry
method:_requestConfirmations
.maxRequestDelay
is low, anyone can call theretry
method where as the request is still pending it will clear first revert check and second as well because of lowmaxRequestDelay
value.Here, as per the Chainlink docs, if the requests of randomness: A, B, C are in short succession, there is no guarantee that the associated randomness fulfillments will also be in order A, B, C. The randomness fulfillments might just as well arrive in order C, A, B or any other order. Blockchain miners/validators can control the order in which the requests appear on-chain.
This is also the reason why chainlink suggests not to re-request randomness in their docs here.
This way miners/validators can control the result through controlling the randomness. They cannot determine the random value in advance. But It enables them to get a fresh random value that might or might not be to their advantage.
Tools Used
VS Code
Recommended Mitigation Steps
Make sure that
maxRequestDelay
is always set atleast multiple times of the average safe_requestConfirmations
time.The text was updated successfully, but these errors were encountered: