Skip to content
DoS Audit finding Intermediate

Transactions arriving at the node out of sequence order will be rejected due to the has_invalid_sequence_number function

The transaction sequence number validation rejects transactions that arrive out of order, causing an account to be stuck for the duration of the used sequence number pool TTL. An attacker could delay transactions by sending them out of order, freezing the account for up to 180 seconds.

niroh Follow

Originally disclosed on Immunefi

Informational View original
  • Disclosed after under an hour

#43346 [BC-Insight] Transactions arriving at the node out of sequence order will be rejected due to the has_invalid_sequence_number function

Submitted on Apr 4th 2025 at 17:54:10 UTC by @niroh for Attackathon | Movement Labs

Description

Vulnerability Details

When transactions arrive to the TransactionPipe, their sequence number is checked for validity in the has_invalid_sequence_number function. The logic in the function is only accept transaction sequence numbers that are between the Min = max of the committed sn and the last used sn and Max = committed sn + tolerance (32) as can be seen in this code:

Rust
let used_sequence_number = self
        .used_sequence_number_pool
        .get_sequence_number(&transaction.sender())
        .unwrap_or(0);

    // validate against the state view
    let state_view = self.db_reader.latest_state_checkpoint_view().map_err(|e| {
        Error::InternalError(format!("Failed to get latest state view: {:?}", e))
    })?;

    // this checks that the sequence number is too old or too new
    let committed_sequence_number =
        vm_validator::get_account_sequence_number(&state_view, transaction.sender())?;

    debug!(
        "Used sequence number: {:?} Committed sequence number: {:?}",
        used_sequence_number, committed_sequence_number
    );
    let min_used_sequence_number =
        if used_sequence_number > 0 { used_sequence_number + 1 } else { 0 };

    let min_sequence_number = (min_used_sequence_number).max(committed_sequence_number);

    let max_sequence_number = committed_sequence_number + TOO_NEW_TOLERANCE;

The issue is that if an account sends multiple transactions with consecutive sns, and they arrive out of order, all the transactions the account sends will be dropped and not executed for the duration of the sequence number ttl (180 seconds).
To see why, consider the following scenario:

  1. Account A has committed sequence number 10. The account sends multiple transactions with sequence numbers 10, 11, 12, 13 ....
  2. The first transaction to arrive at the node is 11. based on the has_invalid_sequence_number function logic, the sn is valid because it is between 10 and 10+32
  3. The transaction is also accepted by the core_mempool because it is of a higher value than the committed sn and it is sent to the da node for processing. 11 is set as the last used sn in the used_sequence_number_pool.
  4. From this point on teh account is stuck because transaction with sn 10 will not get accepted by the has_invalid_sequence_number logic (since now the last used sn is 11) and all transactions will fail during block execution because all transactions will be considered as sequence number too new.
  5. The problem can only be resolved after the used_sequence_number_pool ttl (180 seconds) elapse and transaction with sequence number 10 can be accepted by the node and sent to processing.

Impact Details

Freezing of account for the duration of the ttl, as well as causing any transaction sent by the account is that time frame to fail

Proof of Concept

Proof of Concept

vulnerability scenario:

  1. Account A has committed sequence number 10. The account sends multiple transactions with sequence numbers 10, 11, 12, 13 ....
  2. The first transaction to arrive at the node is 11. based on the has_invalid_sequence_number function logic, the sn is valid because it is between 10 and 10+32
  3. The transaction is also accepted by the core_mempool because it is of a higher value than the committed sn and it is sent to the da node for processing. 11 is set as the last used sn in the used_sequence_number_pool.
  4. From this point on teh account is stuck because transaction with sn 10 will not get accepted by the has_invalid_sequence_number logic (since now the last used sn is 11) and all transactions will fail during block execution because all transactions will be considered as sequence number too new.
  5. The problem can only be resolved after the used_sequence_number_pool ttl (180 seconds) elapse and transaction with sequence number 10 can be accepted by the node and sent to processing.

The original report as published on Immunefi, by niroh. Images and videos are our own copies; raw HTML is shown as text. View it on Immunefi.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the validation logic updates the last used sequence number to a higher value when a later transaction arrives first, causing earlier transactions to be rejected as too old.

Impact

An account could be frozen for up to 180 seconds, and any transactions sent during that time would fail.

What the attacker needed

Account sends multiple transactions; transactions arrive out of order

How it was found

  1. Account A has committed sequence number 10 and sends transactions with sequence numbers 10, 11, 12, 13.
  2. Transaction with sequence number 11 arrives first and is accepted because it is between 10 and 10+32.
  3. Transaction 11 is accepted by the mempool and sent to the DA node; 11 is set as the last used sequence number.
  4. Transaction with sequence number 10 is then rejected by the validation logic because the last used sequence number is now 11.
  5. All subsequent transactions fail during block execution as sequence number too new.
  6. The account remains stuck until the used sequence number pool TTL (180 seconds) elapses.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

A sequence number is like a ticket number that must be used in order. The system checks that each new transaction has a number between the last committed number and a bit higher. If a later-numbered transaction arrives first, the system marks it as used, and then the earlier-numbered transaction is rejected as too old, blocking the account until a timeout.

What is DoS?

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.

More by niroh

View all

28 more disclosed reports, best first.

More from Movement Labs

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.