Definition
A secure element is a separate, tamper-resistant chip that stores cryptographic keys and performs operations with them inside itself, so that the keys never leave it in readable form. The device’s main processor, called the host, sends commands such as “sign this value with the key in slot 2” and receives only results. The element enforces rules about which operations each key allows. SIM (subscriber identity module) cards and the chips in bank cards are secure elements; so are small chips sold for connected devices.
The idea
A key stored in a microcontroller’s §6.1 flash memory §6.6 can be read by any code that runs on the microcontroller. One memory-safety bug in the radio or network software, or a debugger attached to the chip’s debug port, is enough to copy it. A copied key is a lasting loss: the attacker uses it from another computer, as often as it likes, until every party that trusts the key has replaced it.
A secure element moves the key out of the host’s reach. The host can ask the element to use the key but cannot read it. A notary who keeps the official seal in a locked room is a fair picture: clients hand in documents, the notary stamps them and hands them back, and no client ever touches the seal. The picture also shows the limit. A notary who stamps whatever is handed in protects the seal, not the documents. An attacker who controls the host can hand the element anything to sign. The element prevents theft of the key; it does not prevent misuse of the key while the attacker controls the host.
How it works
Provisioning. At manufacture, a key is generated inside the element, or written into one of its numbered key slots. Each slot gets a policy: whether the key may ever be read out, which operations it may be used for (for example, signing only), whether a command must first prove knowledge of an authorization §1.7 secret, and sometimes a counter that limits the number of uses. The configuration is then locked so that it cannot be changed.
Use. The host sends a command and its data over a serial bus, a few wires between the two chips, for example “compute a digital signature §5.14 over this 32-byte hash of the data with the key in slot 0”. The element checks the slot policy, computes the result internally, and returns only the result.
Binding to the host. Some elements accept commands only through an authenticated, encrypted session keyed with a secret shared with the host at provisioning. This stops an attacker who taps the bus, but the host’s copy of that secret sits in host memory.
Physical protection. The chip resists direct attack: a metal mesh over the circuits detects cutting or probing, sensors detect abnormal voltage, clock frequency, temperature and light, and countermeasures limit side channels §1.29, meaning leaks of information through power use, electromagnetic radiation or timing. Elements are commonly certified under the Common Criteria (ISO/IEC 15408) [341], an international standard for security evaluation; each certificate names the product, its configuration and the attacker strength assumed.
Elements also offer services that host software cannot provide safely, such as a random number generator and a monotonic counter §8.28, a counter that only increases and that the host cannot reset. A secure element often serves as a device’s root of trust §1.33, the component whose correct behavior the rest of the device’s security argument starts from.
Related components draw the same line elsewhere. A TPM (Trusted Platform Module) is a standardized chip of this kind for personal computers and servers. An HSM (hardware security module) is a larger device, such as a plug-in card or a network appliance, that protects keys for servers. A TEE (trusted execution environment), such as one built with Arm TrustZone, is an isolated mode of the main processor; it shares the chip with ordinary software, so it resists software attacks on the normal operating system but generally offers less protection against physical attacks than a separate element.
Worked example
A connected meter signs each reading with a private signing key held in a secure element. Suppose, as a hypothetical figure, that one signature takes the element 50 ms, so it can sign at most values per second. An attacker takes control of the host firmware and keeps control for 2 hours before the device is found and reflashed.
During the 2 hours, the attacker has the element sign values of its choice: at most forged readings, each with a valid signature.
After the reflash, the attacker can sign nothing more, because the key never left the element. The forged readings stay valid; a verifier can reject them only by other evidence, such as the time window of the compromise.
Had the key been stored in the host’s flash memory, the attacker would have copied it in the first second and could sign any number of readings, from any computer, until every verifier stopped trusting that key.
The element turned a lasting loss into one bounded by the length of the compromise. It did not prevent the 144,000 forgeries, because each one was a request that the slot policy allowed. A slot policy with a use counter set to, say, 10,000 signatures would have capped them at 10,000, at the cost of a key that wears out.
Stated precisely
Distinguish two kinds of authority over a key: the authority to read it, called export authority, and the authority to have it used, called invocation authority. Assume that the element’s physical and logical protections hold against the attacker’s means, which is what its certification evaluated. Then the element guarantees two things.
A key in a slot marked non-exportable is never output, in any form, by any command.
Each command is carried out only if the slot policy permits it for the authorization the requester presents.
It guarantees nothing about why a permitted command was sent. The operations available to a compromised host are therefore where a credential stored in host memory counts as held, because whoever controls the host can read that memory.
Limits and common mistakes
Non-exportable does not mean unusable by an attacker. A compromised host keeps invocation authority for as long as it is compromised, as the worked example shows.
The element sees only bytes. Asked to sign a 32-byte hash, it cannot tell whether the hash belongs to a genuine reading or a forged command. Checks of meaning, such as which commands are allowed, must take place in a part the attacker does not control, or inside the element through a narrow command whose message the element builds itself, for example one that signs the element’s own counter value.
Operations that return secrets give those secrets to a compromised host. A key agreement command that outputs the shared secret, or a decryption command that outputs plaintext, places those values in host memory.
A key that cannot leave the element cannot be backed up either. If the element fails, the key is lost, so the system needs a recovery path, and every recovery path is another route for an attacker.
A certificate covers a product, a configuration and an attacker strength. An element used with an unlocked slot or a different configuration is not what was certified.
The element does not make the host trustworthy, and it cannot ensure availability §1.10. A compromised host can drop or alter the element’s results before using them, stop using the element, or use up a limited counter, which is a denial of service §1.28.
Questions answered
Which operations can a compromised host still request from the element?
A compromised host can still request every operation that the element’s interface and key-slot policies allow the host, on data of its own choosing; what it cannot do is read a key marked non-exportable. A secure element is a separate tamper-resistant chip that keeps keys inside and uses them on request; the host is the device’s main processor. In practice a compromised host can:
have any value signed or authenticated with each key whose slot permits it, and so forge messages for as long as it controls the host;
have data decrypted, or run key agreements and key derivations, with each key whose policy permits it, and read every result the element returns;
use any authorization or session secret stored in host memory, which unlocks every command that secret protects;
use up limited counters, and change any key or setting that was left unlocked.
Because the keys never leave the element, the attacker loses all use of them once the host is repaired, unlike a key stored in host memory, which can be copied and used indefinitely. To narrow what a compromised host obtains, give each slot one purpose, lock the configuration, keep authorization secrets out of host memory, limit uses with counters, and have receivers check the meaning and freshness of each signed message rather than trusting a valid signature alone.
Related entries: Physical versus logical access (§1.32), Proof of possession (§5.30), Confused deputy (§1.25), Root of trust (§1.33), Monotonic counter (§8.28), Least privilege (§1.15). Further reading: [341].