Definition
A secure default is a behavior a system adopts when nobody has made an explicit choice, and that keeps the protections the system’s threat model §1.2 requires. Defaults take effect before the system is first configured, when a setting is absent, and when a stored configuration cannot be read. With secure defaults, an unconfigured system, or one whose configuration was lost, is no more exposed than a correctly configured one. An insecure default is permissive behavior, such as a factory password shared by every unit, that lasts until someone changes it.
The idea
In 2016 the Mirai malware took over hundreds of thousands of cameras, video recorders and home routers [427]. It needed no software flaw. It logged in through Telnet, an old remote-login service, with a list of about 60 user names and passwords that manufacturers had set at the factory and owners had never changed. Each device worked exactly as configured, and its configuration was the factory default. The point is general: most defaults are never changed, so the protection that most installed systems actually have is the protection of their default state.
A secure default answers the question “what does the system do when nobody has told it what to do?” with the answer the threat model needs. It must answer it in every case where the question arises: the first start, a missing setting and a damaged stored record. A new employee’s door badge is a fair picture. A badge that opens nothing until a manager grants rooms stays safe when the manager forgets a step; a badge that opens every door until a manager restricts it does not. The picture stops being accurate at the first step: a device that refuses everything also refuses its own first configuration, so it needs one narrow, protected way in.
How it works
Design the defaults as named states, each with its own rule.
Unprovisioned: the device has never received its configuration or its keys. Only the operations needed to install them are allowed, each with its own required evidence. Everything else is refused, or limited to a fixed, harmless service such as reporting the device’s status.
Provisioned and valid: the stored configuration passes its integrity §1.9 check, a test that its bytes have not been damaged or altered. The configuration’s rules apply.
Provisioned but damaged: the device was configured once, but the stored record now fails its check. Protected operations are refused, and only a recovery operation authorized by a separate recovery credential can restore a valid configuration.
Inside each state, decide what happens to a request that no rule mentions. Default deny refuses every request that no rule explicitly allows; default allow permits every request that no rule explicitly forbids. For access decisions the secure choice is default deny. A forgotten rule then refuses a legitimate request, which someone notices and fixes, instead of admitting an attacker, which nobody notices.
Decide who may make the first configuration. Accepting the first configuration that arrives, called trust on first use, lets an attacker who arrives first take control. A safer first step needs evidence the attacker lacks: a physical action on the device, such as holding a button during start-up; a per-device secret printed inside the packaging or programmed at the factory; or a signed statement from the vendor naming the device’s owner. Installing a device’s first keys is called key provisioning §5.28.
Keep damaged apart from unprovisioned. If a damaged record counted as “never configured”, anyone able to damage the record, for example by cutting power during a write, could return the device to its unprovisioned state and configure it as its new owner. A durable marker that records “this device has been provisioned” keeps the two states apart even if the whole record is erased. A one-time programmable bit, a memory bit that can be set once and never cleared, is a common choice.
Make a detected fault stick. A latched fault state is a flag that, once set during a start-up, stays set until the next reset or until an authorized recovery clears it. When start-up code finds a damaged key record, it sets the flag, and every later decision in the same run reads the flag instead of reading the record again. Without the latch, a later code path that re-reads the record and finds nothing usable might take the “never configured” branch and accept a built-in factory key; the attacker then needs only to make that path run. For the same reason, a parse error must lead to the restrictive state, never to “use the built-in settings”.
Worked example
A device keeps its management key in a 38-byte record in flash memory §6.6: a 2-byte marker, the 32-byte key and a 4-byte checksum §4.32, a value computed from the other bytes that changes when any of them is damaged by accident (). Erased flash memory reads as bytes of value 0xFF, so a record that was never written is 38 bytes of 0xFF. The firmware also contains a factory key , the same in every device. The device accepts only in the unprovisioned state, and only for the command that installs the first management key.
An insecure rule. “If the record is all 0xFF, or its checksum is wrong, treat the device as unprovisioned.” Updating the key means erasing the record and then writing the new one. A power cut between the two steps, whether accidental or caused by an attacker who holds the device, leaves 38 bytes of 0xFF; a power cut during the write leaves a half-written record with a wrong checksum. Under this rule both mean “unprovisioned”. is in every copy of the firmware, so anyone who has read it out of one device can now send the installation command with and install a management key of their own.
A secure rule. At the first provisioning the device also sets a one-time programmable bit . At every start-up it decides as follows.
clear and the record all
0xFF: unprovisioned. is accepted, for the first installation only.set, marker correct and checksum correct: provisioned and valid.
set and anything else, including a record of 38 bytes of
0xFF: damaged. Set the latched fault flag, refuse every protected command for the rest of this run and accept only a recovery command authenticated with the recovery credential.clear and the record not all
0xFF: also damaged, because the record holds bytes that the device never accepted through provisioning.
The power cut now leaves the device damaged, not unprovisioned, and is useless to the attacker.
Stated precisely
Let the states be (unprovisioned), (provisioned and valid) and (provisioned but damaged). For each state , let be the set of operations the device performs in , each together with the evidence it requires. The defaults are secure when three conditions hold.
contains only the operations needed for the first provisioning, plus fixed services that the threat model accepts as harmless.
contains no operation that the device would refuse in to a requester without the current management key, except recovery operations that require the recovery credential. In particular, does not accept the factory key.
No event that an attacker can cause, such as a power cut, a damaged record or a malformed message, moves the device from or into . Only an authorized reset that also erases every secret may do so.
The latch adds a condition over time: within one run, once the device has entered , every later decision in that run treats the state as , until a reset or a successful recovery.
Limits and common mistakes
Secure does not mean “refuse everything”. A door controller that locks every door when its configuration is missing can trap people in a fire, and an insulin pump that stops when a setting is missing can harm its user. The default must keep the protections that the threat model and the safety requirements name, and those can include a limited service that keeps running.
A secure default differs from failing closed §1.13. Failing closed is the response to a failure during operation, such as refusing a request when a check cannot be completed. A secure default is the behavior when no choice has been made. A system needs both.
A default credential shared by every unit is insecure even when it is documented, because one leak opens every device. A credential unique to each device removes that risk. A California law in force since 1 January 2020 [447] and a United Kingdom product security law in force since 29 April 2024 [428] forbid universal default passwords on consumer devices that connect to a network.
A checksum detects accidental damage only. An attacker who can write the record can also write a matching checksum. Protecting the record against deliberate change needs a message authentication code §5.7 (MAC), a value that only a holder of a secret key can compute, or memory that the attacker cannot write.
Trust on first use is a race. It is acceptable only when the first use happens where no attacker can be present, for example in a factory.
Reporting a problem is not handling it. A device that logs “configuration missing, using built-in settings” and then accepts the factory key has an insecure default, however clearly it reports it.
Questions answered
What happens before the first valid configuration is installed?
Before the first valid configuration is installed, a system with secure defaults runs in an unprovisioned state: only the operations needed to install that configuration are allowed, each requiring its own evidence, and everything else is refused or limited to a fixed, harmless service such as a status report. The evidence for the first installation must be something an attacker lacks: a physical action on the device, a per-device secret delivered with it, or a signed statement from the vendor that names the owner. Accepting whoever configures the device first lets an attacker who arrives first take control.
Two other cases must not be confused with this one. A setting that is missing in a configured system takes the restrictive choice, default deny: a request that no rule allows is refused. A configuration that was installed once but is now damaged is not “no configuration”. The device must refuse protected operations and wait for an authorized recovery; otherwise anyone able to damage the record, for example by cutting power during a write, could make the device unprovisioned again and claim it.
Why must a damaged key record not fall back to the built-in factory key later in the same start-up?
Because a built-in factory key is the same in every device and can be read out of any copy of the firmware, so accepting it would give control to anyone who can damage the key record. The key record is the stored copy of the device’s current management key. A power cut during a write, a hardware fault or an attacker can damage it. Suppose start-up code detects the damage, but a later code path re-reads the record, finds nothing usable and takes the “never configured” branch. The device then accepts the factory key, and the attacker installs a management key of their own. The repair is a latched fault state: when the damage is first detected, the device sets a flag that stays set until the next reset or a successful recovery, and every later decision reads the flag instead of the record. For the rest of that start-up the device refuses protected commands and accepts only an authorized recovery.
Related entries: Fail closed (§1.13), Fail open (§1.14), Recovery authority (§1.46), Key provisioning (§5.28), Authorization (§1.7). Further reading: [427, 428, 447].