sherlock-audit / 2023-06-dinari-judging

5 stars 4 forks source link

hals - `_cancelOrderAccounting` in `SellOrderPeocessor` contract will revert if the `orderRequest.recipient` is a blacklisted account in `BridgedERC20` dShare token #69

Closed sherlock-admin closed 1 year ago

sherlock-admin commented 1 year ago

hals

medium

_cancelOrderAccounting in SellOrderPeocessor contract will revert if the orderRequest.recipient is a blacklisted account in BridgedERC20 dShare token

Summary

_cancelOrderAccounting in SellOrderPeocessor contract will revert if the orderRequest.recipient is a blacklisted account in BridgedERC20 dShare token

Vulnerability Detail

Impact

This will prevent operators from deleting the invalid and un-fulfillabl sellOrders, or deleting the sellOrder as per the request of OrderState.requester (the one who adds the order) , so the assetToken (and paymentToken if the order is partially filled) of the order paid by the OrderState.requester will be stuck (unless manually sent to the requester).

Code Snippet

 Line 150: IERC20(orderRequest.assetToken).safeTransfer(orderRequest.recipient, refund);
    function _beforeTokenTransfer(address from, address to, uint256) internal virtual override {
        // Restrictions ignored for minting and burning
        // If transferRestrictor is not set, no restrictions are applied
        if (from == address(0) || to == address(0) || address(transferRestrictor) == address(0)) {
            return;
        }

        // Check transfer restrictions
        transferRestrictor.requireNotRestricted(from, to);
    }
    function requireNotRestricted(address from, address to) external view virtual {
        // Check if either account is restricted
        if (blacklist[from] || blacklist[to]) {
            revert AccountRestricted();
        }
        // Otherwise, do nothing
    }

Tool used

Manual Review

Recommendation

In OrderProcessor contract/requestOrder function: check if the orderRequest.recipient is not dShare token blacklisted account before adding a sellOrder to the platform.

Duplicate of #55