UNIX Security From UNIX SYSTEMS Programming, Robbins & Robbins Benjamin Brewster, OSU 2006.

Slides:



Advertisements
Similar presentations
Computer-System Structures Er.Harsimran Singh
Advertisements

Basic Unix system administration
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage.
OS2-1 Chapter 2 Computer System Structures. OS2-2 Outlines Computer System Operation I/O Structure Storage Structure Storage Hierarchy Hardware Protection.
1/21/2008CSCI 315 Operating Systems Design1 Operating System Structures Notice: The slides for this lecture have been largely based on those accompanying.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage.
Abhinav Kamra Computer Science, Columbia University 2.1 Operating System Concepts Silberschatz, Galvin and Gagne  2002 Chapter 2: Computer-System Structures.
1/26/2004CSCI 315 Operating Systems Design1 Operating System Structures Notice: The slides for this lecture have been largely based on those accompanying.
Computer System Structures memory memory controller disk controller disk controller printer controller printer controller tape-drive controller tape-drive.
Operating Systems 1 K. Salah Module 1.2: Fundamental Concepts Interrupts System Calls.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2: Computer-System Structures 1/31/03 Computer System Operation I/O Structure.
A. Frank - P. Weisberg Operating Systems Functional View of Operating System.
Operating system Structure and Operation
CCNA 2 v3.1 Module 2.
Chapter 2: Computer-System Structures
General System Architecture and I/O.  I/O devices and the CPU can execute concurrently.  Each device controller is in charge of a particular device.
Filesystem Hierarchy Standard (FHS) –Standard of outlining the location of set files and directories on a Linux system –Gives Linux software developers.
Chapter 1. Introduction What is an Operating System? Mainframe Systems
2.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java Chapter 2: Computer-System Structures Computer System Operation I/O Structure.
CHAPTER 2: COMPUTER-SYSTEM STRUCTURES Computer system operation Computer system operation I/O structure I/O structure Storage structure Storage structure.
Silberschatz, Galvin, and Gagne  Applied Operating System Concepts Module 2: Computer-System Structures Computer System Operation I/O Structure.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage.
Chapter 2: Computer-System Structures
Thanks to Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2 Computer-System Structures n Computer System Operation n I/O Structure.
1 CSE Department MAITSandeep Tayal Computer-System Structures Computer System Operation I/O Structure Storage Structure Storage Hierarchy Hardware Protection.
2: Computer-System Structures
Recall: Three I/O Methods Synchronous: Wait for I/O operation to complete. Asynchronous: Post I/O request and switch to other work. DMA (Direct Memory.
Cisco Routers Objectives –How to log into a Cisco router and determine basic settings. Contents –Differences in available methods of access. –Different.
Chapter 2: Computer-System Structures 2.1 Computer System Operation 2.5 Hardware Protection 2.6 Network Structure.
1 Chapter 2: Computer-System Structures  Computer System Operation  I/O Structure  Storage Structure  Storage Hierarchy  Hardware Protection  General.
Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage Structure Storage Hierarchy Hardware Protection Network Structure.
2.1 Operating System Concepts Chapter 2: Computer-System Structures Computer System Operation Storage Structure Storage Hierarchy Hardware Protection General.
Operating Systems Lecture November 2015© Copyright Virtual University of Pakistan 2 Agenda for Today Review of previous lecture Hardware (I/O, memory,
Operating System Structure A key concept of operating systems is multiprogramming. –Goal of multiprogramming is to efficiently utilize all of the computing.
We will focus on operating system concepts What does it do? How is it implemented? Apply to Windows, Linux, Unix, Solaris, Mac OS X. Will discuss differences.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
Operating Systems 1 K. Salah Module 1.2: Fundamental Concepts Interrupts System Calls.
1 CS.217 Operating System By Ajarn..Sutapart Sappajak,METC,MSIT Chapter 2 Computer-System Structures Slide 1 Chapter 2 Computer-System Structures.
Silberschatz, Galvin and Gagne  Applied Operating System Concepts Chapter 2: Computer-System Structures Computer System Architecture and Operation.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
BIT213,CISY Operating Systems 1
SCSC 455 Computer Security Chapter 3 User Security.
CS4315A. Berrached:CMS:UHD1 Operating Systems and Computer Organization Chapter 4.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage.
Chapter 2: Computer-System Structures(Hardware) or Architecture or Organization Computer System Operation I/O Structure Storage Structure Storage Hierarchy.
Chapter 2. Computer-System Structure Device controllers: synchronize and manage access to devices.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage.
Computer System Structures
Operating Systems Lecture 2.
Chapter 2: Computer-System Structures(Hardware)
Chapter 2: Computer-System Structures
Chapter 2: Computer-System Structures
Protection of System Resources
Chapter 8 File Security.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage.
Computer-System Architecture
Module 2: Computer-System Structures
Operating Systems Lecture 2.
Lecture Topics: 11/1 General Operating System Concepts Processes
Architectural Support for OS
Operating Systems Lecture 3.
Module 2: Computer-System Structures
Architectural Support for OS
CS 143A Principles of Operating Systems
Chapter 2: Computer-System Structures
Chapter 2: Computer-System Structures
Module 2: Computer-System Structures
Module 2: Computer-System Structures
Access Control and Audit
Presentation transcript:

UNIX Security From UNIX SYSTEMS Programming, Robbins & Robbins Benjamin Brewster, OSU 2006

Dual-Mode Operation Sharing system resources requires operating system to ensure that an incorrect program cannot cause other programs to execute incorrectly Provide hardware support to differentiate between at least two modes of operations 1.User mode – execution done on behalf of a user 2.Monitor mode (also supervisor mode or system mode) – execution done on behalf of operating system

Dual-Mode Operation Mode bit added to computer hardware to indicate the current mode: monitor (0) or user (1) When an interrupt or fault occurs hardware switches to monitor mode Privileged instructions can be issued only in monitor mode Interrupt/fault monitoruser set user mode

I/O Protection All I/O instructions are privileged instructions Must ensure that a user program could never gain control of the computer in monitor mode (I.e., a user program that, as part of its execution, stores a new address in the interrupt vector)

Memory Protection Must provide memory protection at least for the interrupt vector and the interrupt service routines In order to have memory protection, add two registers that determine the range of legal addresses a program may access: –base register – holds the smallest legal physical memory address. –Limit register – contains the size of the range Memory outside the defined range is protected

A Base and a Limit Register Define a Logical Address Space

Protection Hardware When executing in monitor mode, the operating system has unrestricted access to both monitor and user’s memory The load instructions for the base and limit registers are privileged instructions

CPU Protection Timer – interrupts computer after specified period to ensure operating system maintains control –Timer is decremented every clock tick –When timer reaches the value 0, an interrupt occurs Timer commonly used to implement time sharing Time also used to compute the current time Load-timer is a privileged instruction

General-System Architecture Given the I/O instructions are privileged, how does the user program perform I/O? System call – the method used by a process to request action by the operating system –Usually takes the form of a trap to a specific location in the interrupt vector –Control passes through the interrupt vector to a service routine in the OS, and the mode bit is set to monitor mode –The monitor verifies that the parameters are correct and legal, executes the request, and returns control to the instruction following the system call

Use of A System Call to Perform I/O

Acting as a different user User files are protected from other users by defining access based on accounts If you are logged in as an account with access (ie, you're the owner, or a a group owner), you can manipulate the file –chmod –group ids

Acting as a different user If you want to temporarily act as a different user (but stay logged on as yourself), you can use the su command: –su yoog –su - jack Runs all init scripts associated with logging in as yoog You'll need to know yoog 's login credentials

id revisited The id command prints out your user and group ids: % id uid=22026(brewstbe) gid=6009(upg22026) groups=6009(upg22026),12028(transfer)

id revisited The user and group ids are changed when using su You will now have different effective ids, as opposed to your real ids, which you still have –id can display both your real and effective ids

root Most UNIX systems have a super-user account, typically called root –su root As root, you can change file ownerships, in addition to many other things You effectively can change anything

Limits, for example As root, you can change /etc/security/limits.conf flip % cat /etc/security/limits.conf # … * hard nproc 30 On flip, everyone is strictly limited to 30 processes

SUID, SGID Each executible has two security bits associated with it: SUID, and SGID –If SUID is set, the executible runs with effective user ID of the owner of the file –If SGID is set, the executible runs with effective user ID of the group owner of the file

SUID, SGID This is different from before – we're now talking about specific executibles that have bits that enable them to run as different users –As opposed to being a different user, and then running programs, as su allows

S[U|G]ID Example % ls –pla /bin... -rwsr-xr-x 1 root root Jun su... s here means that the SUID bit is set An s here would mean that the SGID bit was set

S[U|G]ID Example % ls –pla /bin... -rwsr-xr-x 1 root root Jun su... In this example, su runs with root permissions –therefore, it can change things that only root can change, while not allowing the user to be root!

chmod revisited It turns out that there are twelve mode bits: – Setuid on execution – setgid on execution – set sticky bit – read by owner – write by owner – execute by owner – read by group – wr – execute by group – read by others – write by others – execute by others

What if… What if you replace the real su, which has SUID set and is owned by root, with your own code? –It would have the same permissions, but could do anything you want to the system

What if… What if you could set the SUID bit on your own file? –It would still be owned by you, and thus would run as you Not interesting Can you give your file to root? –No – this is specifically why you have to be logged in as root to change file ownership!

What to secure Following we'll list some things you can do to make your UNIX system more secure There's tons more than this… but what's the maximum security we could provide?

Strongest Security The strongest form of security involves: –Network isolation –Physical isolation

Physical Isolation Why is physical Isolation so important? Even if you disable local shell access, you still have to worry about: –Bootable devices (live CDs, flash drives, etc.) can boot a different OS that can access the hard drive of your computer –Hard drive could be stolen –etc.

Seriously, though Physical and Network isolation makes for a not-so-useful computer –Maybe you could use it for cryptography, or for storing really sensitive data Here are some other ways to secure your system, but still retain real functionality

Insecure Protocols Telnet, FTP Secure versions of these are SSH, and SFTP

Password Security Don't let users write them down Age the passwords Enforce stronger (but more annoying) passwords –1337: –random: Z1#3s8u*h –long: Restrict use of previous passwords Password dictionary check

Login Failures What happens if you don't lock a user account if too many failures happen? –A account can be brute forced How?

Password Encryption Pork sausage model (one-way): –username: Stonesand –password: lamepasswd a3R7nito5fo%r Store the pair Stonesand / a3R7nito5fo%r This encrypted pair is public knowledge, but the encryption method is one-way

Password Encryption If anyone knew how to reverse the password method, then they could go: –a3R7nito5fo%r -> lamepasswd Fortunately it is very hard to crack the one-way encryption Problem: why is storing the password file publicly still dangerous? –Brute force crack approach on a fast compy Hence non-public password file, and long passwords

Monitoring and Logs Finally, monitor everything with logs –Network –Account login/logout –Progam usage –Others

Getting root access when you're not supposed to have it… Try the front door first: ACCOUNT: PASSWORD root: root sys: sys / system / bin bin: sys / bin mountfsys: mountfsys adm: adm uucp: uucp nuucp: anon anon: anon user: user games: games install: install demo: demo umountfsys: umountfsys sync: sync admin: admin guest: guest daemon: daemon

Getting root access when you're not supposed to have it… After that, and assuming social engineering didn't work, you'll have to use fancy stuff –Port scans + port/program insecurities –Buffer overflows (with system access) –Boot Hacking (with physical access) Why are we talking about this stuff? –So you can protect yourself against it