Submitted by zhaojie, also found by rvierdiiev
receiveFlashLoan does not validate the originalCallData. The attacker can pass any parameters into the receiveFlashLoan function and execute any Strategy instruction :_supplyBorrow _repayAndWithdraw _payDeb.
The StrategyLeverage#receiveFlashLoan function only validates whether the msg.sender is _balancerVault, but does not validate the originalCallData:
_balancerVault.flashLoan can specify the recipient:
An attacker can initiate flashLoan from another contract and specify the recipient as BalancerFlashLender. _balancerVault will call the balancerFlashlender#receiveFlashLoan function.
Since the caller of the receiveFlashLoan function is _balancerVault, this can be verified against msg.sender.
The StrategyLeverage#onFlashLoan function parses the instructions to be executed from originalCallData(FlashLoanData) and executes them.
So the attacker, by calling the _balancerVault flashLoan function, designated recipient for BalancerFlashLender, borrower for StrategyLeverage.
An attacker can invoke the _supplyBorrow _repayAndWithdraw _payDeb function in StrategyLeverage with any FlashLoanData parameter.
VSCode, Manual
hvasconcelos (BakerFi) confirmed
0xleastwood (judge) decreased severity to Medium and commented:
0xleastwood (judge) commented:
ickas (BakerFi) commented:
Note: for full discussion, please see the wardens original submission.
For this audit, 3 reports were submitted by wardens detailing low risk and non-critical issues. The report highlighted below by t0x1c received the top score from the judge.
The following wardens also submitted reports: 0xStalin and bin2chen.
