Skip to content
Business logic Audit finding Beginner

Lock-in period option for dCDS users is not enforced when trying to withdraw

The lock-in period chosen by dCDS users during deposit is stored but not checked when withdrawing. A user can therefore withdraw before their chosen lock-in period ends.

0xbakeng Follow with Cybrid and valuevalk

Originally disclosed on Sherlock

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

Found by

0xbakeng, Cybrid, valuevalk

Summary

The lock-in period option set during deposit, for dCDS users is not enforced when trying to withdraw.

Root Cause

As it can be seen from the docs https://docs.autonomint.com/autonomint/blockchain-docs/core-contracts/cds#deposit and the deposit function there is a param called lockingPeriod, which the user can use to specify/make a longer locking period, with a minimum of 1 month by requirement.

Solidity
function deposit(
        uint128 usdtAmount,
        uint128 usdaAmount,
        bool liquidate,
        uint128 liquidationAmount,
        uint128 lockingPeriod ) payable 

lockingPeriod | uint128 | How long the user is willing to stay deposited in the protocol. However, currently it's just set during deposit in CDSLib.sol#L534 but later is not enforced when withdrawing.

This could also be seen from the frontend

A longer lockingperiod could be specified: https://docs.autonomint.com/autonomint/autonomint-1/guides/how-to/dcds-interface

Flow of issue

  1. User wants to lock-in for a longer period, for example, 60 days.
  2. He specifies during the deposit the 60 days duration
  3. Since the problem is that this value is not enforced during withdraw() in CDS.sol, he would be able to withdraw earlier.

Impact

The option will not work, as the value set during a deposit won't be used and the user could withdraw earlier.

Mitigation

Enforce that value upon withdrawing.

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

Impact

The lock-in option does not work, and a user could withdraw earlier than the period they selected.

What the attacker needed

A dCDS deposit with a chosen lock-in period

The fix

The lock-in period should be enforced when withdrawing.

How it was found

  1. User chooses a longer lock-in period, for example 60 days.
  2. User specifies that duration during the deposit.
  3. User calls withdraw() and is able to withdraw before the lock-in period ends.

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 you put money into a savings product, you can promise to leave it there for a minimum time, called a lock-in period. The system records this promise but never checks it when you ask for your money back, so you can take it out early.

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

View all

1 more disclosed report, 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.