The approve
function allows any external address to call it and approve a token address with unlimited spending rights. This function uses a low-level call
to interact with the token contract, which can be exploited if the token address is malicious or not implemented correctly. The function does not perform adequate validation of the token address or the token contract’s behavior, leading to potential unauthorized access and misuse of tokens.
Function:
The function uses call
to invoke the approve
method on the token contract specified by tokenAddr
, granting unlimited allowance to tokenManager
. The function is call by anyone and this method lacks checks to ensure that tokenAddr
is a legitimate ERC20 token or not check zero and that it performs the approve
function as expected.
Allowing anyone to call the approve function without restrictions can lead to significant security risks, including unauthorized token approvals, potential misuse of tokens, and broader vulnerabilities in the system
Manual review
Token Address Validation:
Ensure that tokenAddr
is not a zero address and verify that it conforms to ERC20 standards.
Implement a check to confirm that tokenAddr
supports the approve
function using a safer approach than low-level calls.
Access Control:
Restrict access to the approve
function so that only authorized addresses or roles can perform the approval action.
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.