Skip to content
Business logic Audit finding Intermediate

gOhm stuck forever if call claimDefaulted on Cooler directly

The Cooler contract's claimDefaulted function can be called by anyone, and when a loan owned by the Clearinghouse defaults, the collateral (gOhm) is sent to the Clearinghouse but cannot be recovered or burned. An attacker can easily cause all defaulted gOhm to become permanently stuck.

castle_chain Follow with detectiveking, evilakela and 1 other

Originally disclosed on Sherlock

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

Found by

castle_chain, detectiveking, evilakela, jkoppel

Anyone can call Cooler.claimDefaulted. If this is done for a loan owned by the Clearinghouse, the gOhm is sent to the Clearinghouse, but there is no way to recover or burn it.

Vulnerability Detail

  1. Bob calls Clearinghouse.lendToCooler to make a loan collateralized by 1000 gOhm.
  2. Bob defaults on the loan
  3. Immediately after default, Eve calls Cooler.claimDefaulted on Bob's loan.
  4. The gOhm is transferred to the Clearinghouse
  5. There is no way to burn or transfer it. (In fact, defund() can be used to transfer literally any token except gOhm back to the treasury.)

However, the gOhm can now be stolen using the exploit in #1, potentially in the same transaction as when Eve called Cooler.claimDefaulted().

Impact

Anyone can very easily make all defaulted gOhm get stuck forever.

Code Snippet

Cooler.claimDefaulted sends the collateral to the lender, calls onDefault

https://github.com/sherlock-audit/2023-08-cooler/blob/main/Cooler/src/Cooler.sol#L325

Clearinghouse.onDefault does nothing

https://github.com/sherlock-audit/2023-08-cooler/blob/main/Cooler/src/Clearinghouse.sol#L265

Although Clearinghouse.defund() can be used to send any other token back to the treasury, it cannot do so for gOhm

https://github.com/sherlock-audit/2023-08-cooler/blob/main/Cooler/src/Clearinghouse.sol#L340

Tool used

Manual Review

Recommendation

Unsure. Perhaps add a flag disabling claiming by anyone other than loan.lender? Or just allow defund() to be called on gOhm?

Discussion

jkoppel

This is not a duplicate of #28. #28 involves Clearinghouse.claimDefaulted, but this involves Cooler.claimDefaulted.

Oot2k

Not a duplicate

0xRusowsky

Despite it is not a duplicate, since gOHM would be stuck in CH instead of the being OHM burn. It wouldn't be a big deal (we could ammend the calculations based on that) because it doesn't have any operational/economical impact as long as that supply is removed from the backing calculations.

On top of that, there is an economical incentive to call it from the CH, as the caller is rewarded.

Disagree with severity, imo at max it should be a medium.

Will think about how to deal with it.

0xRusowsky

we will finally add a permissionless burn function despite this logic is unlikely to happen

0xRusowsky

jkoppel

Fix approved.

The original report as published on Sherlock, by castle_chain. 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

Likely the Clearinghouse's onDefault function does nothing and its defund function cannot handle gOhm, so gOhm sent to it becomes stuck.

What the attacker needed

A loan owned by the Clearinghouse; the borrower defaults; anyone can call claimDefaulted

The fix

A permissionless burn function was added to handle stuck gOhm.

How it was found

  1. Bob calls Clearinghouse.lendToCooler to make a loan collateralized by 1000 gOhm.
  2. Bob defaults on the loan.
  3. Immediately after default, Eve calls Cooler.claimDefaulted on Bob's loan.
  4. The gOhm is transferred to the Clearinghouse.
  5. There is no way to burn or transfer it.

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.

In this system, a borrower puts up collateral (gOhm) for a loan. If they fail to repay, anyone can trigger a default to claim that collateral. The problem is that when the lender is the Clearinghouse, the collateral gets sent there but there is no way to get it out, so it is lost forever.

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 by castle_chain

View all

3 more disclosed reports, best first.

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.