The CapitalPool::approve function is intended to be called only by the tokenManager, as stated in the documentation. However, there is no access control implemented in the function, allowing anyone to call it. This can lead to arbitrary external calls, which may result in unintended or malicious behavior.
The CapitalPool::approve function is designed to grant the tokenManager maximum allowance for a specified token:
According to the comment, this function should only be callable by the tokenManager. However, the function lacks any access control mechanism to enforce this restriction. As a result, any external address can call the approve function, triggering an arbitrary external call to any specified address.
This is not only inconsistent with the intended design but also poses potential significant security risks. An attacker could potentially exploit this to initiate external calls that could result in unintended behavior, especially when the contract is being used to store funds.
The POC is shown below:
In this example, user1 is able to call the approve function and initiate an external call, which is not the intended behavior.
This vulnerability allows anyone to execute arbitrary external calls through the CapitalPool::approve function. Though the call is being limited to approve, this could still pose potential risks.
Manual, Foundry
Add access control to the approve function to ensure that only the tokenManager can call 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.