In CapitalPool.sol
, function approve
must only can be called by token manager but there is no limitation for that. Everyone can call this function.
In TokenManager.sol
there is a function which is function _transfer
and uses this approve
to send tokens.
The fact that the approve
function can be called by anyone, especially when used together with the _transfer
function, can lead to serious security vulnerabilities. These vulnerabilities could allow malicious individuals to exploit the system, resulting in unjust gains or disrupting the proper functioning of the system.
Potential System Vulnerabilities
Unauthorized Transfer Authorization:
The unrestricted access to the approve function allows unauthorized users to perform approval actions on the CapitalPool contract.
This could lead to unlimited allowances being granted to the tokenManager address, allowing it to withdraw any desired tokens from CapitalPool.
In such a case, a malicious actor could use the approve function to transfer tokens within the system to another address.
Manipulation and Double-Spending Risk:
A malicious user could continuously call the approve function, frequently granting unlimited allowances to the tokenManager address.
With these allowances, it could be possible to repeatedly transfer the same tokens, enabling double-spending or manipulation.
Denial of Service (DoS) Attacks:
A malicious actor could repeatedly call the approve function to overload the system, causing it to become busy.
This could consume the system's resources, leading to slowdowns or even a complete halt in processing."
Manual review
An access control like the following can be added at the beginning of the 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.