Closed sherlock-admin closed 1 year ago
3 comment(s) were left on this issue during the judging contest.
panprog commented:
invalid, because Lender contract doesn't have onFlashLoan function, so the example approve will simply revert
tsvetanovv commented:
I think the function works as it should
MohammedRizwan commented:
insufficient details
IceBear
medium
Lender.sol flash() is a vulnerable function, can drain the asset
Summary
Lender.sol flash() is a vulnerable function, can drain the asset
Vulnerability Detail
In the Lender.sol, the flash() function does not validate the 'to' address. It allows to pass an arbitrary bytes calldata data as one of the arguments. Later it calls receiver, that can be Lender contract itself, with a malicious data.
Impact
Malicious users can pass parameters like this:
hacker will be approved and be able to transfer all tokens from the contract. P.S. The same issue was in Damn Vulnerably DeFi Challenges (Truster).
Code Snippet
https://github.com/sherlock-audit/2023-10-aloe/blob/main/aloe-ii/core/src/Lender.sol#L295
Tool used
Manual Review
Recommendation
As per eip-3156. This is reference implementation in which initiator is authenticated.
Refer eip-3156 for reference.