Race Condition in try_to_sign can lead to unverifiable blocks and/or blobs
The try_to_sign function fetches a signature and the matching public key in two separate asynchronous steps without a lock, so an admin key rotation between them can pair a signature from the old key with the new public key. Nodes verifying such blocks or blobs would then reject them, potentially causing data loss or fork-like scenarios.
- Disclosed after under an hour
#41731 [BC-Insight] Race Condition in try_to_sign can lead to unverifiable blocks and/or blobs
Submitted on Mar 17th 2025 at 21:09:26 UTC by @jovi for Attackathon | Movement Labs
- Report ID: #41731
- Report Type: Blockchain/DLT
- Report severity: Insight
- Target: https://github.com/immunefi-team/attackathon-movement/tree/main/protocol-units/da/movement/protocol/util
- 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
- Unintended chain split (network partition)
- Some blocks and/or blobs can be signed but not ever be able to be verified
Description
Summary
In the try_to_sign function, the code fetches a signature and the corresponding public key in separate asynchronous steps without locking. This can cause the public key to change in the middle of signing, so you end up with a signature created by one key but published under a different key. As a result, any node that tries to verify this signaturelater will fail.
When this issue occurs during an admin key rotation, it can also cause blocks or blobs to be dropped if their signatures do not validate. In turn, this might trigger partial network outages, fork-like scenarios, or data unavailability.
Vulnerability Details
Location
- File:
protocol-units/da/movement/protocol/util/src/blob/ir/data.rs - Function:
try_to_sign
Description
The try_to_sign function does the following in sequence:
- Computes the message hash (
id). - Calls
signer.inner().sign(...)to produce a signature. - Calls
signer.inner().public_key()to retrieve the current public key.
These steps happen asynchronously without a mutex or other concurrency guard. Consequently, if an admin key rotation completes between steps 2 and 3, the returned public key will be different from the key that created the signature—making verification impossible.
Code Snippet
pub async fn try_to_sign<O>(
self,
signer: &Signer<O, C>,
) -> Result<InnerSignedBlobV1<C>, anyhow::Error>
where
O: Signing<C>,
C: Curve + Digester<C>,
{
let id = self.compute_id()?;
info!("Signing blob with id {:?}", id);
// Potential race: signature and public key retrieved without a lock
let signature = signer.inner().sign(&id.as_slice()).await?.to_bytes();
let signer = signer.inner().public_key().await?.to_bytes();
Ok(InnerSignedBlobV1::new(self, signature, signer, id))
}
Impact
- Verification Failures: Any consumer (e.g., consensus nodes, block verifiers) sees a mismatch between the signer and public key of a published block or blob, causing verification to fail.
- Data Loss / Forks: During admin key rotation, blocks or blobs with mismatched signatures may be generated, leading to forks as those cannot be verified by anyone externally.
Recommended Fix
Use a lock or other concurrency mechanism to guarantee the signature and public key come from the same key version. For example:
pub async fn try_to_sign<O>(
self,
signer: &Signer<O, C>,
) -> Result<InnerSignedBlobV1<C>, anyhow::Error>
where
O: Signing<C>,
C: Curve + Digester<C>,
{
let id = self.compute_id()?;
info!("Signing blob with id {:?}", id);
// Acquire a lock for both signing and key retrieval
let mut guard = signer.lock().await;
let signature = guard.sign(&id.as_slice()).await?.to_bytes();
let signer_pk = guard.public_key().await?.to_bytes();
drop(guard); // Release the lock
Ok(InnerSignedBlobV1::new(self, signature, signer_pk, id))
}
Any approach that atomically binds the signature and public key—ensuring they originate from the same key instance—eliminates the race condition and prevents verification failures, even in the case of admin key rotations.
Proof of Concept
- Setup
- A sequencer node signs blocks before broadcasting them.
- A Data Availability (DA) layer signs “blobs” (transaction data bundles, witnesses) to prove data possession.
- Both systems call the same
try_to_signfunction.
- Concurrent Operations
- Typically, many sign operations happen in parallel for blocks and blobs.
- Meanwhile, an admin key rotation begins, changing the signer’s public/private key pair.
- Race Condition Trigger
- The sequencer calls
try_to_sign(step 2:signer.inner().sign(...)) to sign a new block/blob. - Immediately after signing, the admin rotation updates the public key.
- When
try_to_signthen retrieves the public key, it’s now the new one—thus returning a signature from the old key but labeled with the new key.
- The sequencer calls
- Verification Failure
- Other nodes check the signature against the included public key.
- Verification fails, so those nodes reject the block or blob as invalid.
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 signature and public key are read in separate asynchronous calls with no lock, so a concurrent key rotation can change the key between the two reads.
Impact
Blocks or blobs signed this way cannot be verified by other nodes, which could lead to data loss, partial network outages or fork-like scenarios during a key rotation.
What the attacker needed
Admin key rotation occurs; concurrent signing of blocks or blobs
The fix
The signature and public key should be bound atomically, for example by holding a lock across both operations, so they always come from the same key version.
How it was found
- A sequencer and DA layer sign blocks and blobs through the same try_to_sign function, often in parallel.
- An admin key rotation begins, changing the signer's key pair.
- try_to_sign signs the message with the old key.
- The rotation updates the public key before try_to_sign reads it, so the new key is attached.
- Other nodes verify the signature against the attached key and reject the block or blob.
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.
When a node signs a block, it produces a signature with a private key and also reports the matching public key so others can check it. Here those two things are fetched one after the other, and if the key pair is swapped in between, the signature and the published key no longer match. Anyone checking the signature then sees a mismatch and treats the block as invalid.
What is Race condition?
Parallel requests reach a state the code assumed could not happen: a coupon used twice, a limit overrun, a check skipped.