Authorization and Identity

Slides:



Advertisements
Similar presentations
Linux Users and Groups Management
Advertisements

Access Control Jeff Chase Duke University. The need for access control Processes run programs on behalf of users. (“subjects”) Processes create/read/write/delete.
Chapter 9 Chapter 9: Managing Groups, Folders, Files, and Object Security.
Bilkent University Department of Computer Engineering
Unix Security Issues Process Creation/Space Users and Groups File Permissions Relationship of Program and File Security.
CMSC 414 Computer and Network Security Lecture 10 Jonathan Katz.
1 CSE 380 Computer Operating Systems Instructor: Insup Lee and Dianna Xu University of Pennsylvania Fall 2003 Lecture Note: Protection Mechanisms.
Chapter 14: Protection.
Sharing Files Richard Newman based on Smith “Elementary Information Security”
Lecture 7 Access Control
Lecture slides prepared for “Computer Security: Principles and Practice”, 2/e, by William Stallings and Lawrie Brown, Chapter 4 “Overview”.
CS-550 (M.Soneru): Protection and Security - 2 [SaS] 1 Protection and Security - 2.
Protection, identity, and trust Jeff Chase Duke University.
UNIX! Landon Cox September 3, Dealing with complexity How do you reduce the complexity of large programs? Break functionality into modules Goal.
Managing User Accounts. Module 2 – Creating and Managing Users ♦ Overview ► One should log into a Linux system with a valid user name and password granted.
Controlling Files Richard Newman based on Smith “Elementary Information Security”
D u k e S y s t e m s CPS 210 Security in Networked Systems Always Use Protection Jeff Chase Duke University
Protection, identity, and trust Jeff Chase Duke University.
Announcements Assignment 3 due. Invite friends, co-workers to your presentations. Course evaluations on Friday.
Module 4 - File Security. Security Overview File Ownership Access to Files and Dircetories Changing File and Directory Ownership Changing File and Directory.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 14: Protection.
G53SEC 1 Access Control principals, objects and their operations.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 18: Protection Goals of Protection Objects and Domains Access Matrix Implementation.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Protection (Chapter 14)
CE Operating Systems Lecture 21 Operating Systems Protection with examples from Linux & Windows.
Chapter 10: Rights, User, and Group Administration.
Linux Security. Authors:- Advanced Linux Programming by Mark Mitchell, Jeffrey Oldham, and Alex Samuel, of CodeSourcery LLC published by New Riders Publishing.
Security CS Introduction to Operating Systems.
UNIX System Protection. Unix History Developed by Dennis Ritchie and Ken Thompson at AT&T Bell Labs Adapted some ideas from the Multics project in 1969.
1 Chapter Overview Managing Object and Container Permissions Locating and Moving Active Directory Objects Delegating Control Troubleshooting Active Directory.
COEN 350: Network Security Authorization. Fundamental Mechanisms: Access Matrix Subjects Objects (Subjects can be objects, too.) Access Rights Example:
Access Control Lesson Introduction ●Understand the importance of access control ●Explore ways in which access control can be implemented ●Understand how.
Chapter 14: Protection Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Apr 11, 2005 Goals of Protection Operating.
Introduction to AFS IMSA Intersession 2003 An Overview of AFS Brian Sebby, IMSA ’96 Copyright 2003 by Brian Sebby, Copies of these slides.
The UNIX Time-Sharing System Landon Cox February 10, 2016.
CSE Operating System Principles Protection.
Protection, identity, and trust Illustrated with Unix “setuid” Jeff Chase Duke University.
Information Flow Control for Standard OS Abstractions Landon Cox April 6, 2016.
2Operating Systems  Program that runs on a computer  Manages hardware resources  Allows for execution of programs  Acts as an intermediary between.
Company LOGO Security in Linux PhiHDN - VuongNQ. Contents Introduction 1 Fundamental Concepts 2 Security System Calls in Linux 3 Implementation of Security.
Privileges: who can control what
SE Linux Implementation Russell Coker. What is SE Linux? A system for Mandatory Access Control (MAC) based on the Linux Security Modules (LSM) framework.
File permissions Operating systems I800
Operating Systems Protection Alok Kumar Jagadev.
Chapter 14: System Protection
Chapter 14: Protection.
Chapter 6 Integrity Policies
Computer Data Security & Privacy
The UNIX Time-Sharing System
Chapter 14: Protection.
Linux Users and Groups Management
Chapter 14: Protection.
Chapter 14: Protection.
CE Operating Systems Lecture 21
Chapter 14: Protection.
Chapter 14: Protection.
UNIX System Protection
Security and File Permission
Chapter 14: Protection.
Information Flow Control for Standard OS Abstractions
Chapter 14: Protection.
Chapter 14: Protection.
Information Security CS 526 Topic 16
Chapter 29: Program Security
Chapter 14: Protection.
Rootly Powers Chapter 3.
Chapter 14: Protection.
Preventing Privilege Escalation
Isolation Enforced by the Operating System
Access Control and Audit
Presentation transcript:

Authorization and Identity Based on slides provided by Jeff Chase and Landon Cox

Unix uid (user identifier) Users have unique user identifiers (uids), e.g. bmm is 3371 Every process runs “as” some uid When a user logs in, uid for shell (e.g., bash) is set to the user’s uid. When a new process runs, by default uid for the process is inherited from the process that launched it.

Access Control through uid System calls check uid to see if user has privileges to perform certain operations. E.g., in general for process running as uid = 3371, system call “unlink” won’t delete a file whose owner is uid = 2642. System calls may grant special privileges to certain uids, e.g., uid = 0 is root.

setuid system call Sometimes it’s convenient to change process uid #include <sys/types.h> #include <unistd.h> int setuid(uid_t uid); Sometimes it’s convenient to change process uid Function setuid does this if current uid = 0 Example: login changes uid from 0 to 3371 (bmm) setuid is used to reduce privileges

The setuid bit: another way to setuid The mode bits on a program file may be tagged to setuid to owner’s uid on exec*. This is called setuid bit. Some call it the most important innovation of Unix. It enables users to request protected ops by running secure programs that execute with the uid of the program owner, and not the caller of exec*. The user cannot choose the code: only the program owner can choose the code to run with the program owner’s uid. Parent cannot subvert/control a child after program launch: a property of Unix exec*. Example: sudo program runs as root, checks user authorization to act as superuser, and (if allowed) executes requested command as root.

Unix setuid: two mechanisms Alice Refine the privilege of this process (using setuid syscall). Root (admin/superuser) uid = “root” setuid(“alice”) login exec tool uid=“root” shell uid=“alice” creat(“power”) write(…) chmod(+x,setuid=true) fork uid=“alice” shell power exec(“power”) owner=“root” 755 (exec perm) setuid bit = true uid=“root”!!!! Amplify/escalate the privilege of processes running this trusted program (using setuid bit). open(“secret”) power secret read, write… owner=“root”, 600

running as root vs. protected mode These mechanisms are orthogonal! When a new process is launched with uid = 0, by default execution begins in user mode, not protected mode. Switch to protected mode on trap, exception, interrupt. Note: if superuser wants to run arbitrary code in protected mode, can modify the kernel, which is owned by uid 0.

Access control Insight: sometimes simple inheritance of uids is insufficient Tasks involving management of “user id” state Logging in (login) Changing passwords (passwd) Why isn’t this code just inside the kernel? This functionality doesn’t really require interaction w/ hardware Would like to keep kernel as small as possible (less code run in protected mode!) How are “trusted” user-space processes identified? Run as super user or root (uid 0) Like a software kernel mode If a process runs under uid 0, then it has more privileges

Access control Why does login need to run as root? Needs to check username/password correctness Needs to fork/exec process under another uid Why does passwd need to run as root? Needs to modify password database (file) Database is shared by all users What makes passwd particularly tricky? Easy to allow process to shed privileges (e.g., login) passwd requires an escalation of privileges How does UNIX handle this? Executable files can have their setuid bit set If setuid bit is set, process inherits uid of image file’s owner on exec

Access control How does kernel know if system call is allowed? Looks at user id (uid) of process making the call Looks at resources accessed by call (e.g., file or pipe) Checks access-control policy associated with resource Decides if policy allows uid to access resources How is a uid normally assigned to a process? On fork, child inherits parent’s uid

MOO accounting problem Multi-player game called Moo Want to maintain high score in a file Should players be able to update score? Yes Do we trust users to write file directly? No, they could lie about their score Game client (uid x) “x’s score = 10” High score “y’s score = 11” Game client (uid y)

MOO accounting problem Multi-player game called Moo Want to maintain high score in a file Could have a trusted process update scores Is this good enough? Game client (uid x) “x’s score = 10” Game server High score “x:10 y:11” “y’s score = 11” Game client (uid y)

MOO accounting problem Multi-player game called Moo Want to maintain high score in a file Could have a trusted process update scores Is this good enough? Can’t be sure that reported score is genuine Need to ensure score was computed correctly Game client (uid x) “x’s score = 100” Game server High score “x:100 y:11” “y’s score = 11” Game client (uid y)

MOO accounting problem Multi-player game called Moo Want to maintain high score in a file How does setuid solve our problem? Game executable is owned by trusted entity Game cannot be modified by normal users Users can run executable though High-score is also owned by trusted entity This is a form of trustworthy computing Only trusted code can update score Root ownership ensures code integrity Untrusted users can invoke trusted code Shell (uid x) Game client (uid moo) “fork/exec game” “x’s score = 10” High score (uid moo) “y’s score = 11” Shell (uid y) Game client (uid moo) “fork/exec game”

Concept: access control matrix We can imagine the set of all allowed accesses for all subjects over all objects as a huge matrix. obj1 obj2 Alice RW --- Bob R RW How is the matrix stored?

Concept: ACLs and capabilities How is the matrix stored? ACL obj1 obj2 Alice RW --- capability list Bob R RW Capabilities: each subject holds a list of its rights and presents them as proof of access rights. In many systems, a capability is an unforgeable reference/token that confers specific rights to access a specific object. Access control list (ACL): each object stores a list of identifiers of subjects permitted to access it.

Concept: roles or groups roles, groups objects wizard student obj1 obj2 Alice yes no wizard RW --- Bob no yes student R RW A role or group is a named set S of subjects. Or, equivalently, it is a named boolean predicate that is true for subject s iff s  S. Roles/groups provide a level of indirection that simplifies the access control matrix, and makes it easier to store and manage.

File permissions in Unix (vanilla) The owner of a Unix file may tag it with a “mode” value specifying access rights for subjects. (Don’t confuse with kernel/user mode.) Unix “mode bits” are a simple/compressed form of an access control list (ACL). Later systems like AFS and AWS have richer ACLs. Subject types = {owner, group, other/anyone} [3 subject types] Access types = {read, write, execute} [3 bits for each of 3 subject types] If the file is executed, should the system setuid the process to the userID of the file’s owner. [1 bit, the setuid bit] 10 mode bits total: (3x3)+1. Usually given in octal: e.g., “777” means all 9 bits are set: anyone can r/w/x the file, but no setuid. Unix provides a syscall for owner to set the owner, group, and mode on each file (inode). A command utility of the same name calls it. chmod, chown, chgrp on file or directory “Group” was added later and is a little more complicated: a user may belong to multiple groups.

Unix file accessmode bits

Using the Unix access mode bits A simple example Bob wants to read file foo. Owner=Alice, group=students, mode 640 The owner of file foo is Alice, and the file is associated with the group students. Is Bob Alice? No. So the owner bits don’t apply. Is Bob in the group students? Yes: group members have access “4”: the read is permitted. No: Bob is “other”. “Other” has access “0”: the read is rejected.

Trusting Programs In Unix You trust these programs. Programs you run use your identity (process UID). Maybe you even saved them with setuid so others who trust you can run them with your UID. The programs that run your system run as root. You trust these programs. They can access your files send mail, etc. Or take over your system… Where did you get them?

Any program you install or run can be a Trojan Horse vector for a malware payload.

Rootkit If an attacker obtains root or subverts/compromises the kernel (Trusted Computing Base), then all bets are off. The machine is “rooted”: the attacker has full control. Attacker may install a rootkit: software that maintains continuous and/or undetectable control. A rootkit can: Log keystrokes Hook system APIs Open attacker backdoor Subvert (re)boot Etc….

Trusting Trust Perhaps you wrote them yourself. Or at least you looked at the source code… You built them with tools you trust. But where did you get those tools?

Where did you get those tools? Thompson’s observation: compiler hacks cover tracks of Trojan Horse attacks.

Login backdoor: the Thompson Way Step 1: modify login.c (code A) if (name == “ken”) login as root This is obvious so how do we hide it? Step 2: modify C compiler (code B) if (compiling login.c) compile A into binary Remove code A from login.c, keep backdoor This is now obvious in the compiler, how do we hide it? Step 3: distribute a buggy C compiler binary (code C) if (compiling C compiler) compile code B into binary No trace of attack in any (surviving) source code