Tadle

Tadle
DeFi
30,000 USDC
View results
Submission Details
Severity: low
Invalid

Users may lose funds because of unexpected permanent paused state

Summary

The TokenManager.sol contract includes a vulnerability in its withdraw mechanism. `withdraw() function is protected by a whenNotPaused modifier. This design flaw prevents users from retrieving their tokens when the contract is paused, potentially leading to a permanent loss of assets.

Code Snippet

function withdraw(
address _tokenAddress,
TokenBalanceType _tokenBalanceType
) external whenNotPaused {
uint256 claimAbleAmount = userTokenBalanceMap[_msgSender()][
_tokenAddress
][_tokenBalanceType];
if (claimAbleAmount == 0) {
return;
}
address capitalPoolAddr = tadleFactory.relatedContracts(
RelatedContractLibraries.CAPITAL_POOL
);
if (_tokenAddress == wrappedNativeToken) {
/**
* @dev token is native token
* @dev transfer from capital pool to msg sender
* @dev withdraw native token to token manager contract
* @dev transfer native token to msg sender
*/
_transfer(
wrappedNativeToken,
capitalPoolAddr,
address(this),
claimAbleAmount,
capitalPoolAddr
);
IWrappedNativeToken(wrappedNativeToken).withdraw(claimAbleAmount);
payable(msg.sender).transfer(claimAbleAmount);
} else {
/**
* @dev token is ERC20 token
* @dev transfer from capital pool to msg sender
*/
_safe_transfer_from(
_tokenAddress,
capitalPoolAddr,
_msgSender(),
claimAbleAmount
);
}
emit Withdraw(
_msgSender(),
_tokenAddress,
_tokenBalanceType,
claimAbleAmount
);
}

Vulnerability Details

The withdraw() function in TokenManager.sol is designed to allow users to retrieve their tokens. However, this function is gated by the whenNotPaused modifier, meaning it cannot be executed when the contract is in a paused state. There is no alternative mechanism provided for users to withdraw their tokens if the contract is paused, either temporarily or permanently.

Impact

Users may permanently lose access to their tokens if the contract is paused and no alternative withdrawal mechanism is in place. This can result in a complete and irreversible loss of assets for the users, particularly in cases where the contract remains paused indefinitely.

Proof Of Concept

  1. Bob deposits tokens in the protocol

  2. By any reason the contract gets temporary/permanently paused

  3. Bob tokens are lost for the duration of the paused state. It may be forever.

Tools Used

Manual review

Recommendations

Consider a backup plan for this situation with which token owners will always be able to withdraw their tokens.

Updates

Lead Judging Commences

0xnevi Lead Judge 10 months 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.