Operating System Security MCQs for NSCT
Operating system security is about making the OS itself hard to abuse: hardening it before use, patching it continuously, and controlling privileges so that a compromised account or program cannot take over the machine. It is the fifth topic in the Cyber Security area, which carries 5% of the NSCT according to HEC's Areas of Competencies. Candidates averaged 47.2% accuracy in this area in 2026, per the HEC NSCT report and APP.
This page follows Stallings and Brown's Computer Security: Principles and Practice, with Linux examples. The theory of protection domains and the access matrix sits in the OS area's Protection & Security topic.
Hardening
Hardening means reducing a system's attack surface and configuring it securely before it goes live. Stallings lists the steps in order:
- Install and patch the operating system.
- Remove or disable unneeded services, applications and protocols.
- Configure users, groups and permissions (least privilege).
- Add security controls: host firewall, anti-malware, host-based IDS, logging.
- Test the security, for example with a vulnerability scanner against a baseline such as a CIS Benchmark.
Small example: a new web server should not run Telnet (port 23, cleartext) or an FTP daemon it never uses. Disabling them removes two remote attack paths. Default accounts and passwords should be removed or changed, and SSH should refuse direct root login.
Exam angle: if a question asks for the first thing to do with a newly installed server, the answer is patching it before connecting it to an untrusted network.
Patching
A patch is a vendor update that fixes a bug or vulnerability. Patch management is the process: inventory systems, monitor advisories, test patches, deploy them in stages, and verify. A zero-day vulnerability is one that attackers exploit before a patch exists, so patching cannot help until the vendor responds; other controls (least privilege, application whitelisting, IPS) have to carry the load.
Many breaches exploit known vulnerabilities whose patches were already available but never applied. The trade-off is stability: an untested patch can break a production system, which is why organisations test on a staging copy first.
Exam angle: "vulnerability already public, patch available, still exploited" points to a patch management failure, not a zero-day.
Linux permissions in one table
Each file has read (4), write (2) and execute (1) bits for user, group and others.
| Octal | Symbolic | Meaning |
|---|---|---|
| 755 | rwxr-xr-x | Owner full; others read and run |
| 644 | rw-r--r-- | Owner edits; everyone reads |
| 640 | rw-r----- | Group reads; others nothing |
| 4755 | rwsr-xr-x | SUID: runs with the owner's privileges |
| 1777 | rwxrwxrwt | Sticky bit (as on /tmp): only a file's owner can delete it |
New files start from 666 and directories from 777, minus the umask. With umask 027, a new file is 640 and a new directory 750.
Privilege escalation
Privilege escalation is gaining rights you were not granted. Vertical escalation moves up (a normal user becomes root or Administrator). Horizontal escalation moves sideways (user A reads user B's data).
Common Linux paths:
- A SUID-root binary with a flaw, or one that can spawn a shell.
- A misconfigured sudo rule, such as letting a user run an editor or
findas root. - A root cron job that runs a world-writable script.
- An unpatched kernel vulnerability.
On Windows, unquoted service paths and weak service permissions play the same role. Defences: least privilege, patching, auditing SUID files (find / -perm -4000), mandatory access control such as SELinux or AppArmor, and memory protections like ASLR and DEP/NX that make buffer overflows harder to exploit.
Exam angle: decide first whether the attacker gained more privilege or someone else's privilege.
Common traps
- Reading umask as the permission itself. Umask 022 removes write for group and others, giving 644 files.
- Thinking SUID makes a program run as the user who launched it. It runs as the file's owner.
- Calling every unpatched exploit a zero-day. A zero-day has no patch available yet.
- Assuming the sticky bit makes a file read-only. On a directory it only restricts deletion and renaming.
- Treating ASLR or DEP as a fix for the bug. They raise the cost of exploitation; the bug remains.
- Forgetting that on a directory, x means "may enter", not "may run".
Worked examples
1. Understanding. Which access control model lets the system, not the file owner, enforce labels that even root processes cannot override? Answer: mandatory access control (MAC), as in SELinux. Under discretionary access control (DAC), owners set permissions; MAC policy is set centrally and confines processes regardless of their user.
2. Application. A server's umask is 077. What are the permissions of a new file and a new directory? Answer: 600 (rw-------) and 700 (rwx------). 666 minus 077 leaves only the owner's read and write; 777 minus 077 leaves the owner's full rights.
3. Analysis. A student account can run sudo vim /etc/motd without a password. The admin thinks this is harmless because only one file is named. Is it?
Answer: no, it allows full root escalation. Vim can start a shell (:!sh), and that shell inherits root. Sudo rules should never grant programs that can spawn shells or edit arbitrary files; sudoedit is the safer choice.
Practise
The quiz below has 100 questions on Operating System Security, filterable by tier and difficulty.
Practise: 100 questions
FAQs
What is the difference between hardening and patching?
Hardening is a one-time-plus-review configuration job: removing unneeded services, setting secure defaults and tightening permissions. Patching is continuous: applying vendor fixes as new vulnerabilities are found. A hardened system that is never patched becomes vulnerable over time, and a patched system with open defaults is still easy to attack.
What does chmod 755 mean?
It sets read, write and execute for the owner (7 = 4+2+1), and read plus execute for the group and others (5 = 4+1). In symbolic form it is rwxr-xr-x. It is the usual setting for programs and public directories, where everyone may run or enter but only the owner may change contents.
Why is SUID dangerous?
A SUID program runs with its owner's privileges instead of the caller's. When the owner is root, any bug that lets the caller run commands, such as a shell escape or buffer overflow, gives them root. That is why administrators keep SUID binaries to a minimum and audit them regularly.
What is the principle of least privilege?
Every user and process should get only the rights it needs for its task, and only for as long as needed. In OS terms that means daily work in normal accounts, sudo for specific tasks, and services running as dedicated low-privilege users, so a compromise is contained.
Next step
Continue with Web Application Security MCQs, or revisit Network Security and Security Principles. Browse all topics on the Cyber Security hub, then take an NSCT mock test.