Outline. Security as an economic good. Risk budgeting with ALE. Failure: Risk compensation. Failure: Displacement activity

Similar documents
Outline. Classic races: files in /tmp. Race conditions. TOCTTOU example. TOCTTOU gaps. Vulnerabilities in OS interaction

Advanced Systems Security: Ordinary Operating Systems

CSE 544 Advanced Systems Security

Other array problems. Integer overflow. Outline. Integer overflow example. Signed and unsigned

Advanced Systems Security: Ordinary Operating Systems

Fundamentals of Computer Security

Secure Programming I. Steven M. Bellovin September 28,

I m paranoid, but am I paranoid enough? Steven M. Bellovin February 20,

Computer Security. 04r. Pre-exam 1 Concept Review. Paul Krzyzanowski. Rutgers University. Spring 2018

Lecture 4 September Required reading materials for this class

I m paranoid, but am I paranoid enough? Steven M. Bellovin October 2,

Secure Programming II. Steven M. Bellovin September 29,

CS 161 Computer Security

C and C++ Secure Coding 4-day course. Syllabus

CSE543 - Introduction to Computer and Network Security

Advanced System Security: Vulnerabilities

Software Security: Misc and Principles

CS140 Operating Systems Final December 12, 2007 OPEN BOOK, OPEN NOTES

OS Security III: Sandbox and SFI

Computer Security Spring 2010 Paxson/Wagner Notes 1/29. Patterns for Building Secure Software. 1 The Trusted Computing Base (TCB)

Symlink attacks. Do not assume that symlinks are trustworthy: Example 1

Buffer overflow background

UMSSIA LECTURE I: SOFTWARE SECURITY

Module: Program Vulnerabilities. Professor Trent Jaeger. CSE543 - Introduction to Computer and Network Security

CMSC 414 Computer and Network Security

CS61 Scribe Notes Date: Topic: Fork, Advanced Virtual Memory. Scribes: Mitchel Cole Emily Lawton Jefferson Lee Wentao Xu

STING: Finding Name Resolution Vulnerabilities in Programs

CSE 565 Computer Security Fall 2018

Lecture 4: Threats CS /5/2018

Memory Safety (cont d) Software Security

Software Security: Buffer Overflow Attacks

Control Flow Hijacking Attacks. Prof. Dr. Michael Backes

Security Architecture

Module: Program Vulnerabilities. Professor Trent Jaeger. CSE543 - Introduction to Computer and Network Security

Program Security and Vulnerabilities Class 2

Week 5, continued. This is CS50. Harvard University. Fall Cheng Gong

Software Security: Buffer Overflow Defenses and Miscellaneous

Software Security; Common Implementation Flaws

CS 161 Computer Security. Design Patterns for Building Secure Systems

Outline. Format string attack layout. Null pointer dereference

CS 161 Computer Security

Administrative Details. CS 140 Final Review Session. Pre-Midterm. Plan For Today. Disks + I/O. Pre-Midterm, cont.

Analyzing Systems. Steven M. Bellovin November 26,

SysSec. Aurélien Francillon

CS 161 Computer Security

ECE 471 Embedded Systems Lecture 22

Linux Memory Layout. Lecture 6B Machine-Level Programming V: Miscellaneous Topics. Linux Memory Allocation. Text & Stack Example. Topics.

20: Exploits and Containment

NET 311 INFORMATION SECURITY

Last time. Security Policies and Models. Trusted Operating System Design. Bell La-Padula and Biba Security Models Information Flow Control

INFLUENTIAL OPERATING SYSTEM RESEARCH: SECURITY MECHANISMS AND HOW TO USE THEM CARSTEN WEINHOLD

Secure Programming. Input Validation. Learning objectives Code Injection: Outline. 4 Code Injection

New York University CSCI-UA : Advanced Computer Systems: Spring 2016 Midterm Exam

cs642 /introduction computer security adam everspaugh

CERT Secure Coding Initiative. Define security requirements. Model Threats 11/30/2010

Buffer Overflow. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

CSE 303: Concepts and Tools for Software Development

Operating System Security

One-Slide Summary. Lecture Outline. Language Security

Lecture 3: O/S Organization. plan: O/S organization processes isolation

Module: Program Vulnerabilities. Professor Trent Jaeger. CSE543 - Introduction to Computer and Network Security

SentinelOne Technical Brief

Combining program verification with component-based architectures. Alexander Senier BOB 2018 Berlin, February 23rd, 2018

Buffer Overflow. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Buffer Overflow. Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University

CYSE 411/AIT 681 Secure Software Engineering. Topic #6. Seven Software Security Touchpoints (III) Instructor: Dr. Kun Sun

4. Risk-Based Security Testing. Reading. CYSE 411/AIT 681 Secure Software Engineering. Seven Touchpoints. Application of Touchpoints

Secure Software Development: Theory and Practice

Today. Review. Unix as an OS case study Intro to Shell Scripting. What is an Operating System? What are its goals? How do we evaluate it?

CSE 127: Computer Security. Security Concepts. Kirill Levchenko

SentinelOne Technical Brief

CYSE 411/AIT681 Secure Software Engineering Topic #13. Secure Coding: Race Conditions

Department of Electrical Engineering and Computer Science MASSACHUSETTS INSTITUTE OF TECHNOLOGY Fall 2011.

CMPSC 497 Buffer Overflow Vulnerabilities

CSCI 420: Mobile Application Security. Lecture 7. Prof. Adwait Nadkarni. Derived from slides by William Enck, Patrick McDaniel and Trent Jaeger

19.1. Security must consider external environment of the system, and protect it from:

Access Control. Steven M. Bellovin September 13,

OWASP 5/07/09. The OWASP Foundation OWASP Static Analysis (SA) Track Session 1: Intro to Static Analysis

W4118: OS Overview. Junfeng Yang

BUFFER OVERFLOW. Jo, Heeseung

Buffer Overflow. Jo, Heeseung

CS 162 Operating Systems and Systems Programming Professor: Anthony D. Joseph Spring Lecture 18: Naming, Directories, and File Caching

Software Security and Exploitation

Language-Based Protection

CS 356 Systems Security Spring 2015

CS 162 Operating Systems and Systems Programming Professor: Anthony D. Joseph Spring Lecture 18: Naming, Directories, and File Caching

Attacks Against Websites 3 The OWASP Top 10. Tom Chothia Computer Security, Lecture 14

Memory Management: The process by which memory is shared, allocated, and released. Not applicable to cache memory.

Page 1. Goals for Today. Buffer Overrun Vulnerabilities. Simple Example. More Serious Exploit Example. Modified Example

CS 326: Operating Systems. Process Execution. Lecture 5

It was a dark and stormy night. Seriously. There was a rain storm in Wisconsin, and the line noise dialing into the Unix machines was bad enough to

The Kernel Abstraction. Chapter 2 OSPP Part I

Hakim Weatherspoon CS 3410 Computer Science Cornell University

Linux Essentials. Smith, Roderick W. Table of Contents ISBN-13: Introduction xvii. Chapter 1 Selecting an Operating System 1

Bash command shell language interpreter

CS 161 Computer Security

CIT 380: Securing Computer Systems

Secure Architecture Principles

Chair for Network Architectures and Services Department of Informatics TU München Prof. Carle. Network Security. Chapter 8

Secure Architecture Principles

Transcription:

CSci 5271 Introduction to Computer Security Day 2: Intro to Software and OS Security Stephen McCamant University of Minnesota, Computer Science & Engineering Security as an economic good Security is a good thing (for defenders) But, must trade off other things to get it Rational to not purchase all available In the big picture, always a compromise Risk budgeting with ALE Annual loss expected = (loss amount) (incidence) Net risk reduction = ALE - (security cost) Like with a budget, spreadsheet may not match reality Like other cost-benefit analysis, can make trade-offs more explicit Failure: Displacement activity Failure: Risk compensation Security syllogism (attributed to: politicians): 1. We must do something 2. This is something 3. Therefore we must do this. Example: airport security Example: external vs. internal threats Some benefits of security are taken back by riskier behavior Example: H-Day in Sweden We ll return to human factors later

This class s perspective We ll mostly ignore management issues For this class, maximize security at all costs Trusted Trusted vs. trustworthy In security, trusted is a bad word X is trusted: X can break your security Untrusted = okay if it s evil Trusted Computing Base (TCB): minimize Something you actually should trust is trustworthy Concise definition of security failure: something trusted is not trustworthy Privilege 3 common privilege levels Privilege is the power to take security-relevant actions Concise definition of security failure: the adversary gets privilege they shouldn t 1. Administrator/root/OS kernel 2. Regular user of system 3. Evil people on the Internet

3 common privilege levels 1. Administrator/root/OS kernel * Local exploit 2. Regular user of system * Remote exploit 3. Evil people on the Internet Posting slides before lecture Anyone still not registered? I ll try for 11:55pm on the night before, no guarantees Announcements are most likely to change, recheck after On waiting list, came first day ) should have gotten permission number Thursday Anyone else left? Trade-off: somewhat high student/ta ratio Exercise set 1 Moodle, group-forming Available on website Due Thursday, September 28th, on Moodle Groups of 1-3, turn in one copy Moodle page started Group-finding mechanism: forum

Hands-on assignment 1 Finding project topics Register your groups now, by email to Se Eun (seoh@umn) Description and code available now First, relatively easy attack: due Friday But requires learning how to use VM, exploit scripting Pre-proposal due 9/20 (one week from Wednesday) Don t skimp on topic: hard but important Conference papers linked from class site More on choosing topics Can t: wait to see what part of class you like best But feel free to look ahead Think about your group s skills Also: available hardware/software Think about where to find novelty Topic changes allowed, but will hurt you Classic buffer overflow Buffer overflow classification char buf[20]; gets(buf); Vulnerability in finger daemon Morris worm brought down 1988 Internet (4.3BSD VAXes) Bug: stack buffer overflow Attack: return address overwrite Consequence: (binary) code injection

Read It Twice (WOOT 12) Confused deputy compiler Smart TV (running Linux) only accepts signed apps on USB sticks 1. Check signature on file 2. Install file Malicious USB device replaces app between steps TV rooted / jailbroken Compiler writes to billing database Compiler can produce debug output to user-specified file Specify debug output to billing file, disrupt billing How to write policy preventing this? Leaky intelligence analysts 1000s of analysts need to view 1000s of classified documents to do their job Can we prevent it if one wants to send them to the Washington Post? More than regular access control (Reality: many non-technical problems) Vulnerabilities are bugs Security and quality Security bugs just a special case of bugs Like regular bugs, only obscure ones make it through testing Key difference: Rare regular bug has limited impact Attackers seek out vulnerability circumstances Security correlated with other software quality: Developers understand code well Interactions between modules controlled Well tested

Security and other features Contracts and checks Security would be much easier if systems were less complex But, very few users want that trade-off Risk compensation with improvements to development process Requirement: check X before doing Y What function s responsibility is the check? Answer embodied in contracts, aka specifications, preconditions and postconditions Defensive programming Analogy: defensive driving Don t assume things are right, check Inbound: preconditions on arguments Outbound: error conditions Within reason: some things can t be checked at some places Shell code injection Shell code injection example Don t pass untrusted strings to a command shell In C: system, popen system("cmd $arg1 $arg2") Fix 1: avoid shell Fix 2: sanitize data (preferably whitelist) Benign: system("cp $arg1 $arg2"), arg1 = "file1.txt" Attack: arg1 = "a b; echo Gotcha" Command: "cp a b; echo Gotcha file2.txt" Not a complete solution: blacklist ;

Bad/missing error handling Race conditions Under what circumstances could each system call fail? Careful about rolling back after an error in the middle of a complex operation Fail to drop privileges ) run untrusted code anyway Update file when disk full ) truncate Two actions in parallel; result depends on which happens first Usually attacker racing with you 1. Write secret data to file 2. Restrict read permissions on file Many other examples Classic races: files in /tmp TOCTTOU gaps Temp filenames must already be unique But unguessable is a stronger requirement Unsafe design (mktemp(3)): function to return unused name Must use O EXCL for real atomicity Time-of-check (to) time-of-use races 1. Check it s OK to write to file 2. Write to file Attacker changes the file between steps 1 and 2 Just get lucky, or use tricks to slow you down TOCTTOU example TOCTTOU example int safe_open_file(char *path) f int fd = -1; struct stat s; stat(path, &s) if (!S ISREG(s.st mode)) error("only regular files allowed"); else fd = open(path, O RDONLY); return fd; g int safe_open_file(char *path) f int fd = -1, res; struct stat s; res = stat(path, &s) if (res!s ISREG(s.st mode)) error("only regular files allowed"); else fd = open(path, O RDONLY); return fd; g

TOCTTOU example Changing file references int safe_open_file(char *path) f int fd = -1, res; struct stat s; res = stat(path, &s) if (res!s ISREG(s.st mode)) error("only regular files allowed"); else fd = open(path, O RDONLY); return fd; g With symbolic links With hard links With changing parent directories Directory traversal with.. Environment variables Program argument specifies file, found in directory files What about files/../../../../etc/passwd? Can influence behavior in unexpected ways PATH LD LIBRARY PATH IFS... Also umask, resource limits, current directory IFS and why it s a problem Next time In Unix, splitting a command line into words is the shell s job String! argv array grep a b c vs. grep 'a b' c Choice of separator characters (default space, tab, newline) is configurable Bugs particular to low-level (e.g., C) programs Exploit system("/bin/uname")