OrderBook

First Flight #43
Beginner FriendlySolidity
100 EXP
View results
Submission Details
Impact: medium
Likelihood: medium
Invalid

### [M-1] Centralization Risk::Malicious Onwer can Disable Core tokens.

[M-1] Centralization Risk::Malicious Onwer can Disable Core tokens.

Description

The OrderBook::setAllowedSellToken allows OnlyOnwer to enable and disable specific tokens.
However,This is considered as centralization risk,if owner become compromised or maliciousthey could
set setAllowedSellToken[false] for core tokens such as weth,wbtc,wsol.Which leads to entire
protocol disruption.Sellers can no longer create sell orders of core tokens.

Impact:

1.Denial of service for all sellers of disabled tokens.

2.Protocol disruption and loss of user trust.

3.Sellers tokens gets locked permanently.

Proof of Concept

Owner Disabling weth token:

function test_centralisationrisk() public {
address wethtoken = address(orderbook.iWETH());
vm.startPrank(owner);
orderbook.setAllowedSellToken(wethtoken, false);
vm.stopPrank();
vm.startPrank(bobseller);
weth.approve(address(orderbook), type(uint).max);
vm.expectRevert(OrderBook.InvalidToken.selector);
uint orderid = orderbook.createSellOrder(
address(weth),
2e18,
2000e6,
1 days
);
vm.stopPrank();
}

Recommended Mitigation

Disallow disabling core tokens

function setAllowedSellToken(
address _token,
bool _isAllowed
) external onlyOwner {
+if(!_isAllowed && _token ==address(IWETH) || (_token==address(IWETH)) || (_token==address(IWETH) ) ){
+ revert InvalidToken();
+ }
if (_token == address(0) || _token == address(iUSDC))
revert InvalidToken(); // Cannot allow null or USDC itself
allowedSellToken[_token] = _isAllowed;
emit TokenAllowed(_token, _isAllowed);
}
Updates

Lead Judging Commences

yeahchibyke Lead Judge 4 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.