Aave's flashloan allows to pass a receiverAddress when calling flashloan. This address will be called by aave to invoke the flashloan callback. The attacker can deploy a malicious to call flashloan and set receiverAddress to OptionsPositionManager.
function flashLoan(
address receiverAddress,
address[] calldata assets,
....
The flashloan will call OptionsPositionManager's executeOperation function.
The attacker can pass a constructed params that sets the executeBuyOptions parameters to buy options on behalf of any user.
Lines of code
https://github.com/code-423n4/2023-08-goodentry/blob/main/contracts/PositionManager/OptionsPositionManager.sol#L42
Vulnerability details
Impact
Anyone can buy options on behalf of other users.
Proof of Concept
Aave's flashloan allows to pass a
receiverAddress
when callingflashloan
. This address will be called by aave to invoke the flashloan callback. The attacker can deploy a malicious to callflashloan
and setreceiverAddress
toOptionsPositionManager
.The flashloan will call OptionsPositionManager's
executeOperation
function.The attacker can pass a constructed
params
that sets theexecuteBuyOptions
parameters to buy options on behalf of any user.Tools Used
Manual review
Recommended Mitigation Steps
Add a check on
initiator
.Assessed type
Access Control