Lack of timestamp in setDirectPrice()
and price freshness check in getTokenPrice()
may cause a stale price to be used
#205
Labels
bug
Something isn't working
duplicate
This issue or pull request already exists
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
resolved
Finding has been patched by sponsor (sponsor pls link to PR containing fix)
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Lines of code
https://github.com/code-423n4/2022-06-connext/blob/b4532655071566b33c41eac46e75be29b4a381ed/contracts/contracts/core/connext/helpers/ConnextPriceOracle.sol#L158-L161
Vulnerability details
https://github.com/code-423n4/2022-06-connext/blob/b4532655071566b33c41eac46e75be29b4a381ed/contracts/contracts/core/connext/helpers/ConnextPriceOracle.sol#L81-L97
setDirectPrice()
can be called by the admin to setassetPrices
directly, once set, it will become the primary source ingetTokenPrice()
.However, there is no timestamp assigned alongside with the price when
setDirectPrice()
, as a result, the price set by the admin can and tend to be stale.Furthermore, without a timestamp in the calldata, when the network is congested, transactions sent a while ago with stale prices can be accepted as new/fresh prices.
Recommendation
tokenPrice
should record not only the price but also the last updated time.setDirectPrice
should add a new parameter:_timestamp
:getTokenPrice()
should check for the freshness of directly set token price:The text was updated successfully, but these errors were encountered: