Submitted by sashik_eth
The refundNative modifier unwraps and sends a native coin to the msg.sender at the end of the function execution. However, it could send native even if the case function call was not related to native coin trading - for example, if wrapped tokens were already on the MarginTradingHook balance. At the same time if the function caller is the contract that has no function except native transfer - the whole transaction would be reverted. Malicious actors could DOS such contracts by sending dust amounts of wrapped native tokens to the MarginTradingHook balance.
Contracts that use MarginTradingHook could be DOSed in case they have no function to receive native.
Consider the next scenario:
Bob could effectively continue DOS even if native funds were withdrawn by other users, by spamming dust amount txs each block, at the same time Alice could lose funds on her active positions due to changing market conditions.
Consider adding the explicit parameter refundNative that users could set to true in case they expect a native transfer. Alternatively, remove the require statement at the end of the refundNative modifier code.
fez-init (INIT) disputed and commented:
hansfriese (Judge) decreased severity to Medium and commented:
