CSC 482582 Computer Security Access Control CSC 482582

  • Slides: 55
Download presentation
CSC 482/582: Computer Security Access Control CSC 482/582: Computer Security

CSC 482/582: Computer Security Access Control CSC 482/582: Computer Security

Topics 1. What is Access Control? 2. Access Control Matrix Model 1. Protection State

Topics 1. What is Access Control? 2. Access Control Matrix Model 1. Protection State Transitions 2. Special Rights 3. Principle of Attenuation of Privilege 3. <<Access Control Matrix Activity>> 4. Groups and Roles 5. Implementation of the Access Control Matrix 1. Access Control Lists: by column (object). 2. Capabilities: by row (subject). 3. UNIX, Windows NT, and SQL ACLs. 6. Hardware Protection CSC 482/582: Computer Security

Why study Access Control? Center of gravity of computer security �Why do we authenticate

Why study Access Control? Center of gravity of computer security �Why do we authenticate users? �What security features do OSes provide? �What’s the purpose of cryptography? �Access Control is pervasive. Access Control is where Computer Science meets Security Engineering. �We’ll start with theory (computer science) �Then examine implementations (engineering) CSC 482/582: Computer Security

Access Control is Pervasive Application Middleware Operating System Hardware CSC 482/582: Computer Security

Access Control is Pervasive Application Middleware Operating System Hardware CSC 482/582: Computer Security

Access Control is Pervasive Application 1. • • Complex, custom security policy. Ex: Amazon

Access Control is Pervasive Application 1. • • Complex, custom security policy. Ex: Amazon account: wish list, reviews, CC Middleware 2. • • Database, system libraries, 3 rd party software Ex: Credit card authorization center Operating System 3. • File ACLs, IPC 4. Hardware • Memory management, hardware device access. CSC 482/582: Computer Security

Access Control Matrix Precisely describes protection state of system. P Q Sets of system

Access Control Matrix Precisely describes protection state of system. P Q Sets of system states: – P: Set of all possible states. – Q: Set of allowed states, according to security policy. – P-Q: Set of disallowed states. ACM describes the set of states Q. CSC 482/582: Computer Security

Access Control Matrix As system changes, state changes. �State transitions. �Only concerned with protection

Access Control Matrix As system changes, state changes. �State transitions. �Only concerned with protection state. ACM must be enforced by a mechanism that limits state transitions to those that go from one element of Q to another. CSC 482/582: Computer Security

ACM Description objects (entities) o 1 … om s 1 … sn subjects s

ACM Description objects (entities) o 1 … om s 1 … sn subjects s 1 s 2 … sn CSC 482/582: Computer Security �Objects O = { o 1, …, om } � All protected entities. �Subjects S = { s 1, …, sn } � Active entities, S O �Rights R = { r 1, …, rk } �Entries A[si, oj] R �A[si, oj] = { rx, …, ry } means subject si has rights rx, …, ry over object oj

Example: File/Processes p, q Files f, g Rights r, w, x, a, o p

Example: File/Processes p, q Files f, g Rights r, w, x, a, o p q f rwo a CSC 482/582: Computer Security g r ro p rwxo r q w rwxo

Copy Right Allows possessor to give rights to another Often attached to a right,

Copy Right Allows possessor to give rights to another Often attached to a right, so only applies to that right �r is read right that cannot be copied �rc is read right that can be copied Is copy flag copied when giving r rights? �Depends on model, instantiation of model CSC 482/582: Computer Security

Ownership Right Usually allows possessor to change entries in ACM column �So owner of

Ownership Right Usually allows possessor to change entries in ACM column �So owner of object can add, delete rights for others �May depend on what system allows � Can’t give rights to specific (set of) users � Can’t pass copy flag to specific (set of) users CSC 482/582: Computer Security

Attenuation of Privilege Principle: Subject may not give rights it does not possess to

Attenuation of Privilege Principle: Subject may not give rights it does not possess to another. �Restricts addition of rights within a system �Usually ignored for owner � Why? Owner gives herself rights, gives them to others, deletes her rights. CSC 482/582: Computer Security

How can we implement the ACM? Problem: scale �Thousands of subjects. �Millions of objects.

How can we implement the ACM? Problem: scale �Thousands of subjects. �Millions of objects. �Yet most entries are blank or default. Solutions �Group subjects together as a single entities � Groups and Roles �Implement by row: Capabilities �Implement by column: Access Control Lists CSC 482/582: Computer Security

Groups and Roles Collect subjects together to express: �Need to share objects. �Security categories

Groups and Roles Collect subjects together to express: �Need to share objects. �Security categories (e. g. , admin, faculty, student, guest) role: group that ties membership to function Problem: loss of granularity. CSC 482/582: Computer Security

Capabilities Implement ACM by row. Access Control associated with subject. Example: UNIX file descriptors

Capabilities Implement ACM by row. Access Control associated with subject. Example: UNIX file descriptors �System checks ACL on file open, returns fd. �Process subsequently uses fd to read and write file. �If ACL changes, process still has access via fd. User ls homedir rootdir james rx rw r CSC 482/582: Computer Security

Capability Questions 1. 2. 3. How to prevent user from modifying capabilities? How to

Capability Questions 1. 2. 3. How to prevent user from modifying capabilities? How to prevent user from copying capabilities? How to revoke rights to an object? CSC 482/582: Computer Security

How to prevent user from modifying? Memory protection �Capabilities are readable, but not writable.

How to prevent user from modifying? Memory protection �Capabilities are readable, but not writable. Indirection �Capability is pointer to per-process table whose access control prevents user from touching. Cryptography �Cryptographically secure checksum associated with capability and checked before usage. CSC 482/582: Computer Security

How to prevent user from copying? Copying capabilities allows users to grant rights to

How to prevent user from copying? Copying capabilities allows users to grant rights to others. Solution: �Use indirection or cryptographic techniques from prev slide to prevent direct access. �Add copy flag to capability, as a specific right given to copy capabilities in order to give rights to other users. CSC 482/582: Computer Security

How to revoke rights to an object? Direct solution �Check capabilities of every process.

How to revoke rights to an object? Direct solution �Check capabilities of every process. �Remove those that grant access to object. �Computationally expensive. Alternative solution �Create a global object table. �Capabilities reference objects indirectly via their entries in the global object table. �Invalidate entry in global object table to revoke. CSC 482/582: Computer Security

Access Control Lists (ACLs) Implement ACM by column. Access control by object. Example: UNIX

Access Control Lists (ACLs) Implement ACM by column. Access control by object. Example: UNIX ACLs �Short “rwx” user/group/other. �Long POSIX ACLs. User audit data root rw james r joe CSC 482/582: Computer Security

ACL Questions 1. 2. 3. 4. 5. 6. Which subjects can modify an object’s

ACL Questions 1. 2. 3. 4. 5. 6. Which subjects can modify an object’s ACL? Do ACLs apply to privileged users? Do ACLs support groups and wildcards? How are ACL conflicts resolved? What are default permissions? How can a subject’s rights be revoked? CSC 482/582: Computer Security

Which subjects can modify an ACL? Create an own right for an ACL. �Only

Which subjects can modify an ACL? Create an own right for an ACL. �Only subjects with own right can modify ACL. Creating an object also creates object’s ACL. �Usually creator given own right at this time. �Other default rights may be set at creation too. Some systems allow anyone with access to object to modify ACL. �What are the security implications of sharing access to a file on such a system? CSC 482/582: Computer Security

Do ACLs apply to privileged users? Many systems have privileged users. �UNIX: root. �Windows

Do ACLs apply to privileged users? Many systems have privileged users. �UNIX: root. �Windows NT: administrator. Should ACLs apply to privileged users? �Need read access to all objects for backups. �What security problems are produced by ignoring ACLs for privileged users? CSC 482/582: Computer Security

How are ACL conflicts resolved? What happens when multiple ACL entries give different permissions

How are ACL conflicts resolved? What happens when multiple ACL entries give different permissions to same subject? �First entry wins. �Last entry wins. �Deny wins over allow. CSC 482/582: Computer Security

What are the default permissions? Interaction of ACLs with base permissions. �POSIX ACLs modify

What are the default permissions? Interaction of ACLs with base permissions. �POSIX ACLs modify UNIX base permissions. How are default ACLs determined? �Subject � Subject sets default permissions, like UNIX umask. �Inheritance � Objects in hierarchical system inherit ACLs of parent object. � Subjects inherit sets of default permissions from their parent subjects. CSC 482/582: Computer Security

How are rights revoked? Removal of subject’s rights to object. �Delete entries for subject

How are rights revoked? Removal of subject’s rights to object. �Delete entries for subject from ACL. �If ownership doesn’t control granting rights, matters can be complex: � If A has granted rights to B, what should happen to B’s rights if you remove A’s rights? Removal of subject’s rights to all objects. �Very expensive (millions of objects. ) �Most systems don’t support. �Why isn’t disabling subject’s account sufficient? CSC 482/582: Computer Security

ACLs vs Capabilities ACLs Capabilities • Slow: OS has to read ACL for each

ACLs vs Capabilities ACLs Capabilities • Slow: OS has to read ACL for each object accessed. • Easy to find/change rights on a particular object. • Difficult to revoke privileges for a specific subject. • Fast: OS always knows subject identity. • Easy to find/change rights on a particular subject. • Difficult to revoke privileges to a subject object. CSC 482/582: Computer Security

UNIX Access Control Model UID �integer user ID �UID=0 is root GID �integer group

UNIX Access Control Model UID �integer user ID �UID=0 is root GID �integer group ID �Users can belong to multiple groups Objects have both a user + group owner. System compares object UID with EUID. �EUID identical except after su or SETUID. CSC 482/582: Computer Security

UNIX File Permissions Three sets of permissions: �User owner �Group owner �Other (everyone else)

UNIX File Permissions Three sets of permissions: �User owner �Group owner �Other (everyone else) Three permissions per group �read �write �execute UID 0 can access regardless of permissions. Files: directories, devices (disks, printers), IPC CSC 482/582: Computer Security

UNIX File Permissions Best-match policy �OS applies permission set that most closely matches. �You

UNIX File Permissions Best-match policy �OS applies permission set that most closely matches. �You can be denied access by best match even if you match another set. Directories �read = listing of directory �execute = traversal of directory �write = add or remove files from directory CSC 482/582: Computer Security

Special File Permissions Each object has set of special permission bits sticky � On

Special File Permissions Each object has set of special permission bits sticky � On a directory, means users can only delete files that they own setuid � Execute program with EUID = owner’s UID setgid � Execute program with EGID = owner’s GID � On directories, causes default group owner to be that of directory owner’s GID. CSC 482/582: Computer Security

Changing Permissions: chmod Set specifiers �u = user �g = group �o = other

Changing Permissions: chmod Set specifiers �u = user �g = group �o = other Permissions �r = read # remove other access chmod o-rwx *. c # add group r/w access chmod g+rw *. c �w = write # allow only you access �x = execute chmod u=rwx * CSC 482/582: Computer Security

Octal Permission Notation Each set (u, g, o) is represented by an octal digit.

Octal Permission Notation Each set (u, g, o) is represented by an octal digit. Each permission (r, w, x) is one bit within a digit. ex: chmod 0644 file u: rw, g: r, o: r ex: chmod 0711 bin u: rwx, g: x, o: x CSC 482/582: Computer Security 4 read setuid 2 write setgid 1 execute sticky

Changing Ownership newgrp �Group owner of files is your default group. �Changes default group

Changing Ownership newgrp �Group owner of files is your default group. �Changes default group to another group to which you belong. chgrp �Changes group owner of existing file. chown �Changes owner of existing file. �Only root can use this command. CSC 482/582: Computer Security

Default Permissions: umask Determines permissions given to newly created files Three-digit octal number �Programs

Default Permissions: umask Determines permissions given to newly created files Three-digit octal number �Programs default to 0666 �Umask modifies to: 0666 & ~umask �ex: umask=022 => file has mode 0644 �ex: umask=066 => file has mode 0600 CSC 482/582: Computer Security

setuid/setgid Solution to UNIX ACLs inability to directly handle (user, program, file) triplets. Process

setuid/setgid Solution to UNIX ACLs inability to directly handle (user, program, file) triplets. Process runs with EUID/EGID of file, not of user who spawned the process. Follow principle of least privilege �create special user/groups for most purposes Follow principle of separation of privilege �keep setuid functions/programs small �drop privileges when unnecessary CSC 482/582: Computer Security

Limitations of Classic ACLs ACL control list only contains 3 entries �Limited to one

Limitations of Classic ACLs ACL control list only contains 3 entries �Limited to one user. �Limited to one group. Root (UID 0) can do anything. CSC 482/582: Computer Security

POSIX Extended ACLs Supported by most UNIX/Linux systems. �Slight syntax differences may exist. getfacl

POSIX Extended ACLs Supported by most UNIX/Linux systems. �Slight syntax differences may exist. getfacl setfacl �chmod 600 file �setfacl -m user: gdoor: r-- file �File unreadable by other, but ACL allows gdoor CSC 482/582: Computer Security

Immutable Files on Linux �chattr +i �Cannot delete, rename, write to, link to �Applies

Immutable Files on Linux �chattr +i �Cannot delete, rename, write to, link to �Applies to root too �Only root can remove immutable flag Immutable Files on Free. BSD �chflags +noschg �Cannot be removed by root in securelevel >0 CSC 482/582: Computer Security

Host-based Access Control /etc/hosts. allow and /etc/hosts. deny used by tcpd, sshd, other servers

Host-based Access Control /etc/hosts. allow and /etc/hosts. deny used by tcpd, sshd, other servers Identify subjects by �hostname �IP address �network address/mask �Allow before Deny �use last rule in /etc/hosts. deny to deny all CSC 482/582: Computer Security

Windows NT Access Control Security IDs (SIDs) �users �groups �hosts Token: user SID +

Windows NT Access Control Security IDs (SIDs) �users �groups �hosts Token: user SID + group SIDs for a subject ACLs on �files and directories �registry keys �many other objects: printers, IPC, etc. CSC 482/582: Computer Security

Standard NT Permissions Read: read file or contents of a directory Write: create or

Standard NT Permissions Read: read file or contents of a directory Write: create or write files and directories Read & Execute: read file and directory attributes, view directory contents, and read files within directory. List Folder Contents: RX, but not inherited by files within a folder. Modify: delete, write, read, and execute. Full Control: all, including taking ownership and changing permissions CSC 482/582: Computer Security

Windows NT Conflict Resolution 1. 2. 3. If user not present in ACL and

Windows NT Conflict Resolution 1. 2. 3. If user not present in ACL and not a member of any group in ACL, access is denied. If ACL explicitly denies user access, access is denied. Otherwise, if user named in ACL, user has union of set of rights from each ACL entry in which user is named. CSC 482/582: Computer Security

Special NT Permissions Traverse Folder/Execute File List Folder/Read Data Read Attributes Read Extended Attributes

Special NT Permissions Traverse Folder/Execute File List Folder/Read Data Read Attributes Read Extended Attributes Create Files/Write Data Create Folders/Append Data Write Attributes Write Extended Attributes Delete Subfolders and Files Delete Read Permissions Change Permissions Take Ownership CSC 482/582: Computer Security

SQL Access Control Subjects �Users. �Roles. create role faculty grant faculty to james Objects

SQL Access Control Subjects �Users. �Roles. create role faculty grant faculty to james Objects �Databases, table columns. Rights �Select, insert, update, delete, references, grant. CSC 482/582: Computer Security

SQL Access Control The grant command gives access to a user grant select on

SQL Access Control The grant command gives access to a user grant select on students to james or a role: grant select, insert, update on grades to faculty and includes power to grant options: grant insert on students to registrar with grant option The revoke command removes access remove insert on grades from faculty CSC 482/582: Computer Security

Hardware Protection Confidentiality �Processes cannot read memory space of kernel or of other processes

Hardware Protection Confidentiality �Processes cannot read memory space of kernel or of other processes without permission. Integrity �Processes cannot write to memory space of kernel or of other processes without permission. Availability �One process cannot deny access to CPU or other resources to kernel or other processes. CSC 482/582: Computer Security

Hardware Mechanisms: VM Each process has its own address space. �Prevents processes from accessing

Hardware Mechanisms: VM Each process has its own address space. �Prevents processes from accessing memory of kernel or other processes. � Attempted violations produce page fault exceptions. �Implemented using a page table. �Page table entries contain access control info. � Read � Write � Execute (not separate on Intel CPUs) � Supervisor (only accessible in supervisor mode) CSC 482/582: Computer Security

VM Address Translation CSC 482/582: Computer Security

VM Address Translation CSC 482/582: Computer Security

Hardware Mechanisms: Rings Protection Rings. �Lower number rings have more rights. �Intel CPUs have

Hardware Mechanisms: Rings Protection Rings. �Lower number rings have more rights. �Intel CPUs have 4 rings � Ring 0 is supervisor mode. � Ring 3 is user mode. � Most OSes do not use other rings. �Multics used 64 protection rings. � Different parts of OS ran in different rings. � Procedures of same program could have different access rights. CSC 482/582: Computer Security

Hardware: Privileged Instructions Only can be used in supervisor mode. Setting address space �MOV

Hardware: Privileged Instructions Only can be used in supervisor mode. Setting address space �MOV CR 3 Enable/disable interrupts �CLI, STI Reading/writing to hardware �IN, OUT Switch from user to supervisor mode on interrupt. CSC 482/582: Computer Security

Hardware: System Timer Processes can voluntarily give up control to OS via system calls

Hardware: System Timer Processes can voluntarily give up control to OS via system calls to request OS services. �SYSENTER, INT 2 e Timer interrupt �Programmable Interval Timer chip. �Happens every 1 -100 OS, depending on OS. �Transfers control from process to OS. �Ensures no process can deny availability of machine to kernel or other processes. CSC 482/582: Computer Security

Why is Access Control hard? Complex Objects �Identifying objects of interest. � Is your

Why is Access Control hard? Complex Objects �Identifying objects of interest. � Is your choice of objects too coarse or fine-grained? �Hierarchical structure like filesystem or XML Subjects are Complex �Identifying subjects of interest. �What are the relationships between subjects? Access Control states change. Security objectives often unclear. CSC 482/582: Computer Security

Key Points 1. Center of gravity of security; pervasive. 2. Access Control Matrix simplest

Key Points 1. Center of gravity of security; pervasive. 2. Access Control Matrix simplest abstraction mechanism for representing protection state. 3. ACM is too big, so real systems use either: 1. ACLs: columns (objects) of ACM. 2. Capabilities: rows (subjects) of ACM. 4. Access Control in Practice: UNIX. 5. Access control rests on hardware foundation. Virtual memory, rings, privileged instructions. CSC 482/582: Computer Security

References Anderson, Ross, Security Engineering, 2 nd edition, Wiley, 2008. 2. Bishop, Matt, Introduction

References Anderson, Ross, Security Engineering, 2 nd edition, Wiley, 2008. 2. Bishop, Matt, Introduction to Computer Security, Addison-Wesley, 2005. 3. Bovet, Daniel and Cesati, Marco, Understanding the Linux Kernel, 2 nd edition, O’Reilly, 2003. 4. Silberschatz, et. al. , Database System Concepts, 4 th edition, Mc. Graw-Hill, 2002. 5. Silberschatz, et. al. , Operating System Concepts, 7 th edition, Wiley, 2005. 6. Viega, John, and Mc. Graw, Gary, Building Secure Software, Addison-Wesley, 2002. 1. CSC 482/582: Computer Security