Working with Buffers
|
|
|
- Claire Cameron
- 10 years ago
- Views:
Transcription
1 University Hamburg Department of Informatics Scientific Computing Research Group Working with Buffers Seminar Paper Seminar Efficient Programming in C Christoph Brauer [email protected] Supervisor : Michael Kuhn April 15, 2013
2
3 Working with Buffers Abstract This paper gives an introduction to C buffers including common allocation variants and storage locations. Runtime allocation efficiency is discussed by comparison of different dynamic allocation mechanisms, and common security issues as well as according countermeasures are pointed out. 3
4 Working with Buffers Contents 1 Introduction 2 2 Introduction to C Buffers and Storage Variants Terminology Buffer Variants Static Buffers Dynamic Buffers The Stack The Heap Runtime Allocation Efficiency Malloc Allocation Slice Allocation Summary Security Concerns Countermeasures Bibliography 11 1
5 Christoph Brauer 1 Introduction The C programming language offers various buffer allocation strategies. This paper aims to impart knowledge about different allocation mechanisms in order to provide a programmer with the ability to choose the most efficient mechanism given a specific task. Additionally, common pitfalls and security weaknesses are pointed out to maximize efficiency not only in terms of ressource usage, but also in terms of security and reliability. In order to keep the size of this paper in a convenient range the content is presented in a rather concise and compact manner. For a deeper understanding of the topics provided, this paper is supported by an according presentation [10] which in turn gives various illustrative examples and verbose explanations. 2 Introduction to C Buffers and Storage Variants 2.1 Terminology The meaning of the term buffer itself heavily depends on its context, even if restricted to the domain of computer science. To make up for this ambiguity, the term C buffer used throughout this paper refers to a compound and continuous area of computer memory that is assigned data of the same C datatype and allocated using the C programming language. 2.2 Buffer Variants C Buffers can generally be allocated either statically or dynamically. Both variants differ heavily in terms of ressource usage and flexibility, so a basic understanding of those is vital in order to choose the right allocation strategy suiting the individual task Static Buffers Static buffers feature a fixed size preset at compile time and reside in memory persistently during a program s lifetime. For these characteristics, control of static buffer allocations is given implicitly to the operating system rather than the programmer. Upon program execution, the operating system s executable file loader analyzes the program s static demands, allocates the appropriate amount of memory and finally deallocates that memory at program termination. This approach gives little to no control to the programmer and as such lacks flexibility, though it offers fast, simple and reliable operation. Any C variable that is declared outside a function s body is by default allocated statically. To allocate a static variable inside a function body, the declaration must be prefixed by the static keyword. Listing 1 illustrates a typical static buffer application. Variables declared outside a function s body might as well be 2
6 Working with Buffers prefixed by static, though unlike one might assume by intuition it does not specify allocation requirements but prevents a variable s symbol of being exported [12]. char onestaticbuffer [ 256] ; int main ( void ) { static anotherstaticbuffer [ 256] ; return ( 0 ) ; } Listing 1: Static 256 Byte Buffer Example Dynamic Buffers Dynamic buffers are allocated and deallocated at runtime by either implicit declarations or explicit function calls. Consequently, they offer a broad range of flexibility for they may be allocated or purged on demand and allow for adaptive size settings. Of course these major advantages do not come for free, dynamic buffers require additional ressources such as runtime management measures and special care by the programmer. Dynamic buffers may generally be allocated in any suitable memory region, though in practice only two special types, the stack and the heap, are commonly used The Stack The stack forms a memory area that is accessible in a LIFO ( Last In - First Out ) fashion. One way to imagine the stack is to think of its elements as heavy boxes placed on top of each other. The only box directly accessible is the topmost one, so access to any other box can only be gained by removing the boxes on top of it one by one beforehand. Following this analogy, the box on the bottom is denoted stack bottom, the topmost box is denoted stack top. In terms of stack data structures, putting an element on top of the stack is called a push operation, removal of the topmost element is performed by a pop operation. Unlike the box model, memory cells can not be physically moved of course, so an index is required to keep track of the current stack position. This index is involved in any stack operation and commonly denoted as stack pointer, often abbreviated SP. Though it might not be considered intuitive, the stack traditionally grows towards smaller addresses on many popular architectures such as i386/amd64. In the early years of microcomputer development, a long time before virtual memory became widespread, the negative growth was used as a measure to improve memory efficiency. The stack grew downwards from the top of the physical memory whilst other data such as the heap grew upwards from the bottom. The programmer had to take special care to prevent overlapping or data corruption, and needless to say 3
7 Christoph Brauer that such a layout imposed countless errors, but at least valuable memory space could be saved. Keeping the SP in mind, a push operation can be described as a decrement of the stack pointer followed by a write operation to the memory address pointed to by that altered SP. Accordingly, a pop operation requires a read access followed by in increment. Both push and pop operations as well as a dedicated SP register are usually provided by CPU hardware directly. Figure 1a illustrates the stack s principle of operation, Figure 1b gives a memory snapshot of an example stack featuring an element size of a single byte and a capacity of 256 bytes. The illustrated stack state was reached after the values 0x10, 0x20 and 0x30 were pushed on the initially empty stack, two elements were popped and finally another two values 0x40 and 0x50 got pushed. (a) General Structure (b) Usage Example Figure 1: Stack Illustration In terms of allocation demands, the stack behaves just as one might have guessed by intuition. Any element given a memory address greater than that of the SP is considered free, all others are already occupied and thus reserved. Consequently, allocating a block of memory on the stack is done by nothing but an according increment of the SP, deallocation by a decrement. In other terms, deallocation of stack data is done by abandonment. C programs generally make extensive use of the stack as a general temporary storage. Listing 2 illustrates an example stack buffer allocation. void simplefunction ( void ) { char stackbuffer [ 1024] ; } Listing 2: Stack Buffer Allocation Example A buffer is allocated on the stack whenever its declared inside a function s body as a function-local variable. 4
8 Working with Buffers A C programmer is kept mostly unaware of the actual stack operations for they are implicitly created by the compiler and only appear visible in the assembler output listing. The stack is used as a shared memory between function calls, so there is only one single stack utilized throughout program execution. Though operational details heavily differ by system architecture, compiler or calling convention, the stack is commonly used to store function return pointers, register contents and function-local variables. The ability to store interleaved content such as program flow data and user variables makes the stack a general purpose memory, though this flexibiliy comes at the cost of major drawbacks as described in Section 4. Whenever a C function is called, it is assigned a memory region on the stack, a so-called stack frame. For the stack is shared throughout program execution, nested function calls cause stack frames to be created just one after each other. Figure 2 illustrates an example stack state after a function A has called a function B. Individual stack frames are especially important for the executing of recursive functions for they allow for independent local variables across nested calls. Figure 2: Stack Frame For a function s stack frame is abandoned after the function is finished, the lifetime of local stack variables including buffers if restricted to a function s lifetime. For instance, given a stack layout as illustrated in 2, passing a pointer to function A s local data from function A to function B is unproblematic, though the other way round is errorneous for such a pointer references abandonded any most probably invalid data. In conclusion, stack buffers provide for dynamical runtime allocation requiring minimal management effort, though the application domain is restricted due to the limited lifetime The Heap Unlike the stack, the heap does not feature any access order conventions and as such forms a freely accessible memory region. Though heap memory itself is provided by the operating system, kernel calls are barely ever used directly in practice. One way to imagine the cooperation of kernel and user space allocators is to think of the kernel as a brewery, of an user space allocator as an innkeeper and of a function as a pub guest. The guest wants to drink a beer or maybe two, and though he could buy a whole barrel from the brewery directly, this would be a rather expensive, 5
9 Christoph Brauer time consuming and wasteful approach. Instead, the guest is most likely going to buy a single beer from the innkeeper and leave the task of obtaining whole barrels to him. Additionally, this approach provides the opportunity to distribute the beer among different guests by sharing the barrel. In terms of buffer allocations, the kernel provides for large regions of heap memory. The task of splitting the heap into smaller partitions as demanded by a program s allocation requests is performed by the user space allocator. Allocations are tracked internally to allow for memory bookkeeping and release of previously reserved memory. Once the heap space available to the user space allocator is exhausted, additional memory is requested from the operating system. Many user space allocators come with advanced features such as defragmentation measures or caching mechanisms, though these are not strictly obligatory. One promiment example of an user space allocator is given by malloc [3, 6] shipped as part of the C standard library, but there are multitudes of different 3rd party allocators available as well. Unless a suitable allocator already exists, special tasks might as well benefit from a programmer supplying a self-written version. 3 Runtime Allocation Efficiency As suggested in Section 2.2, buffer allocation efficiency is determined by a tradeoff between flexibility and ressource usage. In order to maximize runtime efficiency, a programmer is advised to choose an allocation mechanism featuring the least flexibility just suiting the specific task. In case neither static nor stack allocations are applicable, memory must be allocated on the heap. Though heap memory allocation generally tends to be the most ressource consuming allocation mechanism, the programmer is given the opportunity to choose an user space allocator best fitting his needs. 3.1 Malloc Allocation The common and traditional way to allocate heap memory using C is to use the malloc allocator. It has been developed and used for many years, and though there were security concerns in the past [8], it is considered stable and generally applicable today. 6
10 Working with Buffers Figure 3: Malloc Heap Layout As depicted by Figure 3, each memory block allocated by malloc is directly prefixed by an associated internal structure called memory header. A header contains information about the memory block next to it such as its size or availability. All headers are arranged to form a doubly-linked list, therefore operations such as insertion or removal require pointer modifications just as known from common list node operations. For each allocated block is accompanied by an according header, significant management overhead in terms of memory usage might occur given many small allocations. Popular implementations of malloc-style allocators include libc ptmalloc [6], jemalloc [11], tcmalloc [7] and dlmalloc [13], though there are many more to choose from. 3.2 Slice Allocation Unlike malloc, a slice allocator as suggested by Jeff Bonwick [9] acts predictively for it s allocation strategy is based on the assumption that the occurence of a small memory allocation request is most probably followed by multiple similar request. The according definition of small varies by implementation and configuration, though less than 256 bytes are commonly considered small given that context. Allocation request that exceed this size limit are not handled by the slice allocator itself but delegated to a traditional allocator such as malloc instead. Figure 4: Slice Heap Layout Figure 4 gives a simplified illustration of a slice allocator heap layout. A slice is made up of a slice header followed by multiple equally-sized slice blocks. The header 7
11 Christoph Brauer contains fundamental information such as the general slice status, the blocksize, the overall number of blocks and the number of occupied blocks. Slice blocks are always reserved in a consecutive fashion such that a bank of occupied blocks is followed by free blocks, if any. This layout allows for a single header controlling multiple allocated blocks and as such might noticeably decrease memory usage. Whenever memory is requested, the slice allocator checks for an available slice such that its blocksize matches the allocation request s size. Unless a pre-existing appropriate slice is found, an according one is created, its header is updated such that the number of occupied blocks is incremented and a pointer to the block just reserved is returned. The process of deallocation forms one of the slice allocator s major drawbacks. In case the according slice contains only one single element, the deallocation of that element causes the slice to be removed. Otherwise, the number of occupied blocks stored in the slice header is decremented and the slice is marked not available for further allocations. As mentioned before, the reduced memory usage of a single slice header controlling multiple blocks relies on the fact that a compound area of allocated blocks is followed by free blocks. A block to be deallocated is not guaranteed to lie at the end of a reserved row, so it possibly breaks the condition of the allocated blocks forming a compound area. Consequently, the positions of the remaining free blocks are left undetermined, and further allocations are prohibited. A fully working implementation of a slice allocator is available as part of GLib [2]. 3.3 Summary Heap allocation can be performed in many different ways, and there is no strategy that can be considered generally superior. An efficiency comparison between ptmalloc and the GLib slice allocator is given in the presentation, and though the slice allocator proves that it may very well outperform malloc in certain situations, there are settings in which malloc might be the more efficient choice. For instance, a program that repeatedly executes a loop in which 2 small buffers of the same size are allocated and only one of them is freed is most probably going to perform significantly better using malloc than a slice allocator. 8
12 Working with Buffers 4 Security Concerns Unlike many modern programming languages such as Java or Python, the C programming language does not provide any built-in capabilities to enforce buffer bounds checking. Consequently, the responsibility for proper buffer usage lies with the programmer. Errorneous buffer usage has been repeatedly identified as a source of program malfunctions for decades [4], and though noticeable effort has been put into the development of according counter measures [14], the problem can not be considered solved yet [5]. Any buffer access that exceeds a buffer s bounds addresses a surrounding region of memory not belonging to that buffer. Such a region may contain vital data such as heap memory management structures, local stack variables or function return addresses, so especially write accesses exceeding a buffer s bounds might cause harmful consequences. Unfortunately, the standard C library itself provides several functions such as the infamous scanf that work on buffers without checking proper size restrictions. One might ask how such insecure functions could ever make their way into a widespread standard code repository, and the answer is as short as simple : The standard C library was invented in the 1970s, and programmers were unaware of a future as we face it today in which computers are commonly integrated into public networks and as such popular targets of malicious attacks. Apart from the unawareness, programmers are simply humans who tend to make mistakes just like everybody else, and routines working on buffers are just as error prone as any others. So called buffer overflow attacks provoke errernous buffer handling on intention. Most commonly, a vulnerable program is provided with selected input data to fill and finally overflow a buffer. According to the type of the attack, the program may crash, the program flow may be altered or even code provided by the attacker may be executed. Listing 2 gives an example of a typical vulnerable program. # include <stdio.h> int main ( void ) { char namebuffer [ 512] ; printf ( " Please enter your name : " ) ; gets ( namebuffer ) ; printf ( " Hello %s!\n", namebuffer ) ; return ( 0 ) ; } Listing 3: Vulnerabilty Example At a first glance, the program does not appear to be too exciting, a name is read from the standard input, stored inside a stack buffer and finally printed on the standard output. One might be temped to assume a certain level of security for a 9
13 Christoph Brauer buffer size of 512 bytes appears sufficient to store any person s real name, yet such an assumption is misleading. The given program can easily be crashed by a single shell command : $ python -c " print 15000* x "./ crash. elf close failed in file object destructor : sys. excepthook is missing lost sys. stderr Segmentation fault Output 1: Vulnerabilty example Numerous practical examples of different buffer overflow techniques are presented in Section 4 of the accompanying presentation, and study of those is highly recommended for a deeper understanding of potential security risks. 4.1 Countermeasures As the enduring presence of buffer overflow bugs may suggest [1], there is no simple answer to the question about how to generally avoid buffer security issues. Though total security can never be guaranteed, several inventions might help to at least reduce the risk of vulnerabilities. Recent compilers such as GCC 4.x offer the option to enable a built-in stack protection mechanism by validating a function s stack frame contents upon its return. Such an mechanism can not prevent stack corruptions, but at least the program is terminated and an verbose error message is given. Many modern CPUs such as those based on the AMD64 architecture provide mechanism so mark memory sections not executable. Just like the compiler stack protection, stack corruptions can not be avoided, though the risk of running malicious injected code is minimized. Last but not least modern operating systems feature an adress space layout randomization such that the address space belonging to a process is altered any time the process is run. Most exploits use fixed jump positions and thus require a known memory layout beforehand, so the risk can be minimized. The most effective counter measure is simply given by security-aware and careful programming. Functions known to induce security risks such as the infamous standard C functions gets, scanf, strcpy, strcat, sprintf, vsprintf should generally be avoided and replaced by variants that are at least known to be less insecure such as fgets, strncpy, strncat, snprintf, fgets, strlcpy and strlcat. This list is by no means comprehensive, and even those functions considered secure might appear to be vulnerable in the future. New bugs are spotted every day, and security focussed internet sites should be consulted to gain latest information about security issues. Software should be tested extensively, and especially buffers should be overflown by intention to investigate potential weak spots. 10
14 Working with Buffers 5 Bibliography References [1] Bugtraq mailing list. [2] Glib memory slice allocator. glib-memory-slices.html. [3] Malloc function reference. malloc.3.html. [4] The morris internet worm /articles/morris-worm.html. [5] Multiple zero-day poc exploits threaten oracle mysql server. multiple-zero-day-poc-exploits-threaten-oracle-mysql-server/. [6] ptmalloc - a multi-threaded malloc implementation. en/. [7] Tcmalloc : Thread-caching malloc. net/doc/tcmalloc.html. [8] Advanced doug lea s malloc exploits. Phrack, 11(61), August [9] Jeff Bonwick. The slab allocator: An object-caching kernel memory allocator. In USENIX Summer, pages 87 98, [10] Christoph Brauer. Presentation about working with buffers. http: //wr.informatik.uni-hamburg.de/_media/teaching/wintersemester_ 2012_2013/epc-1213-brauer-buffer-praesentation.pdf, [11] Jason Evans. A scalable concurrent malloc(3) implementation for freebsd [12] Brian W. Kernighan and Dennis Ritchie. The C Programming Language, Second Edition. Prentice-Hall, [13] Doug Lea. dlmalloc. [14] Todd C. Miller and Theo de Raadt. strlcpy and strlcat - consistent, safe, string copy and concatenation. In USENIX Annual Technical Conference, FREENIX Track, pages ,
Software Vulnerabilities
Software Vulnerabilities -- stack overflow Code based security Code based security discusses typical vulnerabilities made by programmers that can be exploited by miscreants Implementing safe software in
Embedded Systems. Review of ANSI C Topics. A Review of ANSI C and Considerations for Embedded C Programming. Basic features of C
Embedded Systems A Review of ANSI C and Considerations for Embedded C Programming Dr. Jeff Jackson Lecture 2-1 Review of ANSI C Topics Basic features of C C fundamentals Basic data types Expressions Selection
Format string exploitation on windows Using Immunity Debugger / Python. By Abysssec Inc WwW.Abysssec.Com
Format string exploitation on windows Using Immunity Debugger / Python By Abysssec Inc WwW.Abysssec.Com For real beneficiary this post you should have few assembly knowledge and you should know about classic
The C Programming Language course syllabus associate level
TECHNOLOGIES The C Programming Language course syllabus associate level Course description The course fully covers the basics of programming in the C programming language and demonstrates fundamental programming
Software security. Buffer overflow attacks SQL injections. Lecture 11 EIT060 Computer Security
Software security Buffer overflow attacks SQL injections Lecture 11 EIT060 Computer Security Buffer overflow attacks Buffer overrun is another common term Definition A condition at an interface under which
Introduction to Information Security
Introduction to Information Security 0368-3065, Spring 2015 Lecture 1: Introduction, Control Hijacking (1/2) Eran Tromer Slides credit: Avishai Wool, Tel Aviv University 1 Administration Lecturer: Eran
Jonathan Worthington Scarborough Linux User Group
Jonathan Worthington Scarborough Linux User Group Introduction What does a Virtual Machine do? Hides away the details of the hardware platform and operating system. Defines a common set of instructions.
Leak Check Version 2.1 for Linux TM
Leak Check Version 2.1 for Linux TM User s Guide Including Leak Analyzer For x86 Servers Document Number DLC20-L-021-1 Copyright 2003-2009 Dynamic Memory Solutions LLC www.dynamic-memory.com Notices Information
The programming language C. sws1 1
The programming language C sws1 1 The programming language C invented by Dennis Ritchie in early 1970s who used it to write the first Hello World program C was used to write UNIX Standardised as K&C (Kernighan
Storage Classes CS 110B - Rule Storage Classes Page 18-1 \handouts\storclas
CS 110B - Rule Storage Classes Page 18-1 Attributes are distinctive features of a variable. Data type, int or double for example, is an attribute. Storage class is another attribute. There are four storage
C Compiler Targeting the Java Virtual Machine
C Compiler Targeting the Java Virtual Machine Jack Pien Senior Honors Thesis (Advisor: Javed A. Aslam) Dartmouth College Computer Science Technical Report PCS-TR98-334 May 30, 1998 Abstract One of the
Exceptions in MIPS. know the exception mechanism in MIPS be able to write a simple exception handler for a MIPS machine
7 Objectives After completing this lab you will: know the exception mechanism in MIPS be able to write a simple exception handler for a MIPS machine Introduction Branches and jumps provide ways to change
A Test Suite for Basic CWE Effectiveness. Paul E. Black. [email protected]. http://samate.nist.gov/
A Test Suite for Basic CWE Effectiveness Paul E. Black [email protected] http://samate.nist.gov/ Static Analysis Tool Exposition (SATE V) News l We choose test cases by end of May l Tool output uploaded
EECS 354 Network Security. Introduction
EECS 354 Network Security Introduction Why Learn To Hack Understanding how to break into computer systems allows you to better defend them Learn how to think like an attacker Defense then becomes second-nature
Cryptography and Network Security Prof. D. Mukhopadhyay Department of Computer Science and Engineering
Cryptography and Network Security Prof. D. Mukhopadhyay Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Module No. # 01 Lecture No. # 39 System Security Welcome
Operating System Structures
COP 4610: Introduction to Operating Systems (Spring 2015) Operating System Structures Zhi Wang Florida State University Content Operating system services User interface System calls System programs Operating
Cataloguing and Avoiding the Buffer Overflow Attacks in Network Operating Systems
Abstract: Cataloguing and Avoiding the Buffer Overflow Attacks in Network Operating Systems *P.VADIVELMURUGAN #K.ALAGARSAMY *Research Scholar, Department of Computer Center, Madurai Kamaraj University,
1 The Java Virtual Machine
1 The Java Virtual Machine About the Spec Format This document describes the Java virtual machine and the instruction set. In this introduction, each component of the machine is briefly described. This
Last Class: OS and Computer Architecture. Last Class: OS and Computer Architecture
Last Class: OS and Computer Architecture System bus Network card CPU, memory, I/O devices, network card, system bus Lecture 3, page 1 Last Class: OS and Computer Architecture OS Service Protection Interrupts
umps software development
Laboratorio di Sistemi Operativi Anno Accademico 2006-2007 Software Development with umps Part 2 Mauro Morsiani Software development with umps architecture: Assembly language development is cumbersome:
Buffer Overflows. Code Security: Buffer Overflows. Buffer Overflows are everywhere. 13 Buffer Overflow 12 Nov 2015
CSCD27 Computer and Network Security Code Security: Buffer Overflows 13 Buffer Overflow CSCD27 Computer and Network Security 1 Buffer Overflows Extremely common bug. First major exploit: 1988 Internet
Glossary of Object Oriented Terms
Appendix E Glossary of Object Oriented Terms abstract class: A class primarily intended to define an instance, but can not be instantiated without additional methods. abstract data type: An abstraction
I Control Your Code Attack Vectors Through the Eyes of Software-based Fault Isolation. Mathias Payer, ETH Zurich
I Control Your Code Attack Vectors Through the Eyes of Software-based Fault Isolation Mathias Payer, ETH Zurich Motivation Applications often vulnerable to security exploits Solution: restrict application
Interpreters and virtual machines. Interpreters. Interpreters. Why interpreters? Tree-based interpreters. Text-based interpreters
Interpreters and virtual machines Michel Schinz 2007 03 23 Interpreters Interpreters Why interpreters? An interpreter is a program that executes another program, represented as some kind of data-structure.
X05. An Overview of Source Code Scanning Tools. Loulwa Salem. Las Vegas, NV. IBM Corporation 2006. IBM System p, AIX 5L & Linux Technical University
X05 An Overview of Source Code Scanning Tools Loulwa Salem Las Vegas, NV Objectives This session will introduce better coding practices and tools available to aid developers in producing more secure code.
Object Oriented Software Design II
Object Oriented Software Design II Introduction to C++ Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa February 20, 2012 G. Lipari (Scuola Superiore Sant Anna) C++ Intro February
Helping you avoid stack overflow crashes!
Helping you avoid stack overflow crashes! One of the toughest (and unfortunately common) problems in embedded systems is stack overflows and the collateral corruption that it can cause. As a result, we
Organization of Programming Languages CS320/520N. Lecture 05. Razvan C. Bunescu School of Electrical Engineering and Computer Science bunescu@ohio.
Organization of Programming Languages CS320/520N Razvan C. Bunescu School of Electrical Engineering and Computer Science [email protected] Names, Bindings, and Scopes A name is a symbolic identifier used
What is Web Security? Motivation
[email protected] http://www.brucker.ch/ Information Security ETH Zürich Zürich, Switzerland Information Security Fundamentals March 23, 2004 The End Users View The Server Providers View What is Web
Virtual Servers. Virtual machines. Virtualization. Design of IBM s VM. Virtual machine systems can give everyone the OS (and hardware) that they want.
Virtual machines Virtual machine systems can give everyone the OS (and hardware) that they want. IBM s VM provided an exact copy of the hardware to the user. Virtual Servers Virtual machines are very widespread.
Defense in Depth: Protecting Against Zero-Day Attacks
Defense in Depth: Protecting Against Zero-Day Attacks Chris McNab FIRST 16, Budapest 2004 Agenda Exploits through the ages Discussion of stack and heap overflows Common attack behavior Defense in depth
Stack Allocation. Run-Time Data Structures. Static Structures
Run-Time Data Structures Stack Allocation Static Structures For static structures, a fixed address is used throughout execution. This is the oldest and simplest memory organization. In current compilers,
Memory Allocation. Static Allocation. Dynamic Allocation. Memory Management. Dynamic Allocation. Dynamic Storage Allocation
Dynamic Storage Allocation CS 44 Operating Systems Fall 5 Presented By Vibha Prasad Memory Allocation Static Allocation (fixed in size) Sometimes we create data structures that are fixed and don t need
Homeland Security Red Teaming
Homeland Security Red Teaming Directs intergovernmental coordination Specifies Red Teaming Viewing systems from the perspective of a potential adversary Target hardening Looking for weakness in existing
- An Essential Building Block for Stable and Reliable Compute Clusters
Ferdinand Geier ParTec Cluster Competence Center GmbH, V. 1.4, March 2005 Cluster Middleware - An Essential Building Block for Stable and Reliable Compute Clusters Contents: Compute Clusters a Real Alternative
Operating System Overview. Otto J. Anshus
Operating System Overview Otto J. Anshus A Typical Computer CPU... CPU Memory Chipset I/O bus ROM Keyboard Network A Typical Computer System CPU. CPU Memory Application(s) Operating System ROM OS Apps
Chapter 3: Operating-System Structures. Common System Components
Chapter 3: Operating-System Structures System Components Operating System Services System Calls System Programs System Structure Virtual Machines System Design and Implementation System Generation 3.1
CSC230 Getting Starting in C. Tyler Bletsch
CSC230 Getting Starting in C Tyler Bletsch What is C? The language of UNIX Procedural language (no classes) Low-level access to memory Easy to map to machine language Not much run-time stuff needed Surprisingly
N-Variant Systems. Slides extracted from talk by David Evans. (provenance in footer) http://www.cs.virginia.edu/evans/sdwest
1 N-Variant Systems Slides extracted from talk by David Evans (provenance in footer) 2 Inevitability of Failure Despite all the best efforts to build secure software, we will still fail (or have to run
KITES TECHNOLOGY COURSE MODULE (C, C++, DS)
KITES TECHNOLOGY 360 Degree Solution www.kitestechnology.com/academy.php [email protected] [email protected] Contact: - 8961334776 9433759247 9830639522.NET JAVA WEB DESIGN PHP SQL, PL/SQL
Payment Card Industry (PCI) Terminal Software Security. Best Practices
Payment Card Industry (PCI) Terminal Software Security Best Version 1.0 December 2014 Document Changes Date Version Description June 2014 Draft Initial July 23, 2014 Core Redesign for core and other August
VMware Server 2.0 Essentials. Virtualization Deployment and Management
VMware Server 2.0 Essentials Virtualization Deployment and Management . This PDF is provided for personal use only. Unauthorized use, reproduction and/or distribution strictly prohibited. All rights reserved.
How to Sandbox IIS Automatically without 0 False Positive and Negative
How to Sandbox IIS Automatically without 0 False Positive and Negative Professor Tzi-cker Chiueh Computer Science Department Stony Brook University [email protected] 2/8/06 Blackhat Federal 2006 1 Big
Measuring the Effect of Code Complexity on Static Analysis Results
Measuring the Effect of Code Complexity on Static Analysis Results James Walden, Adam Messer, and Alex Kuhl Department of Computer Science Northern Kentucky University Highland Heights, KY 41099 Abstract.
Bypassing Memory Protections: The Future of Exploitation
Bypassing Memory Protections: The Future of Exploitation Alexander Sotirov [email protected] About me Exploit development since 1999 Research into reliable exploitation techniques: Heap Feng Shui in JavaScript
Bypassing Browser Memory Protections in Windows Vista
Bypassing Browser Memory Protections in Windows Vista Mark Dowd & Alexander Sotirov [email protected] [email protected] Setting back browser security by 10 years Part I: Introduction Thesis Introduction
MAGENTO HOSTING Progressive Server Performance Improvements
MAGENTO HOSTING Progressive Server Performance Improvements Simple Helix, LLC 4092 Memorial Parkway Ste 202 Huntsville, AL 35802 [email protected] 1.866.963.0424 www.simplehelix.com 2 Table of Contents
Segmentation and Fragmentation
Segmentation and Fragmentation Operating System Design MOSIG 1 Instructor: Arnaud Legrand Class Assistants: Benjamin Negrevergne, Sascha Hunold September 16, 2010 A. Legrand Segmentation and Fragmentation
Linux Driver Devices. Why, When, Which, How?
Bertrand Mermet Sylvain Ract Linux Driver Devices. Why, When, Which, How? Since its creation in the early 1990 s Linux has been installed on millions of computers or embedded systems. These systems may
Garbage Collection in the Java HotSpot Virtual Machine
http://www.devx.com Printed from http://www.devx.com/java/article/21977/1954 Garbage Collection in the Java HotSpot Virtual Machine Gain a better understanding of how garbage collection in the Java HotSpot
An Overview of Stack Architecture and the PSC 1000 Microprocessor
An Overview of Stack Architecture and the PSC 1000 Microprocessor Introduction A stack is an important data handling structure used in computing. Specifically, a stack is a dynamic set of elements in which
Example of Standard API
16 Example of Standard API System Call Implementation Typically, a number associated with each system call System call interface maintains a table indexed according to these numbers The system call interface
Off-by-One exploitation tutorial
Off-by-One exploitation tutorial By Saif El-Sherei www.elsherei.com Introduction: I decided to get a bit more into Linux exploitation, so I thought it would be nice if I document this as a good friend
Secure Software Programming and Vulnerability Analysis
Secure Software Programming and Vulnerability Analysis Christopher Kruegel [email protected] http://www.auto.tuwien.ac.at/~chris Testing and Source Code Auditing Secure Software Programming 2 Overview
Capability-Based Access Control
Lecture Notes (Syracuse University) Capability: 1 Capability-Based Access Control 1 An Analogy: Bank Analogy We would like to use an example to illustrate the need for capabilities. In the following bank
Introduction. What is an Operating System?
Introduction What is an Operating System? 1 What is an Operating System? 2 Why is an Operating System Needed? 3 How Did They Develop? Historical Approach Affect of Architecture 4 Efficient Utilization
Objectives. Chapter 2: Operating-System Structures. Operating System Services (Cont.) Operating System Services. Operating System Services (Cont.
Objectives To describe the services an operating system provides to users, processes, and other systems To discuss the various ways of structuring an operating system Chapter 2: Operating-System Structures
The Lagopus SDN Software Switch. 3.1 SDN and OpenFlow. 3. Cloud Computing Technology
3. The Lagopus SDN Software Switch Here we explain the capabilities of the new Lagopus software switch in detail, starting with the basics of SDN and OpenFlow. 3.1 SDN and OpenFlow Those engaged in network-related
1) The postfix expression for the infix expression A+B*(C+D)/F+D*E is ABCD+*F/DE*++
Answer the following 1) The postfix expression for the infix expression A+B*(C+D)/F+D*E is ABCD+*F/DE*++ 2) Which data structure is needed to convert infix notations to postfix notations? Stack 3) The
Java Virtual Machine: the key for accurated memory prefetching
Java Virtual Machine: the key for accurated memory prefetching Yolanda Becerra Jordi Garcia Toni Cortes Nacho Navarro Computer Architecture Department Universitat Politècnica de Catalunya Barcelona, Spain
Module 10. Coding and Testing. Version 2 CSE IIT, Kharagpur
Module 10 Coding and Testing Lesson 23 Code Review Specific Instructional Objectives At the end of this lesson the student would be able to: Identify the necessity of coding standards. Differentiate between
Sawmill Log Analyzer Best Practices!! Page 1 of 6. Sawmill Log Analyzer Best Practices
Sawmill Log Analyzer Best Practices!! Page 1 of 6 Sawmill Log Analyzer Best Practices! Sawmill Log Analyzer Best Practices!! Page 2 of 6 This document describes best practices for the Sawmill universal
CS3600 SYSTEMS AND NETWORKS
CS3600 SYSTEMS AND NETWORKS NORTHEASTERN UNIVERSITY Lecture 2: Operating System Structures Prof. Alan Mislove ([email protected]) Operating System Services Operating systems provide an environment for
Moving from CS 61A Scheme to CS 61B Java
Moving from CS 61A Scheme to CS 61B Java Introduction Java is an object-oriented language. This document describes some of the differences between object-oriented programming in Scheme (which we hope you
Get the Better of Memory Leaks with Valgrind Whitepaper
WHITE PAPER Get the Better of Memory Leaks with Valgrind Whitepaper Memory leaks can cause problems and bugs in software which can be hard to detect. In this article we will discuss techniques and tools
Replication on Virtual Machines
Replication on Virtual Machines Siggi Cherem CS 717 November 23rd, 2004 Outline 1 Introduction The Java Virtual Machine 2 Napper, Alvisi, Vin - DSN 2003 Introduction JVM as state machine Addressing non-determinism
Security Overview of the Integrity Virtual Machines Architecture
Security Overview of the Integrity Virtual Machines Architecture Introduction... 2 Integrity Virtual Machines Architecture... 2 Virtual Machine Host System... 2 Virtual Machine Control... 2 Scheduling
ELEC 377. Operating Systems. Week 1 Class 3
Operating Systems Week 1 Class 3 Last Class! Computer System Structure, Controllers! Interrupts & Traps! I/O structure and device queues.! Storage Structure & Caching! Hardware Protection! Dual Mode Operation
Unix Security Technologies. Pete Markowsky <peterm[at] ccs.neu.edu>
Unix Security Technologies Pete Markowsky What is this about? The goal of this CPU/SWS are: Introduce you to classic vulnerabilities Get you to understand security advisories Make
A3 Computer Architecture
A3 Computer Architecture Engineering Science 3rd year A3 Lectures Prof David Murray [email protected] www.robots.ox.ac.uk/ dwm/courses/3co Michaelmas 2000 1 / 1 6. Stacks, Subroutines, and Memory
CS5460: Operating Systems
CS5460: Operating Systems Lecture 13: Memory Management (Chapter 8) Where are we? Basic OS structure, HW/SW interface, interrupts, scheduling Concurrency Memory management Storage management Other topics
Lecture 10: Dynamic Memory Allocation 1: Into the jaws of malloc()
CS61: Systems Programming and Machine Organization Harvard University, Fall 2009 Lecture 10: Dynamic Memory Allocation 1: Into the jaws of malloc() Prof. Matt Welsh October 6, 2009 Topics for today Dynamic
How To Port A Program To Dynamic C (C) (C-Based) (Program) (For A Non Portable Program) (Un Portable) (Permanent) (Non Portable) C-Based (Programs) (Powerpoint)
TN203 Porting a Program to Dynamic C Introduction Dynamic C has a number of improvements and differences compared to many other C compiler systems. This application note gives instructions and suggestions
CSCE 465 Computer & Network Security
CSCE 465 Computer & Network Security Instructor: Dr. Guofei Gu http://courses.cse.tamu.edu/guofei/csce465/ Program Security: Buffer Overflow 1 Buffer Overflow BO Basics Stack smashing Other buffer overflow
SkyRecon Cryptographic Module (SCM)
SkyRecon Cryptographic Module (SCM) FIPS 140-2 Documentation: Security Policy Abstract This document specifies the security policy for the SkyRecon Cryptographic Module (SCM) as described in FIPS PUB 140-2.
An Easier Way for Cross-Platform Data Acquisition Application Development
An Easier Way for Cross-Platform Data Acquisition Application Development For industrial automation and measurement system developers, software technology continues making rapid progress. Software engineers
Operating System Components
Lecture Overview Operating system software introduction OS components OS services OS structure Operating Systems - April 24, 2001 Operating System Components Process management Memory management Secondary
Introduction to computer and network security. Session 2 : Examples of vulnerabilities and attacks pt1
Introduction to computer and network security Session 2 : Examples of vulnerabilities and attacks pt1 Jean Leneutre [email protected] Tél.: 01 45 81 78 81 Page 1 Outline I- Introduction
Oracle Solaris Studio Code Analyzer
Oracle Solaris Studio Code Analyzer The Oracle Solaris Studio Code Analyzer ensures application reliability and security by detecting application vulnerabilities, including memory leaks and memory access
A Scalable Network Monitoring and Bandwidth Throttling System for Cloud Computing
A Scalable Network Monitoring and Bandwidth Throttling System for Cloud Computing N.F. Huysamen and A.E. Krzesinski Department of Mathematical Sciences University of Stellenbosch 7600 Stellenbosch, South
Chapter 5 Names, Bindings, Type Checking, and Scopes
Chapter 5 Names, Bindings, Type Checking, and Scopes Chapter 5 Topics Introduction Names Variables The Concept of Binding Type Checking Strong Typing Scope Scope and Lifetime Referencing Environments Named
Benchmarking Hadoop & HBase on Violin
Technical White Paper Report Technical Report Benchmarking Hadoop & HBase on Violin Harnessing Big Data Analytics at the Speed of Memory Version 1.0 Abstract The purpose of benchmarking is to show advantages
co Characterizing and Tracing Packet Floods Using Cisco R
co Characterizing and Tracing Packet Floods Using Cisco R Table of Contents Characterizing and Tracing Packet Floods Using Cisco Routers...1 Introduction...1 Before You Begin...1 Conventions...1 Prerequisites...1
Informatica e Sistemi in Tempo Reale
Informatica e Sistemi in Tempo Reale Introduction to C programming Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa October 25, 2010 G. Lipari (Scuola Superiore Sant Anna)
Module 816. File Management in C. M. Campbell 1993 Deakin University
M. Campbell 1993 Deakin University Aim Learning objectives Content After working through this module you should be able to create C programs that create an use both text and binary files. After working
Basic Unix/Linux 1. Software Testing Interview Prep
Basic Unix/Linux 1 Programming Fundamentals and Concepts 2 1. What is the difference between web application and client server application? Client server application is designed typically to work in a
Introduction to Embedded Systems. Software Update Problem
Introduction to Embedded Systems CS/ECE 6780/5780 Al Davis logistics minor Today s topics: more software development issues 1 CS 5780 Software Update Problem Lab machines work let us know if they don t
Virtual Routing: What s The Goal? And What s Beyond? Peter Christy, NetsEdge Research Group, August 2001
Virtual Routing: What s The Goal? And What s Beyond? Peter Christy, NetsEdge Research Group, August 2001 Virtual routing is a software design method used to provide multiple independent routers that share
Cloud Computing. Up until now
Cloud Computing Lecture 11 Virtualization 2011-2012 Up until now Introduction. Definition of Cloud Computing Grid Computing Content Distribution Networks Map Reduce Cycle-Sharing 1 Process Virtual Machines
7.1 Our Current Model
Chapter 7 The Stack In this chapter we examine what is arguably the most important abstract data type in computer science, the stack. We will see that the stack ADT and its implementation are very simple.
Operating Systems. Virtual Memory
Operating Systems Virtual Memory Virtual Memory Topics. Memory Hierarchy. Why Virtual Memory. Virtual Memory Issues. Virtual Memory Solutions. Locality of Reference. Virtual Memory with Segmentation. Page
Data Structure with C
Subject: Data Structure with C Topic : Tree Tree A tree is a set of nodes that either:is empty or has a designated node, called the root, from which hierarchically descend zero or more subtrees, which
Data Management for Portable Media Players
Data Management for Portable Media Players Table of Contents Introduction...2 The New Role of Database...3 Design Considerations...3 Hardware Limitations...3 Value of a Lightweight Relational Database...4
View Controller Programming Guide for ios
View Controller Programming Guide for ios Contents About View Controllers 10 At a Glance 11 A View Controller Manages a Set of Views 11 You Manage Your Content Using Content View Controllers 11 Container
