0wning Antivirus Alex Wheeler Neel Mehta

Slides:



Advertisements
Similar presentations
A Binary Agent Technology for COTS Software Integrity Richard Schooler Anant Agarwal InCert Software.
Advertisements

COMP 2003: Assembly Language and Digital Logic
C Programming and Assembly Language Janakiraman V – NITK Surathkal 2 nd August 2014.
Department of Computer Science and Software Engineering
TaintCheck and LockSet LBA Reading Group Presentation by Shimin Chen.
Assembly Language for Intel-Based Computers, 4 th Edition Chapter 6: Conditional Processing (c) Pearson Education, All rights reserved. You may modify.
© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e Chapter 2 The Microprocessor and its Architecture.
1 ICS 51 Introductory Computer Organization Fall 2006 updated: Oct. 2, 2006.
Assembly Language for Intel-Based Computers
Practical Session 3. The Stack The stack is an area in memory that its purpose is to provide a space for temporary storage of addresses and data items.
Microprocessors Introduction to ia32 Architecture Jan 31st, 2002.
ICS312 Set 3 Pentium Registers. Intel 8086 Family of Microprocessors All of the Intel chips from the 8086 to the latest pentium, have similar architectures.
Web siteWeb site ExamplesExamples Irvine, Kip R. Assembly Language for Intel-Based Computers, Stack Operations Runtime Stack PUSH Operation POP.
© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e Chapter 2 The Microprocessor and its Architecture.
The ISA Level The Instruction Set Architecture (ISA) is positioned between the microarchtecture level and the operating system level.  Historically, this.
Introduction to InfoSec – Recitation 2 Nir Krakowski (nirkrako at post.tau.ac.il) Itamar Gilad (itamargi at post.tau.ac.il)
Dr. José M. Reyes Álamo 1.  The 80x86 memory addressing modes provide flexible access to memory, allowing you to easily access ◦ Variables ◦ Arrays ◦
BLENDED ATTACKS EXPLOITS, VULNERABILITIES AND BUFFER-OVERFLOW TECHNIQUES IN COMPUTER VIRUSES By: Eric Chien and Peter Szor Presented by: Jesus Morales.
Introduction: Exploiting Linux. Basic Concepts Vulnerability A flaw in a system that allows an attacker to do something the designer did not intend,
Faculty of Engineering, Electrical Department,
The ISA Level The Instruction Set Architecture (ISA) is positioned between the microarchtecture level and the operating system level.  Historically, this.
The x86 Architecture Lecture 15 Fri, Mar 4, 2005.
Software attacks int ConcatString(char *buf1, char *buf2, size_t len1, size_t len2) { char buf[256]; if((len1 + len2) > 256) return -1; memcpy(buf, buf1,
CET 3510 Microcomputer Systems Tech. Lecture 2 Professor: Dr. José M. Reyes Álamo.
Assembly Language for Intel-Based Computers, 6 th Edition Chapter 6: Conditional Processing (c) Pearson Education, All rights reserved. You may modify.
Today’s topics Procedures Procedures Passing values to/from procedures Passing values to/from procedures Saving registers Saving registers Documenting.
CNIT 127: Exploit Development Ch 3: Shellcode. Topics Protection rings Syscalls Shellcode nasm Assembler ld GNU Linker objdump to see contents of object.
Arithmetic Flags and Instructions
Computer Architecture and Operating Systems CS 3230 :Assembly Section Lecture 4 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
1 ICS 51 Introductory Computer Organization Fall 2009.
Buffer Overflow Proofing of Code Binaries By Ramya Reguramalingam Graduate Student, Computer Science Advisor: Dr. Gopal Gupta.
26-Nov-15 (1) CSC Computer Organization Lecture 6: Pentium IA-32.
Addressing Modes Chapter 6 S. Dandamudi To be used with S. Dandamudi, “Introduction to Assembly Language Programming,” Second Edition, Springer,
CNIT 127: Exploit Development Ch 1: Before you begin.
Assembly Language. Symbol Table Variables.DATA var DW 0 sum DD 0 array TIMES 10 DW 0 message DB ’ Welcome ’,0 char1 DB ? Symbol Table Name Offset var.
CNIT 127: Exploit Development Ch 8: Windows Overflows Part 2.
Reverse Engineering Workshop
Sairajiv Burugapalli. This chapter covers three main categories of classic software vulnerability: Buffer overflows Integer vulnerabilities Format string.
1 The Stack and Procedures Chapter 5. 2 A Process in Virtual Memory  This is how a process is placed into its virtual addressable space  The code is.
October 1, 2003Serguei A. Mokhov, 1 SOEN228, Winter 2003 Revision 1.2 Date: October 25, 2003.
Slides by Kent Seamons and Tim van der Horst Last Updated: Nov 11, 2011.
Assembly 09. Outline Strings in x86 esi, edi, ecx, eax stosb, stosw, stosd cld, std rep loop 1.
Computer Organization & Assembly Language University of Sargodha, Lahore Campus Prepared by Ali Saeed.
Introduction to Intel IA-32 and IA-64 Instruction Set Architectures.
Assembly Language for Intel-Based Computers, 4 th Edition Lecture 22: Conditional Loops (c) Pearson Education, All rights reserved. You may modify.
Assembly Language for Intel-Based Computers, 4 th Edition Week 10: Conditional Processing Slides modified by Dr. Osama Younes.
Paradyn Project Paradyn / Dyninst Week Madison, Wisconsin April 12-14, 2010 Paradyn Project Safe and Efficient Instrumentation Andrew Bernat.
Assembly Language Addressing Modes. Introduction CISC processors usually supports more addressing modes than RISC processors. –RISC processors use the.
Chapter 8 String Operations. 8.1 Using String Instructions.
Exploiting & Defense Day 1 Recap
CSC 221 Computer Organization and Assembly Language
Buffer Overflow Buffer overflows are possible because C doesn’t check array boundaries Buffer overflows are dangerous because buffers for user input are.
Computer Architecture and Assembly Language
Practical Session 5.
Computer Architecture and Assembly Language
Instruction Set Architectures
Assembly IA-32.
Computer Architecture and Assembly Language
Computer Organization and Assembly Language
BIC 10503: COMPUTER ARCHITECTURE
CS 465 Buffer Overflow Slides by Kent Seamons and Tim van der Horst
Practical Session 4.
Discovering Data Structures
X86 Assembly Review.
Chapter 5 Arithmetic and Logic Instructions
0wning Antivirus Alex Wheeler
Computer Architecture and System Programming Laboratory
Computer Architecture and System Programming Laboratory
Computer Architecture and System Programming Laboratory
Presentation transcript:

0wning Antivirus Alex Wheeler Neel Mehta

Why AV? Attractive Attack Surface –Gateways, Servers, Clients, ISP’s, Third Party Vendor Products –Heterogeneous and Layered Environments

Why AV? –Un-trusted Data Processing Must be reachable by external input to be useful

Why AV? –Run on a variety of Platforms Windows, Linux, Solaris, Mac

How Does AV work? –Signature vs. Behavior Pattern-matching / regex File-format decomposition

How Does AV work? –Enterprise vs. Consumer Architecture $$$ & Manageability

How Does AV work? –Common Core Components IO filters Format Engines

How Does AV work? –Standard Features Updates Multi-Threat detection

How Does AV work? –Common Configurations Scan level Scan sizes Scan Method

Code Coverage - Signatures –Field Values Max Len (eg. ARJ header len 0xa28) Magic (eg. PECOFF – “MZ” & “PE”) –Field Sizes PE Section Header 0x28 Tar Object 0x200 –Strings PECOFF – section labels, common libraries –Ida Examples LHA ARJ UPX

Code Coverage – Core Utilities –Read Easy to spot Closest audit point to un-trusted input Usually wrapped & buffered Some truncate length

Code Coverage – Core Utilities –Allocation Any calculations to length are interesting Usually wrapped Some check 4 zero Some add to length for internal headers Some wrappers will truncate length

Code Coverage –Constructs –Conversions String/Number Byte Ordering

Code Coverage –Constructs –Checksum, CRC, etc. Easy to spot (ror, xor, etc. in a loop) Gives un-trusted input context

Code Coverage –Constructs –Inherited File Structures & Commonly Grouped Processors Are annoying to trace, due to indirection Can reveal more subtle unchecked copies Ex: Is MZ -> Is PE -> Is UPX

Audit Points - Inefficiencies –Engine vs. Product differences Can be an issue when engine is stricter than the product Ex: Recent Multi-vendor zip issues

Audit Points - Inefficiencies –Default Scan Levels Can be an issue when product does not require multiple extractions Ex: Packed and SFX

Audit Points - Inefficiencies –File Size Limitations Small archives can contain large files

Audit Points - Inefficiencies –Format Collisions Files conforming to multiple formats may be used to trick state and evade detection

O-Day Detection Generally very minimal capabilities –Measure virus propagation by number of infected customers. Evasion? –Write a new virus.

Audit Points – Memory Corruption –Inconsistent Checks Length type mismatches can be abused to bypass checks, wrap allocations, and overflow copies Negative offsets can be abused to bypass checks and overflow copies

Audit Points – Memory Corruption –Wrappers Allocators that modify length Reads that truncate length (reduces chance of access violation on overflow on negative copies)

Audit Points – Memory Corruption –Error-Prone Formats: 32 bit fields –Interesting to examine sign and any calculations –Ex: PECOFF – Packed & SFX, Archives

Audit Points – Memory Corruption String Based Formats –These can be hard to implement correctly –StringToNumber conversions are interesting –Ex: TNEF, MIME, PDF

Common Error #1 MOV ECX, USERINPUTPTR PUSH ECX LEA ESI, [EBP-100h] PUSH OFFSET _ss; "%s" PUSH ESI CALL _sprintf ADD ESP, 0Ch

Common Error #2 MOV EAX, DWORD PTR [EBX] CMP EAX, 40h JG TOO_LARGE

Common Error #3 MOV ESI, DWORD PTR [EBX] LEA EAX, [ESI+18h] PUSH EAX CALL malloc ADD ESP, 4 MOV EDI, EAX TEST EDI, EDI JZ ALLOCATION_FAILED PUSH ESI// Size to Read PUSH EDI// Destination Buffer PUSH EBP// File Descriptor CALL read_file_wrapper ADD ESP, 0Ch

Common Error #4 XOR EBX, EBX START_LOOP MOV AL, [ESI] INC ESI INC EBX TEST AL, AL JNZ START_LOOP MOVZX ECX, BX LEA ESI, [ECX+1] PUSH ESI CALL malloc ADD ESP, 4

Another Error MOV EAX, DWORD PTR [ESI] MOV EBX, DWORD PTR [ESI+4] ADD ESI, 8 XOR EDX, EDX DIV EBX

Audit Methodology –Identify Utility Functions Naming these will aid in tracing input later Ex: Wrappers, FileIO, Allocations

Audit Methodology –Trace Un-trusted Input Examine data that influences: –Allocations –Copies Structure members –Initializations are easy to spot –Use is less easy – binary search for offset

Audit Methodology –Reverse File Format Processors Track class member offsets and sizes Will reveal more subtle bugs

Audit Results –Symantec Unchecked offset reconstructing UPX PE header Can be triggered by providing a negative offset to prior heap chunk containing MZ header with crafted PE header Heap overflow with no character restrictions

Audit Results –McAfee Improperly checked file name and path strlen in LHA level 1 header Signature in.dat to detect for malformed LHA file Can be triggered my supplying a malformed LHA file, that also conforms to the PECOFF format Stack overflow with ascii character restrictions

Audit Results –TrendMicro Improperly checked filename strlen in ARJ header Doesn’t overflow the next chunk’s header, but does corrupt various pointers, which results in the address of the filename being written to an arbitrary destination Kernel Heap overflow with ascii character restrictions

Audit Results –FSecure Improperly checked filename strlen in ARJ header Standard heap overflow with ascii character restrictions

Future Points of Interest –Large Files Signed Checks Type Truncation Integer Overflows/Wraps/Underflows Ida Examples

Future Points of Interest –New Formats Formats implemented due to bugs Formats implemented due to wide use –Product Administration

Questions?