stake.link

stake.link
DeFiHardhatBridge
27,500 USDC
View results
Submission Details
Severity: medium
Invalid

Potential risks in `RESDLTokenBridge` extraArgs configuration

Summary

The RESDLTokenBridge contract uses extraArgs in the setExtraArgs and transferRESDL functions. The concern lies in the potential misconfiguration of extraArgs for specific chains, leading to the use of default values in the _buildCCIPMessage function. This may result in unintended behavior, non-optimal gas usage, and security risks.

Vulnerability Details

The contract allows for the mutable updating of extraArgs using the setExtraArgs function. However, if extraArgs are not configured for a particular chain in the transferRESDL function, the _buildCCIPMessage function utilizes default values, including a non-refundable gas limit of 200,000. This lack of explicit configuration may lead to unexpected behavior, gas inefficiencies, and potential security risks. The order of message will also be effected because the default strict value will be false in extraArgs.

Code Snippets

Relevant Code in setExtraArgs

function setExtraArgs(uint64 _chainSelector, bytes calldata _extraArgs) external {
extraArgsByChain[_chainSelector] = _extraArgs;
}

Relevant Code in transferRESDL

function transferRESDL(uint64 _destinationChainSelector, /* other parameters */) external {
// ...
bytes memory extraArgs = extraArgsByChain[_destinationChainSelector];
Client.EVM2AnyMessage memory evm2AnyMessage = _buildCCIPMessage(/* parameters */, extraArgs);
// ...
}

Relevant Code in _buildCCIPMessage

extraArgs: _extraArgs, // If not configured, this may use default values including a gas limit of 200,000.

Impact

The impact of this issue includes:

  1. Unintended Behavior: Default values may lead to unexpected behavior in the execution of CCIP messages on the destination chain.

  2. Non-Optimal Gas Usage: The default gas limit of 200,000 may not be sufficient, resulting in transaction failures due to out-of-gas errors.

  3. Inconsistent Execution: The order of parameters within the CCIP message may be unexpected, potentially causing inconsistent execution on the destination chain.

  4. Non-Refundable Gas Fees: Default gas limit being non-refundable may result in higher gas fees being consumed without successful execution.

  5. Security Risks: Depending on the specifics of the CCIP message, there may be security risks associated with unintended behavior or unexpected states.

Tools Used

Manual review.

Recommendations

  1. Documentation and Guidance: Clearly document and provide guidance on the expected configuration of extraArgs for each supported chain to prevent unintentional misconfigurations.

  2. Default Value Considerations: Carefully choose default values in the absence of configured extraArgs to ensure they align with the expected behavior of the system and provide optimal gas usage.

  3. Validation in _buildCCIPMessage: Implement additional validation or checks in the _buildCCIPMessage function to handle scenarios where extraArgs are not configured, ensuring that default values are appropriate for the given context.

Addressing these recommendations is crucial to mitigating the potential risks associated with the misconfiguration of extraArgs and ensuring the reliability and security of the RESDLTokenBridge contract.

Updates

Lead Judging Commences

0kage Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Known issue

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.