Tadle

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

Unauthorized Access to approve Function in CapitalPool Contract

Summary

Vulnerability Details

The approve function in the CapitalPool contract lacks proper access control, allowing any address to call it. This function is intended to be called only by the token manager, as indicated by the comment in the code. However, without any restrictions, an attacker can exploit this function to spam the mempool by repeatedly approving the tokenAddr to the tokenManager.

/**
* @dev Approve token for token manager
* @notice only can be called by token manager
* @param tokenAddr address of token
*/
function approve(address tokenAddr) external {//@audit- no access control
address tokenManager = tadleFactory.relatedContracts(
RelatedContractLibraries.TOKEN_MANAGER
);
(bool success, ) = tokenAddr.call(
abi.encodeWithSelector(
APPROVE_SELECTOR,
tokenManager,
type(uint256).max
)
);
if (!success) {
revert ApproveFailed();
}
}

Impact

  • An attacker can call the approve function in a loop, creating numerous transactions that approve the tokenAddr to the tokenManager. This can lead to congestion in the Ethereum network's mempool, potentially increasing gas prices and delaying other transactions.

  • By spamming the mempool with approval transactions, an attacker can cause a denial of service, making it difficult for legitimate transactions to be processed in a timely manner.

  • Even if the tokenManager is trusted, the lack of access control means that any address can call the approve function, leading to unintended approvals. This could result in the CapitalPool contract approving tokens for spending by the tokenManager without proper authorization.

Tools Used

Manual Analysis

Recommendations

To mitigate this issue, implement access control to ensure that only the token manager can call the approve function.

Updates

Lead Judging Commences

0xnevi Lead Judge about 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

finding-CapitalPool-approve-missing-access-control

This is at most low severity, even though giving max approvals shouldn't be permisionless, the respective tokenManager address is retrieved from the TadleFactory contract whereby the trusted guardian role is responsible for deploying such contracts as seen [here](https://github.com/Cyfrin/2024-08-tadle/blob/04fd8634701697184a3f3a5558b41c109866e5f8/src/factory/TadleFactory.sol#L68). Since the user still has to go through the PreMarkets/DeliveryPlace contracts to perform market actions, this max approval cannot be exploited.

Support

FAQs

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