Skip to content

Reject full blocks with a height-invalid AuxPoW commitment order #101

Closed

Description

@kiwidream

Summary

The full-block acceptance path can store an AuxPoW payload that is invalid under the height-specific commitment-order rule when the corresponding header is already known.

On mainnet, display-order commitments are required from genesis. A peer can first provide a valid display-order header, then provide a full block with the same pure header fields but a separately mined internal-order AuxPoW payload. The second payload passes the context-free EITHER check, bypasses the contextual header check because the block hash is already indexed, and is written to disk. A later height-aware disk read rejects the stored payload and can turn the poisoned block into a fatal read failure during reconnect or reorg.

This should be fixed before mainnet launch.

Verified on

origin/1.0.0 at 988756471aeecdf4463c04be49da2b7b89a98c21.

Source trace

Attack sequence

  1. Mine a valid display-order AuxPoW payload for block B and relay its header. The node creates a block-index entry containing that payload.
  2. Separately mine an internal-order AuxPoW payload for the same pure child header. This is possible because the AuxPoW payload is not part of B's hash.
  3. Send a full block for B carrying the internal-order payload to a node that already has the first header.
  4. The full block passes CheckBlock under EITHER; the known-header early return skips the height-specific display check; ContextualCheckBlock does not replace it; the payload is stored.
  5. The in-memory block can connect immediately. A later indexed disk read rejects the payload under DISPLAY, causing reconnect/reorg failure and potentially FatalError.

The attacker must produce parent proof of work for the substitute payload, but bootstrap difficulty makes this much cheaper at launch than after the network matures.

Expected behavior

Every full block must satisfy the commitment-order rule for its indexed height, regardless of whether its header hash was already known.

Recommended fix

Re-run auxpow::Validate with CommitmentValidationForHeight(..., pindex->nHeight) on the full-block path before relay or disk write. This is preferable to comparing the payload byte-for-byte with whichever valid header payload happened to arrive first, which would make block acceptance depend on arrival order when multiple display-valid AuxPoW proofs exist.

Do not loosen indexed disk reads to EITHER; that would remove the active display-order consensus rule.

Regression coverage

Add a validation test that:

  1. builds two valid AuxPoW payloads for the same pure child header, one display-order and one internal-order;
  2. accepts the display-order header first;
  3. submits the full block with the internal-order substitute;
  4. verifies rejection with the AuxPoW commitment error before disk write; and
  5. verifies a display-order substitute still follows the intended acceptance rule.

Also exercise direct ProcessNewBlock, headers-first download, and getblockfrompeer-equivalent requested-block paths.

Acceptance criteria

  • A full block with a commitment order invalid at its height is rejected even when its hash is already in the block index.
  • No height-invalid AuxPoW payload can be written to block storage through normal block acceptance.
  • Indexed and full-block acceptance use the same height-specific commitment mode.
  • Regression tests cover the known-header substitution case.

Activity

  1. added
    bug
    on Jul 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions