sherlock-audit / 2022-09-notional-judging

4 stars 2 forks source link

Lambda - ExchangeRate age not checked #43

Closed sherlock-admin closed 2 years ago

sherlock-admin commented 2 years ago

Lambda

medium

ExchangeRate age not checked

Summary

The age of exchange rates is not checked, which can result in situations where old exchange rates are used.

Vulnerability Detail

_calculateSecondaryDebt calls buildExchangeRate, which queries the oracle. However, the updatedAt timestamp is ignored, meaning that the returned rate can be arbitrarily old.

Impact

When the exchange rate was not updated in a long time, this enables arbitrage opportunities, as Notional is using a wrong exchange rate.

Code Snippet

https://github.com/sherlock-audit/2022-09-notional/blob/main/contracts-v2/contracts/internal/vaults/VaultConfiguration.sol#L412

Tool used

Manual Review

Recommendation

Ensure that the exchange rate is not too old.

Duplicate of #133