Software Security: Attacks, Defenses, and Design Principles. Goals for Today. Preventing Buffer Overflow. Non-Executable Stack.

Similar documents
CSCE 465 Computer & Network Security

Buffer Overflows. Code Security: Buffer Overflows. Buffer Overflows are everywhere. 13 Buffer Overflow 12 Nov 2015

Design of a secure system. Example: trusted OS. Bell-La Pdula Model. Evaluation: the orange book. Buffer Overflow Attacks

CSC 405 Introduction to Computer Security

Software security. Buffer overflow attacks SQL injections. Lecture 11 EIT060 Computer Security

Bypassing Memory Protections: The Future of Exploitation

Defense in Depth: Protecting Against Zero-Day Attacks

Protocol Rollback and Network Security

Enlisting Hardware Architecture to Thwart Malicious Code Injection

A Comparison of Publicly Available Tools for Dynamic Buffer Overflow Prevention

I Control Your Code Attack Vectors Through the Eyes of Software-based Fault Isolation. Mathias Payer, ETH Zurich

Malware and Attacks Further reading:

Software Vulnerabilities

Data on Kernel Failures and Security Incidents

Chapter 15 Operating System Security

Eugene Tsyrklevich. Ozone HIPS: Unbreakable Windows

Web Security: SSL/TLS

Bypassing Browser Memory Protections in Windows Vista

Cryptography and Network Security Prof. D. Mukhopadhyay Department of Computer Science and Engineering

Security Protection and Checking for Embedded System Integration Against Buffer Overflow Attacks via Hardware/Software

Firewalls. configuring a sophisticated GNU/Linux firewall involves understanding

Exploiting nginx chunked overflow bug, the undisclosed attack vector

Modern Binary Exploitation Course Syllabus

Custom Penetration Testing

Introduction to Information Security

Lecture Overview. INF3510 Information Security Spring Lecture 4 Computer Security. Meaningless transport defences when endpoints are insecure

CSE331: Introduction to Networks and Security. Lecture 1 Fall 2006

CS 155 Final Exam. CS 155: Spring 2013 June 11, 2013

Securing software by enforcing data-flow integrity

CS Computer Security Thirteenth topic: System attacks. defenses

Red Hat. By Karl Wirth

How To Detect A Buffer Overflow Vulnerability In Binary Code

Computer Security: Principles and Practice

ASSURE: Automatic Software Self- Healing Using REscue points. Automatically Patching Errors in Deployed Software (ClearView)

SECURITY B-SIDES: ATLANTA STRATEGIC PENETRATION TESTING. Presented by: Dave Kennedy Eric Smith

Secure Software Programming and Vulnerability Analysis

Payment Card Industry (PCI) Terminal Software Security. Best Practices

Some Anti-Worm Efforts at Microsoft. Acknowledgements

Cataloguing and Avoiding the Buffer Overflow Attacks in Network Operating Systems

Where s the FEEB? The Effectiveness of Instruction Set Randomization

Between Mutual Trust and Mutual Distrust: Practical Fine-grained Privilege Separation in Multithreaded Applications

Kernel Intrusion Detection System

Address Obfuscation: an Efficient Approach to Combat a Broad Range of Memory Error Exploits

N-Variant Systems. Slides extracted from talk by David Evans. (provenance in footer)

Thick Client Application Security

How to Sandbox IIS Automatically without 0 False Positive and Negative

Coverity White Paper. Reduce Your Costs: Eliminate Critical Security Vulnerabilities with Development Testing

ERNW Newsletter 51 / September 2015

0days: How hacking really works. V 1.0 Jan 29, 2005 Dave Aitel dave@immunitysec.com

Application Intrusion Detection

Unix Security Technologies. Pete Markowsky <peterm[at] ccs.neu.edu>

Turn the Page: Why now is the time to migrate off Windows Server 2003

CSE331: Introduction to Networks and Security. Lecture 32 Fall 2004

Chapter 14: Access Control Mechanisms

static void insecure (localhost *unix)

Improving Software Security at the. Source

The Hacker Strategy. Dave Aitel Security Research

90% of data breaches are caused by software vulnerabilities.

Testing for Security

An Attack Simulator for Systematically Testing Program-based Security Mechanisms

N-Variant Systems A Secretless Framework for Security through Diversity

Host Hardening. Presented by. Douglas Couch & Nathan Heck Security Analysts for ITaP 1

Embedded Firmware Diversity for Smart Electric Meters

Introduction to Computer Security

Practical taint analysis for protecting buggy binaries

Source Code Security Analysis Tool Functional Specification Version 1.0

DAWSON -- Synthetic Diversity for Intrusion Tolerance 1

Application Security: Web service and

Summary of the SEED Labs For Authors and Publishers

Hotpatching and the Rise of Third-Party Patches

Malware: Malicious Code

Operating System Overview. Otto J. Anshus

Windows XP SP3 Registry Handling Buffer Overflow

Unix Security Technologies: Host Security Tools. Peter Markowsky <peterm[at]ccs.neu.edu>

Vulnerability Management in Software: Before Patch Tuesday KYMBERLEE PRICE BUGCROWD

Automated Faultinjection Series - Risk Management and Implementation

Review and Exploit Neglected Attack Surface in ios 8. Tielei Wang, Hao Xu, Xiaobo Chen of TEAM PANGU

telnetd exploit FreeBSD Telnetd Remote Exploit Für Compass Security AG Öffentliche Version 1.0 Januar 2012

Betriebssysteme KU Security

Critical Infrastructure Security: The Emerging Smart Grid. Cyber Security Lecture 5: Assurance, Evaluation, and Compliance Carl Hauser & Adam Hahn

How To Protect Your Computer From Being Copied On A Microsoft X86 Microsoft Microsoft System (X86) On A Linux System (Amd) On An X (Amd2) (X64) (Amd

Introduction to computer and network security. Session 2 : Examples of vulnerabilities and attacks pt1

X05. An Overview of Source Code Scanning Tools. Loulwa Salem. Las Vegas, NV. IBM Corporation IBM System p, AIX 5L & Linux Technical University

Dynamic Taint Analysis for Automatic Detection, Analysis, and Signature Generation of Exploits on Commodity Software

Oracle Solaris Studio Code Analyzer

Linux Kernel. Security Report

Keywords: 2013, IJARCSSE All Rights Reserved Page 451

CMSC 421, Operating Systems. Fall Security. URL: Dr. Kalpakis

Cloud Computing. Up until now

Advanced Systems Security

Static Checking of C Programs for Vulnerabilities. Aaron Brown

Secure Web Application Coding Team Introductory Meeting December 1, :00 2:00PM Bits & Pieces Room, Sansom West Room 306 Agenda

Digital Rights Management Demonstrator

Threat Modeling. Frank Piessens ) KATHOLIEKE UNIVERSITEIT LEUVEN

Return-oriented programming without returns

Auditing a Web Application. Brad Ruppert. SANS Technology Institute GWAS Presentation 1

Secure Software Development Lifecycle. Security... Not getting better

Will Dormann: Sure. Fuzz testing is a way of testing an application in a way that you want to actually break the program.

Security features in the OpenBSD operating system

Transcription:

CSE 484 (Winter 2008) Software Security: Attacks, Defenses, and Design Tadayoshi Kohno Thanks to Dan Boneh, Dieter Gollmann, John Manferdelli, John Mitchell, Vitaly Shmatikov, Bennet Yee, and many others for sample slides and materials... Goals for Today Defensive Mechanisms Languages System changes Software Development Design (Programming practices) Preventing Buffer Overflow Use safe programming languages, e.g., Java What about legacy C code? Mark stack as non-executable Randomize stack location or encrypt return address on stack by XORing with random string Attacker won t know what address to use in his or her string Static analysis of source code to find overflows Run-time checking of array and buffer bounds StackGuard, libsafe, many other tools Black-box testing with long strings Non-Executable Stack NX bit on every Page Table Entry AMD Athlon 64, Intel P4 Prescott Code patches marking stack segment as non-executable exist for Linux, Solaris, OpenBSD Some applications need executable stack For example, LISP interpreters Does not defend against return-to-libc exploits Overwrite return address with the address of an existing library function (can still be harmful) nor against heap and function pointer overflows nor changing stack internal variables (auth flag,...)

Run-Time Checking: StackGuard Embed canaries in stack frames and verify their integrity prior to function return Any overflow of local variables will damage the canary buf Saved SP ret/ip Caller s stack frame buf 0000canary Saved SP ret/ip Caller s stack frame Choose random canary string on program start Attacker can t guess what the value of canary will be Terminator canary: \0, newline, linefeed, EOF String functions like strcpy won t copy beyond \0 StackGuard Implementation StackGuard requires code recompilation Checking canary integrity prior to every function return causes a performance penalty For example, 8% for Apache Web server PointGuard also places canaries next to function pointers and setjmp buffers Worse performance penalty StackGuard can be defeated! Phrack article by Bulba and Kil3r Defeating StackGuard (Sketch) Idea: overwrite pointer used by some strcpy and make it point to return address (RET) on stack strcpy will write into RET without touching canary! buf dst canary sfp RET Suppose program contains strcpy(dst,buf) Return execution to this address BadPointer, attack code &RET canary sfp RET Overwrite destination of strcpy with RET position strcpy will copy BadPointer here Run-Time Checking: Libsafe Dynamically loaded library Intercepts calls to strcpy(dest,src) Checks if there is sufficient space in current stack frame frame-pointer dest > strlen(src) If yes, does strcpy; else terminates application

PointGuard Attack: overflow a function pointer so that it points to attack code Idea: encrypt all pointers while in memory Generate a random key when program is executed Each pointer is XORed with this key when loaded from memory to registers or stored back into memory Pointers cannot be overflown while in registers Attacker cannot predict the target program s key Even if pointer is overwritten, after XORing with key it will dereference to a random memory address Normal Pointer Dereference [Cowan] 1. Fetch pointer value 2. Access data referenced by pointer Pointer 1. Fetch pointer value 2. Access attack code referenced by corrupted pointer Corrupted pointer Attack code PointGuard Dereference [Cowan] 1. Fetch pointer value Decrypt 2. Access data referenced by pointer Encrypted pointer 0x7239 Decrypts to random value 0x9786 1. Fetch pointer value Decrypt 2. Access random address; segmentation fault and crash Corrupted pointer 0x7239 Attack code 0x9786 Fuzz Testing Generate random inputs to program Sometimes conforming to input structures (file formats, etc) See if program crashes If crashes, found a bug Bug may be exploitable Surprisingly effective Now standard part of development lifecycle, e.g., for IE

Genetic Diversity Problems with Monoculture Steps toward diversity Automatic diversification of compiled code Address Space Randomization Check inputs Least privilege Check all return values

Securely clear memory (passwords, keys, etc) Failsafe defaults Reduce size of TCB Simplicity Modularity Open design? Open source? Maybe... Linux Kernel Backdoor Attempt: http:// www.freedom-to-tinker.com/?p=472

Vulnerability Analysis and Disclosure What do you do if you ve found a security problem in a real system? Say IM client? Electronic voting machine? ATM machine? Hospital drug (morphine) pump