Closed c4-bot-3 closed 8 months ago
bytes032 marked the issue as insufficient quality report
The Warden specifies how an unbounded iteration of the Yangs (collaterals) in the system may result in an out-of-gas error.
This is an invalid submission as the system would have to be configured with an abnormally large number of collaterals by an administrator of the Opus team.
alex-ppg marked the issue as unsatisfactory: Invalid
Lines of code
https://github.com/code-423n4/2024-01-opus/blob/4720e9481a4fb20f4ab4140f9cc391a23ede3817/src/core/seer.cairo#L202-L230 https://github.com/code-423n4/2024-01-opus/blob/4720e9481a4fb20f4ab4140f9cc391a23ede3817/src/core/sentinel.cairo#L122-L133
Vulnerability details
Impact
In
seer.cairo
file, functionupdate_prices_internal
loops over an array of all yangs:File: seer.cairo
However, the number of elements in
yangs
is nowhere limited. When this array contains a lot of elements - looping will eventually lead to out of gas error.Proof of Concept
File: seer.cairo
Function
sentinel.get_yang_addresses()
gets the list of all the yangs in the protocol. It's implemented as below:File: sentinel.cairo
As demonstrated above, it gets all the yangs in the protocol. When protocols has a lot of yangs, the list returned by
sentinel.get_yang_addresses()
will be extremely big. Moreover, functionupdate_prices_internal
fromseer.cairo
will iterate over that list. This constitues an issue, since, looping over an unbounded list may result in DoS (revert with out of gas error).Function
update_prices_internal
is called whenever we want to either execute a task (execute_task
) or update prices (update_prices
). When it will revert with out of gas error, it won't be possible to properly use the protocol (sinceexecute_task
andupdate_prices
) will revert too.It's mandatory to make sure that we are not looping over too large array of yangs.
Tools Used
Manual code review
Recommended Mitigation Steps
Implement additional check which won't allow to add so many yangs, that
update_prices_internal
won't be able to loop over them.Assessed type
DoS