#41618 [BC-Insight] Timestamp unit doesn't match in GcCounter which causes premature transaction eviction

Submitted on Mar 17th 2025 at 03:48:13 UTC by @Rhaydden for Attackathon | Movement Labs

  • Report ID: #41618

  • Report Type: Blockchain/DLT

  • Report severity: Insight

  • Target: https://github.com/immunefi-team/attackathon-movement/tree/main/util/collections

  • Impacts:

    • A bug in the respective layer 0/1/2 network code that results in unintended smart contract behavior with no concrete funds at direct risk

Description

Brief/Intro

The problem is in the GcCounter impl where timestamps stored in slot units are directly compared against cutoff times in raw time units. This mismatch causes premature garbage collection of entries, resulting in the protocol losing track of in-flight transactions.

Vulnerability Details

In the increment method, timestamps are stored after division by the garbage collection slot duration:

let slot_timestamp = current_time / self.gc_slot_duration.get();

However, in gc, the comparison is done against raw time units:

This causes entries to be evicted much earlier than intended because slot unit timestamps (which are divided by gc_slot_duration) are being compared against much larger raw time values. Since slot timestamps are typically much smaller numbers (as they're divided by gc_slot_duration), they will almost always be less than the raw cutoff time making entries to be evicted prematurely.

Impact Details

Transactions being tracked by the GcCounter will be prematurely evicted from the tracking system. This is particularly important as the GcCounter is used to track "transactions in flight" in the protocol's transaction pipeline. The protocol will lose track of transactions that are still being processed. This could result in duplicate transaction processing or transactions being dropped entirely.

References

https://github.com/immunefi-team/attackathon-movement//blob/a2790c6ac17b7cf02a69aea172c2b38d2be8ce00/util/collections/src/garbage/atomic/counted.rs#L57

https://github.com/immunefi-team/attackathon-movement//blob/a2790c6ac17b7cf02a69aea172c2b38d2be8ce00/util/collections/src/garbage/atomic/counted.rs#L96-L105

Proof of Concept

Proof of Concept

Heres an easy illustration of how this works:

Fix

Convert cutoff_time to slot units for proper comparison.

Was this helpful?