The token vesting contract contains a critical centralization risk due to the absence of time-based access controls on privileged owner functions. Specifically, the rescue_tokens
function can be called by the owner at any point in time, including during the active vesting period. This functionality enables the contract owner to withdraw tokens that are intended for distribution to users according to the vesting schedule, potentially undermining the entire purpose of the vesting contract.
In the current implementation:
While the function includes a comment indicating it should only be used in emergencies, there are no programmatic safeguards preventing its use under normal circumstances. The function is only protected by the onlyOwner
modifier but lacks any time-based restrictions that would prevent the owner from accessing funds during the vesting period.
This vulnerability creates several significant risks:
Trust Violation: Users who expect their tokens to vest according to the predefined schedule have no on-chain guarantee that the owner won't withdraw these tokens prematurely.
Undermining of Vesting Purpose: The entire purpose of a vesting contract is to provide assurance that tokens will be distributed according to a specific schedule. This vulnerability fundamentally compromises that assurance.
Centralization Risk: The contract becomes highly dependent on the trustworthiness of the owner, contradicting the principles of decentralization and trustlessness.
Potential Loss of Funds: In the worst-case scenario, users could lose all their vested and unvested tokens if the owner decides to withdraw all funds from the contract.
Manual Review
Implement time-based restrictions on the rescue_tokens
function to ensure it can only be used in legitimate emergency situations:
The `owner` is trusted and the function `rescue_tokens` can be called only by the owner and only in case of emergency. This means the owner will not act maliciously and will not call the function without need. Also, issues realated to the malicious admin actions are invalid according to the CodeHawks documentation: https://support.cyfrin.io/en/articles/10059196-findings-validity
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.