_wethWithdrawTo is vulnerable re-entrancy
The function `withdrawBorrowETH` calls `_wethWithdrawTo`, which uses a low-level call to transfer ether, making it vulnerable to re-entrancy. An attacker could re-enter the contract to bypass the `MIN_RESERVE` check and potentially manipulate the reserve.
Submitted by pauliax
The function withdrawBorrowETH invokes _wethWithdrawTo and later _checkMinReserve, however, the check of reserve is not necessary here, as function _wethWithdrawTo also does that after transferring the ether. However, this reserve check might be bypassed as TransferHelper._wethWithdrawTo uses a low level call that is vulnerable to re-entrancy attacks. As this MIN_RESERVE sounds like an important value, you should consider preventing re-entrancy attacks here.
// Prevents division by zero and other undesirable behavior
uint public constant MIN_RESERVE = 1000;
Recommend considering using re-entrancy guard on all main action functions (e.g. deposit, withdraw, borrow,repay, etc…):
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the use of a low-level call to transfer ether without a re-entrancy guard, allowing an attacker to re-enter the contract before the reserve check completes.
Impact
An attacker could bypass the minimum reserve check, potentially causing the contract to operate with insufficient reserves.
What the attacker needed
None
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
When a contract sends ether to an external address, that address can run code that calls back into the contract before the first operation finishes. This is called re-entrancy. Here, the contract checks a minimum reserve after sending ether, so an attacker could re-enter and bypass that check.