This contract accepts any ERC20 token for lending tokens and collateral tokens, and it is possible in the future there will be some tokens where transferFrom
will be overridden and modified.
A malicious lending token can create re-entrancy in the addToPool
function.
This is an overridden transferFrom
function in a malicious ERC20 token, as we can see it re-enters the lending contract when we call addToPool
function. It again calls addToPool
until the pool balance is less than 10 ether
.
In this test, we can see an attacker creates a pool with malicious lending ERC20 token with a zero
balance and using the addToPool
function he passes only 1 ether
but pool balances increases to 10 ether
due to re-entrancy.
Also, we can see the lender contract only has 1 ether
, which means the transferFrom
function is working as expected but just modified by the attacker.
Note: You can give a reason that if such a token exists then users will simply not take a loan from those pools, but suppose a token gets hyped and users start borrowing loans on Beedle from the malicious pool then Beedle contract can be manipulated by an attacker
.
An attacker can provide any amount of lending tokens to Beedle and earn interest.
Slither, Manual Review, Solodit
Should follow the CEI (Check Affect Interaction pattern) and also for safety reasons use Openzeppelin Reentrancy Guard for functions interacting with external contracts.
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.