Potential Stale Exchange Rate for DAI/gOHM in Clearinghouse
Summary
The Clearinghouse contract uses a fixed DAI/gOHM exchange rate through the LOAN_TO_COLLATERAL constant. Given the volatile nature of cryptocurrency prices, relying on a fixed exchange rate is problematic. As currencies fluctuate, this constant value will inevitably become obsolete, potentially leading to under-collateralized loans.
Vulnerability Detail
The ClearingHouse contract design permits loan processing as long as the operator approves it. Presumably, this operator could be an automated keeper program. Loan fairness is determined using the LOAN_TO_COLLATERAL constant, which represents the DAI/gOHM exchange rate. As of now, the value of gOHM is $2,500, indicating that LOAN_TO_COLLATERAL fixed value is already outdated.
This vulnerability's gravity can be likened to a scenario where a Chainlink oracle is utilized, but no mechanism checks if the oracle's provided exchange rate is stale. Such a lapse in real-time rate-checking is considered of medium severity.
While it's uncertain who controls the operator address invoking the clear() method, it's likely designed to be an automated keeper. Such a keeper, without any modification, might approve loans without verification. Even if the operator were a human, the existence of hardcoded checks like LOAN_TO_COLLATERAL suggests that the contract aims to safeguard against potential errors, so this particular vulnerability should be addressed.
Impact
There's a potential risk of approving under-collateralized loans. Astute borrowers could exploit this, taking loans they intend to default on. They'd benefit by using the borrowed amount to acquire more collateral than what they'd forfeit upon defaulting.
To ensure loans remain adequately collateralized, implement a dynamic pricing model using Chainlink oracles. This will continuously fetch the most recent DAI/gOHM exchange rate, reducing the potential for under-collateralized loans.
radevauditor
medium
Potential Stale Exchange Rate for DAI/gOHM in Clearinghouse
Summary
The
Clearinghouse
contract uses a fixed DAI/gOHM exchange rate through the LOAN_TO_COLLATERAL constant. Given the volatile nature of cryptocurrency prices, relying on a fixed exchange rate is problematic. As currencies fluctuate, this constant value will inevitably become obsolete, potentially leading to under-collateralized loans.Vulnerability Detail
The
ClearingHouse
contract design permits loan processing as long as the operator approves it. Presumably, this operator could be an automated keeper program. Loan fairness is determined using theLOAN_TO_COLLATERAL
constant, which represents the DAI/gOHM exchange rate. As of now, the value of gOHM is $2,500, indicating thatLOAN_TO_COLLATERAL
fixed value is already outdated.This vulnerability's gravity can be likened to a scenario where a Chainlink oracle is utilized, but no mechanism checks if the oracle's provided exchange rate is stale. Such a lapse in real-time rate-checking is considered of medium severity.
While it's uncertain who controls the operator address invoking the clear() method, it's likely designed to be an automated keeper. Such a keeper, without any modification, might approve loans without verification. Even if the operator were a human, the existence of hardcoded checks like
LOAN_TO_COLLATERAL
suggests that the contract aims to safeguard against potential errors, so this particular vulnerability should be addressed.Impact
There's a potential risk of approving under-collateralized loans. Astute borrowers could exploit this, taking loans they intend to default on. They'd benefit by using the borrowed amount to acquire more collateral than what they'd forfeit upon defaulting.
Code Snippet
The loan-to-collateral is hard-coded, rather than being based on an oracle price. https://github.com/sherlock-audit/2023-08-cooler/blob/main/Cooler/src/Clearinghouse.sol#L55
If the gOHM price drops below $3000 to say $2500, a loan for 3000 DAI will be under-collateralized.
https://github.com/sherlock-audit/2023-08-cooler/blob/main/Cooler/src/Cooler.sol#L371-L373
https://github.com/sherlock-audit/2023-08-cooler/blob/main/Cooler/src/Clearinghouse.sol#L386-L391
Tool used
Manual Review
Recommendation
To ensure loans remain adequately collateralized, implement a dynamic pricing model using Chainlink oracles. This will continuously fetch the most recent DAI/gOHM exchange rate, reducing the potential for under-collateralized loans.