Skip to content
Business logic Audit finding Intermediate

Handler address format mismatch causes digest divergence and unexecutable messages

Two components of the Algorand NTT transceiver disagree on how the handler address is encoded: one treats it as a padded uint64 app ID, the other as a 32-byte Algorand app address. Because the VAA is marked consumed before the downstream check, a message whose handler encoding does not match becomes permanently stuck and the funds it carries are frozen.

Rhaydden Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

57018 sc high handler address format mismatch causes digest divergence and unexecutable messages

Submitted on Oct 22nd 2025 at 17:19:22 UTC by @Rhaydden for Audit Comp | Folks Finance: Wormhole NTT on Algorand

Description

Issue description

There are two incompatible handler formats in play here.

Result: a message attested under one handler representation (padded app ID bytes) can fail execution if the handler expects an app address (32 bytes), or vice versa. Because the VAA is consumed first, the message becomes permanently stuck.

Impact

{% hint style="danger" %} Critical — Permanent freezing of funds.

Messages can be irrecoverably stuck on the destination chain after VAA consumption if attestations or execution fail due to the handler address format mismatch. No re-delivery is possible without manual intervention. {% endhint %}

Recommended mitigation steps

{% hint style="warning" %} Standardize the handler address representation across all components.

A straightforward mitigation: standardize on the padded app ID representation. In MessageHandler.execute_message(), replace the current address equality check with an app ID equality check:

  • Parse handler_address with BytesUtils.safe_convert_bytes32_to_uint64().
  • Compare the parsed uint64 to Global.current_application_id.id.

This ensures digest inputs and runtime checks use the same handler format. {% endhint %}

Proof of Concept

The included tests demonstrate the digest divergence and execution failure when switching the handler representation.

Test added in: tests/poc/HandlerAddressMismatch.test.ts (see links in report)

Example test excerpt:

JavaScript
test("calculate_message_digest differs between padded app id bytes vs app address bytes", async () => {
  const base = getRandomMessageToSend({
    destinationChainId: Number(getRandomUInt(MAX_UINT16)),
    sourceAddress: getRandomBytes(32),
    userAddress: getRandomBytes(32),
  });

  const paddedHandler = convertNumberToBytes(handlerAppId, 32);
  const appAddressBytes = getApplicationAddress(handlerAppId).publicKey;
  const sourceChainId = Number(getRandomUInt(MAX_UINT16));

  const digestPadded = await transceiverManagerClient.calculateMessageDigest({
    args: [{
      id: base.id,
      userAddress: base.sourceAddress,
      sourceChainId,
      sourceAddress: base.sourceAddress,
      handlerAddress: paddedHandler,
      payload: base.payload,
    }],
  });

  const digestAddress = await transceiverManagerClient.calculateMessageDigest({
    args: [{
      id: base.id,
      userAddress: base.sourceAddress,
      sourceChainId,
      sourceAddress: base.sourceAddress,
      handlerAddress: appAddressBytes,
      payload: base.payload,
    }],
  });

  expect(Uint8Array.from(digestPadded)).not.toEqual(Uint8Array.from(digestAddress));
});

As shown by the PoC,:

  • executeMessage fails when handlerAddress is a 32-byte padded uint64 app ID (handler expects app address bytes).
  • calculate_message_digest differs when only handlerAddress changes (padded app ID vs app address bytes).

Logs

<details> <summary>Test output</summary>
 PASS  tests/poc/HandlerAddressMismatch.test.ts
  PoC: handler address format mismatch
    ✓ executeMessage fails when handlerAddress is 32-byte padded app id (Handler expects app address bytes) (39 ms)
    ✓ calculate_message_digest differs between padded app id bytes vs app address bytes (11 ms)

Test Suites: 1 passed, 1 total
Tests:       2 passed, 2 total
Snapshots:   0 total
Time:        2.139 s
Ran all test suites matching /tests\/poc\/HandlerAddressMismatch.test.ts/i.
</details>

References

The original report as published on Immunefi, by Rhaydden. Images and videos are our own copies; raw HTML is shown as text. View it on Immunefi.

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

Impact

Messages can be irrecoverably stuck on the destination chain after VAA consumption, permanently freezing the funds they carry, with no re-delivery possible without manual intervention.

What the attacker needed

A message sent with the mismatched handler encoding; VAA consumed before the handler check

The fix

Standardise the handler address representation across all components, for example by parsing the handler address as a uint64 app ID in execute_message and comparing it to the current application ID.

How it was found

  1. Build a message whose handler address is a 32-byte padded uint64 app ID.
  2. Call calculate_message_digest with that message and note the digest.
  3. Rebuild the same message with the handler address as the 32-byte app address and note the digest differs.
  4. Call executeMessage with the padded app ID form and observe it fails because the handler expects app address bytes.

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 cross-chain message carries a field saying which contract on the destination chain should handle it. Here two parts of the same system read that field in different ways: one expects a number padded out to 32 bytes, the other expects a real Algorand account address. If the sender uses the wrong form, the message is accepted and marked as used, but the handler check then fails, and since the message is already marked used it can never be retried, so the funds it was carrying are stuck.

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.

More by Rhaydden

View all

36 more disclosed reports, best first.

More from Folks Finance: Wormhole NTT on Algorand

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.