NFTBridge
60,000 USDC
View results
Submission Details
Severity: low
Invalid

Insufficient Cancellation Request Validation in L1 Bridge Contract

Summary

The L1 bridge contract's cancelRequest function directly calls cancelL1ToL2Message without verifying if a cancellation request has been initiated or if the required waiting period has elapsed. This bypasses critical security checks implemented in the StarknetMessaging contract.

Vulnerability Details

The cancelRequest function in the bridge contract calls cancelL1ToL2Message on the StarknetMessaging contract without first ensuring that:

  1. A cancellation request has been initiated via startL1ToL2MessageCancellation.

  2. The required waiting period (defined by messageCancellationDelay) has passed.

function cancelRequest(
uint256[] memory payload,
uint256 nonce
) external {
IStarknetMessaging(_starknetCoreAddress).cancelL1ToL2Message(
snaddress.unwrap(_starklaneL2Address),
felt252.unwrap(_starklaneL2Selector),
payload,
nonce
);
Request memory req = Protocol.requestDeserialize(payload, 0);
_cancelRequest(req);
emit CancelRequestCompleted(req.hash, block.timestamp);
}

According to Starknet Docs, user should call this function after calling the startL1ToL2MessageCancellation function and the time between the calls to these two functions must be at least the number of seconds defined by the messageCancellationDelay function.

These checks are present in the StarknetMessaging contract but are not enforced at the bridge contract level, leading leading to unexpected reverts and a poor user experience.

Moreover, currently there is no function available for users to check the status of their cancellation request and the remaining wait time.

Impact

Missing critical cancellation checks may lead to unexpected transaction failures and poor user experience, as the bridge contract does not ensure the proper sequence and timing required for message cancellation.

Tools Used

Manual Review

Recommendations

  1. Modify cancelRequest to check if a cancellation has been initiated and if the required time has passed before calling cancelL1ToL2Message.

  2. Add a function for users to check the status of their cancellation request and the remaining wait time.

Updates

Lead Judging Commences

n0kto Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

Informational / Gas

Please, do not suppose impacts, think about the real impact of the bug and check the CodeHawks documentation to confirm: https://docs.codehawks.com/hawks-auditors/how-to-determine-a-finding-validity A PoC always helps to understand the real impact possible.

Support

FAQs

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