π Security problems and threats in operating system (46 MCQs)
Security Risks Across Operating System Resources
Operating system security addresses threats that can compromise the confidentiality, integrity, or availability of computer resources. Threats target user accounts, processes, memory, files, devices, and network services through malicious software, unauthorised access, or weaknesses in system design. The operating system provides protection mechanisms, privilege separation, authentication, and monitoring to reduce exposure and limit the impact of security incidents.
How System Complexity Creates Security Exposure
Multi-user operation, network connectivity, software installation, and shared resources expand the possible attack surface. Vulnerabilities may result from programming errors, insecure configurations, weak passwords, or excessive privileges. A single weakness can allow an attacker to access protected information, disrupt services, or gain control of additional components.
Threat Sources and Operating System Weaknesses
Threats may originate from malicious users, compromised applications, infected removable media, or remote network systems. An attack may exploit a vulnerability, misuse legitimate permissions, or deceive a user into executing harmful code. Operating systems respond through access control, patch management, process isolation, secure configuration, and security monitoring.
Example of an Unauthorised Privilege Attempt
Suppose a standard user launches a program that attempts to modify a protected system configuration file. The operating system checks the process credentials and file permissions. Without the required authority, the write request is denied. If a vulnerability permits privilege escalation, however, the same program may obtain permissions beyond those intended.
Confidentiality, Integrity and Availability Trade-Offs
Security controls protect sensitive data, prevent unauthorised modification, and maintain service availability. Strong restrictions can increase administrative effort or interfere with legitimate tasks when poorly configured. Effective defence combines technical controls, timely updates, monitoring, backups, and user practices rather than relying on one security feature.
Misconceptions About Operating System Threats
'Only remote attackers threaten a system' ignores local malware and insider misuse. 'An antivirus program prevents every attack' overlooks unknown vulnerabilities and non-malware threats. 'A successful login proves all subsequent actions are safe' is false because authenticated users and processes can still misuse their permitted access.
Exam Focus: Threat Categories and Security Objectives
Distinguish threats from vulnerabilities, attacks, and security controls. Explain confidentiality, integrity, and availability using system-level examples. Questions may ask how malware, privilege escalation, or denial of service affects these objectives. For each scenario, identify the exposed resource, possible consequence, and an appropriate preventive or detective control.
Key Terms of Operating System Security
- Threat - Potential cause of security harm.
- Vulnerability - Weakness that can be exploited.
- Confidentiality - Protection against unauthorised disclosure.
- Integrity - Protection against improper modification.
- Availability - Access to resources when needed.
π All Security problems and threats in operating system MCQs
Q1. A system administrator notices that an unauthorized process is executing code from a memory region marked as non-executable. This is most directly a failure of which security mechanism?
π Explanation: DEP prevents code from being executed in memory regions marked as non-executable (e.g., stack or heap). ASLR randomizes memory addresses to make exploitation harder, stack canaries detect stack buffer overflows, and ACLs control access to files. The bypass of DEP indicates a vulnerability that allowed code execution in a protected region, which is a fundamental failure of memory protection.
Q2. A system uses a simple paging mechanism. The page table entry (PTE) contains a valid bit, read/write bit, and a 10-bit frame number. If an attacker corrupts the PTE of a user process to point to a frame belonging to the kernel, which violation is most likely to occur?
π Explanation: By changing the frame number to point to a kernel frame, the user process can read kernel memory. The 'read/write' bit allows reading, so the attacker can access sensitive kernel data (e.g., passwords, keys). This is primarily an information disclosure (confidentiality) violation. Privilege escalation is typically a change in user level, not just memory access. The attack doesn't directly cause a crash (DoS) or modify data (Integrity).
Q3. Consider a system with multi-level security. A process running at 'Secret' clearance attempts to write data to a file with classification 'Top Secret'. According to the Bell-LaPadula model, which action should be taken and why?
π Explanation: Bell-LaPadula focuses on confidentiality. The *-property (star property) states that a process can only write to objects at the same or higher classification level ('write up'). Writing from 'Secret' to 'Top Secret' is 'writing up' and is allowed. Option B is wrong because it incorrectly describes the *-property. Option C is incorrect as 'write up' is allowed in BLP. Option D is the rule for 'read up', which is prohibited by the simple security property.
Q4. An operating system uses a stack canary. An attacker tries a buffer overflow to overwrite a return address. The attack fails. However, a system log shows a 'stack smashing detected' error and the process terminates. This is a direct example of the canary's role as what?
π Explanation: The stack canary is a reactive detection mechanism. It detects an overflow when the canary value is corrupted before the function returns. It does not prevent the overflow from occurring; it detects it after it happens and before control is transferred to the corrupted address, thus mitigating the exploitation. Option A overstates its capabilities; it doesn't prevent all attacks. Option C is wrong; it doesn't patch the vulnerability. Option D is false; it's a value to check, not encryption.
Q5. A program has the following C code snippet: 'char buffer[10]; gets(buffer);'. An attacker provides a 100-character input. The program crashes. What is the primary security weakness exploited here?
π Explanation: The 'gets()' function does not perform bounds checking. Providing 100 characters for a 10-byte buffer causes a buffer overflow. This is the most direct and classic example of a buffer overflow. Format string vulnerabilities involve 'printf()' with user-controlled format strings. Integer overflow is a numeric overflow. Use-after-free is accessing memory after it has been freed.
Q6. Which of the following is an example of an application-level attack that exploits a lack of input validation to execute arbitrary system commands on the OS?
π Explanation: Command injection is a type of attack where the attacker executes arbitrary commands on the host operating system via a vulnerable application. SQL injection targets databases. XSS targets web users' browsers. A buffer overflow can lead to code execution, but command injection is a specific class of attack that directly executes OS commands.
Q7. In the context of operating system security, the 'confused deputy' problem primarily involves what?
π Explanation: The 'confused deputy' problem occurs when a process with privileges is tricked by an attacker into performing an action that the attacker is not authorized to do. The deputy (the privileged process) is 'confused' about the identity or permissions of the requestor. Option A is too specific. Option C is a symptom, not the core definition. Option D describes a general detection problem.
Q8. A system is designed with a Trusted Computing Base (TCB). An attacker discovers a way to exploit a bug in a device driver that is part of the TCB. What is the most significant security implication of this compromise?
π Explanation: The TCB is the set of components (hardware and software) that are critical to the system's security. If any part of the TCB is compromised, the security of the entire system can be considered compromised because there is no trusted component to fall back on. The attacker can then bypass all security checks. Option A is a minor effect. Option B is incorrect because a TCB compromise can lead to total system compromise.
Q9. A security researcher finds that a race condition exists in the file system. An attacker can exploit this to create a symbolic link in the time between a program checking for a file's existence and opening it. This is an example of what kind of vulnerability?
π Explanation: A TOCTOU vulnerability is a race condition where the state of a resource changes between a program's check of that state and its use of that resource. This is a classic example. A dangling pointer points to freed memory. Double-free is freeing memory twice. A memory leak is when memory is not freed.
Q10. Which security concept ensures that a user cannot deny having performed a specific operation, such as deleting a critical system file?
π Explanation: Non-repudiation ensures that an entity cannot deny its involvement in an action. Digital signatures are a key tool for non-repudiation. Confidentiality is about secrecy, integrity about data correctness, and availability about accessibility.
Q11. A system uses role-based access control (RBAC). A user in the 'Manager' role can read and write files in the 'Projects' directory. A user in the 'Intern' role can only read files in the 'Projects' directory. What security principle does this implement?
π Explanation: The principle of least privilege dictates that a subject should be given only the privileges it needs to perform its tasks. Granting the Intern read-only access and the Manager read-write access is a direct application of this principle. Separation of duty is about splitting a critical task among multiple people. Defense in depth is about layering defenses. Fail-safe defaults is about denying access by default.
Q12. Consider a system where a user, 'Alice', has a file with permissions '-rwx------'. The system administrator adds Alice to the 'staff' group, which has read access to the file. What are the new permissions for Alice?
π Explanation: The permission string '-rwx------' indicates the owner (Alice) has read, write, and execute permissions. The group and others have no permissions (---). When Alice is added to the 'staff' group, the group permissions for the file do not automatically change. The file's group permissions remain '---'. Alice's effective permissions are still based on her ownership, which is 'rwx'. Therefore, the permissions remain unchanged for her. Option B and C incorrectly assume group permissions are applied to the owner.
Q13. A system is being secured against malware. Which of the following is an example of a 'signature-based' detection technique?
π Explanation: Signature-based detection relies on known, unique patterns (signatures) of malware. A cryptographic hash of a file is a strong signature. Options A, B, and D are examples of behavior-based or heuristic detection, which is used to detect new or unknown malware (zero-day).
Q14. A system process tries to allocate memory using 'malloc(1024)'. The system is out of memory and the allocation fails. The OS then selects a process to terminate to free up memory. This is an example of what?
π Explanation: When the system runs out of memory, the OOM killer is invoked to select and terminate a process to free memory, allowing the system to continue. A buffer overflow is a write beyond buffer bounds. A memory leak is memory that is not freed, but doesn't directly cause the killer to act until resources are exhausted. A segmentation fault is an invalid memory access, not necessarily an OOM condition.
Q15. A process is running with root privileges. Due to a bug, it inadvertently drops its privileges and then attempts to perform an operation that requires root access. What is the likely outcome and what security principle is being violated?
π Explanation: If the process has successfully dropped its root privileges, it should not be able to perform root-only operations. The operation will fail. This is a correct implementation of the principle of least privilege; the process is not allowed to do more than necessary. Option A is incorrect. Option B is wrong because the failure is the correct behavior, not a violation of the principle. Option D is irrelevant.
Q16. The following graph shows the number of zero-day vulnerabilities discovered per year and the average time to patch them. If both trends continue linearly, what is the most critical implication for OS security? (Assume graph: y1 = 5x + 10 for vulnerabilities, y2 = -0.5x + 30 for days to patch)
π Explanation: The graph describes the 'window of exposure'βthe time between when a vulnerability is discovered and when it is patched. If the number of vulnerabilities (y1) increases and the time to patch (y2) decreases, the total 'attack surface' or number of vulnerable days across all systems can increase. However, the question asks for the most critical implication. A decrease in patch time is good, but if vulnerabilities are discovered at a faster rate, the overall risk (vulnerabilities * time) is increasing. Option A is incorrect. Option C is the most logical conclusion for a security professional.
Q17. In a virtual memory system, the OS maintains a page table for each process. An attacker exploits a vulnerability to modify the 'present/absent' bit of a page table entry. What is the most likely direct consequence of this attack?
π Explanation: By changing the present/absent bit, the attacker can cause the OS to incorrectly think a page is not in memory, leading it to load a page from disk. This can be used to overwrite memory with malicious data. The attacker doesn't directly prevent access (A) or cause a panic (B). It could lead to a side-channel, but the most direct consequence is memory corruption.
Q18. A system's audit log shows a sequence of events: Event 1: User 'admin' logs in. Event 2: Admin creates a new user 'attacker'. Event 3: Admin assigns 'attacker' to the 'administrators' group. Event 4: The 'attacker' account is used to delete the system log. This is an example of what type of attack?
π Explanation: This attack involves a legitimate user (the admin) performing actions that compromise the system, which defines an insider threat. The admin is either malicious or their credentials are compromised. Phishing and MITM are external attacks. DoS aims to disrupt service, not gain privileges.
Q19. The principle of 'defense in depth' suggests that a security system should have multiple layers of protection. Which of the following is the strongest argument for this approach?
π Explanation: Defense in depth is about redundancy. The idea is that a failure in one layer (e.g., a firewall) will not compromise the entire system because other layers (e.g., intrusion detection, application security) are still in place. Option A overstates its capability. Option B is a negative side effect, not a primary argument. Option D is generally false.
Q20. Consider a multithreaded application. A vulnerability allows an attacker to corrupt a function pointer used for a callback. The attacker overwrites the pointer with the address of a malicious function. This is most directly an example of what type of attack?
π Explanation: Overwriting a function pointer to redirect execution to a malicious function is a classic control-flow hijacking attack. The attacker is taking control of the program's execution flow. Code injection involves injecting new code. ROP uses existing code sequences (gadgets) to achieve execution. Privilege escalation is a consequence, but the direct attack is CFH.
Q21. An OS uses a mandatory access control (MAC) system like SELinux. A user process tries to read a file, and the MAC policy denies the operation. A traditional UNIX DAC (Discretionary Access Control) system would have allowed it. This is an example of what?
π Explanation: In systems with both MAC and DAC, MAC policies are typically enforced first or override DAC. If the MAC policy denies access, it is a true positive for the MAC system. The DAC system's allowance is irrelevant. Option A is wrong. Option B (false negative) would be if the MAC allowed a malicious operation. Option D is wrong; it's not a DAC error.
Q22. Which of the following is a primary limitation of using a host-based intrusion detection system (HIDS) for security monitoring?
π Explanation: A HIDS monitors activity on a single host (e.g., system logs, file integrity). It does not monitor network traffic, so it cannot detect network-level attacks (e.g., port scans, packet spoofing). While HIDS can generate false positives (B) and use resources (C), its primary limitation is its scope. Option D is incorrect; a HIDS can detect anomalous application behavior (e.g., file changes, privilege escalation).
Q23. An attacker uses a SQL injection to dump the contents of a database containing user credentials. This is a direct threat to which of the CIA triad properties?
π Explanation: The primary goal of stealing credentials is a breach of confidentiality. The attack reveals sensitive information. While the attacker could modify data (integrity) or cause a DoS (availability), the core of this specific attack is reading data, which is a confidentiality violation.
Q24. A process has a memory map with segments: [Code: 0x1000-0x2000, R-X], [Data: 0x2000-0x3000, RW-], [Heap: 0x3000-0x4000, RW-], [Stack: 0x6000-0x7000, RW-]. An attacker exploits a vulnerability to make the program's instruction pointer jump to 0x2500. What will be the immediate outcome?
π Explanation: The instruction pointer (program counter) can only fetch instructions from memory regions marked as executable (R-X). The data segment at 0x2500 is marked as RW- (read-write, no execute). Therefore, jumping to this address will cause a segmentation fault because the system will not allow code execution from a non-executable region. Option A is wrong because it cannot execute. Options C and D are incorrect outcomes.
Q25. A security team recommends using 'sandboxing' for untrusted applications. This is most analogous to:
π Explanation: Sandboxing is about running an application in an isolated environment with restricted access to system resources. A virtualized environment is a strong analogy because it provides hardware-level isolation. Option B is code review. Option C is encryption. Option D is a backup.
Q26. In a system with Address Space Layout Randomization (ASLR), an attacker attempts a return-to-libc attack by trying to call the 'system()' function. ASLR makes this attack more difficult by:
π Explanation: ASLR randomizes the memory locations of key data areas, including the base address of libraries like libc. This makes it difficult for an attacker to predict the address of functions like 'system()' needed for a return-to-libc attack. Option A is false. Option C is false. Option D is a property of stack canaries, not ASLR.
Q27. An operating system uses a capability-based security model. A user has a capability that allows them to read a file. If the user wants to write to the same file, what must happen?
π Explanation: In a capability-based system, a capability is an unforgeable token that grants specific rights to an object. If the user only has a read capability, they cannot write. To gain write access, a new capability must be created and granted to the user. Options B and D are incorrect because the capability is the authority, not a separate permission. Option C is absurd.
Q28. A process requests a resource that is currently held by another process. The OS implements a wait-for graph. A deadlock is detected when:
π Explanation: In a resource allocation graph, a cycle is a necessary and sufficient condition for a deadlock (in systems with single-instance resources). A node with in-degree 2 implies multiple requests, but not necessarily a deadlock. A tree or a self-loop are not deadlock definitions.
Q29. A system is protected by a firewall that filters incoming packets based on port numbers. An attacker wants to remotely exploit a vulnerability in a service running on port 8080. If the firewall blocks all traffic to port 8080, what could the attacker do to overcome this?
π Explanation: If the firewall blocks port 8080, the attacker can try to use a technique like port knocking (to open the port) or tunneling the attack through an allowed port (e.g., tunneling HTTP traffic over port 80). Option A is irrelevant as the service is on 8080. Option B doesn't bypass port blocking, only content filtering. Option C is possible but less likely, as it's a different exploit.
Q30. Which of the following is a valid criticism of relying solely on anti-virus software for protection against modern malware?
π Explanation: Anti-virus software primarily relies on signature-based detection, which is reactive. It can only detect malware that is already known and has a signature. It is ineffective against zero-day attacks (new, unknown malware). Option A is not universally true. Option B is false. Option D is a minor performance issue.
Q31. Consider the following code: `if (uid == 0) { // root grant_access(); } else { deny_access(); }` An attacker finds a way to make `uid` negative. The condition `uid == 0` fails, but the system incorrectly handles negative UIDs, granting access. This is an example of what kind of vulnerability?
π Explanation: This is a logic error or authentication bypass. The code's intent is to check if the user is root (UID 0). By making `uid` negative, the check fails, but the system misinterprets this, granting access. It's not a buffer overflow (writing beyond memory), a race condition (timing), or an integer overflow (wrapping). It's a flawed authentication logic.
Q32. A system is implementing a security policy that requires all users to authenticate using a password and a smart card. This is an example of:
π Explanation: Two-factor authentication uses two different types of credentials: something you know (password) and something you have (smart card). Option A is incorrect because it's two factors. Option C is about classification levels. Option D is a broader strategy.
Q33. Which of the following attacks is a classic example of a 'man-in-the-middle' (MITM) attack on an OS?
π Explanation: ARP spoofing is a MITM attack where an attacker associates their MAC address with the IP address of a legitimate host, causing traffic to be sent to the attacker. The attacker can then intercept, modify, or drop the traffic. Option B is ransomware. Option C is a code execution exploit. Option D is a DoS attack.
Q34. A student is writing a report on OS security. They state that 'sandboxing' and 'virtualization' are the same thing. Which of the following best corrects this misconception?
π Explanation: The core difference is that virtualization provides hardware-level isolation by emulating a full machine, while sandboxing is a software-based isolation mechanism that restricts an application's access to system resources. Option A is the only correct distinction. Options B, C, and D are all incorrect.
Q35. A system is vulnerable to a 'use-after-free' vulnerability. What is the most direct mitigation technique for this class of vulnerabilities?
π Explanation: Use-after-free occurs when a program continues to use memory after it has been freed. The most direct mitigation is to use safe memory management practices, such as garbage collection or reference counting, which prevent memory from being freed while references exist. ASLR, DEP, and stack canaries are defenses against other types of exploits (e.g., code injection, ROP, buffer overflow).
Q36. An OS uses a segmented memory model where each segment has a base and a limit. An attacker corrupts a segment's limit register. What is the most critical security risk?
π Explanation: The limit register defines the size of the segment. Corrupting it allows the attacker to read or write memory outside the intended segment, leading to a buffer overflow or information disclosure. This is a classic way to break memory protection. Options A, C, and D are less direct or incorrect consequences.
Q37. A security administrator notices that an attacker is using a technique called 'Return-Oriented Programming' (ROP) to exploit a system. The attacker is not injecting any new code. Which of the following security mechanisms is specifically designed to mitigate ROP attacks?
π Explanation: ROP attacks chain together short sequences of existing code (gadgets) to perform arbitrary operations. Control-flow integrity (CFI) is designed to enforce that program execution follows a pre-determined control-flow graph, which is broken by ROP. Code signing verifies code origin. Stack canaries detect stack overflow. ASLR makes finding gadgets harder, but CFI is the specific mitigation.
Q38. An operating system uses a security policy that states: 'No process can read data at a higher classification level, and no process can write data to a lower classification level.' This policy is an example of:
π Explanation: The described policy is the Biba model, which is focused on integrity. The Biba model's rules are: 'No read down' (simple integrity) and 'No write up' (*-property) to prevent untrusted data from flowing to high-integrity objects. Bell-LaPadula is for confidentiality. Clark-Wilson and Chinese Wall are other integrity models with different goals.
Q39. Consider a system with a hardware security module (HSM) that stores cryptographic keys. An attacker gains physical access to the system and tries to extract the keys. The HSM is designed to be tamper-resistant and will self-destruct if tampered with. This is an example of:
π Explanation: The HSM is designed to protect the confidentiality of the cryptographic keys. If an attacker gains physical access, the self-destruct mechanism prevents the keys from being read. The primary goal is to keep the keys secret. While integrity, availability, and non-repudiation are important, the core function here is preserving the secrecy of the keys.
Q40. A system is running a vulnerability scanner. The scanner reports that a service is running on a non-standard port. This is most likely a sign of:
π Explanation: Running a service on a non-standard port is a common technique to evade detection by simple port scans (e.g., running SSH on port 2222 instead of 22). While it could be a legitimate change (A), from a security perspective, it's a significant red flag and is more suspicious. Option C is unlikely. Option D is possible but less of a security concern.
Q41. In an operating system, which of the following is the best example of 'availability' being compromised?
π Explanation: Availability means that systems and data are accessible to authorized users when needed. A down authentication server prevents users from logging in, which is a direct denial of service (availability). Option A is a confidentiality breach. Options C and D are integrity breaches.
Q42. A system is hardened by disabling all unnecessary services. This reduces the attack surface. What is a potential negative consequence of this action?
π Explanation: Disabling unnecessary services is a good security practice, but it can break applications that rely on those services. Option A is not necessarily true. Option B is wrong; it reduces vulnerability to zero-day attacks by reducing the number of potential targets. Option D is a potential negative, but breaking functionality is the most direct and significant negative consequence.
Q43. A system uses a challenge-response authentication protocol. The server sends a random number (challenge) to the client, and the client sends back the hash of the challenge and a password. This prevents what kind of attack?
π Explanation: A replay attack involves capturing a valid authentication token (like a password hash) and resending it later to gain access. In a challenge-response system, the challenge is different each time, so the old hash cannot be reused. A MITM can still intercept the challenge and response, but cannot replay it effectively. Brute-force and dictionary attacks are mitigated by the password's strength, not by the challenge-response mechanism.
Q44. Consider the following scenario: A user has a file with permissions '644' (-rw-r--r--). The user executes a program that runs with setuid (Set User ID) bit set. The program writes to the file. What permissions does the program have to write to the file?
π Explanation: The setuid bit means that the program runs with the permissions of the file's owner, not the user executing it. Therefore, it can write to the file if the file owner has write permissions. The file '644' means the owner has read/write. So the program can write. Option B is true for normal programs, but setuid overrides it. Option C is wrong. Option D is incorrect because the owner has write permission.
Q45. A student is trying to explain the concept of 'least privilege' to a peer. They give an example: 'A user should not be able to install software unless they are an administrator.' The peer says, 'That's just common sense, not a security principle.' How should the student respond to best clarify the concept?
π Explanation: The best response is that it limits the damage. The principle of least privilege is about reducing the attack surface and limiting the blast radius of a compromise. If a user only has the privileges they need, an attacker who compromises that user account will have limited capabilities. Option A is a benefit but not the core principle. Option C is an operational benefit. Option D is often true but not the core reason.
Q46. An attacker successfully exploits a vulnerability in a web browser. The browser process runs with low privileges. However, the attacker is able to use this to read the contents of a file belonging to another user on the system. This is possible because the file system:
π Explanation: This is a classic scenario of a boundary attack. The web browser, despite running with low privileges, can read another user's file due to a misconfiguration in the file system. The most likely cause is that the file has a misconfigured permission (e.g., 644 or 444) that allows 'other' (world) read access. Option D is also possible if the browser user and the other user are in the same group. The correct answer must be a misconfiguration at the OS level, which is a flaw in the access control. The explanation must detail that the attack doesn't require privilege escalation; it simply exploits the existing permissions.