About

8.4 Integrity Controls

Theory: Integrity Controls

Week 5 introduced control types. Here they are applied to integrity: preventive controls stop wrong data getting in, detective controls find it when it does, and corrective controls get correct data back. No single control is enough; a good design uses all three.

Preventive: Input Validation

Stop wrong data before it enters.

#CheckExample
1Range checkInsulin dose must be between 0.5 and 100 units.
2Format checkHospital number must match the correct pattern.
3Mandatory fieldsAn order cannot be saved without a patient ID.
4Pick listsChoose the drug from a list, not free text.
5Double entryHigh-risk values must be typed twice or confirmed.
6Validate UDIsOutside data is checked before it becomes trusted (Clark-Wilson).

Preventive: Separate “Change” from “Read”

Most staff need to READ. Few need to CHANGE.

RoleCan readCan change
DoctorFull clinical recordDiagnoses and orders
NurseOrders and vital signsAdministration record and vital signs
PharmacistOrders and allergiesOrder verification status
Billing clerkBilling itemsBilling items only, no clinical data

This is least privilege (Week 6) applied to write access.

Preventive: Separation of Duties & Maker-Checker

One person makes, another person checks.

ProcessMakerChecker
Medication orderDoctorPharmacist
Supplier paymentAccounts clerkFinance manager
System changeDeveloperChange approver (CAB)

Maker-checker only works if the checker actually checks. When one checker is overloaded (e.g. a single pharmacist on night shift), checks get skipped and separation of duties exists only on paper.

Preventive: Change Management

Every change follows a controlled process.

Diagram loads as you scroll.

Many integrity failures are not attacks. They are untested or badly deployed changes.

Real case: Knight Capital, 1 August 2012

FactDetail
LossAbout 440 million US dollars (pre-tax)
Servers that missed the new code1 of 8
Hackers involved0

What happened. A technician did not copy the new code to one server. A reused flag woke up old, unused code on that server, and it sent a flood of wrong orders at market open.

Missing controls. No check that every server was updated (deploy to all servers, configuration baseline). Old code left in place. No fast rollback. The company lost its independence within months.

Detective: Audit Trail

Find out who changed what.

WHOWHATWHENOLD / NEWWHEREWHY
User accountWhich recordExact timeValue before and afterWhich workstationReason code

Protect the log itself: logs are write-once; system admins cannot edit or delete them; clocks on all systems are synchronized so events can be ordered across systems.

Links to earlier topics: Accounting in AAA (Week 6); Repudiation in STRIDE. Log management continues in Week 9.

Detective: Reconciliation

Compare two sources that should match.

Source 1Source 2
Lab analyzer result=?Result in the EHR
Drugs dispensed by pharmacy=?Medication orders
Services billed=?Services recorded as given

A mismatch is not proof of an attack. It is a signal to investigate. Reconciliation is Clark-Wilson’s IVP.

Corrective: Backup and Restore

Get correct data back.

Corrective: Fix Data the Right Way

Correct with a trail.

Wrong wayRight way
Open the record. Type over 40 with 4. Save.Keep the original value (40). Add the correction (4). Record who, when, and why.
Now no one can see that the error ever happened.The history stays complete.

This is how medical record amendments should work.

Common mistake: “fixing” an error by overwriting it. That destroys the evidence and the history, and itself breaks integrity (the record is no longer complete).

Integrity Technologies (Overview Only)

What each is for, not how it works.

Data level

TechnologyWhat it does for integrityDetails
Hash (e.g. SHA-256)A “fingerprint” that shows if data changedWeek 10
Digital signatureShows who created the data and that it is unchangedWeek 10
Code signingShows a software update is genuineWeek 10
Hash chain / ledgerRecords linked so that edits are detectedWeek 10
Database integrity (ACID, constraints)Keeps data consistent; blocks invalid recordsThis week only
Version control (e.g. Git)Tracks every change and can undo itThis week only

System and storage level

TechnologyWhat it does for integrityDetails
File Integrity Monitoring (e.g. Wazuh, Tripwire)Alerts when important files changeWeek 9
Immutable / WORM storageLogs and backups that cannot be changedWeek 9
RAID parityDetects and repairs disk errorsWeek 9
ECC memoryDetects and fixes memory errorsThis week only
Secure boot / TPMSystem starts only with trusted softwareThis week only

Control Map

PREVENTIVE (stop it)DETECTIVE (find it)CORRECTIVE (fix it)
Input validationAudit trailBackup and restore
Separate change from readReconciliation (IVP)Immutable backup copy
Separation of dutiesHash / digital signatureVersioning
Change managementFile Integrity MonitoringCorrection with a trail
Database constraintsRAID parity, ECCRollback plan
Secure boot, immutable storage

Choose controls by threat source (see 8.2): mistakes → validation, reconciliation; failures → change management; nature → backup; attackers → edit rights, audit.


Worked Examples

Exercise 1

A doctor enters an insulin order of 40 units. The normal dose for this patient is 4 units. The system detects that the order is far above the normal dose. What should it do?

A. Block it: the order cannot be saved. B. Warn: show a warning; the doctor can override. C. Route it: send it to a pharmacist to confirm first.

Show solution ↓
Solution

Think about whether 40 units can ever be correct, and who should decide.

  1. Block is right only for values that are never valid (e.g. outside the 0.5–100 unit range). 40 units is within the range and is the correct dose for some patients, so blocking would stop legitimate care.
  2. Warn relies on the same person who made the error to catch it. Busy staff click through warnings (alert fatigue), so the maker is still checking his own work.
  3. Route adds an independent checker (maker-checker, separation of duties). The pharmacist confirms with the doctor before the dose reaches the patient. Legitimate high doses still go through; mistakes are caught.

Best answer: C, route it to a pharmacist to confirm (a warning to the doctor can appear as well, but the independent check is what makes it safe). Keep hard blocks for impossible values.

Exercise 2

Only one pharmacist is on duty during the night shift. What happens to separation of duties, and what can the hospital do about it?

Show solution ↓
Solution
  1. The problem: the medication process relies on the pharmacist as checker (TP2 Verify Order). One overloaded pharmacist is likely to skip checks to save time, especially re-checks of edited orders. Separation of duties then exists only on paper: in practice the maker’s entry goes straight to the patient.
  2. Options (compensating controls):
    • Make the system enforce verification: an order (new or edited) cannot be released to the ward until it is verified.
    • Add a second checker for high-risk drugs: two nurses independently double-check before giving insulin, heparin, etc.
    • Use remote pharmacist verification from another site at night.
    • Review all night-shift edits in the morning (detective).

Answer: separation of duties weakens because the single checker skips checks; enforce verification in the system and add compensating checks (nurse double-check, remote verification, morning review).

Exercise 3

The lab analyzer shows potassium 0.5. The EHR shows 5.0 for the same sample. Which value do you trust, and what do you check next?

A. Trust the EHR (it is the official record). B. Trust the analyzer (it is the original source). C. Trust neither yet (check first, then decide).

Show solution ↓
Solution
  1. A reconciliation mismatch is a signal to investigate, not proof of which side is wrong.
  2. Either side could be wrong: the EHR value could come from an interface or conversion fault; the analyzer value could come from a faulty or uncalibrated analyzer or a bad sample. 0.5 is also a value that would normally be life-threatening, which itself is suspicious.
  3. Next checks:
    • the audit trail for the EHR value (who/what wrote it, when, old and new values);
    • the interface: any recent change or update to the analyzer-to-EHR link (change records);
    • the analyzer: calibration and quality-control results;
    • if needed, re-test the sample, and alert the doctor so no treatment decision is based on either value meanwhile.

Answer: C, trust neither yet; investigate (audit trail, interface changes, analyzer QC, re-test) before deciding.

Exercise 4

Ransomware hits on Thursday at 02:00. Investigators find the malware has been hidden in the system since Monday. You have backups from Sunday 23:00 and Wednesday 23:00. Which restore point do you choose?

A. Wednesday 23:00 (lose very little data, but malware may come back) B. Sunday 23:00 (clean, but lose three days of data) C. Sunday + rebuild (restore Sunday, then re-enter Mon–Wed from paper and other systems)

Show solution ↓
Solution
  1. Wednesday 23:00 was taken after Monday, so it very likely contains the dormant malware. Restoring it would bring the attacker back, and encryption could start again. Reject A.
  2. Sunday 23:00 was taken before the malware arrived, so it is the latest clean restore point. But restoring it alone loses Monday–Wednesday data: orders, results and notes from three days. In a hospital, missing data is itself an integrity failure (incomplete, not current). B alone is not enough.
  3. Sunday + rebuild: restore the clean Sunday backup, then re-enter Monday–Wednesday from paper records, the lab and pharmacy systems, and other sources, and verify the result (reconciliation).

Answer: C, restore Sunday 23:00 (clean) and rebuild Monday–Wednesday from paper and other systems. Lesson: keep enough backup history and an immutable copy, and test restores.

Exercise 5

Knight Capital lost about 440 million US dollars in 2012 with no hacker involved. Explain what went wrong and name three change-management controls that would have prevented or limited it.

Show solution ↓
Solution
  1. What happened: during deployment, the new code was not copied to one of eight servers. A reused flag activated old, unused code on that server, which sent a flood of wrong orders at market open.
  2. Source: structural/technical (a badly deployed change), not adversarial.
  3. Controls:
    • Deploy to ALL servers and verify against a configuration baseline (would have shown one server differed).
    • Remove old, unused code and do not reuse flags (tested in a test system before deployment).
    • A rollback plan that can be executed fast (would have limited the loss).
    • A review step right after deployment.

Answer: an incomplete, unverified deployment woke up dead code; configuration-baseline checks of every server, removal of old code with proper testing, and a fast rollback plan would have prevented or limited the loss.

Exercise 6

A nurse discovers that a dose recorded as 40 units should be 4 units. Describe the right way to correct the record, and explain why simply typing over the value is wrong.

Show solution ↓
Solution
  1. Right way (correction with a trail):
    • keep the original value (40) visible in the history;
    • add the corrected value (4);
    • record who made the correction, when, and why (reason code).
  2. Why typing over is wrong:
    • it destroys the evidence that an error happened, so no one can investigate the cause or learn from it;
    • the record is no longer complete, which is itself an integrity failure;
    • the change cannot be traced (Clark-Wilson audit), and it weakens the record’s value as legal evidence.

Answer: keep the original, add the correction, and log who, when and why; overwriting hides the error and breaks the history.