Operating System Security MCQs for NSCT

By the NSCT Exam Editorial Team · Updated 2026-11-24 · Facts checked against official sources on 2026-11-24

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:

  1. Install and patch the operating system.
  2. Remove or disable unneeded services, applications and protocols.
  3. Configure users, groups and permissions (least privilege).
  4. Add security controls: host firewall, anti-malware, host-based IDS, logging.
  5. 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:

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

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

Interactive quiz loading. The first 10 questions are shown below.

  1. What does 'hardening' an operating system mean?

    1. Encrypting the entire hard disk
    2. Installing the newest version of every application
    3. Reducing its attack surface and configuring it securely before and during use
    4. Making the file system read-only
    Show answer

    Answer: C. Reducing its attack surface and configuring it securely before and during use

    Hardening means removing what is not needed (services, accounts, software) and setting secure configurations so fewer weaknesses are exposed. Disk encryption or read-only file systems may be part of it, but they are not what the term means.

  2. What is a zero-day vulnerability?

    1. A flaw that attackers can exploit before the vendor has released a fix
    2. A flaw fixed on the same day it was reported
    3. A bug that causes the system clock to reset
    4. A vulnerability with a CVSS score of zero
    Show answer

    Answer: A. A flaw that attackers can exploit before the vendor has released a fix

    A zero-day is unknown to the vendor or has no patch yet, so defenders have had 'zero days' to fix it. Once a patch exists, exploiting unpatched systems is a patch management failure, not a zero-day.

  3. In Linux, what does the SUID bit on an executable do?

    1. The program runs with the privileges of the user who launches it, even if root owns it
    2. Only the owner may delete the file
    3. The file cannot be modified by anyone
    4. The program runs with the privileges of the file's owner
    Show answer

    Answer: D. The program runs with the privileges of the file's owner

    With SUID set, the process's effective user ID becomes the file owner's. A SUID-root program such as passwd can therefore update /etc/shadow for an ordinary user. Restricting deletion is the sticky bit's job on directories.

  4. A normal user exploits a flaw and gains root access. What kind of privilege escalation is this?

    1. Horizontal privilege escalation
    2. Vertical privilege escalation
    3. Lateral movement
    4. Session fixation
    Show answer

    Answer: B. Vertical privilege escalation

    Moving from a lower privilege level to a higher one, such as user to root or Administrator, is vertical escalation. Horizontal escalation gains another user's rights at the same level. Lateral movement means moving to other machines.

  5. Which principle says users and processes should get only the rights needed for their task?

    1. Defence in depth
    2. Least privilege
    3. Separation of duties
    4. Security through obscurity
    Show answer

    Answer: B. Least privilege

    Least privilege limits each account or process to the minimum rights it needs, so a compromise does less damage. Defence in depth layers controls, and separation of duties splits critical tasks between people.

  6. According to standard hardening guidance (as in Stallings), what should be done first with a newly installed server?

    1. Install a web application firewall
    2. Patch the operating system
    3. Run a penetration test
    4. Create user accounts for all staff
    Show answer

    Answer: B. Patch the operating system

    Stallings' sequence starts with installing and patching the OS, then removing unneeded services, configuring users and permissions, adding security controls and finally testing. An unpatched system exposed to a network can be compromised before the rest is done.

  7. Why is the sticky bit set on the /tmp directory?

    1. So users can create files there but delete or rename only their own
    2. So files in /tmp are deleted at every reboot
    3. So programs in /tmp run as root
    4. So /tmp cannot be written by anyone
    Show answer

    Answer: A. So users can create files there but delete or rename only their own

    /tmp is world-writable (1777). Without the sticky bit any user could delete others' files; with it, only a file's owner, the directory's owner or root can remove or rename a file.

  8. Which file on a modern Linux system stores password hashes, readable only by privileged users?

    1. /etc/shadow
    2. /etc/passwd
    3. /etc/group
    4. /etc/hosts
    Show answer

    Answer: A. /etc/shadow

    Password hashes moved from the world-readable /etc/passwd to /etc/shadow, which only root (and, on some distributions, the shadow group) can read. This blocks ordinary users from copying hashes for offline cracking.

  9. In octal Linux permissions, what values do read, write and execute have?

    1. r = 1, w = 2, x = 4
    2. r = 2, w = 4, x = 1
    3. r = 4, w = 2, x = 1
    4. r = 4, w = 1, x = 2
    Show answer

    Answer: C. r = 4, w = 2, x = 1

    Each permission is one bit: read is 4, write is 2 and execute is 1. Adding them gives one octal digit per class, so rwx = 7, r-x = 5 and rw- = 6.

  10. A student changes the ID in a URL and reads another student's marks, without gaining admin rights. What kind of escalation is this?

    1. Vertical privilege escalation
    2. Horizontal privilege escalation
    3. Denial of service
    4. Buffer overflow
    Show answer

    Answer: B. Horizontal privilege escalation

    The attacker stays at the same privilege level but acts as a different user, which is horizontal escalation. Vertical escalation would mean gaining higher rights, such as an administrator role.

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.