Tadle

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

Unchecked Call Return Value

Summary

The approve function performs a low-level call to tokenAddr. If the call fails, the transaction will revert. However, using low-level calls without checking return values can lead to unnoticed failures or unexpected behaviours.

Vulnerability Details

A malicious token contract could always return true, even if the approve call fails or does something malicious. This could lead to unauthorised transfers or other unexpected behaviour

Impact

If an attacker manages to bypass the approval mechanism, they could potentially drain the entire token balance of the contract. The loss would depend on the balance of the token at the time of the attack but could be catastrophic if the contract holds significant funds

Tools Used

Manual review

CODE SNIPPET

function approve(address tokenAddr) external {
address tokenManager = tadleFactory.relatedContracts(
RelatedContractLibraries.TOKEN_MANAGER
);
(bool success, ) = tokenAddr.call(
abi.encodeWithSelector(
APPROVE_SELECTOR,
tokenManager,
type(uint256).max
)
);
if (!success) {
revert ApproveFailed();
}

Recommendations

Use the IERC20 interface and it's approve function to avoid low-level calls

function approve(address tokenAddr) external onlyOwner{
address tokenManager = tadleFactory.relatedContracts(
RelatedContractLibaries.TOKEN_MANAGER
);
IERC20(tokenAddr).approve(tokenManager,type(uint256).max);
}
Updates

Lead Judging Commences

0xnevi Lead Judge
about 1 year ago
0xnevi Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement
Assigned finding tags:

[invalid] finding-CapitalPool-approve-return-boolean

Invalid, low level call will always return true as long as the call succeeds without reverting, so this has no impact described, given approvals can only fail when some weird tokens do not allow a uint256.max approval, which is not described in any of the issues below.

Support

FAQs

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