Unix Security Model
Unix Security Model
• Access control subjects are users (objects belong to users, users • Has UID 0
delegate access to their objects to other subjects)
• Can bypass access controls
• Users run processes to do things. Processes belong to users
• Has other rights in the system (capabilities) — can configure
• Processes run by user have the same privileges as the user does devices, network stack, mount filesystems etc
• Internally, users are identified by numeric user ID (UID) • Can change the ownership of current process (login!)
• There are no other ways for accessing objects • Can change file ownership
– Hardware protection • Can arbitrarily change file groups
– Protected operating system with well-defined interface to
• Can create and remove users and groups
user programs
• Can install and modify any software
• Normal users need a gateway to privileged operations (e.g. • Fixed structure ACL — there are always entries for owner, one
change your password in system password database) group of users and the rest of users
• Normally processes run with the rights of executing user, • For each subject in ACL 3 permission bits are present:
independent on whoever owns the file r — read 4
• Setuid programs run with the effective uid of the owner of the w — write 2
file (often root) x — execute 1
• Setgid programs run with effective group being set to program • r w x r - x - - - = 0750 (octal representation!!!)
file’s group (whether ot not the user belongs to the group)
• ACL only protects one object — no influence to objects in
• "Gateways to other user accounts" — security critical subdirectories, each of them has their own permission bits
components
– Minimize the amount of setuid programs
– We still need some of them
• umask — bitmap of permissions that newly created files must • Each process has UID, GID ("real UID, real GID")
not have
• EUID, EGID — effective UID and GID
• Example: – Usually the same as UID and GID
– Process does open("file.txt", O_RDWR, 0666) – Setuid/setgid programs affect these ID-s
– If umask=000, file would have permissions rw-rw-rw-
• Saved UID, saved GID — for swithing between 2 ID-s ("drop and
– If umask=027, file would have permissions rw-r----- regain root privileges in setuid root program")
• At user logon, root-owned process sets group list and all the
UID and GID info for the process (changing EUID last)
• Try to express the following with Unix permission bits: • Halfway standardized ACL model for Unix system (POSIX
– Owner has rw dropped the standard)
• Or, a more common example for users’ public_html directories • ACL mask for all ACL entries
– Owner has rwx • Default ACL-s for directories (copied into ACL-s of newly created
– Web server user has --x objects)
– No other users or groups have any permissions • Only positive permissions, no denying ACL entries
• So we need more flexible ACL-s (Access Control Lists) • NFS version 4 network file system makes use of
Windows-compatible ACL-s with negative ACL entries too and
this is also used in some file systems
• Subjects (users, groups, computers) are identified by SID • Each named object and some unnamed objects have security
(Security ID) descriptor — owner, group, ACL-s
– S-1-5-21-2025429065-492874223-1748137768-500
• Lots of different object types, including
• SAM (Security Account Manager) — keeps database of users – Files, directories
and performs authentication
– Processes, threads
• On login, user’s SID and SID-s of all his groups are added to his
– Windows
process
– Login sessions
• Process security token contains user and group SID-s, SID of
– Named pipes, semaphores, other IPC
the logon session, list of system-wide privileges granted to user
– Registry keys
• These security tokens are inherited to subprocesses
• Threads can have different security token (to impersonate
remote users for some local services)
• System privileges
• Two types of ACL-s: containers and objects • First steps in MAC (Mandatory Access Controls) — additional
restrictions to the standard discretionary ACL
• Objects in containers inherit their ACL from container
• Processes have trustworhiness level, objects have integrity level
• ACL is set by the user and delegates access
• Objects: files, registry keys, windows (for sending window
• System ACL is set by system administrator and regulates
messages for interaction)
auditing
• Can isolate different processes of the same user one from
• Missing ACL means full access
another
• Present but empty ACL means no access – Internet Explorer protected mode
• ACLs can have negative entries ("no access") • Stored in system ACL
• Inheritance flags — "no ACL here, look at the parent"