A small core you can trust: TCB, kernel and rings

9 min 6 sections 4 practice questions 4 sources citedISC2 objective 3.1

Every computer has a small set of parts that enforce its security rules: some hardware, some built-in software and the heart of the operating system. If that core is correct, a faulty application can do only limited harm. If it is wrong, nothing above it can be trusted. The smaller and simpler the core, the better the chance of getting it right. No technical background is assumed.

By the end of this unit you will be able to:

  • Explain why a small, simple protective core is easier to trust
  • Tell apart the trusted computing base, the reference monitor and the security kernel
  • Explain protection rings, kernel mode and user mode
  • Describe how process isolation keeps one program out of another's memory
  • Tell apart the four security modes of operation

Two door locks at the same price

An illustrative example

A hotel is replacing its metal keys with key cards, and the supplier offers two door locks. The first reads a card and asks a small controller behind the front desk whether to open. It does nothing else.

The second also shows the weather, plays the hotel's welcome video and takes room service orders at the door handle. It costs the same. The hotel's security adviser asks one question: how much programming is able to open the door, and who has checked it?

Why does the amount of programming that can open the door matter more than the number of features on offer?

Keep it simple and small

Every instruction in a program is a place where a mistake can hide. The plain lock runs a few thousand instructions, and a careful team can read every one. The clever lock runs millions, written by several suppliers, and any of them might open the door by accident or by design.

The design principle is to keep it simple and small. The part of a system that enforces protection should do one job, in as few steps as possible. Saltzer and Schroeder called the principle economy of mechanism. Their reason was that design errors which open unwanted paths are not noticed in normal use. The protective part must therefore be small enough to inspect line by line.

Three practical rules follow. Remove functions the task does not need, since each one widens the . Use one mechanism for one purpose, not several that overlap. Keep protective code apart from everything else, so that a change to a feature cannot disturb it.

The principle does not mean fewer controls. A building may still have a fence, a door and an alarm. It means each of them should be simple enough to understand completely.

The trusted computing base and its perimeter

The trusted computing base (TCB) is the whole set of protection mechanisms in a computer system that together enforce its . It includes hardware, firmware and software. Firmware is programming stored in a chip inside the device, which runs before the operating system starts and underneath it afterwards.

On an ordinary laptop the includes the processor's protection features, the firmware, the core of the operating system and the program that checks passwords at sign-in. A word processor, a game and a web browser are outside it.

Trusted here means relied upon. It does not mean proven good. A flaw in a game is a nuisance. A flaw in the trusted computing base breaks the security policy for everything on the machine. Keeping it simple and small is therefore applied here before anywhere else.

The security perimeter is the boundary between the trusted computing base and the rest of the system. Nothing crosses it except through defined, checked doorways. A trusted path is one such doorway for people: a way for a user to reach the trusted computing base directly, which other software cannot imitate. A sign-in screen that appears only after a special key sequence is an example. A fake sign-in window drawn by a malicious program cannot answer that sequence.

The reference monitor and the security kernel

A library has a rule that every loan is checked against the borrower's card. The rule is an idea. The assistant at the desk, with the card reader, is the thing that carries it out. Computer security makes the same distinction.

Three terms that are easy to mix up
TermWhat it isIn the library
Reference monitorA concept: an abstract machine that checks every access by a subject to an objectThe rule that every loan is checked
Security kernelThe hardware, firmware and software that implement the The assistant and the card reader
Trusted computing baseEverything relied on to enforce the security policy, of which the kernel is the centreThe desk, the gates, the staff and the catalogue

A security kernel must meet three conditions. It must mediate all accesses, so that no request can go round it. It must be protected from modification. And it must be verifiable as correct, which in practice means small enough to analyse and test completely.

The reference monitor is the idea. The security kernel is what implements it: always invoked, tamper-proof, small enough to verify. The trusted computing base is everything relied on.

Rings and modes: who may touch the hardware

A processor, the chip that carries out a program's instructions, can run them at different levels of privilege. The levels are called protection rings and are numbered from 0, the most privileged, outward. The idea comes from the Multics operating system, which used eight. The layout taught today has four.

Privilege falls from ring 0 outward to ring 3

Privilege falls from ring 0 outward to ring 3Four rings as layers: ring 0, the kernel, at the foot; rings 1 and 2, services and drivers, dashed because most systems leave them unused; ring 3, applications, on top. A system call leads from ring 3 to ring 0.Ring 3applications, user modeRing 2services and driversRing 1services and driversRing 0kernel, kernel modeSystemcallcheckedrequestif allowedPrivilege falls from ring 0 outward to ring 3Four rings as layers: ring 0, the kernel, at the foot; rings 1 and 2, services and drivers, dashed because most systems leave them unused; ring 3, applications, on top. A system call leads from ring 3 to ring 0.Ring 3applications, user modeRing 2services and driversRing 1services and driversRing 0kernel, kernel modeSystemcallchecked
Read this figure as text

A processor can run instructions at different levels of privilege, called protection rings and numbered from 0, the most privileged, outward. The idea comes from Multics, which used eight; the layout taught today has four.

  1. Ring 3 holds applications started by users. It runs in user mode, also called problem state, where instructions that touch hardware or another program's memory are refused.
  2. An application that needs a file cannot fetch it itself. It makes a system call, a request to the kernel, and the kernel checks the request against the security policy, does the work in ring 0 and hands back the result. That single checked doorway is where the reference monitor does its job.
  3. Rings 2 and 1 hold other operating system services and device drivers, privileged but less than the kernel, ring 2 less than ring 1. Most current operating systems use only ring 0 and ring 3, so these two are drawn dashed.
  4. Ring 0 holds the kernel, the small trusted core of the operating system. It runs in kernel mode, also called supervisor or privileged mode, where the processor will carry out any instruction.
The four-ring layout
RingWhat runs thereMode
0The kernel: the small trusted core of the operating systemKernel mode
1 and 2Other operating system services and device drivers, the programs that operate hardware such as a printerPrivileged, less than the kernel
3Applications started by usersUser mode

Most current operating systems use only ring 0 and ring 3. In kernel mode, also called supervisor or privileged mode, the processor will carry out any instruction, including ones that touch hardware or any program's memory. In user mode, also called problem state, those instructions are refused.

An application that needs a file cannot fetch it from the disk itself. It makes a system call, a request to the kernel. The kernel checks the request against the security policy, does the work in ring 0 and hands back the result. That single, checked doorway is where the reference monitor does its job.

A running program is in one of a few process states: ready and waiting its turn, running, waiting for something such as a key press, supervisory while the kernel acts for it, or stopped. The processor itself has only the two states above: supervisor state, which is kernel mode, and problem state, which is user mode.

Three related terms describe how work is shared. Multitasking is one processor switching between tasks so quickly that they appear to run together. Multiprocessing uses more than one processor. Multithreading lets one program run several strands of work side by side.

Keeping programs apart

A process is a program in execution. A laptop runs hundreds at once, and a fault or an intrusion in one must not spread to the rest.

Process isolation
Each process is given its own area of memory. The kernel and the processor stop it reading or changing any other process's area.
Bounds
The limits of the memory a process may use. A request outside its bounds is refused.
Confinement
A process is restricted to the resources it needs and cannot pass information to others. A for opening unknown attachments confines them.
Abstraction and data hiding
A component shows others what it does and conceals how. Details kept at one layer cannot be read or changed from another.
Constrained interface
A user is shown only the functions they are permitted to use. A cash machine offers a customer four choices and none of the engineer's menus.

Four security modes for classified systems

United States government systems that hold classified information are run in one of four security modes. The mode depends on three facts about the users: whether they are cleared for the data, whether they have formal approval to access it, and whether they have a it.

The four security modes: what every user must hold
ModeClearanceFormal access approvalNeed-to-know
DedicatedFor all dataFor all dataFor all data
System highFor all dataFor all dataFor some of the data
CompartmentedFor the level of all dataFor some compartmentsFor some of the data
MultilevelFor some of the dataFor some of the dataFor some of the data

The table reads downward as rising trust in the machine. In dedicated mode every user may see everything, so the system need not separate anyone. In multilevel mode some users are not cleared for some of the data, and only the trusted computing base keeps them apart.

A question, worked through

A firm is building a card payment terminal. The engineering lead proposes moving the loyalty points feature and the receipt designer into the protected core that checks each customer's PIN. Code in the core reaches the hardware faster, and a launch date is close. The security architect is asked for advice before the design is frozen.

What is the BEST advice?

  1. Keep the core to the PIN check and run both features outside it
  2. Move both features into the core and test them more than usual
  3. Move both features into the core and encrypt all that it stores
  4. Keep both features outside the core until an audit has passed
Decide on your answer, then open the reasoning
  1. The protected core is the terminal's trusted computing base. The question is whether to enlarge it for speed.
  2. Rule out c. Encryption protects stored data. It does nothing about a mistake in feature code that now runs with the core's full privilege.
  3. Rule out d. An audit examines the features. Moving them in afterwards still enlarges the core, and every later change to a feature would touch protected code.
  4. Between a and b: extra testing finds some errors and cannot show there are none in a large body of code. A core that holds only the PIN check stays small enough to verify completely.
  5. Option a applies keep it simple and small where it matters most. The features run in a less privileged place and ask the core for what they need.

Answer: A. Keep the core to the PIN check and run both features outside it

Choosing between good answers

A design adds convenience or speed by putting more function into the protected core
choose the answer that keeps the core to what enforces the policy. Testing a large core is the weaker answer.
A question asks which of reference monitor, security kernel and trusted computing base is meant
a concept or abstract machine is the reference monitor. Its implementation is the security kernel. Everything relied on is the trusted computing base.
A ring number is given
lower means more privilege. Ring 0 is the kernel in kernel mode. Ring 3 is applications in user mode.
A security mode is asked for
check need-to-know first. All users needing all data is dedicated. Some users not cleared for some data is multilevel.

Check your understanding

4 questions on this unit, easiest first. Confirm an answer to see the reasoning for it, then the right answer, the other options and the rule to reuse. Your answers are kept in this browser and feed readiness and review.

These questions are drafts that no named reviewer has approved yet.

Question 1 of 4

An evaluation report describes the part of an operating system, made of hardware, firmware and software, that checks every request by a program to use a file. Other programs cannot alter it, and it is small enough to test completely.

Which term names this part?

What to remember

  • Keep it simple and small: the protective part of a system should be small enough to inspect completely. Saltzer and Schroeder's name for it is economy of mechanism.
  • The trusted computing base is all the hardware, firmware and software relied on to enforce the security policy. The security perimeter is its boundary.
  • The reference monitor is the concept of checking every access. The security kernel implements it and must be always invoked, tamper-proof and verifiable.
  • Ring 0 is the kernel in kernel mode. Ring 3 is applications in user mode. An application reaches the kernel only by a system call.
  • Process isolation gives each running program its own memory. The four security modes are dedicated, system high, compartmented and multilevel.

Say it from memory

  1. State the principle of keeping a design simple and small, and say how the trusted computing base applies it.

    The part of a system that enforces protection should do one job in as few steps as possible, so that it can be inspected and tested completely. Complexity hides flaws and widens the attack surface. The trusted computing base applies it by keeping the security kernel small enough to verify and leaving every other function outside the security perimeter.

    Read this part again

  2. What is the trusted computing base, what is the security perimeter, and what is a trusted path?

    The trusted computing base is the whole set of hardware, firmware and software protection mechanisms that together enforce the security policy. The security perimeter is the boundary between it and the rest of the system. A trusted path is a way for a user to reach the trusted computing base directly, which other software cannot imitate.

    Read this part again

  3. How do the reference monitor and the security kernel differ, and what three conditions must the kernel meet?

    The reference monitor is a concept: an abstract machine that checks every access by a subject to an object. The security kernel is the hardware, firmware and software that implement it. The kernel must mediate all accesses, be protected from modification, and be verifiable as correct.

    Read this part again

  4. What runs in protection rings 0 to 3, and how does an application reach a file?

    Ring 0 holds the kernel, in kernel mode. Rings 1 and 2 hold other operating system services and device drivers. Ring 3 holds user applications, in user mode, also called problem state. An application makes a system call, and the kernel checks it against the security policy and does the work in ring 0.

    Read this part again

  5. What do process isolation, bounds and confinement each mean?

    Process isolation gives each process its own memory area, and the kernel and processor stop it reading or changing any other's. Bounds are the limits of the memory a process may use; a request outside them is refused. Confinement restricts a process to the resources it needs so it cannot pass information to others, as a sandbox does.

    Read this part again

  6. Name the four security modes in order of rising trust in the machine, and say how dedicated and multilevel differ.

    Dedicated, system high, compartmented and multilevel. In dedicated mode every user has clearance, formal access approval and need-to-know for all data, so the system need not separate anyone. In multilevel mode some users are not cleared for some of the data, and only the trusted computing base keeps them apart.

    Read this part again

Sources