Skip to content
Business logic Audit finding Intermediate

Clearinghouse.sol#claimDefaulted()

The Clearinghouse contract calls the minter's burn function without first granting it an allowance over the OHM tokens it holds, so the burn always fails. As a result, the claimDefaulted function always reverts and defaulted loans cannot be processed through this path.

Ignite Follow with deth

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2023-08-cooler-judging/issues/176

Found by

Ignite, deth Clearinghouse doesn't approve the MINTR to handle tokens in his name, which bricks the entire function.

Vulnerability Detail

Inside claimDefaulted on the last line we call MINTR.burnOhm which in turn calls OHM.burnFrom. The docs for MINTR.burnFrom state: "Burn OHM from an address. Must have approval.". We can confirm that this is the case when looking at OHM source code and it's burnFrom. I found 2 OHM tokens that are currently deployed on mainnet, so I'm linking both their addresses: https://etherscan.io/token/0x383518188c0c6d7730d91b2c03a03c837814a899#code, https://etherscan.io/token/0x64aa3364f17a4d01c6f1751fd97c2bd3d7e7f1d5#code. Both addresses use the same burnFrom logic and in both cases they require an allowance. Nowhere in the contract do we approve the MINTR to handle OHM tokens in the name of Clearinghouse, in fact OHM isn't even specified in Clearinghouse.

Side note: The test testFuzz_claimDefaulted succeeds, because MockOhm is written incorrectly. When burnFrom gets called MockOhm calls the inherited _burn function, which burns tokens from msg.sender. The mock doesn't represent how the real OHM.burnFrom works.

Impact

Claimdefault will always revert.

Code Snippet

https://github.com/sherlock-audit/2023-08-cooler/blob/6d34cd12a2a15d2c92307d44782d6eae1474ab25/Cooler/src/Clearinghouse.sol#L244

Tool used

Manual Review

Recommendation

Add a variable ohm which will be the OHM address and approve the necessary tokens to the MINTR before calling MINTR.burnOhm.

Discussion

jkoppel

Seems real

0xRusowsky

Confirmed, but disagree with the severity. Defaults could still happen via the Cooler contracts and OHM could be burned ad-hoc by the DAO.

0xRusowsky

After discussing it internally, we don't mind if it's labeled as high or medium cause we would need to deploy a new policy (so it would require some extra work on our end)

0xRusowsky

jkoppel

Fix approved.

The original report as published on Sherlock, by Ignite. Images and videos are our own copies; raw HTML is shown as text. View it on Sherlock.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

The contract calls a burn function that requires an allowance, but it never approves the minter to spend its OHM tokens.

Impact

claimDefaulted always reverts, so defaults cannot be processed through this function; the team noted defaults could still happen via the Cooler contracts and OHM could be burned manually by the DAO.

What the attacker needed

A defaulted loan to process

The fix

The recommendation was to store the OHM address and approve the needed tokens to the minter before calling the burn; the discussion shows a fix pull request was approved.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

Some tokens only let another contract move or destroy them if the owner has first given permission, called an allowance. Here the contract never gave that permission, so the step that destroys tokens always failed and the whole function stopped working. The project's own test passed only because a fake token in the test behaved differently from the real one.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More from Cooler Update

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.