Open code423n4 opened 1 year ago
thereksfour changed the severity to QA (Quality Assurance)
thereksfour marked the issue as grade-a
This is highly unlikely with ChainLink VRFv2. However, seems like a valid concern.
rand0c0des marked the issue as sponsor acknowledged
Lines of code
https://github.com/code-423n4/2023-03-wenwin/blob/main/src/RNSourceController.sol#L89-L104
Vulnerability details
Impact
A malicious randon source con frontrun calls to
swapSource
and prevent protocol owners from changing the random source by frontrunning the call with a transaction toonRandomNumberFulfilled
which effectively resets thefailedSequentialAttempts
to zero, making the original call toswapSource
revert.This process can be repeated any number of times, eventually leading to a DoS and the impossibility of changing the random source.
Proof of Concept
failedSequentialAttempts == maxFailedAttempts
.swapSource
to change the random source of the contractonRandomNumberFulfilled
which resets thefailedSequentialAttempts
back to 0.failedSequentialAttempts
is now less thanmaxFailedAttempts
.Recommendation
In case of
maxFailedAttempts
enter a more robust "pause" state that lets protocol owners deal better with the current situation.