The GC_INTERVAL might not be fitting for the configured sequence_number_ttl_ms
The garbage collection interval is a fixed 30-second constant while the sequence number time-to-live is configurable, so expired sequence numbers can linger in the used pool for up to roughly 29 seconds after expiry. The report frames this as a design insight rather than a demonstrated exploit.
Originally disclosed on Immunefi
- Disclosed after under an hour
#43220 [BC-Insight] The GC_INTERVAL might not be fitting for the configured sequence_number_ttl_ms
Submitted on Apr 3rd 2025 at 19:45:13 UTC by @KlosMitSoss for Attackathon | Movement Labs
- Report ID: #43220
- Report Type: Blockchain/DLT
- Report severity: Insight
- Target: https://github.com/immunefi-team/attackathon-movement/tree/main/protocol-units/execution/maptos/opt-executor
- Impacts:
Description
Brief/Intro
While GC_INTERVAL is a constant that equals 30 seconds, the sequence_number_ttl_ms can be configured. As a result, sequence numbers that expire after 1 second can still only be garbage collected every 30 seconds.
Vulnerability Details
The used_sequence_number_pool, transactions_in_flight and core_mempool can only be garbage collected every 30 seconds.
pub(crate) async fn receive_transaction_tick(&mut self) -> Result<(), Error> {
... ...
>> if self.last_gc.elapsed() >= GC_INTERVAL {
// todo: these will be slightly off, but gc does not need to be exact
let now = Instant::now();
let epoch_ms_now = chrono::Utc::now().timestamp_millis() as u64;
// garbage collect the used sequence number pool
self.used_sequence_number_pool.gc(epoch_ms_now);
// garbage collect the transactions in flight
{
// unwrap because failure indicates poisoned lock
let mut transactions_in_flight = self.transactions_in_flight.write().unwrap();
transactions_in_flight.gc(epoch_ms_now);
}
// garbage collect the core mempool
self.core_mempool.gc();
self.last_gc = now;
}
... ...
}
However, since sequence_number_ttl_ms can be configured, a sequence number could already be expired after for example 1 second.
pub(crate) fn gc(&mut self, current_time_ms: u64) {
let gc_slot = current_time_ms / self.gc_slot_duration_ms;
// remove all slots that are too old
>> let slot_cutoff = gc_slot - self.sequence_number_ttl_ms / self.gc_slot_duration_ms;
let slots_to_remove: Vec<u64> = self
.sequence_number_lifetimes
.keys()
.take_while(|slot| **slot < slot_cutoff)
.cloned()
.collect();
for slot in slots_to_remove {
debug!(
"Garbage collecting sequence number slot {} with duration {} timestamp {}",
slot,
self.gc_slot_duration_ms,
slot * self.gc_slot_duration_ms
);
self.sequence_number_lifetimes.remove(&slot);
}
}
As a result, a sequence number could for example still be in the used_sequence_number_pool for 29 seconds after expiring.
To mitigate this, it should also be possible to configure the GC_INTERVAL.
Impact Details
A sequence number will remain in the used_sequence_number_pool even when they have been expired for a long time since GC_INTERVAL is a constant that might not fit the configured sequence_number_ttl_ms.
References
Code references are provided throughout the report.
Proof of Concept
Proof of Concept
used_sequence_number_pool.set_sequence_number()is called for a specifc sequence number.- This sequence number expires after 1 second.
- The
used_sequence_number_poolcan only be garbage collected after 29 more seconds.
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 garbage collection interval is hard-coded as a constant instead of being derived from or configured alongside the sequence number time-to-live.
Impact
Expired sequence numbers may remain in the used pool longer than intended, which the report presents as a configuration mismatch rather than a proven attack.
What the attacker needed
Configurable sequence_number_ttl_ms set low
The fix
The garbage collection interval should be made configurable so it can be aligned with the configured sequence number time-to-live.
How it was found
- A sequence number is recorded in the used sequence number pool.
- The configured time-to-live for that number is one second.
- The pool is only cleaned up on the next 30-second garbage collection tick, so the number stays for about 29 more seconds.
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 a counter attached to each transaction so the system can reject duplicates. The code keeps a record of used numbers and periodically deletes old ones, but the cleanup runs on a fixed 30-second timer while the expiry time can be set much shorter. So a number that should be forgotten after one second may stay in memory for about half a minute.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.