About
SealTriage is an autonomous bug-bounty and post-quantum security triage agent on QoreChain Diana Testnet.
Zero-day vulnerability reports sent over classical encryption are vulnerable to harvest-now-decrypt-later attacks, while autonomous payout agents holding hot keys can be drained by prompt-injected reports or leaked classical ECDSA keys. Meanwhile, new QoreChain contracts need fast checks for missing post-quantum precompile guards (0x0A01 / 0x0A02) and over-broad EVM authorization windows.
SealTriage solves both:
1. Live Ecosystem PQC Scanner: paste any Diana testnet contract address to run a live @qorechain/mcp + EVM instruction-boundary bytecode audit for missing 0x0A01 pqcVerify calls, unproven 0x0A02 admin keys, and over-broad EVM windows.
2. Sealed Disclosure (Sign-then-Encrypt): researchers sign claimDigest with ML-DSA-87 (QoreSign) and encrypt both report and signature to the program's on-chain ML-KEM-1024 key (QoreSeal) so exploit details and reporter identity never leak.
3. Three Independent On-Chain Defense Layers: even if the AI agent is prompt-injected or an ECDSA key leaks, payouts are bounded by x/abstractaccount spending rules, a scoped MsgOpenEVMWindow pinned to SealBountyVault, and Solidity 0x0A01/0x0A02 checks with finding-level deduplication (paidFindings) and daily/tier caps.
How it's made
SealTriage is a TypeScript monorepo built with Hardhat (Solidity 0.8.24), Express, Next.js 15, and seven QoreChain kits (@qorechain/sdk, @qorechain/evm, @qorechain/react, @qorechain/pqc, @qorechain/qoresign, @qorechain/qoreseal, and @qorechain/mcp).
Architecture and key design decisions:
- Non-custodial pass-through vault (SealBountyVault.sol): triageAgent holds the bounded QOR reserve and forwards msg.value into payable disburseBounty(...) so QoreChain's protocol layers (x/abstractaccount MsgUpdateSpendingRules and MsgOpenEVMWindow maxValue + allowed_targets) inspect and cap every payout directly before EVM execution reaches the contract.
- Separate cold ML-DSA-87 root: Owner cold-controls triageAgent's ML-DSA-87 root to open/close MsgOpenEVMWindow and update x/abstractaccount rules, while the AI runtime only holds a classical delegated execution key. Owner policy changes (updatePolicy, setTargetScope, unpause) require 0x0A01 pqcVerify over domain-separated digests with monotonic policyNonce; a stolen ECDSA key can only pause, never loosen caps.
- Sign-then-Encrypt without circularity: researcher signs claimDigest (excluding ciphertextHash) with ML-DSA-87 and seals { report, researcherMlDsaSig } inside ML-KEM-1024 QoreSeal ciphertext. Only reportHash and ciphertextHash appear on-chain.
- Deterministic ground truth + zero-key LLM advisor: PqcAuditor strips Solidity CBOR metadata and walks EVM opcodes (checking PUSH2 0x0a01/0x0a02 within a 32-opcode window of STATICCALL/CALL) alongside live @qorechain/mcp queries. Optional Gemini/OpenAI reasoning is strictly sandboxed and can never override deterministic verdicts, caps, or the ML-DSA-87 signed researcher address.
What was hard on Diana Testnet:
- Live probing revealed 0x0A02 pqcKeyStatus returns (bool, uint8, bytes, bool) (different from the 3-tuple bundled in @qorechain/evm@0.14.0), requiring a 4-tuple ABI and explicit .staticcall(...) to avoid Solidity EXTCODESIZE reverts on zero-code precompiles.
- Explicit gas limits (700,000 for disburseBounty) and all 13 Solidity error ABIs were required so viem decodes raw 4-byte reverts (InvalidPqcSignature, ExceedsTierCap, FindingAlreadyPaid) and reaches QoreChain's protocol AnteHandler during jailbroken-agent broadcasts.
All 64 automated tests pass (13 shared crypto, 12 Hardhat Solidity, 39 agent/scanner/API) plus a clean Next.js production build. Full Diana proof tx hashes live in docs/diana-testnet-proofs.md and AI workflow notes in AI_USAGE.md.