CSC 405 Introduction to Computer Security



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

Vigilante: End-to-End Containment of Internet Worms

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

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

CSCE 465 Computer & Network Security

Software Vulnerabilities

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

Bypassing Memory Protections: The Future of Exploitation

Securing software by enforcing data-flow integrity

Secure Software Programming and Vulnerability Analysis

Defense in Depth: Protecting Against Zero-Day Attacks

CS52600: Information Security

Eugene Tsyrklevich. Ozone HIPS: Unbreakable Windows

How to Sandbox IIS Automatically without 0 False Positive and Negative

International Journal of Computer Science and Network (IJCSN) Volume 1, Issue 5, October ISSN Bhopal, M.P.

UNCLASSIFIED Version 1.0 May 2012

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

Homeland Security Red Teaming

Chapter 15 Operating System Security

90% of data breaches are caused by software vulnerabilities.

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

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

Course: Information Security Management in e-governance. Day 1. Session 5: Securing Data and Operating systems

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

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

SY system so that an unauthorized individual can take over an authorized session, or to disrupt service to authorized users.

Application Intrusion Detection

Source Code Security Analysis Tool Functional Specification Version 1.0

Protect Your IT Infrastructure from Zero-Day Attacks and New Vulnerabilities

Custom Penetration Testing

Linux Kernel. Security Report

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

Data Management Policies. Sage ERP Online

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

SANS Top 20 Critical Controls for Effective Cyber Defense

Architecture Overview

MSc Computer Science Dissertation

Background. How much does EMET cost? What is the license fee? EMET is freely available from Microsoft without material cost.

Module II. Internet Security. Chapter 7. Intrusion Detection. Web Security: Theory & Applications. School of Software, Sun Yat-sen University

Red Hat. By Karl Wirth

Introduction to Security

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

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

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

Protecting Your Organisation from Targeted Cyber Intrusion

Where s the FEEB? The Effectiveness of Instruction Set Randomization

Deep Security Vulnerability Protection Summary

Summary of the SEED Labs For Authors and Publishers

Automatic vs. Manual Code Analysis

Plain English Guide To Common Criteria Requirements In The. Field Device Protection Profile Version 0.75

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

Enlisting Hardware Architecture to Thwart Malicious Code Injection

Chapter 9 Firewalls and Intrusion Prevention Systems

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

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

Levels of Software Testing. Functional Testing

Threat Modeling. Frank Piessens ) KATHOLIEKE UNIVERSITEIT LEUVEN

3. Broken Account and Session Management. 4. Cross-Site Scripting (XSS) Flaws. Web browsers execute code sent from websites. Account Management

Advanced Endpoint Protection Overview

Security Goals Services

Security for Mac Computers in the Enterprise

Basic Unix/Linux 1. Software Testing Interview Prep

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

Where every interaction matters.

Build (develop) and document Acceptance Transition to production (installation) Operations and maintenance support (postinstallation)

Hotpatching and the Rise of Third-Party Patches

USM IT Security Council Guide for Security Event Logging. Version 1.1

Security Target. McAfee Host Intrusion Prevention 8 and epolicy Orchestrator 4.5. Document Version 1.1. September 9, 2011

Malicious Software. Malicious Software. Overview. Backdoor or Trapdoor. Raj Jain. Washington University in St. Louis

Introduction. Figure 1 Schema of DarunGrim2

SAFECode Security Development Lifecycle (SDL)

IDS / IPS. James E. Thiel S.W.A.T.

Digital Forensic. A newsletter for IT Professionals. I. Background of Digital Forensic. Definition of Digital Forensic

Malicious Software. Ola Flygt Växjö University, Sweden Viruses and Related Threats

Developing Secure Software in the Age of Advanced Persistent Threats

CS 356 Lecture 25 and 26 Operating System Security. Spring 2013

Effective Software Security Management

CDM Vulnerability Management (VUL) Capability

International Journal of Enterprise Computing and Business Systems ISSN (Online) :

Cataloguing and Avoiding the Buffer Overflow Attacks in Network Operating Systems

CPA SECURITY CHARACTERISTIC SECURE VOIP CLIENT

NETWORK AND CERTIFICATE SYSTEM SECURITY REQUIREMENTS

Securing OS Legacy Systems Alexander Rau

-.% . /(.0/ ) 53%/( (01 (%((. * 7071 (%%2 $,( . 8 / 9!0/!1 . # (3(0 31.%::((. ;.!0.!1 %2% . ".(0.1 $) (%+"",(%$.(6

Adobe Flash Player and Adobe AIR security

Introduction to Information Security

SECURITY PATCH MANAGEMENT INSTALLATION POLICY AND PROCEDURES

Building A Secure Microsoft Exchange Continuity Appliance

Transcription:

CSC 405 Introduction to Computer Security Topic 3. Program Security -- Part II CSC 405 Dr. Peng Ning 1 Targeted Malicious Code General purpose malicious code Affect users and machines indiscriminately Targeted malicious code Written for a particular system, for a particular application, and for a particular purpose Trapdoor Salami attack Covert channel CSC 405 Dr. Peng Ning 2

Salami Attack A salami attack merges seemingly inconsequential data to yield powerful results Example Bank programmer: transfer one cent of interest from each account to his/her account CSC 405 Dr. Peng Ning 3 Covert Channels Covert channels Programs that communicate information to people who should not receive it The communication travels unnoticed, accompanying other, perfectly proper, communications A human example Reveal answers to multiple choice questions Coughing for (a) Sighing for (b) CSC 405 Dr. Peng Ning 4

Covert Channels (Cont d) Structure of cover channels A sender Service program A receiver Spy A Trojan horse is always involved Service Program Protected data Legitimate user Spy CSC 405 Dr. Peng Ning 5 How to Create Covert Channels Example: A printed report CSC 405 Dr. Peng Ning 6

Classification of Covert Channels Storage channels Pass information by using the presence or absence of objects in storage Timing channels Pass information by using the speed at which things happen CSC 405 Dr. Peng Ning 7 Storage Channels Example 1: File lock channel CSC 405 Dr. Peng Ning 8

Storage Channels (Cont d) Example 2: File existence channel CSC 405 Dr. Peng Ning 9 Timing Channels Example: Cover timing channel The attacker may use error correction codes to reduce the interference from other processes. CSC 405 Dr. Peng Ning 10

Covert Channels (Cont d) The service program and the spy need access to a shared resource Storage channels Object in shared storage medium Timing channels Time CSC 405 Dr. Peng Ning 11 Identifying Potential Covert Channels Shared resource matrix Basis of cover channel is a shared resource Find all shared resources Determine which processes can write to and read from the resources Can be automated Service Process Spy s Process Locked Confidential data R, M R R, M Locked Service Process R, M Spy s Process R, M R: Can read M: Can write Confidential data R R CSC 405 Dr. Peng Ning 12

Identifying Potential Covert Channels (Cont d) Information flow method Static analysis of program source code Explicit flow B:=A Information flows from A to B B:=A; C:=B Information flows from A to C (by way of B) Implicit flow IF D=1 THEN B:=A Information flows explicitly from A to B Information flows implicitly from D to B CSC 405 Dr. Peng Ning 13 Information Flow Method (Cont d) Functions B:=fntl(args) At a superficial level, information flows from args to B Need to analyze the definition of fntl Information flows from global variables to B Need to put all pieces together to show which output are affected by which inputs Can be automated CSC 405 Dr. Peng Ning 14

Controls against Program Security Threats Development controls Operating system controls Administrative controls CSC 405 Dr. Peng Ning 15 Development Controls Peer reviews Review Presented informally to a team of reviewers Goal: consensus and buy-in before development proceeds further Walk-through Presented to the team by its creator Goal: education; focus is on learning about a single document Inspection Formal process; detailed analysis in which the artifact is checked against a prepared listed of concerns Goal: verify properties of the artifact of concern CSC 405 Dr. Peng Ning 16

Peer Review (Cont d) Review log analysis Do particular reviewers need training? Root cause analysis ==> What should be done to discover the fault earlier? Build a checklist for future reviews CSC 405 Dr. Peng Ning 17 Development Controls (Cont d) Hazard analysis Intended to expose potentially hazardous system states Involves developing Hazard lists, and Procedures for exploring what if scenarios to trigger consideration of non-obvious hazards Example: Failure modes and effects analysis (FMEA) Bottom up technique Identify each component s possible faults Determine what could trigger the fault and the system-wide effects of the fault Often lead to possible system failures that are not made visible by other analytical means CSC 405 Dr. Peng Ning 18

Development Controls (Cont d) Testing Involves several stages Unit testing Each component is tested on its own, isolated from the other components in the system Done in a controlled environment AKA, module testing, component testing Integration testing Ensure the interface among the components are defined and handled properly Verify that the system components work together as specified CSC 405 Dr. Peng Ning 19 Testing (Cont d) Function test Evaluate the system to determine whether the functions described by the requirement specification are actually performed by the system Performance test Compare the system with the remainder of the software and hardware requirements Security requirements are examined during the function and performance tests CSC 405 Dr. Peng Ning 20

Testing (Cont d) Acceptance test Ensure that the system works according to customer expectations Installation test A final test to ensure the system still functions as it should Regression test After a change is made to enhance or fix the system, regression testing ensures that all remaining functions are still working CSC 405 Dr. Peng Ning 21 Development Controls (Cont d) Good design Using a philosophy of fault tolerance Active fault detection Redundancy Isolate the damage and minimize the disruption Having a consistent policy for handling failures Capturing the design rationale and history Using design patterns CSC 405 Dr. Peng Ning 22

Development Controls (Cont d) Prediction Identify what unwanted events might occur Make plans to avoid them or mitigate their effects Static analysis Examine design and code to locate and repair security flaws Control flow Data flow Data structure Many approaches; automated tools needed CSC 405 Dr. Peng Ning 23 Development Controls (Cont d) Configuration management The process by which we control the changes during development and maintenance Four activities Configuration identification Build an inventory (baseline) of all components of the system Configuration control and change management Coordinate separate, related versions Configuration auditing Confirms that the baseline is complete and accurate, changes are recorded, recorded changes are made, the actual software is reflected accurately in the documents Status accounting Record the information about the components CSC 405 Dr. Peng Ning 24

Operating System (OS) Controls Trusted software A part of the OS that has been rigorously developed and analyzed Called Trusted Computer Base (TCB) Key characteristics during rigorous analysis and testing Functional correctness Enforcement of integrity Limited privilege Access is minimized; sensitive data not disclosed Appropriate confidence level Often used as a safe way for general users to access sensitive data CSC 405 Dr. Peng Ning 25 Operating System (OS) Controls (Cont d) Mutual suspicion Programs do not trust each other Confinement Program is strictly limited in what system resources it can access Access (audit) log List of who accessed what objects Allow tracking down what has been done CSC 405 Dr. Peng Ning 26

Administrative Controls Standards of program development Capture the wisdom from previous projects Standards of design Design tools, languages, methodologies Standards of documentation, language, and coding style Layout of code, choices of variable names, recognized program structures Standards of programming Mandatory peer reviews, periodic code audits, compliance with standards Standards of testing Program verification, archiving test results, independent testers, Standards of configuration management CSC 405 Dr. Peng Ning 27 Administrative Controls (Cont d) Separation of duties Break development tasks into pieces to be performed by separate developers/testers/administrators Force developers/testers/administrators to cooperate More rigorous examination CSC 405 Dr. Peng Ning 28

Preventing Buffer Overflow Attacks Non-executable stack Static source code analysis Run time checking: StackGuard, Libsafe, SafeC, (Purify) Randomization Type safe languages (Java, ML) Legacy code? Detection deviation of program behavior Many more CSC 405 Dr. Peng Ning 29 Marking Stack as Non-Executable Basic stack exploit can be prevented by marking stack segment as non-executable Support in SP2. Code patches exist for Linux, Solaris Problems: Does not defend against `return-to-libc exploit Some apps need executable stack (e.g. LISP interpreters) Does not block more general overflow exploits: Overflow on heap: overflow buffer next to func pointer CSC 405 Dr. Peng Ning 30

Static Source Code Analysis Statically check source code to detect buffer overflows Several consulting companies Can we automate the review process? Several tools exist: Coverity (Engler et al.): Test trust inconsistency Microsoft program analysis group: PREfix: looks for fixed set of bugs (e.g. null ptr ref) PREfast: local analysis to find idioms for prog errors Berkeley: Wagner, et al. Test constraint violations Find lots of bugs, but not all CSC 405 Dr. Peng Ning 31 Run Time Checking: StackGuard Many many run-time checking techniques Solutions 1: StackGuard (WireX) Run time tests for stack integrity Embed canaries in stack frames and verify their integrity prior to function return Frame 2 Frame 1 local canary sfp ret para local canary sfp ret para stack CSC 405 Dr. Peng Ning 32

Canary Types Random canary: Choose random string at program startup Insert canary string into every stack frame Verify canary before returning from function To corrupt random canary, attacker must learn current random string Terminator canary: Canary = 0, newline, linefeed, EOF String functions will not copy beyond terminator Hence, attacker cannot use string functions to corrupt stack CSC 405 Dr. Peng Ning 33 StackGuard (Cont d) StackGuard implemented as a GCC patch Program must be recompiled Minimal performance effects: 8% for Apache Newer version: PointGuard Protects function pointers and setjmp buffers by placing canaries next to them More noticeable performance effects Note: Canaries don t offer fullproof protection Some stack smashing attacks can leave canaries untouched CSC 405 Dr. Peng Ning 34

Windows XP SP2 /GS Non executable stack Compiler /GS option: Combination of ProPolice and Random canary Triggers UnHandledException in case of Canary mismatch to shutdown process Litchfield vulnerability report Overflow overwrites exception handler Redirects exception to attack code CSC 405 Dr. Peng Ning 35 Run Time Checking: Libsafe Solutions 2: Libsafe (Avaya Labs) Dynamically loaded library Intercepts calls to strcpy (dest, src) Validates sufficient space in current stack frame: frame-pointer dest > strlen(src) If so, does strcpy Otherwise, terminates application sfp ret-addr dest src buf sfp ret-addr stack libsafe main CSC 405 Dr. Peng Ning 36

More Methods StackShield At function prologue, copy return address RET and SFP to safe location (beginning of data segment) Upon return, check that RET and SFP is equal to copy Implemented as assembler file processor (GCC) CSC 405 Dr. Peng Ning 37 Randomization: Motivation Buffer overflow and return-to-libc exploits need to know the (virtual) address to which pass control Address of attack code in the buffer Address of a standard kernel library routine Same address is used on many machines Slammer infected 75,000 MS-SQL servers using same code on every machine Idea: introduce artificial diversity Make stack addresses, addresses of library routines, etc. unpredictable and different from machine to machine CSC 405 Dr. Peng Ning 38

Randomization PaX Address Space Layout Randomization Randomize location of libc Attacker cannot jump directly to exec function. Attacks: Repetitively guess randomized address Spraying injected attack code Instruction Set Randomization (ISR) Each program has a different and secret instruction set Use translator to randomize instructions at load-time Attacker cannot execute its own code. CSC 405 Dr. Peng Ning 39 Dynamic Taint Analysis Hard to tell if data is sensitive when it is written Binary has no type information Easy to tell it is sensitive when it is used Dynamic Taint Analysis: Keep track of tainted data from untrusted sources Detect when tainted data is used in a sensitive way e.g., as return address or function pointer Reference: James Newsome and Dawn Song. Dynamic Taint Analysis: Automatic Detection, Analysis, and Signature Generation of Exploit Attacks on Commodity Software, In Proceedings of Network and Distributed Systems Security Symposium, Feb 2005. CSC 405 Dr. Peng Ning 40

Example: Detecting a Buffer Overflow Socket data Function Pointer ATTACK DETECTED! buffer boundary buffer start Memory CSC 405 Dr. Peng Ning 41 Design & Implementation: TaintCheck Use Valgrind to monitor execution Instrument program binary at run-time No source code required Track a taint value for each location: Each byte of tainted memory Each register CSC 405 Dr. Peng Ning 42

TaintCheck Components Untrusted Input Copy!!! Misuse TaintSeed TaintTracker TaintAssert CSC 405 Dr. Peng Ning 43 TaintSeed Monitors input via system calls Marks data from untrusted inputs as tainted Network sockets (default) Standard input File input (except files owned by root, such as system libraries)!!! CSC 405 Dr. Peng Ning 44

TaintTracker Propagates taint Data movement instructions: e.g., move, load, store, etc. Destination tainted iff source is tainted Taint data loaded via tainted index e.g., unicode = translation_table[tainted_ascii] Arithmetic instructions: e.g., add, xor, mult, etc. Destination tainted iff any operand is tainted Untaint result of constant functions xor eax, eax!!! CSC 405 Dr. Peng Ning 45 TaintAssert Detects when tainted data is misused Destination address for control flow (default) Format string (default) Argument to particular system calls (e.g., ) Invoke Exploit Analyzer when exploit detected!!! CSC 405 Dr. Peng Ning 46

Coverage: Attack Classes Detected Return Address Function Pointer Fn Ptr Offset (GOT) Jump Address Format String Stack Overflow Heap Overflow N/A Heap Corruption (Double Free) CSC 405 Dr. Peng Ning 47 Vigilante Automates worm defense Collaborative Infrastructure to detect worms Negligible rate of false positives Network-level approaches do not have access to vulnerability specifics Reference: Manuel Costa, Jon Crowcroft, Miguel Castro, Anthony Rowstron, Lidong Zhou, Lintao Zhang, and Paul Barham, "Vigilante: End-to-End Containment of Internet Worms", SOSP'05, Brighton, UK, October 2005. CSC 405 Dr. Peng Ning 48

Solution Overview Run heavily instrumented versions of software on honeypot or detector machines Broadcast exploit descriptions to regular machines Generate message filters at regular machines to block worm traffic Requires separate detection infrastructure for each particular service CSC 405 Dr. Peng Ning 49 SCA: Self-Certifying Alert Allows exploits to be described, shipped, and reproduced Self-Certifying: to verify authenticity, just execute within sandbox Expressiveness: Concise or Inadequate? Worms defined as exploiters of vulnerability rather than generators of traffic CSC 405 Dr. Peng Ning 50

Types of Vulnerabilities Arbitrary Execution Control: message contains address of code to execute Arbitrary Code Execution: message contains code to execute Arbitrary Function Argument: changing arguments to critical functions. e.g exec How about others? CSC 405 Dr. Peng Ning 51 Example SCA: Slammer Address of code to execute is contained at this offset within message CSC 405 Dr. Peng Ning 52

Alert Generation Many existing approaches Non-executable pages: faster, does not catch function argument exploit Dynamic Data-flow Analysis: track dirty data Basic Idea: Do not allow incoming messages to execute or cause arbitrary execution CSC 405 Dr. Peng Ning 53 Alert Verification Hosts run same software with identical configuration within sandbox Insert call to Verified instead of: Address in execution control alerts Code in code execution alerts Insert a reference argument value instead of argument in arbitrary function argument alert CSC 405 Dr. Peng Ning 54

Alert Verification Verification is fast, simple and generic, and has no false positives Assumes that address/code/argument is supplied verbatim in messages Works for C/C++ buffer overflows, but what about more complex interactions within the service? Assumes that message replay is sufficient for exploit reproduction Scheduling policies, etc? Randomization? CSC 405 Dr. Peng Ning 55 Alert Distribution Flooding over secure Pastry overlay What about DOS? Don t forward already seen or blocked SCAs Forward only after Verification Rate-limit SCAs from each neighbor CSC 405 Dr. Peng Ning 56

Local Response Verify SCA Generate filters conjunctions of conditions on single messages Data flow analysis: remember how dirty data propagates Control flow analysis: generate filter condition to remember under what condition the vulnerability is exploited Two levels : general filter with false positives + specific filter with no false positives General filter: specific filter with some conditions removed Bytes after the vulnerable offset Condition introduced by function calls CSC 405 Dr. Peng Ning 57