The approve
function in the CapitalPool contract lacks proper access control, allowing any address to call it. This function is intended to be called only by the token manager
, as indicated by the comment in the code. However, without any restrictions, an attacker can exploit this function to spam the mempool by repeatedly approving the tokenAddr to the tokenManager.
An attacker can call the approve function in a loop, creating numerous transactions that approve the tokenAddr to the tokenManager. This can lead to congestion in the Ethereum network's mempool, potentially increasing gas prices and delaying other transactions.
By spamming the mempool with approval transactions, an attacker can cause a denial of service, making it difficult for legitimate transactions to be processed in a timely manner.
Even if the tokenManager is trusted, the lack of access control means that any address can call the approve function, leading to unintended approvals. This could result in the CapitalPool contract approving tokens for spending by the tokenManager without proper authorization.
Manual Analysis
To mitigate this issue, implement access control to ensure that only the token manager can call the approve 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.