Open
Description
Lines of code
Vulnerability details
Impact
MCAGRateFeed#getRate may return stale data
Proof of Concept
(, int256 answer,,,) = oracle.latestRoundData();
Classic C4 issue. getRate only uses answer but never checks the freshness of the data, which can lead to stale bond pricing data. Stale pricing data can lead to bonds being bought and sold on KUMASwap that otherwise should not be available. This would harm KIBToken holders as KUMASwap may accept bond with too low of a coupon and reduce rewards.
Tools Used
Manual Review
Recommended Mitigation Steps
Validate that updatedAt
has been updated recently enough:
- (, int256 answer,,,) = oracle.latestRoundData();
+ (, int256 answer,,updatedAt,) = oracle.latestRoundData();
+ if (updatedAt < block.timestamp - MAX_DELAY) {
+ revert();
+ }
if (answer < 0) {
return _MIN_RATE_COUPON;
}