You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 3, 2024. It is now read-only.
sherlock-admin opened this issue
Aug 28, 2023
· 0 comments
Labels
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelHighA valid High severity issueRewardA payout will be made for this issue
The claimDefaulted function might revert if there is no allowance of OHM tokens from the Clearinghouse to the MINTR contract.
Summary
The MINTR.burnOhm() function requires allowances ohm tokens from the owner first to burn ohm. Thus, the Clearinghouse.claimDefaulted() function may revert at line 245 since there is no allowance ohm token from Clearinghouse to the MINTR contract.
Vulnerability Detail
When someone calls the Clearinghouse.claimDefaulted() function to default the loan, this will unstake and burn the collateral of the defaulted loans.
function claimDefaulted(address[] calldata coolers_, uint256[] calldata loans_) external {
...
// Unstake and burn the collateral of the defaulted loans.
gOHM.approve(address(staking), totalCollateral - keeperRewards);
MINTR.burnOhm(address(this), staking.unstake(address(this), totalCollateral - keeperRewards, false, false));
}
However, at line 245, the MINTR.burnOhm() function needs to approve ohm tokens from the owner before MINTR burns the owner's ohm token.
Add the ohm variable address as a relevant contract in Clearinghouse.
Increase the ohm token to burn from the Clearinghouse contract to the MINTR contract and pass the burn if the ohm token to burn is 0 since MINTR.burnOhm() will revert in this case.
// Unstake and burn the collateral of the defaulted loans.
gOHM.approve(address(staking), totalCollateral - keeperRewards);
+ uint256 ohmToBurn = staking.unstake(address(this), totalCollateral - keeperRewards, false, false);+ if (ohmToBurn > 0) {+ ohm.increaseAllowance(address(MINTR), ohmToBurn);- MINTR.burnOhm(address(this), staking.unstake(address(this), totalCollateral - keeperRewards, false, false));+ MINTR.burnOhm(address(this), ohmToBurn);+ }
}
sherlock-admin2
changed the title
Rough Garnet Ape - The claimDefaulted function might revert if there is no allowance of OHM tokens from the Clearinghouse to the MINTR contract.
Ignite - The claimDefaulted function might revert if there is no allowance of OHM tokens from the Clearinghouse to the MINTR contract.
Sep 12, 2023
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelHighA valid High severity issueRewardA payout will be made for this issue
Ignite
high
The claimDefaulted function might revert if there is no allowance of OHM tokens from the Clearinghouse to the MINTR contract.
Summary
The
MINTR.burnOhm()
function requires allowances ohm tokens from the owner first to burn ohm. Thus, theClearinghouse.claimDefaulted()
function may revert at line 245 since there is no allowance ohm token fromClearinghouse
to theMINTR
contract.Vulnerability Detail
When someone calls the
Clearinghouse.claimDefaulted()
function to default the loan, this will unstake and burn the collateral of the defaulted loans.However, at line 245, the
MINTR.burnOhm()
function needs to approve ohm tokens from the owner beforeMINTR
burns the owner's ohm token.MINTR: https://github.com/OlympusDAO/olympus-v3/blob/19236eb1c02464df8fb79c7b59b7195d7511b338/src/modules/MINTR/OlympusMinter.sol#L50-L61
OHM Token: https://etherscan.io/token/0x64aa3364f17a4d01c6f1751fd97c2bd3d7e7f1d5
As a result, the
Clearinghouse.claimDefaulted()
function may revert with the error string "ERC20: burn amount exceeds allowance".Reference address: https://docs.olympusdao.finance/main/technical/addresses
Impact
The user may not be able to default the loan on behalf of the
Clearinghouse
and the collateral will be stuck.Code Snippet
https://github.com/sherlock-audit/2023-08-cooler/blob/main/Cooler/src/Clearinghouse.sol#L244
Tool used
Manual Review
Recommendation
Add the ohm variable address as a relevant contract in
Clearinghouse
.Increase the ohm token to burn from the
Clearinghouse
contract to theMINTR
contract and pass the burn if the ohm token to burn is0
sinceMINTR.burnOhm()
will revert in this case.Duplicate of #176
The text was updated successfully, but these errors were encountered: