The approve
function from the IERC20
interface is used in several part of the protocole. However, the use of approve
is not recommended due to potential security risks and edge cases. Instead, the safeApprove
function should be used to ensure safer token approvals.
https://github.com/Cyfrin/2025-01-zaros-part-2/blob/35deb3e92b2a32cd304bf61d27e6071ef36e446d/src/market-making/branches/VaultRouterBranch.sol#L354
https://github.com/Cyfrin/2025-01-zaros-part-2/blob/35deb3e92b2a32cd304bf61d27e6071ef36e446d/src/market-making/branches/CreditDelegationBranch.sol#L662
https://github.com/Cyfrin/2025-01-zaros-part-2/blob/35deb3e92b2a32cd304bf61d27e6071ef36e446d/src/market-making/branches/CreditDelegationBranch.sol#L747
https://github.com/Cyfrin/2025-01-zaros-part-2/blob/35deb3e92b2a32cd304bf61d27e6071ef36e446d/src/market-making/branches/CreditDelegationBranch.sol#L847
Severity: Low/Informational
Impact: While the use of approve
may not immediately lead to a vulnerability, it can cause issues in certain scenarios, such as when the spender's allowance is not properly reset before setting a new one. This can lead to unexpected behavior or potential loss of funds.
Replace all approve
function with safeApprove
to mitigate potential risks. The safeApprove
function ensures that the allowance is set to zero before updating it to a new value, preventing potential issues with token approvals.
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.