The CapitalPool::approve function is intended to allow only the designated token manager to approve tokens (as indicated in the natspec here https://github.com/Cyfrin/2024-08-tadle/blob/04fd8634701697184a3f3a5558b41c109866e5f8/src/interfaces/ICapitalPool.sol#L11). However, the current implementation lacks proper access control mechanisms, enabling any address to call this function and approve unlimited amounts of tokens without restriction.
The absence of an access control mechanism, such as a modifier that verifies the caller's identity, means that the approve function does not enforce its intended restriction to the token manager only. This oversight allows unauthorized users to execute the function.
An attacker exploiting this vulnerability can approve tokens from the contract to any address, including their own, without needing authorization from the token manager and transfer the funds.
Copy and paste this test in PreMarket.t.sol
Run forge test --match-test test_notOnlyTokenManager
Manual review
Implement a modifier to enforce access control for the approve function, ensuring that only the designated token manager can invoke 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.