28659 - [SC - Insight] Reentrancy in BorrowerOperationsflashLoan enabl...
Submitted on Feb 23rd 2024 at 08:12:41 UTC by @OxG0P1 for Boost | eBTC
Report ID: #28659
Report type: Smart Contract
Report severity: Insight
Target: https://github.com/ebtc-protocol/ebtc/blob/release-0.7/packages/contracts/contracts/BorrowerOperations.sol
Impacts:
Griefing (e.g. no profit motive for an attacker, but damage to the users or the protocol)
Description
Brief/Intro
Due to an reentrancy attack vector, an attacker can flashLoan an unlimited amount of eBTC. For example the attacker can create a malicious contract as the receiver, to execute the attack via the onFlashLoan callback .
The exploit works because BorrowerOperations.flashLoan() is missing a reentrancy protection (modifier).
As a result an unlimited amount of eBTC can be borrowed by an attacker via the flashLoan .
Vulnerability Details
The BorrowerOperations.sol contract facilitates the execution of flash loans for eBTC. A user is permitted to loan a maximum amount of type(uint112).max. However, a vulnerability exists wherein an attacker can exploit the absence of the Reentrancy modifier in the BorrowerOperations.flashLoan() function. This oversight enables an attacker to potentially mint an infinite amount of eBTC tokens. By leveraging a malicious receiver implementation contract, the attacker can execute this exploit, posing a significant risk to the integrity and security of the eBTC ecosystem.
Impact Details
An attacker can bypass the maxFlashloan amount and mint infinite amount of eBTC tokens.
References
https://github.com/ebtc-protocol/ebtc/blob/a96bd000c23425f04c3223a441a625bfb21f6686/packages/contracts/contracts/BorrowerOperations.sol#L1091-L1122
Proof of Concept
Test :
Receiver Implementation :
Test Results :
Last updated
Was this helpful?