a trusted execution environment
/ T-E-E /
Imagine handing your most sensitive paperwork into a sealed glove box: you can put work in and take results out, but no one — not even the building's owner — can reach inside to read or tamper with what is on the table. A trusted execution environment, or TEE, is the hardware version of that glove box. It is a region of a processor that runs code and holds data in a protected bubble, isolated by the hardware so that even the operating system, the hypervisor, and an attacker with full control of the rest of the machine cannot peer in or change what is inside.
Concretely, a TEE splits the system into a normal world and a secure world, with the CPU itself enforcing the wall between them. Code in the secure world gets its own protected memory and execution state; only narrow, controlled gates let the normal world request a service, much like a system call across a privilege boundary, but here the boundary protects the secure side from the more privileged software, not the other way round. Memory belonging to the TEE is typically encrypted and integrity-checked by the hardware, so even if an attacker reads the physical DRAM or the memory bus, they see only ciphertext (see secure-enclave and memory-mapped-io). Examples include Arm TrustZone, which underpins mobile payment and fingerprint handling, and Intel SGX enclaves.
The honest framing is that a TEE shrinks what you must trust, but does not make trust disappear. Its promise is confidentiality and integrity for the code and data inside, even on a machine whose OS you do not control — useful for processing secrets in the cloud or guarding cryptographic keys. But you still trust the silicon vendor and the TEE's own (usually small) firmware, and TEEs are not immune to the side-channel attacks in this field: several have been shown to leak secrets through cache timing and speculative execution despite their isolation (see side-channel-attack and spectre-vulnerability). A TEE raises the bar dramatically; it is not a magic box that ends all attacks.
A phone handles your fingerprint inside a TEE. The matching algorithm and the stored fingerprint template live in the secure world; the ordinary Android apps live in the normal world and can only send a 'does this match?' request and receive yes/no. Even malware that fully compromises Android cannot read the fingerprint template, because the hardware refuses the normal world any access to secure-world memory.
The OS can ask the TEE a question but cannot read its memory — isolation enforced by the CPU, not by the OS.
A TEE reduces the trusted base but is not unbreakable: real TEEs (including SGX) have been pierced by cache-timing and speculative-execution side channels. Treat it as a strong barrier, not a guarantee that secrets inside are physically unreachable.