Loading learning content...
Operating systems are the guardians of computer security. They mediate every access to hardware, manage every process's privileges, and enforce every permission check. When security fails at the OS level, nothing above it—applications, data, users—is safe.
Interviewers probe security concepts to assess whether candidates understand the fundamental mechanisms that protect systems: How does authentication work? What's the difference between discretionary and mandatory access control? How do buffer overflows lead to privilege escalation? These questions reveal depth of systems understanding.
This page consolidates security fundamentals at the level expected in operating systems interviews—from the classic protection concepts to modern defense mechanisms.
By the end of this page, you will understand: (1) the CIA triad and protection goals, (2) authentication mechanisms and password storage, (3) authorization and access control models (DAC, MAC, RBAC), (4) the principle of least privilege and defense in depth, (5) common attack vectors and OS defenses, and (6) how to articulate security concepts in interviews.
All security mechanisms serve three fundamental goals, known as the CIA triad:
Definition: Ensuring that information is accessible only to those authorized to access it.
OS mechanisms:
Threats:
Definition: Ensuring that information and system state can only be modified by authorized parties in authorized ways.
OS mechanisms:
Threats:
Definition: Ensuring that authorized users have reliable access to information and resources.
OS mechanisms:
Threats:
| Goal | Protects Against | Key OS Mechanism |
|---|---|---|
| Confidentiality | Unauthorized reading | Permissions, isolation, encryption |
| Integrity | Unauthorized modification | Permissions, signatures, MAC |
| Availability | Denial of access | Quotas, fair scheduling, isolation |
Some frameworks extend CIA with Authentication (verifying identity), Authorization (verifying permission), and Non-repudiation (preventing denial of actions). These are sometimes called the CIA-AA model. Modern security also emphasizes Privacy as a distinct concern.
Authentication is the process of verifying that an entity (user, process, system) is who or what it claims to be. It answers: "Are you really who you say you are?"
Something you know:
Something you have:
Something you are:
Multi-factor authentication (MFA):
Storing passwords securely is critical. The progression of techniques:
Level 0: Plain text ❌
users table: username, password
"alice", "secret123"
Disaster: One breach exposes all passwords.
Level 1: Encrypted passwords ❌
Store encrypt(password, key)
Better, but: Key must be stored somewhere; compromise key = compromise all.
Level 2: Hashed passwords ⚠️
Store hash(password) // e.g., SHA-256
One-way function; cannot reverse. But:
Level 3: Salted hashes ✓
Store (salt, hash(salt + password))
Salt: random value unique per password
Rainbow tables are useless (would need table per salt). Dictionary attacks much slower (must hash each guess with each salt).
Level 4: Slow hashes (modern standard) ✓✓
Store bcrypt(password, cost_factor) or
argon2(password, memory_cost, time_cost)
Deliberately slow to compute. GPU/ASIC attacks become impractical. Bcrypt, scrypt, Argon2 are designed for password storage.
12345678910111213141516171819202122232425
Password: "correct horse battery staple" Plain text (NEVER): password: "correct horse battery staple" Simple hash (INSECURE): password: "c4bbcb1f...3456789" (SHA-256) Rainbow table lookup: instant crack Salted hash (BETTER): salt: "a1b2c3d4e5f6" password: hash("a1b2c3d4e5f6" + "correct horse...") Rainbow tables: useless (need table for each salt) bcrypt (RECOMMENDED): $2b$12$LQv3c1yqBWVHxkd0LHAkCOYz6TtxMQJqhN8/X4.2nZ1K1C4f2a6Xq $2b$ = algorithm identifier 12 = cost factor (2^12 iterations) LQv3c... = salt + hash Cracking: even with optimized hardware, ~years argon2 (CURRENT BEST): $argon2id$v=19$m=65536,t=3,p=4$saltsaltsa$hash... Memory-hard: requires specific amount of RAM Resists GPU/ASIC acceleration effectivelyUse established libraries for authentication: bcrypt, Argon2id, PBKDF2. Custom implementations invariably have vulnerabilities. Security is hard; use vetted solutions.
Authorization determines what an authenticated entity is allowed to do. It answers: "Now that I know who you are, what can you access?"
Conceptually, access control is a matrix:
File A File B Printer Network
User alice read read/wrt print -
User bob - read - connect
Process X read - - -
Rows: subjects (users, processes) Columns: objects (files, devices, resources) Cells: permissions (read, write, execute, etc.)
This matrix is typically stored in one of two ways:
Access Control Lists (ACLs) - stored with objects:
File A: [(alice, read), (process X, read)]
File B: [(alice, read/write), (bob, read)]
Easy to see: "Who can access this file?"
Capability Lists - stored with subjects:
alice: [(File A, read), (File B, read/write), (Printer, print)]
bob: [(File B, read), (Network, connect)]
Easy to see: "What can this user access?"
Most systems use ACLs (stored with files). Unix permissions are a simplified ACL.
Definition: Resource owners decide who can access their resources.
Characteristics:
Unix/Linux permissions:
-rwxr-x--- 1 alice developers 4096 Jan 1 file.txt
│└┬┘└┬┘└┬┘
│ │ │ └── others: no access
│ │ └───── group (developers): read, execute
│ └──────── owner (alice): read, write, execute
└────────── file type (- = regular file)
Octal: 750 (rwx=7, r-x=5, ---=0)
Limitation: If alice runs malicious code, that code inherits alice's permissions. It can read/write anything alice can. No protection against trojan horses.
Definition: System-wide policy enforced by the OS, regardless of owner preferences.
Characteristics:
Bell-LaPadula Model (Confidentiality):
Biba Model (Integrity):
Real implementations:
1234567891011121314151617181920
# SELinux assigns labels to everything$ ls -Z /var/www/html/index.htmlsystem_u:object_r:httpd_sys_content_t:s0 /var/www/html/index.html # Label format: user:role:type:level# type (httpd_sys_content_t) is most important for access decisions # Policy rules define what's allowed:# "httpd_t can read httpd_sys_content_t"# httpd running as httpd_t can read web content# httpd running as httpd_t CANNOT read /etc/shadow (wrong type) # Even if file permissions say world-readable,# SELinux blocks based on type enforcement # Check if SELinux blocked something:$ ausearch -m avc -ts recenttype=AVC msg=audit(1234567890.123:456): avc: denied { read } for pid=1234 comm="httpd" name="shadow" scontext=httpd_t tcontext=shadow_tDefinition: Access rights assigned to roles; users assigned to roles.
Characteristics:
Example:
Roles:
admin: [all_files: read/write/delete, users: manage, logs: read]
developer: [code_repo: read/write, docs: read, logs: read]
auditor: [all_files: read, logs: read]
Users:
alice: [admin, developer] → gets union of permissions
bob: [developer]
carol: [auditor]
Variations:
| Model | Who Decides | Flexibility | Security | Use Case |
|---|---|---|---|---|
| DAC | Resource owner | High | Lower (user error) | General-purpose OS |
| MAC | Security admin | Low | High (enforced) | Military, high-security |
| RBAC | Admin defines roles | Medium | Medium-High | Enterprise, cloud IAM |
Several foundational principles guide secure system design:
Statement: Every process, user, and system should have only the minimum privileges necessary to perform its function.
Rationale: If an entity is compromised, damage is limited to what that entity could legitimately do.
Examples:
www-data (not root)CAP_NET_BIND_SERVICE, not full rootChallenge: Convenience vs. security. Users want things easy; least privilege adds friction.
Statement: Multiple layers of security, so failure of one doesn't compromise the system.
Layers:
Rationale: Attackers must bypass multiple defenses, each reducing success probability.
Statement: Default to denying access; explicitly grant permissions.
Examples:
Opposite (fail-open) is dangerous: "Grant all, block listed" means new resources are vulnerable by default.
These principles were defined by Jerome Saltzer and Michael Schroeder in 1975. Nearly 50 years later, they remain the foundation of secure system design. Every security-conscious engineer should know them.
Understanding attacks helps understand defenses. Here are the most important OS-level attack vectors:
The attack:
void vulnerable(char *input) {
char buffer[64];
strcpy(buffer, input); // No length check!
// If input > 64 bytes, it overwrites stack
// including return address
}
OS defenses:
1234567891011121314151617181920212223242526272829303132
Stack layout without protection: High memory+------------------+| Return Address | ← Overwrite target+------------------+| Previous Frame |+------------------+| Local buffer[64] | ← Overflow here+------------------+Low memory Attack: strcpy(buffer, "A"*72 + shellcode_address)Result: Return to attacker's shellcode Stack layout WITH canary: High memory+------------------+| Return Address |+------------------+| CANARY | ← Random value, verified before return+------------------+| Previous Frame |+------------------+| Local buffer[64] |+------------------+Low memory Overflow overwrites canary → detected → abortAttacker cannot easily guess random canary valueThe attack:
Vectors:
OS defenses:
The attack:
Examples:
OS defenses:
Code injection:
Return-Oriented Programming (ROP):
Defenses:
| Attack | Exploits | Key Defenses |
|---|---|---|
| Buffer overflow | Unchecked input length | Canaries, ASLR, DEP/NX |
| Privilege escalation | SUID bugs, kernel vulns | Capabilities, seccomp, namespaces |
| Side-channel | Speculative execution, timing | KPTI, constant-time code, cache isolation |
| ROP | Existing code gadgets | ASLR, CFI, shadow stacks |
Modern security relies heavily on isolation—containing processes so that compromise of one doesn't affect others.
We covered this earlier: each process has its own address space. This is the first layer of isolation.
Guarantees:
Limitations:
Concept: Limit which system calls a process can make.
Rationale: Kernel vulnerabilities often exploited via system calls. Fewer available syscalls = smaller attack surface.
// seccomp-bpf example: allow only read, write, exit
scmp_filter_ctx ctx = seccomp_init(SCMP_ACT_KILL);
seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(read), 0);
seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(write), 0);
seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(exit), 0);
seccomp_load(ctx);
// Process can now only read, write, exit
// Any other syscall → killed
Usage:
Concept: Partition kernel resources so processes see isolated views.
Namespace types:
Effect: Process in namespace cannot see or access resources outside it.
Concept: Limit and account for resource usage.
Capabilities:
Usage:
Containers (Docker, Kubernetes pods) combine:
This provides strong isolation without the overhead of full virtualization.
Containers share the host kernel. Kernel vulnerabilities affect all containers. For hostile multi-tenancy (untrusted code), VMs provide stronger isolation via hypervisor separation. Projects like gVisor and Kata Containers add kernel isolation to containers.
Security must start at the lowest level. If the boot process is compromised, nothing above it can be trusted.
Concept: Verify that boot code is signed and unmodified.
UEFI Secure Boot process:
Protection against:
Concept: Hardware chip that provides cryptographic functions and secure storage.
Capabilities:
Measured Boot:
Use cases:
1234567891011121314151617181920212223
UEFI Secure Boot Chain: +----------------+ verify +------------------+| UEFI | ─────────────>| Bootloader || Firmware | signature | (GRUB/Windows) |+----------------+ +------------------+ | | | Platform Key (PK) | Key Exchange Key (KEK) | authorizes db | authorizes db | | v verify v+----------------+ signature +------------------+| db keys | ────────────>| Kernel || (trusted sigs) | | (vmlinuz, etc.) |+----------------+ +------------------+ | v +------------------+ | Drivers | | (signed only) | +------------------+ Any unsigned component: boot fails or enters recovery modeSecurity questions in OS interviews typically fall into a few categories. Here's how to structure answers:
"Operating systems protect confidentiality, integrity, and availability—the CIA triad. Confidentiality means only authorized users can read data (enforced via permissions and isolation). Integrity means only authorized modifications occur (enforced via access control and signatures). Availability means authorized users can access resources (enforced via quotas and fair scheduling)."
"Authentication verifies identity—it answers 'who are you?' Methods include passwords, tokens, biometrics, and MFA. Authorization determines permissions—it answers 'what can you do?' Once authenticated, the system checks ACLs, capabilities, or roles to determine access rights. Authentication precedes authorization."
"Every entity should have only the minimum permissions needed for its function. A web server doesn't need root—it runs as www-data. If compromised, damage is limited. Modern implementations include Linux capabilities (grant specific privileges without root), seccomp (limit available syscalls), and containerization (namespace isolation)."
Strong answers connect concepts: 'SELinux provides mandatory access control, which addresses the trojan horse weakness in DAC by enforcing policy regardless of what process runs code.' This shows understanding of WHY mechanisms exist, not just WHAT they do.
Operating system security is the foundation upon which all application and data security rests. Let's consolidate the essential knowledge:
Module Complete:
This concludes Module 5: Conceptual Questions. You've now mastered the five essential conceptual topics for operating systems interviews:
These topics represent the conceptual foundations that interviewers expect strong candidates to articulate clearly and deeply. Combined with numerical problem-solving skills and hands-on project experience, you are well-prepared for operating systems interviews.
Congratulations! You've completed Module 5: Conceptual Questions. You now possess world-class knowledge of the fundamental OS concepts that distinguish excellent candidates in technical interviews—and more importantly, that make you an effective systems engineer in practice.