CS 380S - 0x1A Great Papers in Computer Security Fall Homework #1

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

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

Eugene Tsyrklevich. Ozone HIPS: Unbreakable Windows

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

CSC 405 Introduction to Computer Security

CSCE 465 Computer & Network Security

Software Vulnerabilities

Bypassing Browser Memory Protections in Windows Vista

Bypassing Memory Protections: The Future of Exploitation

Off-by-One exploitation tutorial

Chapter 15 Operating System Security

Modern Binary Exploitation Course Syllabus

Sandy. The Malicious Exploit Analysis. Static Analysis and Dynamic exploit analysis. Garage4Hackers

How To Detect A Buffer Overflow Vulnerability In Binary Code

Access Control Fundamentals

Securing software by enforcing data-flow integrity

Format string exploitation on windows Using Immunity Debugger / Python. By Abysssec Inc

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

Defense in Depth: Protecting Against Zero-Day Attacks

Introduction to Information Security

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

Return-oriented programming without returns

Hotpatching and the Rise of Third-Party Patches

Betriebssysteme KU Security

Practical taint analysis for protecting buggy binaries

Building accurate intrusion detection systems. Diego Zamboni Global Security Analysis Lab IBM Zürich Research Laboratory

Cataloguing and Avoiding the Buffer Overflow Attacks in Network Operating Systems

CS Computer Security Thirteenth topic: System attacks. defenses

CS5460: Operating Systems

Enlisting Hardware Architecture to Thwart Malicious Code Injection

How to Sandbox IIS Automatically without 0 False Positive and Negative

Java and Java Virtual Machine Security

Fine-Grained User-Space Security Through Virtualization. Mathias Payer and Thomas R. Gross ETH Zurich

Restraining Execution Environments

Quiz I Solutions MASSACHUSETTS INSTITUTE OF TECHNOLOGY Fall Department of Electrical Engineering and Computer Science

Automating Mimicry Attacks Using Static Binary Analysis

Windows Phone 7 Internals and Exploitability

Advanced IBM AIX Heap Exploitation. Tim Shelton V.P. Research & Development HAWK Network Defense, Inc. tshelton@hawkdefense.com

X86-64 Architecture Guide

Application Intrusion Detection

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

Introduction. What is an Operating System?

Cloud Computing. Up until now

Memory Systems. Static Random Access Memory (SRAM) Cell

FINAL DoIT v.4 PAYMENT CARD INDUSTRY DATA SECURITY STANDARDS APPLICATION DEVELOPMENT AND MAINTENANCE PROCEDURES

MSc Computer Science Dissertation

Stack Overflows. Mitchell Adair

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

CS412/CS413. Introduction to Compilers Tim Teitelbaum. Lecture 20: Stack Frames 7 March 08

Exploiting nginx chunked overflow bug, the undisclosed attack vector

1 The Java Virtual Machine

Red Hat. By Karl Wirth

Intrusion Detection via Static Analysis

Malicious Code on Java Card Smartcards: Attacks and Countermeasures

CS52600: Information Security

Overview. CISC Developments. RISC Designs. CISC Designs. VAX: Addressing Modes. Digital VAX

CEN 559 Selected Topics in Computer Engineering. Dr. Mostafa H. Dahshan KSU CCIS

(General purpose) Program security. What does it mean for a pgm to be secure? Depends whom you ask. Takes a long time to break its security controls.

Transparent Monitoring of a Process Self in a Virtual Environment

Exploits: XSS, SQLI, Buffer Overflow

Security & Exploitation

Automatically Patching Errors in Deployed Software

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

Assembly Language: Function Calls" Jennifer Rexford!

CS 356 Lecture 23 and 24 Software Security. Spring 2013

For a 64-bit system. I - Presentation Of The Shellcode

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

90% of data breaches are caused by software vulnerabilities.

Computer Security: Principles and Practice

EECS 354 Network Security. Introduction

Attacking Host Intrusion Prevention Systems. Eugene Tsyrklevich

System Calls and Standard I/O

Where s the FEEB? The Effectiveness of Instruction Set Randomization

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

The programming language C. sws1 1

CS 392/681 - Computer Security. Module 16 Vulnerability Analysis

RE-TRUST Design Alternatives on JVM

Windows XP SP3 Registry Handling Buffer Overflow

ERNW Newsletter 51 / September 2015

Exception and Interrupt Handling in ARM

CS 161 Computer Security

Operating Systems. Privileged Instructions

Certified Ethical Hacker (CEH) Ethical Hacking & Counter Measures Course 9962; 5 Days, Instructor-Led

Secure application programming in the presence of side channel attacks. Marc Witteman & Harko Robroch Riscure 04/09/08 Session Code: RR-203

CS 361S - Network Security and Privacy Spring Homework #1

Stack machines The MIPS assembly language A simple source language Stack-machine implementation of the simple language Readings:

Transcription:

CS 380S - 0x1A Great Papers in Computer Security Fall 2012 Homework #1 Due: 2pm CDT (in class), Sep 27, 2012 NO LATE SUBMISSIONS WILL BE ACCEPTED YOUR NAME: Collaboration policy No collaboration is permitted on this assignment. Any cheating (e.g., submitting another person s work as your own, or permitting your work to be copied) will automatically result in a failing grade. 1

Homework #1 (30 points) Problem 1 Molvanîan Security Defense Operating System (MS-DOS) protects against memory corruption exploits as follows. MS-DOS ensures that heap, stack, and code sections of the program are all page-aligned. On a 32-bit x86 machine (the only kind they use in Molvanîa), each page is 4096 bytes. MS-DOS randomizes memory layout using a modified runtime loader: each time a binary is loaded in the process address space, the loader selects a random page-aligned address for the code, data, and heap segments. Problem 1a (1 point) What is this defense based on? Problem 1b (2 points) The famous Molvanîan hacker R00tkowski has found an exploitable stack-based buffer overflow in the MS-DOS login program and decides to exploit it using a return-to-libc attack. He must correctly guess the buffer start address, as well as the location of execve call (which is the target of the control transfer in his attack) in the system call table. If the guess is incorrect, the login program crashes and then automatically restarts. How many guesses are necessary, on average, to ensure a successful attack? Explain. Problem 2 All Molvanîan C compilers for x86 insert stack canaries into generated code to prevent stack-smashing attacks. Nevertheless, Molvanîan Cyber-Security Bureau mandates the use of libsafe with all executables compiled from C. 2

libsafe is a wrapper around the C string library, intended to ensure that string operations cannot overwrite any control information stored on the stack (such as saved return address, saved frame pointer, etc.). For example, the libsafe wrapper around strcpy adds the following check before strcpy(src,dest) is executed: framepointer - dest > strlen(src) Problem 2a (3 points) What additional protections are gained by using libsafe with canary-equipped executables? Problem 2b (2 points) Give a short snippet of C code that contains a single call to a libsafe-protected strcpy, and yet is vulnerable to a memory corruption attack as a result of this call. Your attack must also bypass compiler-inserted stack canaries. 3

Problem 3 x68 is Molvanîan homegrown chip architecture. Unlike on x86, the stack on x68 grows upwards. Problem 3a (2 points) How does a stack-based overflow attack work on x68? Problem 3b (2 points) How would you implement StackGuard on x68? What would be the main differences from x86? Problem 3c (2 points) How would you implement libsafe on x68? What would be the main differences from x86? 4

Problem 4 (4 points) Sandboxing x86 (as opposed to RISC) code is difficult because variable-length x86 instructions are hard for the verifier to parse. In Molvanîa, however, code is shipped as ASCII assembly language source. The verifier modifies the source to ensure the following properties: Register %edx is only used to define the logical fault domain (i.e., for segment matching). Every instruction that modifies memory...... is relative to the stack or frame pointer (with a small enough offset not to go out of bounds), or...uses the %edx register for segment matching with the following code: mov DEST, %edx bound %edx, domainrange INST SRC, (%edx) Here DEST is the memory location that is being written, domainrange is the location of pointers to the beginning and end of the fault domain s data segment, the bound instruction traps if %edx is not within that range, and INST and SRC can be any instruction and source that modify the memory pointed to by DEST. The verifier allows relative branches to any byte within the fault domain s code segment, but control transfers outside the code segment use a jump table which transfers to trusted code stubs not in the code segment. Explain how, even with this scheme, malicious code could escape the sandbox and modify other regions of a process s address space. 5

Problem 5 Problem 5a (3 points) What is the exact control-flow property that Native Client enforces? Is it weaker, stronger, or the same as control-flow integrity? Problem 5b (2 points) In Native Client, springboards are snippets of trusted code which are located in the memory of the untrusted binary module. Their purpose is to enable control transfers from the trusted runtime environment to untrusted code. Because the sprinboard code is trusted, it may include privileged instructions which are not normally available to the untrusted code. What prevents untrusted code from executing these instructions by passing control via either a jump, or sequential execution to the springboard code located in its memory? Problem 6 Consider the following snippet of C code: static char logfile[]="log.txt"; int checklog() { return (access(logfile, O_RDWR)); int openlog() { return (open(logfile, O_RDWR)); int writelog(int fd, int len) { if (fd > 0) write(fd, "", len); void log() { 6

int fd; if (checklog()) { fd=openlog(); for(int i=0; i<5; i++) writelog(fd,64); writelog(fd,32); Problem 6a (6 points) Write the Dyck model of the control flow of this code. If you are unable to write the Dyck model, write the callgraph and explain why it is imprecise and why a Dyck model would provide more precision. Problem 6b (1 points) Can you use a reference monitor based on the above Dyck model to prevent TOCTTOU attacks on this code? If yes, explain how; if no, explain why. 7