Function CapitalPool:approve
supposed to be called only by TokenManager according to its natspec. However, there's no access control implemented causing the function can be called by anyone to approve token of their interest.
The natspec in function CapitalPool:approve
specifies that only the token manager can call the function. In the code implementaion, there's no access control check resulting the function can be called by anyone to approve token of their interest.
Proof of concept:
In test/PreMarkets.t.sol
, add the following test :
After forge test run, the test passes indicating that any random user can approve the function CapitalPool:approve
Anyone can just approve the token of their interest in the CapitalPool
contract which could affect the normal functionality and integrity of the other contract that depends on the state of this function.
Manual review with forge test
To implment access control check in the function code:
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.