Skip to content

Smart Contract Threat Model

This threat model describes production smart-contract risks, existing mitigations, evidence, and residual risk. It should be reviewed before mainnet activation and whenever a protocol-pinned runtime profile, host import surface, registry policy, migration workflow, or contract-to-contract rule changes.

Assets

  • Contract WASM bytecode, code hashes, manifests, and manifest hashes.
  • Contract state key/value rows and state-root leaves.
  • Bucket metadata, bucket access rules, bucket keys, and encrypted-record metadata.
  • Local ciphertext availability and local encrypted payload store contents.
  • Contract registry approvals, audit metadata, package status, and release workflow rows.
  • Runtime activation governance, rollout policies, and validator attestations.
  • Operator/admin credentials, governance authority, and validator identities.
  • Wasmtime sidecar binary, sidecar protocol, runtime capabilities, and runtime profile.
  • Contract events, structured call results, metrics, and alert feeds.
  • Snapshot archives, backup-drill reports, checkpoints, and restored databases.

Trust Boundaries

  • Caller or operator client to TypeScript node HTTP/API routes.
  • Signed transaction envelope to deterministic block execution.
  • Contract WASM module to host imports.
  • TypeScript node to Rust Wasmtime sidecar.
  • Contract runtime to bucket access and payload availability layers.
  • Calling contract to called contract in contract-to-contract execution.
  • Governance transactions to activation, registry, release, migration, and deactivation policy.
  • Node-local readiness/metrics state to consensus contract state.
  • Snapshot archive to restored database/checkpoint.
  • Validator runtime membership to governance validator state.

Attacker Profiles

  • Malicious contract author attempting sandbox escape, resource exhaustion, host import abuse, or misleading manifest/ABI data.
  • Malicious caller attempting auth bypass, malformed args, replay divergence, or contract-to-contract abuse.
  • Compromised contract owner attempting unsafe migration, deactivation bypass, package substitution, or bucket access expansion.
  • Malicious or mistaken operator enabling the wrong runtime, approving an unsafe package, restoring stale state, or leaking credentials.
  • Compromised validator or node serving stale data, broken sidecar capabilities, or unavailable local payloads.
  • Contract callee/dependency attacker causing cycles, rollback surprises, fuel exhaustion, or dependency deactivation failures.
  • Snapshot/backup tamperer modifying archived contract code, state, events, migrations, registry rows, or call results.
  • Byzantine peer outside the current CFT production assumptions.

Existing Mitigations

  • Rust Wasmtime sidecar with native fuel metering and memory limits.
  • Protocol-pinned runtime profiles and compatibility vectors.
  • Mandatory sidecar capability handshake and production preflight.
  • Deterministic host import allowlist.
  • Deterministic failure codes for metering, traps, import abuse, malformed modules, large payloads, and readiness failures.
  • Manifest-declared method auth and bucket access requirements.
  • Contract principal support in bucket access rules.
  • Node-local readiness gates for buckets, permissions, payload availability, and runtime capabilities.
  • Registry/catalog and release workflow with hashes, audit metadata, approval metadata, and status transitions.
  • Contract-to-contract depth, auth, fuel, deactivation, cycle, ordering, and rollback rules.
  • Per-contract state namespaces and state-root materialization.
  • Migration proposals, jobs, batches, pinned hashes, resumable cursors, and release workflow integration.
  • Event indexing and structured call-result persistence.
  • Replay verification, runtime compatibility vectors, snapshot verification, archive import, and backup drills.
  • Production alert rules, monitoring exports, readiness APIs, and operator runbooks.

Residual Risks

  • Consensus is crash-fault-tolerant in the current production path, not Byzantine-fault-tolerant.
  • Formal verification is not implemented for runtime rules, host imports, or contract logic.
  • Fuzz/property testing is not yet a completed hardening layer.
  • Contract author business logic remains a per-contract audit responsibility.
  • Operator key custody, cloud posture, and CI/CD supply-chain controls are external to the node implementation.
  • Upstream Wasmtime, Node.js, PostgreSQL, and OS vulnerabilities remain inherited dependency risks.
  • Metrics and readiness are local operational surfaces; incorrect operator interpretation can still delay incident response.

Threat Table

IDThreatAttackerImpactExisting MitigationEvidenceResidual Risk / Follow-Up
SC-T01Runtime escape or forbidden import abuseMalicious contract authorHost compromise or non-deterministic behaviorWasmtime sandbox, import allowlist, malformed/import abuse testsnpm run test:contract-runtime-security, npm run test:contract-wasm-host-importsTrack upstream Wasmtime advisories and release provenance
SC-T02Infinite loop or CPU exhaustionMalicious contract author/callerValidator stalls or denial of serviceNative fuel metering, per-method and protocol max fuelnpm run test:contract-deterministic-meteringAdd fuzz/property coverage for generated WASM shapes
SC-T03Memory or payload exhaustionMalicious contract author/callerRuntime crash or node pressureMemory, args, event, return, and host IO limitsnpm run test:contract-runtime-security, npm run test:contract-execution-limitsExpand soak with larger adversarial payload mixes
SC-T04Non-deterministic execution resultContract author or runtime mismatchReplay/state-root divergenceProtocol-pinned profiles, capability handshake, compatibility vectorsnpm run test:contract-runtime-compatibilityExternal audit runtime profile upgrade process
SC-T05Host import writes applied before failureMalicious contractPartial state leakage after trap/failureIntent staging and post-return applicationnpm run test:contract-wasm-host-imports, npm run test:contract-call-executionAdd property tests for host intent rollback
SC-T06Contract state isolation bypassMalicious contract/callerUnauthorized modification of another contract's statePer-contract state namespaces, C2C rules, migration controlsnpm run test:contract-to-contract-callsReview every new host write import against isolation rules
SC-T07C2C cycles, depth, or rollback abuseMalicious caller/calleeUnbounded execution or inconsistent nested stateDepth limit, cycle detection, nested rollback testsnpm run test:contract-c2c-adversarialAdd longer multi-contract graph fuzzing
SC-T08Auth bypass by user, organization, or contract principalMalicious caller/contractUnauthorized method invocationManifest method auth, caller/contract identity modelnpm run test:contract-call-execution, npm run test:contract-to-contract-callsPer-contract audit of auth design still required
SC-T09Registry bypass or package substitutionCompromised owner/operatorUnapproved code or manifest deployedRegistry policy, provenance checks, release workflownpm run test:contract-registry, npm run test:contract-on-chain-provenanceExternal governance/key custody remains operational risk
SC-T10Bucket declaration or access bypassMalicious contract authorUnauthorized bucket metadata or encrypted-record metadata accessManifest declarations, readiness gates, bucket access rulesnpm run test:contract-host-api, npm run test:contract-readinessRecheck every new bucket host import against policy
SC-T11Local ciphertext availability leakMalicious contract/operatorLocal availability becomes consensus signal or data leakConsensus snapshots redact ciphertext, readiness is localnpm run test:snapshots, npm run test:contract-backup-disaster-recoveryOperator handling of ciphertext backups remains sensitive
SC-T12Unsafe migration overwrite or destructive transformContract owner/operatorState loss or corrupted upgraded contractMigration proposals/jobs/batches, pinned hashes, release workflownpm run test:contract-state-migration-jobs, npm run test:contract-release-workflowContract-defined migration entrypoints need per-contract review
SC-T13Deactivation bypassMalicious caller/calleeCalls continue against disabled/unsafe targetDeactivation state, dependency inspection, C2C target checksnpm run test:contract-deactivation, npm run test:contract-deactivation-dependenciesOperator must review dependency report before deactivation
SC-T14Snapshot or backup tamperingBackup tamperer/operator mistakeRestored node diverges or loses contract historyArchive hashes, verifier, state-root rebuild, checkpoint bootstrapnpm run test:snapshots, npm run test:contract-backup-disaster-recoveryExternal backup storage integrity is operational
SC-T15Monitoring blind spot or alert fatigueOperator/process failureDelayed incident responseAlert rules, JSON/Prometheus exports, runbooksnpm run test:contract-production-alerts, npm run test:contract-production-monitoring-integrationAlert routing and on-call ownership are deployment-specific
SC-T16Operator credential compromiseExternal attacker/insiderUnsafe approvals, activation, migration, restoreOperator auth, explicit guarded restore, documented proceduresnpm run noos -- production preflight --profile validatorSecret custody and MFA are external controls
SC-T17Sidecar binary/config compromiseOperator/supply-chain attackerWrong runtime semantics or disabled meteringCapability handshake, runtime profile checks, preflightnpm run test:contract-runtime-preflight, npm run test:contract-wasmtime-sidecar-lifecycleReproducible builds and release signing are follow-up hardening
SC-T18Readiness evidence driftOperator/release process failureActivation with stale or missing evidenceMachine-readable launch gate and layer-readiness reportnpm run test:contract-mainnet-launch-gate, npm run noos -- contracts layer-readiness --jsonHuman review still requires operational discipline

Review Triggers

Re-run this threat model when any of these change:

  • Wasmtime version, sidecar protocol, executor version, ABI version, or metering model.
  • Host import names, signatures, payload limits, or failure codes.
  • Contract-to-contract depth, rollback, fuel, or auth rules.
  • Registry enforcement policy or release workflow states.
  • Bucket access, ciphertext availability, or encrypted-record write semantics.
  • Migration job, batch, transform, or contract-defined migration behavior.
  • Snapshot format, archive import/export, replay checkpoint, or backup drill behavior.
  • Production activation gate, preflight, readiness, monitoring, or alert rules.

Required Review Artifacts

Audience-first NOOSChain documentation.