Missing Nonce Reset During TSS Address Update Allowing Signature Replay
The update_tss function in the Solana gateway contract changes the TSS address without resetting the nonce counter, so signatures authorised under the old TSS address remain valid and can be replayed. An attacker could replay previously authorised signatures to have unauthorised transactions accepted.
0xpetern Follow with berndartmueller and g
Originally disclosed on Sherlock
Source: https://github.com/sherlock-audit/2025-04-zetachain-cross-chain-judging/issues/352
Found by
0xpetern, berndartmueller, g
Summary
In the solana implementation, When updating the TSS address via update_tss, the function fails to reset the nonce counter.
This creates a security issue where previously authorized signatures could remain valid after a TSS address change and can be replayed.
Root Cause
The update_tss() function updates the TSS address (used for signature verification) without resetting the nonce counter that prevents signature replay attacks. This creates a dangerous security gap where the system transitions to a new signing authority while maintaining continuity with the nonce sequence of the previous authority.
// Updates the TSS address. Caller is authority stored in PDA.
pub fn update_tss(ctx: Context<UpdateTss>, tss_address: [u8; 20]) -> Result<()> {
verify_authority(&ctx.accounts.signer.key(), &ctx.accounts.pda)?;
let pda = &mut ctx.accounts.pda;
pda.tss_address = tss_address;
msg!(
"TSS address updated: new TSS address = {:?}, PDA authority = {}",
tss_address,
ctx.accounts.signer.key()
);
Ok(())
}
This implementation only modifies th TSS address, while the nonce remain unchanged, when this function is called. Previous signatures remain valid with their existing nonces.
Internal Pre-conditions
- Protocol uses TSS for cross-chain transaction authorization
- Transaction nonce serves as a replay protection mechanism
- TSS address is used to verify transaction signatures
- Authority has ability to update TSS address
External Pre-conditions
- Protocol is actively processing cross-chain transactions
- Transactions are flowing between chains with TSS signatures
Attack Path
Here is a possible attack path
- System uses TSS address A with current nonce sequence (e.g., nonce = N)
- Authority updates TSS from address A to address B but Nonce remains at N (not reset to 0)
- System now accepts signatures from TSS B, continuing from nonce N+1.
- System validates signature against TSS B but with nonces that were used by TSS A resulting to a successful signature replay.
Impact
- Signatures from old TSS could be replayed.
- System may accept unauthorized transactions.
PoC
No response
Mitigation
Update the update_tss function to reset the nonce counter when changing the TSS address:
pub fn update_tss(ctx: Context, tss_address: [u8; 20]) -> Result<()> {
verify_authority(&ctx.accounts.signer.key(), &ctx.accounts.pda)?;
let pda = &mut ctx.accounts.pda;
// Update TSS address
pda.tss_address = tss_address;
// Reset nonce to zero - CRITICAL SECURITY FIX
pda.nonce = 0;
msg!(
"TSS address updated: new TSS address = {:?}, nonce reset to 0, PDA authority = {}",
tss_address,
ctx.accounts.signer.key()
);
Ok(())
}
Discussion
sherlock-admin2
The protocol team fixed this issue in the following PRs/commits: https://github.com/zeta-chain/protocol-contracts-solana/pull/107
gjaldon
The issue is fixed by resetting the nonce to 0 when updating the TSS address.
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 update_tss function updates the TSS address but does not reset the nonce counter, so replay protection continuity is kept across a change of signing authority.
Impact
Signatures from the old TSS could be replayed and the system may accept unauthorised transactions.
What the attacker needed
Protocol uses TSS for cross-chain authorisation; Nonce used for replay protection; TSS address used to verify signatures; Authority can update TSS address
How it was found
- System uses TSS address A with current nonce sequence (e.g., nonce = N)
- Authority updates TSS from address A to address B but Nonce remains at N (not reset to 0)
- System now accepts signatures from TSS B, continuing from nonce N+1.
- System validates signature against TSS B but with nonces that were used by TSS A resulting to a successful signature replay.
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 nonce is a number used once to stop someone reusing an old signed message. Here, when the trusted signer (TSS address) was changed, the nonce was not reset, so old signed messages still looked fresh and could be sent again. That could let an attacker get unauthorised transactions accepted.
What is Crypto?
Encryption, signatures, randomness or certificate checks that do not protect what they claim to.