You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The redeemUSDT function lacks slippage protection, which could result in users receiving fewer USDT tokens than expected due to market movements. Specifically, the function calculates the USDT amount based on fixed prices (usdaPrice and usdtPrice) without including a minOutputAmount parameter to ensure users receive a minimum acceptable amount of USDT. This exposes users to potential losses during volatile market conditions or delays in transaction execution.
Vulnerability Details
The redeemUSDT function in CDSLib.sol uses fixed prices (usdaPrice and usdtPrice) for calculating the output USDT amount. However, these prices may not reflect the actual exchange rate at the time of transaction execution due to potential market movements or execution delays. Additionall y, there is no mechanism to enforce a minimum acceptable output amount, leaving users vulnerable to slippage. CDSLib.sol#L382-L418
functionredeemUSDT(CDSInterface.Interfacesmemoryinterfaces,uint256burnedUSDaInRedeem,uint128usdaAmount,uint64usdaPrice,uint64usdtPrice)externalreturns(uint256){// CHeck the usdaAmount is non zeroif(usdaAmount==0)revertCDSInterface.CDS_NeedsMoreThanZero();// Check the user has enough usda balanceif(interfaces.usda.balanceOf(msg.sender)<usdaAmount)revertCDSInterface.CDS_Insufficient_USDa_Balance();// Increment burnedUSDaInRedeemburnedUSDaInRedeem+=usdaAmount;// GET the omnichain dataIGlobalVariables.OmniChainDatamemoryomniChainData=interfaces.globalVariables.getOmniChainData();// Increment burnedUSDaInRedeemomniChainData.burnedUSDaInRedeem+=usdaAmount;// burn usdabooltransfer=interfaces.usda.burnFromUser(msg.sender,usdaAmount);if(!transfer)revertCDSInterface.CDS_TransferFailed(IBorrowing.AssetName.USDa);// calculate the USDT USDa ratio
@>uint128usdtAmount=((usdaPrice*usdaAmount)/usdtPrice);//@audit no slippage// more code
The actual exchange rate at execution time could be different from what the user expected when initiating the transaction.
Bitter Crepe Lizard
Medium
Lack of slippage protection in
redeemUSDT
Summary
The
redeemUSDT
function lacks slippage protection, which could result in users receiving fewerUSDT
tokens than expected due to market movements. Specifically, the function calculates theUSDT
amount based on fixed prices (usdaPrice
andusdtPrice
) without including aminOutputAmount
parameter to ensure users receive a minimum acceptable amount ofUSDT
. This exposes users to potential losses during volatile market conditions or delays in transaction execution.Vulnerability Details
The
redeemUSDT
function inCDSLib.sol
uses fixed prices (usdaPrice
andusdtPrice
) for calculating the outputUSDT
amount. However, these prices may not reflect the actual exchange rate at the time of transaction execution due to potential market movements or execution delays. Additionall y, there is no mechanism to enforce a minimum acceptable output amount, leaving users vulnerable to slippage.CDSLib.sol#L382-L418
The actual exchange rate at execution time could be different from what the user expected when initiating the transaction.
Example Scenario:
Impact
Users may receive significantly fewer
USDT
tokens than expected, especially during periods of high market volatility or delayed transaction execution.Tools Used
Manual Review
Recommendation
Add a
minOutputAmount
parameter to theredeemUSDT
function to ensure users receive a minimum acceptable amount ofUSDT
.The text was updated successfully, but these errors were encountered: