This report identifies a critical issue in the interaction between the FeeCollector
contract and the Treasury
contract. The problem arises from the way tokens are transferred to the Treasury
using the safeTransfer
method without updating the internal balance tracking state variable (_balances[token]
) in the Treasury
contract. This can lead to a situation where the contract’s internal state does not reflect the actual token balance, preventing the successful withdrawal of funds from the treasury.
In the current implementation, tokens are sent from the FeeCollector
contract to the Treasury
contract using the following line of code:
However, the Treasury
contract maintains an internal balance (_balances[token]
) which is only updated through the deposit
function. Since the safeTransfer
method is directly used to send tokens, the internal state does not get updated with the new token balance. As a result, the withdraw()
function in the Treasury
contract, which checks the balance of tokens using _balances[token]
, will return incorrect values and fail to allow withdrawals, even though the contract holds the correct amount of tokens.
The issue can have several severe consequences:
Token Depletion Risk: Since internal balances are not updated when tokens are transferred, the treasury contract will report an incorrect token balance. This can lead to failed withdrawals or incorrect accounting of available funds.
Security Breach: Attackers or malicious actors may exploit this behavior to make it appear that tokens are not available in the treasury, which could lead to the loss of funds or manipulation of token distribution processes.
User Confusion: Users and auditors may be unable to determine the true state of the treasury, leading to confusion regarding available assets.
Manual code review
To resolve this vulnerability and ensure the correct functionality of the treasury contract, the following changes should be made:
In the FeeCollector
contract, after transferring tokens to the Treasury
, ensure that the deposit()
function is called to update the internal balance:
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.