Introduction

On August 11th, 2025, zkSecurity was engaged to perform a security audit of Venture23 Aleo Oracle. The specific code to review was extracted from various public repositories of Venture23 (https://github.com/venture23-aleo). The audit lasted 3 weeks with 2 consultants.

Scope

The scope of the audit included the following repositories with the respective commit hash:

  • aleo-oracle-notarization-backend: 137dbd0cd9b2cc8e0f6a46142407b875127b07ff
  • oracle-verification-backend: 9f6285dd70472bf893c66b919963aa696614cd19
  • aleo-oracle-encoding: d43858242683696959759ac7fc300479dffa1120
  • aleo-utils-go: 78a47ddecc7a7e34a769b90b94f2d85053ce7ff6
  • aleo-oracle-sdk-js: c150794f24e98874c4972d81aa9e1b1cb6c577b1
  • aleo-oracle-sdk-go: 0a82cfaf43c5b33eea4d25550b58d4590a96f5f7
  • aleo-oracle-contracts: d709d0eb0b24af0a725e1287eeb742b1d76b0f31

For aleo-oracle-contracts, only the file vlink_oracle_v0001.aleo was included in scope. Components related to AWS Nitro in the repositories were considered out-of-scope and not reviewed during this audit, as the assessment focused solely on Intel SGX–based components.

Methodologies

The security assessment employed a systematic two-phase approach designed to evaluate both the overall system architecture and individual component security properties. The methodology was structured to understand the complete trust model and identify potential attack vectors across the entire oracle pipeline, using the price feed workflow as a primary reference implementation to map relationships between components and understand the trust boundaries, data transformation points, and critical dependencies.

The first phase focused on the core infrastructure components, examining the notarization backend, verification backend, and supporting utilities. This analysis evaluated the security properties of the protocol design, assessing whether the composition of various parties achieves the intended security guarantees through proper cryptographic proofs and attestation mechanisms. The team studied how the split-verification architecture addresses Aleo’s platform limitations while maintaining security properties, with particular attention to trust relationships between components and potential failure modes in the verification chain.

The second phase conducted detailed analysis of the SDK and client-side components, examining how applications integrate with the oracle infrastructure and identifying potential vulnerabilities in the client interaction layer. This included analysis of the Go and JavaScript SDKs, smart contract interfaces, and the overall client experience to ensure that security properties are maintained throughout the complete user interaction flow.

Throughout both phases, each component was examined for implementation vulnerabilities, configuration weaknesses, and operational risks focusing on three primary threat categories: integrity of the attestation process, confidentiality of cryptographic keys involved in the system, and potential availability issues that could disrupt oracle operations. For identified potential issues, the team engaged in collaborative discussions with the client to understand the intended behavior and operational constraints. Where appropriate, proof-of-concept demonstrations were developed to confirm the exploitability and impact of discovered vulnerabilities. All findings were then classified using a severity framework that considers both the likelihood of exploitation and the potential impact on the oracle’s security properties, enabling prioritized remediation efforts.

Strategic Recommendations

The Aleo Oracle system demonstrates a well-engineered approach to bridging trusted execution environments with blockchain-based data verification, but its current architecture reveals fundamental trust assumptions that can potentially compromise the security of the oracle. The most significant architectural limitation stems from Aleo’s inability to perform native ECDSA signature verification, which forces critical SGX attestation validation to occur off-chain in the verification backend. This design creates a trust dependency that impacts the security model, as the smart contract can only validate Aleo signatures while trusting that proper SGX verification has already occurred.

The current split-verification architecture represents a pragmatic compromise given Aleo’s limitations, but it introduces several systemic risks. The verification backend becomes a single point of trust and failure, potentially allowing compromised or malicious verifiers to inject invalid attestations into the system. Additionally, the off-chain verification process lacks the transparency and auditability that blockchain-based systems typically provide, making it difficult to detect or prove verification malfeasance after the fact.

Although the likelihood of such attacks is relatively low (it requires an attacker’s control of an Aleo private key corresponding to a trusted public key in the contract), the impact is very high, since it breaks the fundamental trust premise of the system. In order to strengthen the architectural foundations of the oracle system, development should focus on reducing and eventually eliminating these trust assumptions. Short term, is advised to review the architecture such that verifiers sign the outcome of a given verification and contracts can check this against a list of trusted verifiers. Medium term, the contract should implement ECDSA verification and the system should be able to work without the verification backend, as it is already acknowledged in the project documentation.

Overview

Architecture

The Aleo Oracle system provides cryptographically verifiable external data to Aleo smart contracts using Trusted Execution Environments (TEEs). The architecture addresses Aleo’s current limitations while aiming at maintaining strong security guarantees through hardware-backed attestation.

Core Data Flow: The core data-flow can be summarized as follows: A TEE Backend receives a request to notarize the response of a given URL (i.e. BTC to USD price according to a given exchange or list of exchanges). This response is notarized in two ways: an Aleo private key (that is generated in the TEE enclave) signs the attestation report, which is also signed by the TEE hardware. A client uses this attestation to update the state of an Aleo contract. Given that Aleo cannot directly verify the hardware attestation (ECDSA signatures), the client calls a verifier backend that checks the TEE signature. The contract then checks the Aleo signature (verifying also that the verification public key is in a list of allowed keys).

The system consists of five primary components:

  1. Notarization Backend (aleo-oracle-notarization-backend): Runs inside Intel SGX enclaves using Gramine LibOS to fetch external data and generate cryptographically signed attestation reports. The TEE isolation ensures data integrity and prevents tampering during the critical data acquisition phase.

  2. Verification Backend (oracle-verification-backend): Validates SGX attestation reports and ECDSA signatures outside the TEE environment. This component serves as a bridge until Aleo supports native ECDSA verification, converting complex cryptographic proofs into simpler Aleo-compatible signatures.

  3. Smart Contract (aleo-oracle-contracts/programs/vlink_oracle_v0001.leo): Implements on-chain verification and data storage with blockchain-enforced security. The contract manages enclave measurements, authorized keys, and final data validation using Aleo’s native signature schemes.

  4. SDKs (aleo-oracle-sdk-go, aleo-oracle-sdk-js): Client libraries (Go/JavaScript) that provide application integration points, handling network communication and request formatting. These can be orchestrated by automated infrastructure such as cronjobs (e.g., the aleo-oracle-gateway service) to manage periodic price feed updates.

  5. Supporting Libraries (aleo-oracle-encoding, aleo-utils-go): Including encoding utilities for Leo language compatibility and WASM wrappers for Aleo cryptographic functions.

BTC Price Attestation Example

Consider a typical Bitcoin price update flow:

  1. Data Acquisition: Upon request by a client, the notarization backend, running within an SGX enclave, makes HTTPS requests to multiple cryptocurrency exchanges (e.g., Binance, CoinGecko) to fetch current BTC/USD prices.

  2. Processing & Signing: The enclave aggregates the price data, applies any configured transformations (averaging, precision scaling), and signs the result using its private key along with SGX attestation evidence proving the computation occurred within a genuine Intel SGX environment.

  3. Attestation Submission: Automated infrastructure (a client, such as the gateway service) retrieves the signed price attestation and submits it to the verification backend for validation.

  4. External Verification: The verification backend validates the SGX attestation report, verifies the ECDSA signature and returns the result of the verification process.

  5. On-Chain Storage: The verified price attestation is submitted to the Aleo smart contract, which performs final validation checks and stores the BTC price for use by other Aleo applications.

This entire flow aims at ensuring that price data cannot be manipulated by compromised infrastructure, as the critical computation and signing occurs within the hardware-protected SGX enclave.

architecture overview

Gramine Library OS

The notarization backend uses the Gramine framework to run the service inside an Intel SGX enclave for processing attestation requests. Gramine is a lightweight Library Operating System that runs largely unmodified Linux applications (including Go binaries) inside SGX. It provides several useful capabilities for the oracle system:

  • POSIX compatibility: Enables standard networking, file I/O, and common cryptographic libraries to work inside SGX without application rewrites.
  • Secure channels: TLS libraries run inside the enclave; for inbound use cases Gramine offers RA-TLS helpers to bind an SGX quote to a TLS session. For outbound calls, the service performs normal HTTPS from within the enclave boundary.
  • Attestation integration: Provides APIs and tooling (e.g., RA-TLS) to obtain SGX quotes and expose measurements; the application is responsible for binding keys, source identifiers, and freshness into attested payloads.

By using Gramine, the notarization backend can reuse existing HTTP clients, JSON parsers, and crypto libraries while benefiting from SGX’s hardware-backed isolation and remote attestation. This reduces development complexity compared to the native SGX SDK, with the trade-off of a larger trusted computing base (the LibOS becomes part of the enclave TCB).

Notarization Backend

The notarization backend is the core component of the Aleo Oracle, responsible for processing attestation requests. It runs on the Gramine framework inside an Intel SGX enclave, fetching oracle data from external sources over TLS and generating an SGX quote to enable remote attestation.

According to the official architecture documentation in the repository, the workflow can be summarized as follows:

  1. The backend runs inside Intel SGX enclave using Gramine. It generate enclave signing key, sign the manifest with the key, and loads the Gramine LibOS and the backend binary. This enclave will get a MRENCLAVE measurement hash, proving the integrity of the initial state of the enclave. Since the build is reproducible, anyone can independently verify the hash by rebuilding the backend via Docker.
  2. On startup, the backend generates Aleo key pair. The private key remains inside the enclave, while the public key is registered on the Aleo smart contract.
  3. Users submit requests to the backend. The backend verifies the URL whitelist and payload format, then fetches the target data to be attested via HTTPS.
  4. The backend builds an oracle report containing the request details, timestamp, and attestation data, then encodes it in Aleo-specific format.
  5. The backend produces two hashes using Poseidon8. First, it computes the requestHash, which is the hash of the Aleo-encoded request (with zeroed timestamp). Then, it derives the timestampedRequestHash by hashing the requestHash together with the attestation timestamp. These hashes are later used in the SGX quote generation process.
  6. The enclave generates an SGX report. The quoting enclave signs it along with the attestation hash and PCK chain, while the provisioning enclave assists with cryptographic key setup.
  7. The Aleo-encoded oracle report is produced, hashed, and signed with the Aleo private key. The backend outputs both the attestation report and the Aleo oracle data for verification.

Verification Backend

The verification backend is responsible for validating SGX remote attestation reports produced by the notarization backend. Its sole function is to verify SGX reports, so it does not require a trusted execution environment (TEE) and can be operated by any party. The component leverages the Ego library for attestation verification and relies on a Platform Certificate Caching Service (PCCS) server to validate SGX reports.

At a high level, the verification backend operates as follows:

  1. The backend loads the configuration containing the uniqueId, which corresponds to the MRENCLAVE of the enclave being verified.
  2. Users submit attestation requests, which include the SGX report and Aleo-encoded data.
  3. The backend uses Ego to verify the report, extracting metadata and enclave measurements. The attestation is accepted if the uniqueId matches the configured value.
  4. The backend ensures integrity of the oracle data by recomputing the Poseidon8 hash and comparing it against the value embedded in the attestation. A match indicates that the data has not been tampered with.

Oracle SDK

The Aleo oracle provides an SDK to integrate its components into user applications. Currently, SDKs are available in TypeScript and Go. Under the hood, the SDK acts as an HTTP request wrapper, handling communication with both the notarization and verification backends.

The SDK exposes a Client class, which provides the following public methods:

  • Notarize: The primary function to submit a request to the oracle.
  • EnclavesInfo: Retrieves enclave information, including cryptographic details such as uniqueId and the Aleo public key.
  • GetAttestedRandom: Requests an attested random number from the oracle.
  • TestSelector: Allows testing of requests without performing attestation or verification.

Note that a single call to Notarize or GetAttestedRandom also triggers verification by sending the attestation to the verification backend.

Oracle Smart Contract

The Aleo Smart Contract (vlink_oracle_v0001.aleo) serves as the final trust anchor in the oracle system, providing cryptographically-enforced data storage and integrity guarantees on the blockchain. The contract maintains critical configuration state including authorized SGX enclave measurements (UniqueID) and a whitelist of allowed signing keys, with owner-only functions ensuring that only trusted TEE instances can contribute data to the system. When the SDK orchestrator calls the set_data_sgx function, the contract performs several validation steps: it verifies that the signing key is authorized, checks that the SGX UniqueID from the attestation report matches the stored trusted measurement, and validates that the provided data hash was correctly included in the TEE-signed report using Poseidon8 cryptographic hashing.

However, the contract cannot perform full SGX attestation verification due to Aleo’s current limitation of not supporting ECDSA signature verification natively. Instead, it relies on the verification backend to have already validated the ECDSA signatures and SGX attestation reports before the data reaches the contract. The contract only performs Aleo-native signature verification on the final report hash that was signed by the verification backend, effectively creating a trust chain where SGX ECDSA validation occurs off-chain in the verification backend, and Aleo signature validation occurs on-chain in the contract. Once validation is complete, the contract stores the attested data with timestamps and implements versioning logic to maintain only the latest data per request type, ensuring that applications consuming oracle data have access to the most recent verified information while maintaining full cryptographic auditability of the trust chain from TEE to blockchain.