28713 - [SC - Insight] Reentrancy on BorrowerOperations allows users t...
Description
Brief/Intro
Vulnerability Details
function flashLoan(
IERC3156FlashBorrower receiver,
address token,
uint256 amount,
bytes calldata data
) external override returns (bool) {
require(amount > 0, "BorrowerOperations: 0 Amount");
uint256 fee = flashFee(token, amount); // NOTE: Check for `eBTCToken` is implicit here // NOTE: Pause check is here
require(amount <= maxFlashLoan(token), "BorrowerOperations: Too much");
// Issue EBTC
ebtcToken.mint(address(receiver), amount);
// Callback
require(
receiver.onFlashLoan(msg.sender, token, amount, fee, data) == FLASH_SUCCESS_VALUE,
"IERC3156: Callback failed"
);
// Gas: Repay from user balance, so we don't trigger a new SSTORE
// Safe to use transferFrom and unchecked as it's a standard token
// Also saves gas
// Send both fee and amount to FEE_RECIPIENT, to burn allowance per EIP-3156
ebtcToken.transferFrom(address(receiver), feeRecipientAddress, fee + amount);
// Burn amount, from FEE_RECIPIENT
ebtcToken.burn(feeRecipientAddress, amount);
emit FlashLoanSuccess(address(receiver), token, amount, fee);
return true;
}Impact Details
References
Proof of Concept
Previous28659 - [SC - Insight] Reentrancy in BorrowerOperationsflashLoan enabl...Next28791 - [SC - Low] The system protects from any rounding issues wh...
Last updated
Was this helpful?