15,000 USDC
View results
Submission Details
Severity: high

redeemCollateralForDsc

Summary

The amountCollateral should be more than zero. so that redeemCollateral value will be greater than zero.

Vulnerability Details

Add moreThanZero(amountCollateral) nonReentrant in below function =>
function redeemCollateralForDsc(address tokenCollateralAddress, uint256 amountCollateral, uint256 amountDscToBurn)
external
{
burnDsc(amountDscToBurn);
redeemCollateral(tokenCollateralAddress, amountCollateral);
// redeemCollateral already checks health factor
}

Impact

If the moreThanZero(amountCollateral) and nonReentrant modifiers are not added to the redeemCollateralForDsc function, then the function will not check if the amountCollateral argument is greater than zero and will not prevent reentrancy attacks.

This means that it would be possible for a user to call the function with an amountCollateral argument of zero, which could get errors in the function’s execution. Additionally, without the nonReentrant modifier, the function would be vulnerable to reentrancy attacks, where an attacker could potentially call the function again before it has finished executing.

Tools Used

Manual Review

Recommendations

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.