📝 Access Matrix in protection of Operating System (26 MCQs)
Representing Protection Policy with an Access Matrix
The access matrix is a conceptual model for specifying which protection domains may perform operations on system objects. Rows represent domains, columns represent objects, and each cell contains the permitted rights for that domain-object pair. Objects may include files, devices, memory segments, or processes. The matrix provides a unified way to describe access policy across an operating system.
Why a Unified Permission Model Is Needed
Scattered permission rules make it difficult to understand who can access a resource and what operations are allowed. The matrix brings these decisions into one logical structure. It also helps describe administrative rights, such as changing permissions or switching domains. A complete matrix can be very large, so practical systems usually store it in another representation.
Reading Rows, Columns and Permission Sets
To evaluate a request, identify the subject's current domain and the target object. Locate their matrix intersection and check whether the requested operation appears in the cell. A cell containing read and write permits both operations, while an empty cell grants neither. Special rights such as owner, control, or copy may support changes to protection relationships.
Example of an Access Matrix Decision
Suppose domain D1 has read access to file F1 and execute access to program P1. Domain D2 has read and write access to F1. A process in D1 requesting to write F1 must be denied because its cell contains no write right, even though D2 has that permission.
Expressiveness and Practical Storage Challenges
The access matrix clearly separates subjects, objects, and rights, making policy analysis straightforward. It can represent sharing, ownership, copying permissions, and domain control. However, most cells in a large system are empty, creating substantial storage waste. Implementations therefore use global tables, access control lists, capability lists, or other sparse representations.
Common Misinterpretations of the Matrix
'Rows represent objects and columns represent users' reverses the conventional model, where rows represent domains and columns represent objects. 'An empty cell grants default read access' is false because no listed right means no permission. 'The matrix is always stored as a complete two-dimensional array' ignores sparse implementation techniques used in real systems.
Exam Focus: Matrix Lookup and Permission Changes
Practise constructing a small matrix from given permissions and deciding whether specific operations are allowed. Questions may ask how owner, control, copy, or domain-switch rights affect the model. Be prepared to compare the matrix's logical clarity with the storage cost of maintaining a large number of mostly empty cells.
Key Terms of the Access Matrix
- Row - Represents a protection domain.
- Column - Represents a protected object.
- Cell - Stores permitted access rights.
- Access right - Operation authorised for a domain.
- Sparse matrix - Matrix with mostly empty entries.
📝 All Access Matrix in protection of Operating System MCQs
Q1. What does the setuid bit on a Unix file indicate?
📖 Explanation: The setuid bit signals that when the file is executed, the process adopts the file owner's UID, granting the owner’s privileges temporarily. Option B captures this behavior. Option A confuses setuid with the ordinary executable permission, C describes read‑only status unrelated to setuid, and D mischaracterizes it as a hidden attribute. Understanding this helps administrators control privilege elevation in multi‑user environments.
Q2. In the dual‑mode model, what is the primary capability of monitor mode?
📖 Explanation: Monitor mode allows execution of privileged instructions, giving the kernel direct access to hardware and critical resources. Option B correctly describes this. Option A describes user mode, C is vague and does not address privilege, and D misstates memory restrictions. Recognizing monitor mode’s power explains why only trusted code runs there, protecting the system from user‑level faults.
Q3. Why are two protection domains (monitor and user) not enough in a multi‑user system?
📖 Explanation: Two domains separate the kernel from applications but do not stop one user from accessing another’s resources. Option B states this limitation. Option A is false because breaches can still occur, C is irrelevant to security, and D incorrectly claims domains replace file permissions. This reasoning justifies the need for additional user‑specific domains.
Q4. How does the setuid bit facilitate domain switching in Unix?
📖 Explanation: When setuid is set, the operating system temporarily changes the process’s effective UID to match the file owner, effectively switching its protection domain. Option A describes this mechanism. Option B incorrectly suggests mode change, C is unrelated to permissions, and D misrepresents the function. This illustrates how Unix leverages file attributes to manage temporary privilege changes safely.
Q5. If the setuid bit is off, what happens when a user executes the file?
📖 Explanation: With the setuid bit cleared, execution occurs under the invoking user’s UID, so no privilege elevation occurs. Option B reflects this outcome. Option A describes the opposite scenario, C falsely claims root access, and D incorrectly states execution failure. Knowing this behavior helps developers decide when to apply setuid for controlled privilege escalation.
Q6. Which statement best compares Unix’s setuid mechanism with MULTICS’s protection rings?
📖 Explanation: Unix changes the effective UID based on file attributes, whereas MULTICS relies on hardware‑enforced protection rings to separate privilege levels. Option B captures this contrast. Option A incorrectly claims Unix uses rings, C misattributes setuid to MULTICS, and D ignores their architectural differences. This comparison clarifies how different OS designs achieve isolation.
Q7. What is the main purpose of an access matrix in operating‑system security?
📖 Explanation: An access matrix records which subjects (users or processes) may access which objects (files, devices) and in what mode, providing a comprehensive permission map. Option B states this purpose. Option A confuses it with code storage, C with scheduling, and D with networking. Recognizing the matrix’s role helps engineers design precise access controls.
Q8. In an access matrix, how would a setuid file be represented for a user without direct permission?
📖 Explanation: When a setuid file runs, the system temporarily adds an entry granting the invoking user the owner’s rights, reflecting the transient privilege escalation. Option C describes this dynamic entry. Option A shows a static owner row, B misrepresents read access, and D ignores the need to model temporary rights. This representation aids in analyzing security implications of setuid binaries.
Q9. User C with UID=C runs a script owned by D where the setuid bit is off. Which UID is used for subsequent file accesses inside the script?
📖 Explanation: Because the setuid bit is off, the process retains its original UID, C, for all subsequent operations. Option A is correct. Option B would be true only if setuid were on, C incorrectly assumes escalation to root, and D invents an unrelated UID. This scenario demonstrates how the absence of setuid maintains the caller’s identity, preserving least‑privilege principles.
Q10. A backup program owned by root has the setuid bit set. When user E executes it, which UID does the program run under?
📖 Explanation: The setuid bit causes the process to adopt the file owner’s UID, which is root, granting the necessary privileges for backup operations. Option B reflects this behavior. Option A would apply if setuid were cleared, C suggests a non‑standard UID, and D misstates the effect of setuid. Knowing this helps administrators safely delegate privileged tasks.
Q11. If a malicious user gains control of a setuid‑root binary, what is the most direct security consequence?
📖 Explanation: Controlling a setuid‑root binary lets the attacker run commands with root’s effective UID, bypassing normal restrictions. Option B captures this risk. Option A is a possible outcome but less direct; C and D describe specific actions that are not guaranteed. This highlights why protecting setuid binaries is critical in system hardening.
Q12. Why does the operating system revert to the original UID after a setuid program terminates?
📖 Explanation: Reverting restores the original user’s limited rights, ensuring that temporary elevation does not persist, which aligns with the principle of least privilege. Option B is correct. Option A is unrelated to UID handling, C is irrelevant, and D concerns file system metadata. This behavior prevents unintended privilege leakage after program completion.
Q13. When a setuid process runs, how does the access matrix view change for that process?
📖 Explanation: During setuid execution, the process temporarily acquires the owner’s permission set, effectively adding a row that mirrors the owner’s rights. Option A describes this change. Options B and C incorrectly suggest removal of entries, and D ignores the dynamic nature of setuid. Understanding this shift helps analysts predict access rights during privileged execution.
Q14. Which of the following best describes the difference between monitor mode and user mode?
📖 Explanation: Monitor mode grants the ability to run privileged instructions that can affect system resources, whereas user mode is limited to non‑privileged operations. Option B states this distinction. Option A reverses the restrictions, C incorrectly claims user mode can alter kernel data, and D falsely asserts equivalence. This knowledge underpins OS protection strategies.
Q15. What security principle justifies having separate protection domains for each user in a multi‑user OS?
📖 Explanation: The principle of least privilege dictates that each user should have only the rights necessary for their tasks, which is achieved by assigning distinct domains. Option B is correct. Confidentiality is a goal, not the justification; redundancy and scalability address system design but not permission isolation. Applying least privilege limits damage from compromised accounts.
Q16. A system has users U1, U2 and files F1, F2. U1 owns F1 and sets setuid on it. U2 does not own F1. In the access matrix, which entry must temporarily appear when U2 runs F1?
📖 Explanation: When U2 executes the setuid file, the OS temporarily grants U2 the owner’s (U1’s) execution rights, effectively adding an entry that reflects owner privileges for that session. Option D captures this temporary elevation. Options A and C miss the owner‑based aspect, and B describes unrelated permissions. Modeling this entry is essential for accurate security analysis.
Q17. An administrator notices that a non‑privileged user can modify system logs after running a certain utility. Which property of the utility is most likely responsible?
📖 Explanation: If the utility runs with the setuid bit set to root, it executes with root privileges, allowing the user to alter protected logs. Option A explains this behavior. Option B concerns location, C contradicts execution, and D describes a different file type. Identifying setuid misuse is key to preventing unauthorized log manipulation.
Q18. A security policy requires that no user can gain root privileges except through approved programs. Which mechanism best enforces this policy?
📖 Explanation: Requiring that only digitally signed setuid binaries be allowed ensures that only vetted programs can grant root privileges, aligning with the policy. Option B is correct. Option A is overly restrictive, C defeats the policy by granting broad sudo rights, and D would expose the kernel to many untrusted processes.
Q19. In a system using both setuid and capability lists, a process starts with user domain UID=U3, then executes a setuid program owned by U4. How does the capability list change?
📖 Explanation: During setuid execution, the process temporarily inherits the capabilities associated with the owner (U4), effectively merging the original list with U4’s capabilities. Option B reflects this dynamic merging. Option A suggests a full replacement, which would discard original rights; C ignores the setuid effect; D incorrectly assumes all capabilities are removed. This model aids in precise privilege tracking.
Q20. A developer tests a setuid program and finds that file creation fails with permission denied. Which of the following is the most likely cause?
📖 Explanation: If the effective UID remains that of the invoking user, the program lacks the elevated rights needed to create files in protected locations, leading to denial. Option A identifies this mismatch. Option B could cause failures but is less specific; C would prevent any setuid effect, and D would stop execution entirely. Proper UID handling is crucial for privileged operations.
Q21. If all user processes were allowed to run in monitor mode, what would be the primary impact on the access matrix?
📖 Explanation: Running all processes in monitor mode eliminates the need for permission checks, rendering the access matrix ineffective because every process could perform any operation. Option A captures this outcome. Options B and C misrepresent structural changes, and D contradicts the loss of enforcement. This scenario underscores why mode separation is vital for security.
Q22. A network daemon runs with setuid to a non‑root user 'svc'. What security advantage does this provide compared to running as root?
📖 Explanation: By running as a non‑root user, the daemon’s privileges are limited, so any compromise affects only the 'svc' account rather than the entire system. Option B describes this containment benefit. Option A is unrelated to setuid, C is performance‑related, and D incorrectly suggests authentication removal. Principle of least privilege guides this design choice.
Q23. During an audit, a file owned by user F has the setuid bit set but is not intended to be executable. Which action should be taken to mitigate risk?
📖 Explanation: Clearing the setuid bit eliminates unintended privilege elevation, reducing the chance of exploitation. Option B is the appropriate mitigation. Changing ownership (A) does not address the setuid flag, making the file read‑only (C) does not stop execution if permissions allow, and moving it (D) leaves the setuid flag active. Proper flag management is essential for security.
Q24. A directory /opt/app has permissions 755 and contains a setuid binary owned by root. A user without execute permission on the directory attempts to run the binary. What will happen?
📖 Explanation: Directory execute permission is required to traverse into it; without it, the kernel denies access before evaluating the binary’s setuid flag, resulting in a permission error. Option B reflects this order. Option A would be true only if traversal succeeded, C misstates permission effects, and D incorrectly assumes setuid overrides directory checks.
Q25. When designing an access matrix for an OS that uses setuid for privilege elevation, which of the following must be included to accurately model temporary rights?
📖 Explanation: To represent the transient nature of setuid privileges, the matrix must allow entries that appear when a process runs a setuid program and disappear afterward. Option B captures this requirement. Static rows (A) cannot reflect temporary changes, owner rows (C) miss the dynamic aspect, and omitting setuid entries (D) would ignore a critical security feature.
Q26. In a container environment, a setuid binary inside the container is owned by root inside the container but maps to a non‑root user on the host. What is the security implication?
📖 Explanation: Container runtimes typically map the container’s root UID to an unprivileged host UID, so the setuid binary runs with root inside the container but does not gain host‑level privileges. Option C describes this isolation. Option A and B would represent a severe breakout risk, which is prevented by user‑namespace mapping; D is incorrect because the host kernel still respects the setuid flag within the namespace.