Submitted by SpicyMeatball, also found by oakcobalt
https://github.com/code-423n4/2024-07-benddao/blob/main/src/modules/BVault.sol#L74https://github.com/code-423n4/2024-07-benddao/blob/main/src/modules/CrossLending.sol#L50https://github.com/code-423n4/2024-07-benddao/blob/main/src/modules/IsolateLending.sol#L51
If the user specifies native tokens as output assets, the protocol will mistakenly try to unwrap wrapped tokens from the msg.sender instead of the receiver address that was specified in the function call.
This issue occurs in the following modules:
Users are allowed to specify an output asset when borrowing/withdrawing funds from the protocol. If the output asset is a native token, a wrapped version will be sent to the receiver via the erc20TransferOutLiquidity function, and then the receiver of these tokens must send them to the protocol, which will unwrap and send them back:
The problem here is that the wrapped tokens will be sent to the params.receiver address, but the unwrapNativeTokenInWallet function will try to get them from msg.sender, who may not have them in the wallet. As a result withdraw/borrow functionality may fail if msg.sender != receiver:
Same in crossBorrowERC20 and isolateBorrow functions.
Token-Transfer
thorseldon (BendDAO) confirmed and commented:
For this audit, 5 reports were submitted by wardens detailing low risk and non-critical issues. The report highlighted below by Ch_301 received the top score from the judge.
The following wardens also submitted reports: oakcobalt, SpicyMeatball, bin2chen, and 0x73696d616f.
