🎓 BookMCQ
← Back to 14. Protection

📝 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.
5
Easy
10
Medium
11
Hard

📝 All Access Matrix in protection of Operating System MCQs

Q1. What does the setuid bit on a Unix file indicate?

A.File is executable only by owner
B.Execute with owner's privileges ✅
C.File is read‑only
D.File is hidden
💡 Difficulty: easy | ✅ Correct: B

📖 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?

A.Execute only non‑privileged instructions
B.Access hardware directly ✅
C.Run user applications
D.Restrict memory usage
💡 Difficulty: easy | ✅ Correct: B

📖 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?

A.They prevent all security breaches
B.They cannot isolate users from each other ✅
C.They require more memory
D.They eliminate need for file permissions
💡 Difficulty: easy | ✅ Correct: B

📖 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?

A.By changing the process’s UID to the file owner ✅
B.By disabling user mode
C.By altering file size
D.By encrypting the file
💡 Difficulty: easy | ✅ Correct: A

📖 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?

A.UID changes to file owner
B.UID remains the same as the user ✅
C.Process gains root privileges
D.Process cannot execute
💡 Difficulty: easy | ✅ Correct: B

📖 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?

A.Both use hardware rings to enforce privileges
B.Unix uses file‑based UID changes while MULTICS uses hardware rings ✅
C.MULTICS relies on setuid bits
D.Unix and MULTICS have identical domain models
💡 Difficulty: medium | ✅ Correct: B

📖 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?

A.Store program code
B.List all possible user‑resource permissions ✅
C.Schedule CPU time
D.Manage network routing
💡 Difficulty: medium | ✅ Correct: B

📖 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?

A.A row granting execute to the file owner only
B.A column granting read to everyone
C.A temporary entry that gives the user the owner’s rights during execution ✅
D.No entry is needed
💡 Difficulty: medium | ✅ Correct: C

📖 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?

A.C ✅
B.D
C.root
D.anonymous
💡 Difficulty: medium | ✅ Correct: A

📖 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?

A.E
B.root ✅
C.a special backup UID
D.nobody
💡 Difficulty: medium | ✅ Correct: B

📖 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?

A.They can read any file
B.They can execute commands with root privileges ✅
C.They can change the kernel version
D.They can delete the binary
💡 Difficulty: medium | ✅ Correct: B

📖 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?

A.To free memory
B.To maintain the principle of least privilege ✅
C.To reset the CPU clock
D.To update the file system
💡 Difficulty: medium | ✅ Correct: B

📖 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?

A.The process gains a new row for the owner’s permissions ✅
B.The process’s column is deleted
C.All permissions are removed
D.The matrix is unchanged
💡 Difficulty: medium | ✅ Correct: A

📖 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?

A.Monitor mode restricts memory, user mode allows all
B.Monitor mode can execute privileged instructions, user mode cannot ✅
C.User mode can modify kernel data structures
D.Both modes have identical capabilities
💡 Difficulty: medium | ✅ Correct: B

📖 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?

A.Confidentiality
B.Least privilege ✅
C.Redundancy
D.Scalability
💡 Difficulty: medium | ✅ Correct: B

📖 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?

A.U2 → F1 : execute
B.U1 → F1 : read/write
C.U1 → F1 : execute
D.U2 → F1 : execute with owner’s rights ✅
💡 Difficulty: hard | ✅ Correct: D

📖 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?

A.It has the setuid bit set for root ✅
B.It is stored in /tmp
C.It lacks execute permission
D.It is a symbolic link
💡 Difficulty: hard | ✅ Correct: A

📖 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?

A.Disabling all setuid bits
B.Allowing only signed setuid binaries ✅
C.Granting all users sudo access
D.Running all programs in monitor mode
💡 Difficulty: hard | ✅ Correct: B

📖 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?

A.It is replaced entirely by U4’s list
B.It is merged with U4’s capabilities for the duration ✅
C.It remains unchanged
D.It is cleared to no capabilities
💡 Difficulty: hard | ✅ Correct: B

📖 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?

A.The program’s effective UID is still the original user ✅
B.The file system is read‑only
C.The setuid bit was not set
D.The program lacks execute permission
💡 Difficulty: hard | ✅ Correct: A

📖 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?

A.All entries would become irrelevant ✅
B.Rows for users would double
C.Columns for resources would be removed
D.The matrix would enforce stricter limits
💡 Difficulty: hard | ✅ Correct: A

📖 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?

A.It can bind to privileged ports
B.It limits damage if the daemon is compromised ✅
C.It increases network throughput
D.It disables authentication
💡 Difficulty: hard | ✅ Correct: B

📖 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?

A.Change ownership to root
B.Remove the setuid bit ✅
C.Make the file read‑only
D.Move the file to /usr/bin
💡 Difficulty: hard | ✅ Correct: B

📖 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?

A.The binary runs with root privileges
B.Permission denied before execution ✅
C.The user gains write access
D.The setuid bit is ignored
💡 Difficulty: hard | ✅ Correct: B

📖 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?

A.Static rows only
B.Dynamic entries that can be added and removed per process ✅
C.Only owner rows
D.No entries for setuid files
💡 Difficulty: hard | ✅ Correct: B

📖 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?

A.The binary can escape the container with host root privileges
B.The binary runs with host root privileges
C.The binary runs with container root (non‑host) privileges ✅
D.The setuid bit is ignored by the host kernel
💡 Difficulty: hard | ✅ Correct: C

📖 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.

🔗 Related Topics (MCQs)