Summary
The nonReentrant modifier should occur before all other modifiers
Vulnerability Details
In DSCEngine.sol, the following is used
function redeemCollateral(address tokenCollateralAddress, uint256 amountCollateral)
public
moreThanZero(amountCollateral)
nonReentrant
{
_redeemCollateral(msg.sender, msg.sender, tokenCollateralAddress, amountCollateral);
_revertIfHealthFactorIsBroken(msg.sender);
}
Impact
The other modifiers could be re-entered if they have complex logic
Tools Used
Manual review
Recommendations
change the function to this.
function redeemCollateral(address tokenCollateralAddress, uint256 amountCollateral)
public
nonReentrant
moreThanZero(amountCollateral)
{
_redeemCollateral(msg.sender, msg.sender, tokenCollateralAddress, amountCollateral);
_revertIfHealthFactorIsBroken(msg.sender);
}