Tadle

Tadle
DeFiFoundry
27,750 USDC
View results
Submission Details
Severity: low
Invalid

Call the `TokenManager::updateTokenWhiteListed` function when market place have their tokenAddress in "unwhitelisted" can break offer with status different to 'Online'

Relevant GitHub Links

https://github.com/Cyfrin/2024-08-tadle/blob/04fd8634701697184a3f3a5558b41c109866e5f8/src/core/TokenManager.sol#L197

https://github.com/Cyfrin/2024-08-tadle/blob/04fd8634701697184a3f3a5558b41c109866e5f8/src/core/TokenManager.sol#L65

https://github.com/Cyfrin/2024-08-tadle/blob/04fd8634701697184a3f3a5558b41c109866e5f8/src/core/TokenManager.sol#L220

https://github.com/Cyfrin/2024-08-tadle/blob/04fd8634701697184a3f3a5558b41c109866e5f8/src/core/DeliveryPlace.sol#L267

Summary

Offers whose tokenAddress has been deactivated can no longer be fully satisfied.

Vulnerability Details

The DeliveryPlace::settleAskTaker and DeliveryPlace::settleAskMakerfunctions call TokenManager::tillIn providing the tokenAddress of the appropriate marketplace.
The method TokenManager::updateTokenWhiteListed which can be used to disable a token ("unwhitelist")who ill be used in the app does not take into account that there might exist offers. That can be in the AskSettling or BidSettling stage that might certainly have already been partially "asked" on by caling DeliveryPlace::settleAskMaker or DeliveryPlace:SettleAskTaker.

In TokenManager contract:

@> function updateTokenWhiteListed(
address[] calldata _tokens,
bool _isWhiteListed
) external onlyOwner {
uint256 _tokensLength = _tokens.length;
for (uint256 i = 0; i < _tokensLength; ) {
_updateTokenWhiteListed(_tokens[i], _isWhiteListed);
unchecked {
++i;
}
}
}
function tillIn(
address _accountAddress,
address _tokenAddress,
uint256 _amount,
bool _isPointToken
)
external
payable
onlyRelatedContracts(tadleFactory, _msgSender())
@> onlyInTokenWhiteList(_isPointToken, _tokenAddress)
{
/// @notice return if amount is 0
if (_amount == 0) {
return;
}
...
}
function _updateTokenWhiteListed(
address _token,
bool _isWhiteListed
) internal {
@> tokenWhiteListed[_token] = _isWhiteListed;
emit UpdateTokenWhiteListed(_token, _isWhiteListed);
}

In DeliveryPlace contract:

function settleAskMaker(address _offer, uint256 _settledPoints) external {
...
if (settledPointTokenAmount > 0) {
@> tokenManager.tillIn(
_msgSender(),
marketPlaceInfo.tokenAddress,
settledPointTokenAmount,
true
);
}
...
}

Impact

Creation of some offers that will not be fully satisfied.

Tools Used

Manual anlysis.

Recommendations

prevent disabling a token if there are offers that are currently being settled with this token.

Updates

Lead Judging Commences

0xnevi Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Known issue
Assigned finding tags:

[invalid] finding-Admin-Errors-Malicious

The following issues and its duplicates are invalid as admin errors/input validation/malicious intents are1 generally considered invalid based on [codehawks guidelines](https://docs.codehawks.com/hawks-auditors/how-to-determine-a-finding-validity#findings-that-may-be-invalid). If they deploy/set inputs of the contracts appropriately, there will be no issue. Additionally admins are trusted as noted in READ.ME they can break certain assumption of the code based on their actions, and

Support

FAQs

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

Give us feedback!