Missing slippage control when swapping loan tokens for collateral tokens in the Fees#sellProfits(), which allow an attacker to steal funds by the front-running / sandwich attack when swapping loan tokens for collateral tokens in the Fees#sellProfits()
Within the Fees#sellProfits(), 0 would always be assigned into the amountOutMinimum property as a argument of the params for swapping loan tokens for collateral tokens like this:
https://github.com/Cyfrin/2023-07-beedle/blob/main/src/Fees.sol#L38
However, setting 0 to the amountOutMinimum property means no slippage control, which allow an attacker to steal funds by the front-running / sandwich attack when swapping loan tokens for collateral tokens in the Fees#sellProfits().
Lose of fund by front-running / sandwitch attack when swapping the loan token for the collateral token due to lack of slippage control.
Foundry
Within the Fees#sellProfits(), consider adding the _amountOutMinimum parameter and replacing the argument to be assigned into the amountOutMinimum property from 0 to the _amountOutMinimum so that a caller can specify their acceptable slippage parameter like this:
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.