◇ OpenCyber Academy
Engineering · Chapter 22 · English

Chapter 22 — Systems, endpoints and hardware security: system and data models

Open, free learning for anyone who wants to protect people and technology. No account is required to read this text or its worked answers.

Chapter 22 — Systems, endpoints and hardware security: system and data models

Lesson map

Lesson 22 published. Map, example, EX064.

flowchart TD
  N0["Learning outcomes"]
  N1["22.1 Boot chain model"]
  N2["22.2 Manifest"]
  N3["Lab — Lab — boot measurements"]
  N4["22.3 Reading the result"]
  N5["22.4 Interpreting"]
  N6["22.5 Data model"]
  N7["Measured boot and attestation"]
  N0 --> N1 --> N2 --> N3 --> N4 --> N5 --> N6 --> N7
  N7 --> EX["Worked example"]
  EX --> Q["Exercise EX064"]

Logical drawing

flowchart LR
  N0["Learning outcomes"]
  N1["22.1 Boot chain model"]
  N2["22.2 Manifest"]
  N3["Lab — Lab — boot measurements"]
  N4["22.3 Reading the result"]
  N5["22.4 Interpreting"]
  N6["22.5 Data model"]
  N7["Measured boot and attestation"]
  N0 --> N1 --> N2 --> N3 --> N4 --> N5 --> N6 --> N7 --> Q["EX064"]
[Learning outcomes]
    |
    v
[22.1 Boot chain model]
    |
    v
[22.2 Manifest]
    |
    v
[Lab — Lab — boot measurements]
    |
    v
[22.3 Reading the result]
    |
    v
[22.4 Interpreting]
    |
    v
[22.5 Data model]
    |
    v
[Measured boot and attestation]
    |
    v
[Worked example] --> [Exercise EX064]

Learning outcomes

You will (1) model the boot chain and measured components; (2) compare observed measurements to a manifest; (3) interpret mismatches.

22.1 Boot chain model

Firmware verifies the bootloader, which verifies the kernel; the kernel loads an initial file system and then applies the kiosk policy. Each component can be measured by its digest.

Each step checks the next before handing over control, so the chain is only as strong as its first link. Mateo draws it as five boxes in a row, matching the components in the lab. The kiosk policy sits at the end because it is applied by the running system, not verified by firmware; that makes it the component most likely to drift, as the lab result shows.

22.2 Manifest

The golden image release includes a manifest of expected digests for each component.

The manifest is created by the release process from the image itself, not written by hand, so it cannot disagree with what was built. Each entry names a component and its digest. Mateo stores the manifest with the signed release, and each PC compares its own measurements with the manifest of the release it is supposed to run. A PC on an older release is compared with that release's manifest.

Lab — Lab — boot measurements

"""Compare synthetic boot-component digests with an expected manifest (stdlib only)."""
import hashlib
expected = {c: hashlib.sha256(f"{c}-v2.1".encode()).hexdigest() for c in ("firmware", "bootloader", "kernel", "initrd", "kiosk-policy")}
observed = dict(expected)
observed["kiosk-policy"] = hashlib.sha256(b"kiosk-policy-v2.0").hexdigest()
for c in expected:
    print(f"{c:13} {'match' if observed[c] == expected[c] else 'MISMATCH'}  {observed[c][:12]}")
print(f"{sum(observed[c] != expected[c] for c in expected)} of {len(expected)} components differ")

Run with python3 lab_boot.py. Verified output:

firmware      match  a46bac657b78
bootloader    match  7e5ecd63dec1
kernel        match  eafae6b3a1ca
initrd        match  0a6473933bba
kiosk-policy  MISMATCH  9ad757800d10
1 of 5 components differ

22.3 Reading the result

Four components match the manifest; the kiosk policy does not. One of five components differs.

The output lists each component on its own line, which makes the single mismatch easy to spot. The short digest prefix shown is enough for a person to compare by eye; the full digest is used for the actual comparison. Mateo reads the result as a fact about this PC at this moment, not yet as an explanation of why the policy differs. The next step is to find the cause.

22.4 Interpreting

The mismatch shows the PC is running policy version 2.0, not 2.1. Investigation finds the PC was offline during the update. The fix is to reapply the release, not to treat the PC as compromised.

Mateo checked the PC's restore log and found it had been switched off on the night the new release went out. When it next started, the patron area restored correctly but the policy update had not been applied. Treating every mismatch as an attack would waste staff time and teach people to ignore alerts. The response rule below handles the ordinary case first.

22.5 Data model

Measurement results are stored with PC, date, component and status.

Mateo keeps one record per component per check, so a PC's history shows exactly when a component changed and when it was corrected. The asset tag serves as the PC key, as in the inventory. Status takes three values: match, mismatch or not measured, since a missing measurement is a finding of its own. These records feed the weekly summary and the response rule. A mismatch recorded on two consecutive days is easy to find with a simple query.

Measured boot and attestation

With a TPM, each boot component's measurement can be recorded in secure registers. A management server can request these measurements and compare them with expected values, a process called attestation. Fernhill's design uses a simpler version: a startup script computes digests of key files and reports them. The lab shows the comparison logic.

Mateo notes that the simple version relies on the OS being trustworthy enough to report honestly, which Secure Boot supports.

Response rule

Mismatch after one restore triggers a reapply; mismatch after two triggers investigation.

Storing results

Measurement results are kept for a year and summarised weekly, showing how often mismatches occur and how quickly they are fixed.

Worked example

Marta asks whether a mismatch means an attack. Mateo explains that most mismatches are update failures; the response is to restore and recheck, escalating only if a mismatch persists after restore.

Synthetic case. Synthetic digests.

Errors and limits

Measurements show difference, not cause.

Exercises

Synthesis

Model the boot chain and compare measurements to a manifest.

Continue studying — chapter 22 of 50

← Chapter 21 (draft) · Course chapter index · Chapter 23 (draft) →