The approve function in the CapitalPool contract lacks proper access control, allowing any external address to execute the function. This vulnerability could enable an attacker to approve unlimited spending of ERC20 tokens held by the contract, potentially leading to significant financial losses.
The approve function allows any external address to call it without any access control mechanisms such asonlyTokenManager. As a result, any address can instruct the CapitalPool contract to approve an unlimited amount of tokens for spending by the tokenManager contract (or any other contract, depending on the configuration). This can lead to unauthorized transfers of tokens out of the CapitalPool contract, resulting in the depletion of its token reserves.
An attacker can call the approve function with an arbitrary token address, granting the tokenManager (or another contract) unlimited spending power over the specified tokens in the CapitalPool. This could allow the attacker to transfer all of those tokens to their own address, leading to substantial financial losses.
Manual review
Restrict access to the approve function by adding an onlyOwner, onlyTokenManager, or similar modifier to ensure only authorized entities can execute it.
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.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.