OrderBook

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

setAllowedSellToken Does Not Restrict to Approved Tokens

Root + Impact

Description

  • Only four token are allowed to sell

  • setAllowedSellToken doesn't restrict which token to sell.

function setAllowedSellToken(address _token, bool _isAllowed) external onlyOwner {
if (_token == address(0) || _token == address(iUSDC)) revert InvalidToken(); // Cannot allow null or USDC itself
allowedSellToken[_token] = _isAllowed;
//@audit if(_token != address(iWETH) | _token != address(iWBTC) | _token != address(iWSOL) | _token != address(iUSDC)) revert InvalidToken(); ))
emit TokenAllowed(_token, _isAllowed);
}

Risk

Likelihood:

  • Reason 1 Human error(owner might add malicious tokens)

  • Reason 2 Attacker become owner (private key leak)

Impact:

  • The onlyOwner role can whitelist any ERC20 token (except address(0)/USDC).

  • Malicious token can leads to loss of funds.

Proof of Concept Owner (or compromised owner) calls:

Buyer pays USDC for the malicious token.

  • Attacker steals funds or causes trade to fail.

setAllowedSellToken(address(maliciousToken), true);

Recommended Mitigation Include given require checks.

- remove this code
+ require(
_token == address(iWETH) ||
_token == address(iWBTC) ||
_token == address(iWSOL) ,
"InvalidToken: Only iWETH, iWBTC, iWSOL, or iUSDC allowed"
);
Updates

Lead Judging Commences

yeahchibyke Lead Judge about 1 month ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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