Skip to content
Business logic Audit finding Intermediate

`CDSLib::withdrawUserWhoNotOptedForLiq()` tax is not stored in the treasury

When a CDS depositor who did not opt in for liquidation withdraws, the profit tax owed to the protocol is never recorded in the treasury. The tax amount therefore becomes stuck in the contract instead of being accounted for.

0x37 Follow with 0x73696d616f, Audinarey and 2 others

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2024-11-autonomint-judging/issues/829

Found by

0x37, 0x73696d616f, Audinarey, almurhasan, onthehunt

Summary

CDSLib::withdrawUserWhoNotOptedForLiq() does not store the tax from the cds depositor profit, leaving these funds stuck. It must call Treasury::updateUsdaCollectedFromCdsWithdraw(), similarly to what is done when the user opts in for liquidation.

Root Cause

In CDSLib::withdrawUserWhoNotOptedForLiq(), the profit tax is not stored in the treasury.

Internal pre-conditions

None.

External pre-conditions

None.

Attack Path

  1. Cds depositor who did not opt in for liquidation withdraws, and the profit tax to the protocol is not stored and gets stuck.

Impact

Stuck funds.

PoC

None.

Mitigation

Call Treasury::updateUsdaCollectedFromCdsWithdraw() on the profit.

The original report as published on Sherlock, by 0x37. 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 withdrawal path for users who did not opt in for liquidation omits the treasury update call that the opted-in path performs.

What the attacker needed

A CDS deposit that made a profit; withdrawal without opting in for liquidation

The fix

The withdrawal function should call the treasury update function for the profit, as the opted-in path does.

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.

A user withdraws their deposit and makes a profit; a slice of that profit is meant to go to the protocol. The code forgets to record that slice in the protocol's treasury, so the money sits in the contract with no way to account for it.

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 0x37

View all

79 more disclosed reports, best first.

More from Autonomint Colored Dollar V1

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.