1. Access Control Issues
Critical Functions Limited to onlyOwner
:
Functions such as adding or removing chains and approving reward tokens are restricted by onlyOwner
. However, if the ownership isn't managed correctly (like lack of a two-step ownership transfer), it may leave the contract exposed to accidental or malicious changes.
onlyRebaseController
and onlyUpdateInitiator
Roles:
If these roles are compromised, an attacker could exploit the distributeRewards
or executeQueuedUpdates
functions, which affect token transfers across chains. Role management should be verified to ensure these addresses can’t be altered maliciously.
Mitigation:
Consider adding multi-signature control for critical roles like onlyOwner
.
Add mechanisms to revoke or reassign the rebaseController
and updateInitiator
securely.
The contract uses Solidity 0.8.15, which has built-in overflow/underflow checks, so direct arithmetic vulnerabilities (like in older Solidity versions) are unlikely.
However, arithmetic involving uint256
and int256
conversions may cause problems. Specifically:
If the value of totalRESDLSupplyChange
is extremely large, this conversion could underflow the uint256
.
Mitigation:
Add bounds checks to ensure the subtraction won't cause underflows.
distributeRewards
The transferAndCall
function allows executing arbitrary logic after token transfer. If the wrappedToken
contract is malicious or has flawed logic, it could lead to reentrancy attacks, disrupting the state of the rewards distribution.
Mitigation:
Use a reentrancy guard on distributeRewards
.
Ensure trusted contracts are used as wrapped tokens, or carefully validate their behavior.
Untrusted Chain IDs and Destinations:
There isn’t a strong check to ensure that chains added via addWhitelistedChain
are legitimate. If a malicious owner or compromised account adds a fake chain, rewards could be drained to unintended destinations.
Mitigation:
Add checks or whitelists to ensure only legitimate chains and destinations can be added.
Functions like _distributeRewards
and executeQueuedUpdates
depend on gas limits provided by users. If incorrect gas limits are set:
Rewards distribution may fail on destination chains.
Critical updates may be stuck in the queue, causing operational failures.
Mitigation:
Set default gas limits or use fallback logic if user-provided gas limits are insufficient.
In executeQueuedUpdates
, all updates are cleared after a single execution. If execution partially fails (some updates succeed, some don’t), the contract could lose data about unprocessed updates.
Mitigation:
Consider marking updates as processed individually instead of clearing the entire array.
Implement event-based logging for failed executions to aid recovery.
The maxLINKFee
must be set correctly. If too low, legitimate transactions could be blocked. If too high, it might not protect against excessive fees.
Mitigation:
Provide an adaptive fee limit mechanism based on network conditions.
There is a potential issue when swapping tokens with wrappedRewardTokens
. If the wrapped token logic is flawed or tokens are handled incorrectly, the distribution could fail.
Mitigation:
Ensure comprehensive validation of token addresses and balances before swapping and transferring.
Use reentrancy guards on state-changing functions like distributeRewards
.
Ensure safe arithmetic operations during int256
to uint256
conversions.
Improve gas limit management to prevent operational failures.
Implement individual handling of queued updates to avoid data loss.
Strengthen access control mechanisms with multisig or secure role assignment.
Validate wrapped reward tokens and chain whitelisting logic rigorously.
This code is generally well-written but has a few areas where a malicious actor could exploit edge cases. A careful audit and thoughtful improvements should make the contract safer.
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.