TOCTTOU Vulnerabilities in UNIX-Style File Systems BY: Mayank Ladoia.

Slides:



Advertisements
Similar presentations
TOCTTOU Attacks Don Porter CS 380S
Advertisements

Operating System Type of Operating System
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License. Unix system calls (part 2)
Operating system services Program execution I/O operations File-system manipulation Communications Error detection Resource allocation Accounting Protection.
1 Introduction to UNIX Ke Liu
Exploring the UNIX File System and File Security
Files. System Calls for File System Accessing files –Open, read, write, lseek, close Creating files –Create, mknod.
Lesson 22 – Introduction to Linux Systems Administration.
Linux+ Guide to Linux Certification, Second Edition
6/24/2015B.RamamurthyPage 1 File System B. Ramamurthy.
Linux Linux File System.
Guide To UNIX Using Linux Third Edition
Guide To UNIX Using Linux Third Edition
Introduction Operating Systems’ Concepts and Structure Lecture 1 ~ Spring, 2008 ~ Spring, 2008TUCN. Operating Systems. Lecture 1.
7/15/2015B.RamamurthyPage 1 File System B. Ramamurthy.
Linux File Security. What is Permission ? Specifies what right are granting to users to access the resources available in the computer. So that important.
Authentication and authorization Access control consists of two steps, authentication and authorization. Subject Do operation Reference monitor Object.
1 SEEM3460 Tutorial Unix Introduction. 2 Introduction What is Unix? An operation system (OS), similar to Windows, MacOS X Why learn Unix? Greatest Software.
Managing Software using RPM. ♦ Overview In Linux, Red Hat Package Manager referred as RPM is a tool used for managing software packages and its main function.
1 THE UNIX FILE SYSTEM By Chokechai Chuensukanant ID COSC 513 Operating System.
The file structure and related utilities CS240 Computer Science II.
Lesson 7-Creating and Changing Directories. Overview Using directories to create order. Managing files in directories. Using pathnames to manage files.
Linux Directory Navigation. File & Directory Commands This is a minimal list of Unix commands that you must know for file management: ls (list) mkdir.
Files & Directories Objectives –to be able to describe and use the Unix file system model and concepts Contents –directory structure –file system concepts.
1 Lecture 2 Working with Files and Directories COP 3344 Introduction to UNIX.
SUSE Linux Enterprise Server Administration (Course 3037) Chapter 4 Manage Software for SUSE Linux Enterprise Server.
Chapter Oracle Server An Oracle Server consists of an Oracle database (stored data, control and log files.) The Server will support SQL to define.
CSE 4481 Computer Security Lab Mark Shtern. INTRODUCTION.
OS Hardening Justin Whitehead Francisco Robles. ECE Internetwork Security OS Hardening Installing kernel/software patches and configuring a system.
Software.
File Permissions. What are the three categories of users that apply to file permissions? Owner (or user) Group All others (public, world, others)
Linux+ Guide to Linux Certification, Second Edition
Chapter Two Exploring the UNIX File System and File Security.
INTRODUCTION TO LINUX Jacob Chan. GNU/Linux Consists of Linux kernel, GNU utilities, and open source and commercial applications Works like Unix –Multi-user.
Top Five Web Application Vulnerabilities Vebjørn Moen Selmersenteret/NoWires.org Norsk Kryptoseminar Trondheim
SUSE Linux Enterprise Desktop Administration Chapter 6 Manage Software.
Guide to Linux Installation and Administration1 Chapter 4 Running a Linux System.
1 Multiprocessors May Reduce System Dependability Under File-based Race Condition Attacks Jinpeng Wei, Calton Pu Georgia Institute of Technology Atlanta,
CSE 4481 Computer Security Lab Mark Shtern. INTRODUCTION.
Chapter Two Exploring the UNIX File System and File Security.
EMT 2390L Lecture 5 Dr. Reyes Reference: The Linux Command Line, W.E. Shotts.
RaceGuard: Kernel Protection From Temporary File Race Vulnerabilities Crispin Cowan, Steve Beattie, Chris Wright, and Greg Kroah-Hartman In USENIX Security.
Linux+ Guide to Linux Certification, Third Edition
Linux+ Guide to Linux Certification, Third Edition
Unix Security Assessing vulnerabilities. Classifying vulnerability types Several models have been proposed to classify vulnerabilities in UNIX-type Oses.
Λειτουργικά Συστήματα – Lab2 Γιάννης Πετράκης. Directory Navigation and Control  The Unix file system is set up like a tree branching out from the root.
Laface 2007 File system 2.1 Operating System Design Filesystem system calls buffer allocation algorithms getblk brelse bread breada bwrite iget iput bmap.
The Unix File system (UFS) Presented by: Gurpreet Singh Assistant Professor Department of School of Computing and Engineering Galgotias University.
© 2008 Wipro Ltd - Confidential Informatica & ETL Testing Rahul Parashar.
Race conditions and synchronization issues Exploiting UNIX.
Chapter Linux Basics. Acknowledgements This presentation was prepared by – Banyat Settapanich – Bahran Madaen This presentation will be updated later.
Mark Shtern.  Our life depends on computer systems  Traffic control  Banking  Medical equipment  Internet  Social networks  Growing number of.
The Unix File System R Bigelow. The UNIX File System The file system refers to the way in which UNIX implements files and directories. The UNIX file system.
Theme 2: Working smarter Topic 10: Keep your hard drive in good working order and making backups Chapter 1.3. Page 48 – 59 Looking after the hard drive.
Embedded Software Design Week II Linux Intro Linux Kernel.
Thousands of Linux Installations (and only one administrator) A Linux cluster client for the University of Manchester A V Le Blanc I T Services University.
Linux Filesystem Management
Lesson 9: SOFTWARE ICT Fundamentals 2nd Semester SY
Chapter 3 Maintaining Security
Basic knowledge about Linux
Lecture 13 RPM and its advantages.
Exploring the UNIX File System and File Security
File System B. Ramamurthy B.Ramamurthy 11/27/2018.
Informatica & ETL Testing
The Linux Command Line Chapter 9
Bethesda Cybersecurity Club
1.3 Given a scenario, apply appropriate Microsoft command line tools
Tools and Explanations for Mac Beginners
January 26th, 2004 Class Meeting 2
Race Condition Vulnerability
Presentation transcript:

TOCTTOU Vulnerabilities in UNIX-Style File Systems BY: Mayank Ladoia

TOCTTOU Time OF Check To Time Of Use A time-of-check-to-time-of-use bug (TOCTTOU − pronounced "TOCK too") is a software bug caused by changes in a system between the checking of a condition (such as a security credential) and the use of the results of that check A TOCTTOU vulnerability requires two steps:  Vulnerable program checks for a file status.  The program operates on the file assuming the original file status remained invariant during execution

List Of Directories Owned By Root In LINUX

The CUU Model of TOCTTOU A necessary condition for a TOCTTOU vulnerability to happen is a pair of system calls (referred to as “TOCTTOU pair” in this paper) operating on the same disk object using a file pathname The first system call (referred to as “CU-call”) establishes some preconditions about the file (e.g., the file exists, the current user has write privilege to the file, etc). CUSet = { access, stat, open, creat, mknod, link, symlink, mkdir, unlink, rmdir, rename, execve, chmod, chown, truncate, utime, chdir, chroot, pivot_root, mount } The second system call (referred to as “Use-call”) operates on the file, based on those preconditions UseSet = { creat, mknod, mkdir, rename, link, symlink, open, execve, chdir, chroot, pivot_root, mount, chmod, chown, truncate, utime }

TOCTTOU pairs Definition 1: CreationSet contains system calls that create new objects in the file system. CreationSet = FileCreationSet U LinkCreationSet U DirCreationSet FileCreationSet = {creat, open, mknod, rename} LinkCreationSet = {link, symlink, rename} DirCreationSet = {mkdir, rename}

TOCTTOU pairs (cont.) Definition 2: RemoveSet contains system calls that remove objects from the file system. RemoveSet = FileRemoveSet U LinkRemoveSet U DirRemoveSet FileRemoveSet = {unlink, rename} LinkRemoveSet = {unlink, rename} DirRemoveSet = {rmdir, rename}

TOCTTOU pairs (cont.) Definition 3: NormalUseSet contains system calls which work on existing storage objects and do not remove them. NormalUseSet = FileNormalUseSet U DirNormalUse-Set FileNormalUseSet = {chmod, chown, truncate, utime, open, execve} DirNormalUseSet = {chmod, chown, utime, mount, chdir, chroot, pivot_root}

TOCTTOU pairs (cont.) Definition 4: CheckSet contains the system calls that establish preconditions about a file pathname explicitly. CheckSet = {stat, access}

CUset & UseSet CUSet = CheckSet U CreationSet U RemoveSet U NormalUseSet UseSet = CreationSet U NormalUseSet Based on the precondition established by the CUcall, we can divide the TOCTTOU pairs into two groups: Group 1 creates a new object  CU-call establishes the precondition that the file pathname does not exist Group 2 operates on an existing object  CU-call establishes the precondition that the file pathname exists

TOCTTOU Detection An actual TOCTTOU vulnerability consists of a victim program containing a TOCTTOU pair The attacker program attempts to access or modify the file being manipulated by the victim through shared access during the vulnerability window between the CU-call and Use-call

Model Based Detection Tool

Model Based Detection Tool(cont) The first component of our framework is a set of plug-in Sensor code in the kernel, placed in system calls listed in the CUSet and UseSet The second component of our framework is the Collector, which periodically empties the ring buffer (before it fills up) The third component of our framework is the Analyzer, which looks for TOCTTOU pairs that refer to the same file pathname The fourth component of our framework is the Inspector, which identifies the actual TOCTTOU vulnerability in the program being monitored

rpm 4.2 Temp File Vulnerability rpm is a popular software management tool for installing, uninstalling, verifying, querying, and updating software packages in Linux When rpm installs or removes a software package, it creates a temporary script file in directories such as /var/tmp or var/local/tmp Since the access mode of this file is set to 666 (world-writable), an attacker can insert arbitrary commands into this script Given the privileges required for installing software (usually root), this is a significant vulnerability The TOCTTOU pair involved is : the first open creates the script file for writing the script; and the second open is called in a child process to read and execute the script.

vi 6.1 Vulnerability When vi saves the file being edited, it first renames the original file as a backup, then creates a new file with the original name The new file is closed after all the content in the edit buffer is written If vi is running as root, the initial owner and group of this new file is root, so vi needs to change the owner and group of the new file to its original owner and group This forms an window of vulnerability every time vi saves the file During this window, if the file name can be changed to a link to /etc/passwd, then vi can be tricked into changing the ownership of /etc/passwd to the normal user

References ull_papers/wei/wei.pdf Homepage_files/toctou-issse-camera.pdf ary?doi=