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.
Stop wrong data before it enters.
| # | Check | Example |
|---|
| 1 | Range check | Insulin dose must be between 0.5 and 100 units. |
| 2 | Format check | Hospital number must match the correct pattern. |
| 3 | Mandatory fields | An order cannot be saved without a patient ID. |
| 4 | Pick lists | Choose the drug from a list, not free text. |
| 5 | Double entry | High-risk values must be typed twice or confirmed. |
| 6 | Validate UDIs | Outside data is checked before it becomes trusted (Clark-Wilson). |
Preventive: Separate “Change” from “Read”
Most staff need to READ. Few need to CHANGE.
| Role | Can read | Can change |
|---|
| Doctor | Full clinical record | Diagnoses and orders |
| Nurse | Orders and vital signs | Administration record and vital signs |
| Pharmacist | Orders and allergies | Order verification status |
| Billing clerk | Billing items | Billing 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.
| Process | Maker | Checker |
|---|
| Medication order | Doctor | Pharmacist |
| Supplier payment | Accounts clerk | Finance manager |
| System change | Developer | Change 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.
- Rollback plan: before any change, know exactly how to undo it.
- Configuration baseline: a record of the approved, known-good setup. Compare every system against it.
Many integrity failures are not attacks. They are untested or badly deployed changes.
Real case: Knight Capital, 1 August 2012
| Fact | Detail |
|---|
| Loss | About 440 million US dollars (pre-tax) |
| Servers that missed the new code | 1 of 8 |
| Hackers involved | 0 |
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.
| WHO | WHAT | WHEN | OLD / NEW | WHERE | WHY |
|---|
| User account | Which record | Exact time | Value before and after | Which workstation | Reason 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 1 | | Source 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.
- 3-2-1 rule: 3 copies of the data, on 2 different types of storage, 1 copy off-site.
- Add an immutable copy: ransomware attacks backups too, so keep one copy that cannot be changed or deleted.
- Test the restore: a backup you never restored is only a hope. Test it on a schedule.
- How much data can we afford to lose? (RPO, Week 9)
Corrective: Fix Data the Right Way
Correct with a trail.
| Wrong way | Right 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
| Technology | What it does for integrity | Details |
|---|
| Hash (e.g. SHA-256) | A “fingerprint” that shows if data changed | Week 10 |
| Digital signature | Shows who created the data and that it is unchanged | Week 10 |
| Code signing | Shows a software update is genuine | Week 10 |
| Hash chain / ledger | Records linked so that edits are detected | Week 10 |
| Database integrity (ACID, constraints) | Keeps data consistent; blocks invalid records | This week only |
| Version control (e.g. Git) | Tracks every change and can undo it | This week only |
System and storage level
| Technology | What it does for integrity | Details |
|---|
| File Integrity Monitoring (e.g. Wazuh, Tripwire) | Alerts when important files change | Week 9 |
| Immutable / WORM storage | Logs and backups that cannot be changed | Week 9 |
| RAID parity | Detects and repairs disk errors | Week 9 |
| ECC memory | Detects and fixes memory errors | This week only |
| Secure boot / TPM | System starts only with trusted software | This week only |
Control Map
| PREVENTIVE (stop it) | DETECTIVE (find it) | CORRECTIVE (fix it) |
|---|
| Input validation | Audit trail | Backup and restore |
| Separate change from read | Reconciliation (IVP) | Immutable backup copy |
| Separation of duties | Hash / digital signature | Versioning |
| Change management | File Integrity Monitoring | Correction with a trail |
| Database constraints | RAID parity, ECC | Rollback 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 ↓Hide solution ↑
Solution
Think about whether 40 units can ever be correct, and who should decide.
- 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.
- 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.
- 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 ↓Hide solution ↑
Solution
- 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.
- 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 ↓Hide solution ↑
Solution
- A reconciliation mismatch is a signal to investigate, not proof of which side is wrong.
- 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.
- 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 ↓Hide solution ↑
Solution
- 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.
- 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.
- 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 ↓Hide solution ↑
Solution
- 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.
- Source: structural/technical (a badly deployed change), not adversarial.
- 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 ↓Hide solution ↑
Solution
- 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).
- 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.