In liquidateBorrower, you use crvUSDToken.approve(address(lendingPool), scaledUserDebt).
This can lead to race conditions where a malicious contract can front-run and change the allowance before finalizeLiquidation is executed.
}
Instead of approve, use safeIncreaseAllowance and safeDecreaseAllowance from SafeERC20.
Alternatively, use permit if crvUSDToken supports EIP-2612.
Another safer pattern is to call transfer directly rather than approving beforehand.
crvUSDToken.safeIncreaseAllowance(address(lendingPool), scaledUserDebt);
lendingPool.finalizeLiquidation(userAddress);
crvUSDToken.safeDecreaseAllowance(address(lendingPool), scaledUserDebt);
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.