Skip to content
Business logic Audit finding Intermediate

10% of CDS depositors profit are stuck in the treasury during withdrawal without a way to retrieve them

When a user withdraws from the CDS, 10% of their profit is sent to the treasury and recorded, but no function exists to withdraw or use those funds. As a result, that portion of profit remains permanently stuck in the treasury.

0x37 Follow with Audinarey, almurhasan and 1 other

Originally disclosed on Sherlock

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

Found by

0x37, Audinarey, almurhasan, valuevalk

Summary

During withdrawal from the CDS, 10% of the USDa profit of the user are sent to the treasury. However there is no way to withdraw these funds from the treasury and as such they are stuck forever.

Root Cause

Solidity
File: CDS.sol
334:     @>    uint256 optionFees = ((cdsDepositDetails.normalizedAmount * omniChainData.lastCumulativeRate) /
335:             (CDSLib.PRECISION * CDSLib.NORM_PRECISION)) - cdsDepositDetails.depositedAmount;

343:         uint256 currentValue = cdsAmountToReturn( // @audit-info value to return (i.e depositedAmount ± profit)
344:             msg.sender,
345:             index,
346:             omniChainData.cumulativeValue,
347:             omniChainData.cumulativeValueSign,
348:             excessProfitCumulativeValue
349:         ) - 1; //? subtracted extra 1 wei
350: 
351:         cdsDepositDetails.depositedAmount = currentValue;
352:         uint256 returnAmount = cdsDepositDetails.depositedAmount + optionFees;
353:   @>    cdsDepositDetails.withdrawedAmount = returnAmount;


  • currentValue is the user's depositedAmount ± profit and
  • returnAmount is the depositedAmount ± profit + optionFees which is now the cdsDepositDetails.withdrawedAmount

params.usdaToTransfer is the amount of USDa that is finally transferred to the user but not all the cdsDepositDetails.withdrawedAmount above is transferred because 10% of this amount is transferred to the treasury and recorded as usdaCollectedFromCdsWithdraw by calling updateUsdaCollectedFromCdsWithdraw()

https://github.com/sherlock-audit/2024-11-autonomint/blob/main/Blockchain/Blockchian/contracts/lib/CDSLib.sol#L800-L803

https://github.com/sherlock-audit/2024-11-autonomint/blob/main/Blockchain/Blockchian/contracts/Core_logic/Treasury.sol#L493-L497

Solidity
File: CDSLib.sol
800:                 //Calculate the usda amount to give to user after deducting 10% from the above final amount @audit HIGH: the remaining 10% is stuck in the treasury!
801:                 params.usdaToTransfer = calculateUserProportionInWithdraw(params.cdsDepositDetails.depositedAmount, returnAmountWithGains);
802:                 //Update the treasury data
803:    @>           interfaces.treasury.updateUsdaCollectedFromCdsWithdraw(returnAmountWithGains - params.usdaToTransfer);



File: Treasury.sol
493:     function updateUsdaCollectedFromCdsWithdraw(
494:         uint256 amount
495:     ) external onlyCoreContracts {
496:   @>    usdaCollectedFromCdsWithdraw += amount;
497:     }

The problem is that unfortunately, this amount is never removed from the treasury by any means or used anywhere.

Internal pre-conditions

No response

External pre-conditions

No response

Attack Path

No response

Impact

10% of profit during withdrawa are stuck in the treasury forever

PoC

No response

Mitigation

Consider implementing a function to withdraw this usdaCollectedFromCdsWithdraw from the treasury or better still account for it elsewhere.

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

The treasury records the 10% cut in a variable but provides no function to withdraw or otherwise use those funds.

Impact

10% of the profit from each withdrawal is permanently stuck in the treasury, reducing the funds available to users.

What the attacker needed

None

The fix

A function should be added to withdraw the collected amount from the treasury, or the funds should be accounted for elsewhere.

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.

When someone takes their money out of a savings pool, a small cut of their profit is moved to a central fund called the treasury. The report says there is no way to take money out of that fund, so that cut 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 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.