In the buyLoan
function, there is no check that the caller owns pool where the debt is transfered to, resulting in funds being stolen.
When a loan is put up for auction, anyone can call the buyLoan
function which transfers the debt to another pool without checking that the caller owns the new pool.
https://github.com/Cyfrin/2023-07-beedle/blob/658e046bda8b010a5b82d2d85e824f3823602d27/src/Lender.sol#L518
Hence, a malicious actor can:
Create a pool
Take a loan in his own pool
Put the loan for auction
Call buyLoan
to transfer the debt to a similar pool
Repeat steps (2)(3)(4)
Keep all the profit
All tokens from the lender
contract can be stolen. This is a critical issue.
Here are the tests that can be added to Lender.t.sol
to illustrate the steps of an attacker:
Manual review + Foundry
Check that msg.sender
is the owner of the pool poolId
. Add this check at the top of the buyLoan
function:
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.