Docsity

Understanding Least Privilege and Privilege Separation in Computer Security, Exams of Design

Partial preview of the text

Download Understanding Least Privilege and Privilege Separation in Computer Security and more Exams Design in PDF only on Docsity!

Deian Stefan Slides adopted from John Mitchell, Dan Boneh, and Stefan Savage

CSE 127: Computer Security

Least privilege and privilege separation

This week…

  • How to build secure systems ➤ (^) Least privilege and privilege separation ➤ (^) Sandboxing and isolation
  • Key is underlying principles not mechanisms ➤ (^) We’re going to look at systems techniques ➤ (^) Other ways to achieve similar goals: language-based

Principles of secure design

  • Principle of least privilege
  • Privilege separation
  • Defense in depth ➤ (^) Use more than one security mechanism ➤ (^) Fail securely/closed
  • Keep it simple

Principle of Least Privilege

Defn: A system should only have the minimal privileges needed for its intended purposes

  • What’s a privilege? ➤ (^) Ability to access (e.g., read or write) a resource

Principle of Least Privilege

Defn: A system should only have the minimal privileges needed for its intended purposes

  • What’s a privilege? ➤ (^) Ability to access (e.g., read or write) a resource

What’s the problem with this defn?

  • Talking about a huge, monolith system is not really useful
  • Why? Network User input File system Network User device File system

How dow we break things apart?

Map compartment to user ids!

  • Recall: permissions in UNIX granted according to UID ➤ (^) A process may access files, network sockets, ….
  • Each process has UID
  • Each file has ACL ➤ (^) Grants permissions to users according to UIDs and roles (owner, group, other) ➤ (^) Everything is a file!

Process UIDs

  • Real user ID (RUID) ➤ (^) same as the user ID of parent (unless changed) ➤ (^) used to determine which user started the process
  • Effective user ID (EUID) ➤ (^) from setuid bit on the file being executed, or syscall ➤ (^) determines the permissions for process
  • Saved user ID (SUID) ➤ (^) Used to save and restore EUID

Process UIDs

  • Real user ID (RUID) ➤ (^) same as the user ID of parent (unless changed) ➤ (^) used to determine which user started the process
  • Effective user ID (EUID) ➤ (^) from setuid bit on the file being executed, or syscall ➤ (^) determines the permissions for process
  • Saved user ID (SUID) ➤ (^) Used to save and restore EUID

Process UIDs

  • Real user ID (RUID) ➤ (^) same as the user ID of parent (unless changed) ➤ (^) used to determine which user started the process
  • Effective user ID (EUID) ➤ (^) from setuid bit on the file being executed, or syscall ➤ (^) determines the permissions for process
  • Saved user ID (SUID) ➤ (^) Used to save and restore EUID

SetUID demystified (a bit)

  • Root ➤ (^) ID=0 for superuser root; can access any file
  • fork and exec system calls ➤ (^) Inherit three IDs, except exec of file with setuid bit
  • setuid system call ➤ (^) seteuid(newid) can set EUID to ➤ (^) Real ID or saved ID, regardless of current EUID ➤ (^) Any ID, if EUID is root

SetUID demystified (a bit)

  • Root ➤ (^) ID=0 for superuser root; can access any file
  • fork and exec system calls ➤ (^) Inherit three IDs, except exec of file with setuid bit
  • setuid system call ➤ (^) seteuid(newid) can set EUID to ➤ (^) Real ID or saved ID, regardless of current EUID ➤ (^) Any ID, if EUID is root

SetUID demystified (a bit)

  • There are actually 3 bits: ➤ (^) setuid - set EUID of process to ID of file owner ➤ (^) setgid - set EGID of process to GID of file ➤ (^) sticky bit ➤ (^) on: only file owner, directory owner, and root can rename or remove file in the directory ➤ (^) off: if user has write permission on directory, can rename or remove files, even if not owner