/

CVE-2026-45329

Severity:

HIGH RISK

(7.1)

TEE Memory Exposure (CWE-200) in Espressif ESP-IDF

CVE-2026-45329

Analyzed

Vulnerability type

Category:

Information Exposure / Memory Access Control

CWE:

CWE-20, CWE-125, CWE-200

Impact:

Exposure of TEE-resident sensitive data to non-trusted code

Severity:

HIGH RISK

(7.1)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Several ESP-TEE secure-service wrappers in ESP-IDF insufficiently validate caller-supplied pointers, allowing access to TEE-exclusive memory via hardware peripherals running in machine mode.

An attacker code running in the rich execution environment (REE) can abuse these services to read or infer sensitive data from TEE memory, including through oracle-style incremental disclosure.

Affected context

The vulnerability arises in ESP-IDF deployments that use ESP-TEE secure-service wrappers to access hardware peripherals such as ECC, SHA, or SPI from non-secure (REE) code.

It manifests when the wrapper functions accept caller-supplied pointers and only partially validate them, failing to ensure that input buffers do not reference TEE-exclusive memory regions.

The issue is most relevant where sensitive keys, credentials, or confidential application data are stored in TEE memory under the assumption that REE code cannot read them directly.

Exploit preconditions

  • Attack surface: Secure-service APIs exposed by ESP-TEE wrappers in esp_secure_services.c and esp_secure_services_iram.c.
  • Required access: Ability to execute or control code in the REE context that can invoke these secure-service wrappers.
  • Trigger point: Calls to affected wrappers that pass attacker-controlled pointers as input buffers, pointing into TEE-protected memory.
  • Why exploitation is possible: The wrapper functions only validate some pointer arguments and do not consistently enforce that all input pointers reference allowed REE memory ranges, while the underlying peripherals execute in RISC‑V M‑mode with full address-space access and can operate over TEE memory.

Why this happens

The core issue is incomplete validation of untrusted input pointers passed across a privilege boundary into trusted execution code.

Some secure-service wrappers check only subsets of arguments or rely on assumptions about pointer provenance, allowing REE-controlled pointers to reference TEE-exclusive memory.

Because the TEE hardware peripherals execute with high privilege and unrestricted address-space access, they will read from the supplied addresses without enforcing TEE/REE separation.

This maps to:

  • CWE-20 (Improper Input Validation): Pointer arguments are not fully validated against expected address ranges.
  • CWE-125 (Out-of-Bounds Read): Peripheral operations read from memory regions outside the intended accessible domain.
  • CWE-200 (Information Exposure): Data from TEE-only regions is returned or inferable in the REE, breaking confidentiality guarantees.

Potential impact

  • Exposure of cryptographic keys or intermediate values stored in TEE memory.
  • Disclosure of sensitive application data or credentials resident in secure memory.
  • Reconstruction of TEE-resident information via repeated oracle-style queries, even when only derived values or single bits are returned per call.
  • Undermining of the isolation guarantees between TEE and REE, weakening overall platform trust assumptions.
  • Potential facilitation of further attacks that rely on knowledge of TEE-internal state.

General mitigation guidance

Effective mitigation focuses on enforcing strict memory and trust boundaries at the secure-service API layer and within TEE code:

  • Validate all pointer arguments in secure-service wrappers, ensuring they point only to approved REE-accessible regions before invoking high-privilege peripherals.
  • Centralize pointer validation logic into reusable helpers so every TEE entry point consistently applies the same address-range and alignment checks.
  • Design secure-service interfaces to minimize or eliminate the need for caller-supplied input pointers into arbitrary memory, favoring fixed or pre-validated buffers where practical.
  • Restrict the amount and granularity of data returned from TEE operations, especially where derived outputs could form an oracle for incremental disclosure.
  • Apply least-privilege principles to TEE-accessible peripherals and code paths, reducing the scope of memory they can legitimately access when servicing REE requests.

How teams detect issues like this

Detection typically relies on a combination of code-centric and policy-centric approaches:

  • Static analysis: Define rules to flag TEE entry points that accept raw pointers from less-privileged contexts without comprehensive range checks against trusted memory regions.
  • Code review: Pay particular attention to secure-service wrapper implementations, verifying that every pointer argument (input and output) is validated before dereference or peripheral invocation.
  • Architecture review: Maintain explicit documentation of TEE vs. REE memory maps and require that all cross-world APIs reference standardized validation routines aligned with these maps.
  • Automated testing: Add negative tests that attempt to pass pointers near or into TEE-exclusive regions and verify that calls fail safely rather than leaking data.
  • Tooling integration: Use automated code review or security scanning tools to enforce patterns such as "no direct dereference or peripheral use of unvalidated REE pointers in TEE code."

Sources

SourceLink
github.comgithub.com/espressif/esp-idf/commit/145ba4c42dc8283054cfde9a1c3470db7399192f
github.comgithub.com/espressif/esp-idf/commit/7867f4a57560bf9fc4a931e37ba02b7a3e9f406b
github.comgithub.com/espressif/esp-idf/commit/eebabaff2fdc273b1530fe66e55fb3bcd181dfd6
github.comgithub.com/espressif/esp-idf/security/advisories/GHSA-w82j-7q63-7pqm

Frequently asked

questions

Exploitability is constrained to environments where untrusted or semi-trusted code can run in the REE and is able to invoke the affected secure-service wrappers. In such contexts, it can be reliably exploited to read or infer TEE-resident data.

The attacker typically needs only the level of privilege required to execute code that can call the ESP-TEE secure services from the REE. Elevated operating-system privileges are not strictly required if the platform API is available to normal REE applications.

The most robust pattern is to perform strict, centralized pointer and range validation at every TEE entry point, ensuring that no caller-controlled pointer can reference TEE-only memory before it is used by high-privilege peripherals or TEE routines.

Future designs should treat every cross-world parameter as untrusted, enforce explicit memory-domain checks on all pointers, minimize dependence on arbitrary caller-provided buffers, and institutionalize security-focused reviews for all TEE/REE boundary APIs and privilege transitions.

Find out what's already
exploitable in your codebase.