Zealynx AcademyZealynx Academy
ZLX-Check

Spot the Bug: the bridge replay trap

Question 1 of 3Score 0/3

A bridge function verifies the signature on an inbound message, then executes it. The signature check passes. What is still wrong?

Review and apply

Worked answers

Try the quiz above first, then open an answer to compare your reasoning. These notes are also available to read without completing an attempt.

  1. 1. A bridge function verifies the signature on an inbound message, then executes it. The signature check passes. What is still wrong?

    • A.Nothing, a valid signature means the message is safe to run
    • B.Nothing marks the message as used, so the same valid message can be run again
    • C.The verify call should be internal, not external
    • D.The function is missing a payable modifier
    Answer and explanation

    B. Nothing marks the message as used, so the same valid message can be run again

    A signature proves who authored a message, not that it has only been used once. If no code records that this message id already executed, the contract will happily run the exact same authentic message every time it is submitted.

  2. 2. Why can an attacker drain the bridge without ever forging anything?

    • A.They brute-force the signing key over many transactions
    • B.A valid signature never expires, so resubmitting the same signed message pays out each time
    • C.They front-run the relayer to change the recipient
    • D.The signature becomes valid on other chains only after it expires
    Answer and explanation

    B. A valid signature never expires, so resubmitting the same signed message pays out each time

    The message stays cryptographically valid forever. With no per-message used flag, the attacker just presses play again on something that was genuinely signed. One burn on the source chain becomes two mints on the destination, then three, as far as gas allows.

  3. 3. What is the correct fix for replay of a signed cross-chain message?

    • A.Add a longer timeout before the message is allowed to execute
    • B.Trust an upstream settlement contract to have already checked it
    • C.Record the message id or nonce before executing, and reject anything already seen
    • D.Require two signatures instead of one
    Answer and explanation

    C. Record the message id or nonce before executing, and reject anything already seen

    A valid message must be consumed exactly once. Mark its unique id or nonce as used before you run it, and reject any id you have already recorded. Keep that record in storage you own and that survives upgrades. Delegating the check to another contract means your replay protection changes whenever that contract does.

Read alongside: See it in real audits