The CapitalPool contract contains an approve function that is intended to allow only the TokenManager to authorize token approvals. However, due to the lack of an explicit access control check, this function can be called by any external account, leading to a potential security vulnerability.
The approve function retrieves the TokenManager address from the TadleFactory contract using the RelatedContractLibraries. However, it does not verify whether the caller (msg.sender) is the authorized TokenManager. This missing check allows any external account to execute the approve function, potentially leading to unauthorized approvals.
https://github.com/Cyfrin/2024-08-tadle/blob/main/src/core/CapitalPool.sol#L24
If exploited, this vulnerability could allow a malicious actor to call the approve function and approve an unlimited amount of tokens to any address of their choosing. This could result in unauthorized transfers of tokens and significant financial loss.
Manual Code Review
Add an explicit access control check in the approve function to ensure that only the TokenManager can execute this function.
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.