Lender
is susceptible to reentrancy attacks, leading to loss of funds.
The Lender
contract is designed to work with any ERC20-based tokens and does not implement any kind of whitelisting. The omission of reentrancy guards leads to the possibility of reentrancy attacks by supplying a malicious loanToken
or collateralToken
.
Funds can be drained from the Lender
contract.
None
The PoC only demonstrates a single attack vector. Since the interactions with the loan and collateral tokens are complex, there are most likely other options for exploitation as well.
Therefore, I suggest implementing a reentrancy guard (such as OpenZeppelin's nonReentrant
modifier from the ReentrancyGuard
contract) for every state-changing method in the Lender
contract.
The PoC demonstrates loss of funds in form of the collateral tokens, where reentering seizeLoan
while still in repay
allows an attacker to withdraw legitimately deposited collateralToken
s of other users.
Paste the below code into test/ReentrancyTest.sol
and run it with the command forge test --match-test "testReentrancy" -vv
. You should see this output:
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.