Skip to content
Business logic Audit finding Intermediate

odosAssembledData can be manipulated

The signature used in the withdraw function can be reused with different odosAssembledData, allowing a borrower to choose a swap input amount smaller than the remaining collateral. This causes part of the collateral to remain locked in the contract and the borrower to receive less USDT than expected.

0x37 Follow with 0x73696d616f, 0xNirix and 3 others

Originally disclosed on Sherlock

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

Found by

0x37, 0x73696d616f, 0xNirix, Laksmana, tjonair, volodya

Summary

The signature in withDraw can be reused and this will cause users can choose one improper odosAssembledData and convert less collateral than expected.

Root Cause

In borrowing.sol:withDraw, borrowers can withdraw their collateral. If the current Ether price is larger than deposited Ether price, borrowers will not withdraw all collaterals. There will be some remaining collateral. These remaining collaterals will be swapped to USDT via odos router.

In one normal scenario, the protocol backend server will generate odos assembled data got from odos api, and sign the signature. The borrower will use this signed signature and odosAssembledData to trigger this withDraw function.

But the problem is that malicious users can choose one improper odosAssembledData and signature. Although we can not manipulate the odosAssembledData to any value we want, the backend servers will generate all kinds of odosAssembledData for different borrower's withdrawal. The malicious borrower can choose any odosAssembledData from all of these odosAssembledData.

For example:

  1. Alice deposits WrsETH via depositTokens.
  2. The Ether price increases, Alice wants to withdraw her collateral. Her borrow position's remaining collateral is 0.05 ether. Normally, Alice's odosAssembledData will swap 0.05 ether wrsETH to USDT. But Alice searches the valid used odosAssembledData, and find one odosAssembledData which input token amt is 0.01 ether. Alice uses used odosAssembledData to trigger her withdraw.
  3. We will swap 0.01 ether wrsETH to USDT. This will cause some wrsETH locked in the contract.
Solidity
    function _withdraw(
        address toAddress,
        uint64 index,
        bytes memory odosAssembledData,
        uint64 ethPrice, // current ether price
        uint128 exchangeRate,
        uint64 withdrawTime
    ) internal {
    ...
        uint256 amountToSwap = result.collateralRemainingInWithdraw -
            collateralRemainingInWithdraw;
        if (amountToSwap > 0) {
            amountToSwap = (amountToSwap * 1 ether) / exchangeRate;
            treasury.swapCollateralForUSDT(depositDetail.assetName, amountToSwap, odosAssembledData);
        }
    ...    
}

Internal pre-conditions

N/A

External pre-conditions

N/A

Attack Path

  1. Alice deposits WrsETH via depositTokens.
  2. The Ether price increases, Alice wants to withdraw her collateral. Her borrow position's remaining collateral is 0.05 ether. Normally, Alice's odosAssembledData will swap 0.05 ether wrsETH to USDT. But Alice searches the valid used odosAssembledData, and find one odosAssembledData which input token amt is 0.01 ether. Alice uses used odosAssembledData to trigger her withdraw.
  3. We will swap 0.01 ether wrsETH to USDT. This will cause some wrsETH locked in the contract.

Impact

When we swap the remaining collateral to USDT, we may swap only one part of remaining collateral to USDT. This will break our intent. Some remaining collateral will be locked in the contract, and the output USDT is less than expected.

PoC

N/A

Mitigation

odosAssembledData and signature should only be valid for one borrower's specific borrowing index.

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 signature does not bind the odosAssembledData to a specific borrower's borrowing index, allowing reuse of any valid signed swap data.

Impact

Some remaining collateral will be locked in the contract and the output USDT is less than expected.

What the attacker needed

A borrower with remaining collateral; access to a valid signed odosAssembledData

How it was found

  1. Alice deposits WrsETH via depositTokens.
  2. The Ether price increases and Alice initiates a withdrawal, leaving 0.05 ether of collateral to be swapped.
  3. Alice finds a previously used odosAssembledData with an input amount of 0.01 ether.
  4. Alice uses that odosAssembledData to trigger her withdraw, swapping only 0.01 ether of WrsETH to USDT.

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 a borrower withdraws collateral, the contract swaps any leftover collateral into USDT using data from a swap service. The signature that authorises this swap does not tie the swap data to a specific borrower or withdrawal, so a borrower can reuse a signature from another withdrawal that swaps a smaller amount. As a result, some collateral stays stuck in the contract and the borrower gets less USDT.

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.