Access control and intrusion detection
Clear notes on access control (models, mechanisms, policies) and intrusion detection (types, metrics, placement), with formal definitions, diagrams to draw, formulas and worked examples for exam practice.
Drafted with Aria, reviewed by the AiCanCode.org team · Updated . How we write and check our notes. Spotted an error? Use Give Feedback at the bottom of the page.
Why it matters
Access control and intrusion detection are used by engineers to protect systems and data: access control decides who (which process or user) may do what to which resource, and intrusion detection finds attempts that break those rules. You will use these ideas when designing secure operating systems, network gateways, IAM (identity and access management), security monitoring, and incident response.
Key ideas
Start with first principles: a computer system contains subjects (active entities: users or processes that request actions) and objects (passive resources: files, sockets, devices). An access right or permission is an allowed operation (read, write, execute, delete) that a subject can perform on an object.
Access control (definition): the set of mechanisms and policies that ensure a subject can exercise only the access rights allowed by policy. Access control enforces confidentiality, integrity and availability requirements.
Principle of least privilege (definition): a subject should be given no more privileges than those necessary to perform its tasks. This reduces damage from compromise.
Separation of duty (definition): split critical tasks across different principals so that fraud or errors require collusion.
Three classical policy families:
- Discretionary Access Control (DAC): the owner of an object (or subjects delegated by the owner) decides who else may access it. Example mechanism: Access Control Lists (ACLs) attached to objects, or capability lists held by subjects.
- Mandatory Access Control (MAC): a central security policy (often using labels) enforces access decisions independent of owners. Typical in high-assurance and military systems.
- Role-Based Access Control (RBAC): permissions are not assigned directly to users but to roles; users are assigned roles. RBAC supports separation of duty and simplifies administration.
Mechanisms and data structures:
- Access Control Matrix (definition): a matrix A indexed by subjects (rows) and objects (columns) where A[s,o] is the set of rights subject s has on object o. To draw: draw a rectangular matrix, label rows with subject names and columns with object names; fill cells with rights sets (r, w, x).
- Access Control List (ACL) (definition): for each object, a list of (subject, rights) pairs. To draw: take one column of the matrix and show a list next to the object.
- Capability (definition): an unforgeable token held by a subject that names an object and the allowed rights. To draw: show each subject having a capability list (tokens) with rights.
Formal models often used in exams and system design:
- Bell–LaPadula model (confidentiality-focused): subjects and objects are given security classifications (levels) from a lattice (e.g. Unclassified < Confidential < Secret < TopSecret). Exact statements used in exams:
- Simple security property (no read up): A subject may read an object only if Clearance(subject) >= Classification(object).
- -property (star property) (no write down): A subject may write an object only if Clearance(subject) <= Classification(object).
- The model assumes a lattice of security levels and a dominance relation (>=). It aims to prevent leakage of classified information downward.
- When asked, draw levels vertically and show forbidden arrows: read up (from lower to higher) and write down (from higher to lower).
- Biba model (integrity-focused), the dual of Bell–LaPadula:
- Simple integrity property (no read down): subject can read object only if IntegrityLevel(subject) <= IntegrityLevel(object).
- Star integrity property (no write up): subject may write object only if IntegrityLevel(subject) >= IntegrityLevel(object).
- Biba prevents low-integrity data corrupting high-integrity objects.
- RBAC formal elements (basic NIST-style view required in exams):
- Sets: USERS, ROLES, PERMISSIONS, SESSIONS.
- Relations: UA ⊆ USERS × ROLES (user assignment), PA ⊆ PERMISSIONS × ROLES (permission assignment); sessions map a user to an active subset of roles.
- Constraints used for separation of duty: e.g. mutually exclusive roles.
- Bell–LaPadula model (confidentiality-focused): subjects and objects are given security classifications (levels) from a lattice (e.g. Unclassified < Confidential < Secret < TopSecret). Exact statements used in exams:
Intrusion detection terms and architecture:
- Intrusion Detection System (IDS) (definition): a system that monitors events to detect malicious activities or policy violations.
- Intrusion Prevention System (IPS) (definition): similar to IDS but can block or prevent detected attacks automatically.
- Two major detection approaches:
- Signature-based detection: detect known attacks by matching patterns or signatures (fast, low FP for known attacks, cannot detect novel attacks).
- Anomaly-based detection: build a model of normal behaviour and flag deviations (can detect unknown attacks, higher false positive rate).
- Deployment types:
- Network IDS (NIDS): sensors on the network that inspect packets or flows. To draw: show sensors on network links, analyzer box, and console.
- Host IDS (HIDS): agents on hosts monitoring logs, system calls, or file integrity.
- IDS building blocks: sensors, collectors, analyzers (detection engines), databases of signatures/models, alert manager, and response module.
Detection performance metrics (useful for exam numericals): definitions below and formulas in the Formulas section.
- True Positive (TP): correctly detected intrusions.
- False Positive (FP): normal events incorrectly reported as intrusion.
- True Negative (TN): normal events correctly not flagged.
- False Negative (FN): intrusions missed.
When using formal models (Bell–LaPadula, Biba, RBAC) state assumptions: static labels, trusted reference monitor, non-bypassable enforcement point, and correct classification of subjects/objects. Also state tamperproof enforcement and that the reference monitor/TCB is small enough to be verifiable (reference monitor properties: complete mediation, tamperproof, verifiable).
Formulas
Accuracy = (TP + TN) / (TP + TN + FP + FN) — TP true positives, TN true negatives, FP false positives, FN false negatives. Unitless (ratio). Use for overall correctness of an IDS classifier.
Precision = TP / (TP + FP) — fraction of alerts that are real intrusions. Unitless. Use when cost of false alarms matters.
Recall = TP / (TP + FN) — also called detection rate or true positive rate; fraction of intrusions detected. Unitless.
F1 = 2 · (Precision · Recall) / (Precision + Recall) — harmonic mean of precision and recall. Unitless.
False Positive Rate = FP / (FP + TN) — unitless; probability that a normal event is flagged.
False Negative Rate = FN / (TP + FN) — unitless; probability that an intrusion is missed.
Access Control Matrix entry: A[s,o] = {rights} — A is matrix, s subject index, o object index. Rights are elements like r (read), w (write), x (execute). Unitless; structural representation.
Worked examples
RBAC assignment and check (small algebraic example)
- Given: USERS = {Alice, Bob}; ROLES = {R_developer, R_tester}; PERMISSIONS: P1 = (repo, write), P2 = (repo, read), P3 = (test_suite, run).
- Assignments: UA = {(Alice, R_developer), (Bob, R_tester)}. PA = {(P1, R_developer), (P2, R_developer), (P2, R_tester), (P3, R_tester)}.
- Question: Can Bob write to repo? Step-by-step:
- Bob's roles from UA: {R_tester}.
- Permissions of R_tester from PA: {P2 (repo, read), P3 (test_suite, run)}.
- Write permission on repo (P1) is only assigned to R_developer, which Bob does not have.
- Conclusion: Bob cannot write to repo. (Clear, simple reasoning a full-marks answer needs.)
IDS performance numerical
- Given counts: TP = 90, FP = 10, FN = 30, TN = 870. Total events = 1000.
- Compute formulas and carry units (unitless fractions):
- Accuracy = (TP + TN) / total = (90 + 870) / 1000 = 960 / 1000 = 0.96.
- Precision = TP / (TP + FP) = 90 / (90 + 10) = 90/100 = 0.90.
- Recall = TP / (TP + FN) = 90 / (90 + 30) = 90/120 = 0.75.
- F1 = 2·(0.90·0.75)/(0.90+0.75) = 1.35 / 1.65 = 0.818 (approx).
- False Positive Rate = FP / (FP + TN) = 10 / 880 = 0.01136 (≈ 1.136%).
- False Negative Rate = FN / (TP + FN) = 30 / 120 = 0.25.
- Interpretation: high accuracy with moderate recall — system misses 25% of intrusions.
Bell–LaPadula read/write example (policy check)
- Levels: TopSecret > Secret > Confidential > Unclassified. Subject S with clearance Secret.
- Object O1 classification TopSecret, Object O2 classification Confidential.
- Rules: simple security (no read up) and star (no write down).
- Can S read O1? Clearance(S) = Secret < Classification(O1) = TopSecret → No (no read up).
- Can S write O2? Clearance(S) = Secret > Classification(O2) = Confidential → No (no write down).
- Can S read O2? Secret >= Confidential → Yes.
- Can S write O1? Secret <= TopSecret → Yes.
- In answers explain lattice ordering and apply exact inequalities.
Common mistakes
- Mixing Bell–LaPadula and Biba rules (confidentiality vs integrity): memorize which direction is allowed for read and write for each model.
- Forgetting units or denominators in IDS metrics (e.g., using TP + FP in place of TP + FN for recall).
- In RBAC, assigning permission to a user directly: in standard NIST RBAC, permissions are assigned to roles, not directly to users; if a non-standard variant allowing direct user-permission assignments is assumed, state it explicitly.
- In access control matrix questions, not drawing or describing transpose views (ACL vs capability) when asked for diagrams.
- Treating IDS accuracy alone as sufficient metric; accuracy can be misleading with imbalanced workload (many normal events).
For your exam
- Short notes: compare DAC vs MAC vs RBAC; explain principle of least privilege; describe Bell–LaPadula and Biba. Full marks: list rules, assumptions, and a short diagram.
- Derivations: show why Bell–LaPadula prevents leakage using lattice ordering; derive *-property rationale. Full marks: clear inequalities, assumption of reference monitor.
- Numericals: compute precision/recall/F1 from counts. Full marks: state formulas, substitute numbers with units (unitless), show final decimals.
- Diagrams: draw access control matrix and show ACL and capability views; draw IDS architecture (sensors, analyzer, console). Full marks: labelled diagram + short caption.
- Programs/algorithms: simulate authorization check by searching ACL or checking a capability; full marks: correct pseudo-code and complexity.
Quick check
- In Bell–LaPadula, is a subject allowed to write to an object at a lower classification? (Yes/No)
- Give one advantage of signature-based IDS over anomaly-based IDS.
- In RBAC, where are permissions assigned: to users or roles?
Answers: 1. No. 2. Lower false-positive rate for known attacks and faster matching (can be implemented by pattern matching). 3. Permissions are assigned to roles (users are then assigned roles).
Finished this topic? Mark it so your progress, study plan and readiness keep up.
Stuck on something here?