Pools can be created with arbitrary tokens as the collateral, including ERC777 tokens. However, when the addToPool is used with those tokens, an attacker can drain all contract's tokens completely. This happens because with ERC777 tokens, there is a tokensToSend hook that is executed before the actual transfer (and the balance updates) happen.
Lender.sol has an addToPool function, which allows the lender to add funds to the pool. However, this function doesn't follow CEI (checks, effects, interactions) pattern and lacks a reentrancy guard. Consequently, any user can reenter this function and increase their poolBalance.
Example:
By using ERC777, an attacker can reenter addToPool function and increase their poolBalance
Then the attacker can call the setPool() function to change the collateral token, which this function doesn't prohibit. poolBalance will stay the same
Finally, the attacker may call setPool() again and reduce their poolBalance.
The attacker can repeat steps 2-3 with all collateral tokens
Malicious user can steal all collateral tokens
Manual Review
Add reentrancy guard to the addToPool function and change it in the following way:
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.