Open code423n4 opened 1 year ago
The manual intervention to the prices is supposed to be a distress handle. It should not be expected that the prices are fresh as in the normal hearth beat feed.
Could be QA.
0xSorryNotSorry marked the issue as low quality report
Valid QA, and for the sponsor to consider whether this is the best approach to the problem of oracle brakdown.
alcueca changed the severity to QA (Quality Assurance)
alcueca marked the issue as grade-a
Lines of code
https://github.com/code-423n4/2023-07-moonwell/blob/main/src/core/Oracles/ChainlinkOracle.sol#L79-L81
Vulnerability details
Impact
Override prices from
ChainlinkPriceOracle
can be out of date which could cause unwanted liquidations, excess borrowing or arbitrage.Proof of Concept
In
ChainlinkPriceOracle
there is a function to override the prices from the chainlink feed:https://github.com/code-423n4/2023-07-moonwell/blob/main/src/core/Oracles/ChainlinkOracle.sol#L79-L81
These prices are set by
admin
in two similar callssetUnderlyingPrice
andsetDirectPrice
:https://github.com/code-423n4/2023-07-moonwell/blob/main/src/core/Oracles/ChainlinkOracle.sol#L135-L138
There is little documentation why the
admin
would do this but I assume it is in the case where the chainlink feed is unavailable (either not existing or down).The issue is that for the protocol to work properly, prices needs to be fresh. Otherwise unwanted liquidations or excess borrowing/arbitrage can occur. So for the direct price override to work properly when used it must be updated often and regularly.
If you look at in
mip00
, which details the protol setup, theadmin
will be theTemporalGovernor
:https://github.com/code-423n4/2023-07-moonwell/blob/main/test/proposals/mips/mip00.sol#L315-L316
TemporalGovernor
can only act on cross chain messages. The fastest possible action would be for theguardian
to fasttrack the messages but they still need to wait for the cross chain latency. Hence there's a high risk that when the direct price override is used inChainlinkPriceOracle
the prices will lag behind and could be abused.Tools Used
Manual audit
Recommended Mitigation Steps
Consider reverting instead of using a default price for assets. Or at least have the
admin
of theChainklinkPriceOracle
be a "local" chain account (i.e.guardian
) that can take action faster.Assessed type
Timing