Computer Forensics Use of Malicious Input. Buffer and Heap Overflow Attacks Standard Tool to Break Into Systems. Used for Access Escalation. Very Common.

Slides:



Advertisements
Similar presentations
Buffer Overflows Nick Feamster CS 6262 Spring 2009 (credit to Vitaly S. from UT for slides)
Advertisements

Smashing the Stack for Fun and Profit
Computer Forensics Use of Malicious Input. Buffer and Heap Overflow Attacks Standard Tool to Break Into Systems. Used for Access Escalation. Very Common.
CMSC 414 Computer and Network Security Lecture 22 Jonathan Katz.
Stack-Based Buffer Overflows Attacker – Can take over a system remotely across a network. local malicious users – To elevate their privileges and gain.
Gabe Kanzelmeyer CS 450 4/14/10.  What is buffer overflow?  How memory is processed and the stack  The threat  Stack overrun attack  Dangers  Prevention.
Stack buffer overflow
SQL Injection and Buffer overflow
Application Security Chapter 8 Copyright Pearson Prentice Hall 2013.
Control hijacking attacks Attacker’s goal: – Take over target machine (e.g. web server) Execute arbitrary code on target by hijacking application control.
Buffer Overflow Attacks. Memory plays a key part in many computer system functions. It’s a critical component to many internal operations. From mother.
Shuo Chen, Jun Xu, Emre C. Sezer, Prachi Gauriar, and Ravishankar K. Iyer Brett Hodges April 8, 2010.
Computer Forensics Use of Malicious Input.
Security Exploiting Overflows. Introduction r See the following link for more info: operating-systems-and-applications-in-
Application Security: General apps &Web service (April 11, 2012) © Abdou Illia – Spring 2012.
An anti-hacking guide.  Hackers are kindred of expert programmers who believe in freedom and spirit of mutual help. They are not malicious. They may.
The OWASP Top 10 and Buffer Overflow Attacks
A Security Review Process for Existing Software Applications
CAP6135: Malware and Software Vulnerability Analysis Buffer Overflow : Example of Using GDB to Check Stack Memory Cliff Zou Spring 2011.
Lecture 0 Appendix on Implementation Threats Material from Warren Page & Chpt 11, Information Security by Mark Stamp.
Chapter 6 Buffer Overflow. Buffer Overflow occurs when the program overwrites data outside the bounds of allocated memory It was one of the first exploited.
Exploiting Buffer Overflows on AIX/PowerPC HP-UX/PA-RISC Solaris/SPARC.
BLENDED ATTACKS EXPLOITS, VULNERABILITIES AND BUFFER-OVERFLOW TECHNIQUES IN COMPUTER VIRUSES By: Eric Chien and Peter Szor Presented by: Jesus Morales.
Chapter 10 Hacking Code Last modified Common Exploit Techniques Buffer Overflows and Design Flaws –History Buffer over-runs in the mid-1990s.
Buffer Overflows Lesson 14. Example of poor programming/errors Buffer Overflows result of poor programming practice use of functions such as gets and.
CGI Security COEN 351. CGI Security Security holes are exploited by user input. We need to check user input against Buffer overflows etc. that cause a.
Mitigation of Buffer Overflow Attacks
CIS 450 – Network Security Chapter 7 – Buffer Overflow Attacks.
1 Application Security: Electronic Commerce and Chapter 9 Copyright 2003 Prentice-Hall.
COMPUTER SECURITY MIDTERM REVIEW CS161 University of California BerkeleyApril 4, 2012.
Buffer Overflow CS461/ECE422 Spring Reading Material Based on Chapter 11 of the text.
CIS 450 – Network Security Chapter 14 – Specific Exploits for UNIX.
The Top 10 Bugs in Windows 2000 From Jesper Johanssen’s W2K Security Vulnerabilities Lecture.
Overflow Examples 01/13/2012. ACKNOWLEDGEMENTS These slides where compiled from the Malware and Software Vulnerabilities class taught by Dr Cliff Zou.
What is exactly Exploit writing?  Writing a piece of code which is capable of exploit the vulnerability in the target software.
A Tool for Pro-active Defense Against the Buffer Overrun Attack D. Bruschi, E. Rosti, R. Banfi Presented By: Warshavsky Alex.
1 Figure 9-3: Webserver and E-Commerce Security Importance of Webservice and E-Commerce Security  Cost of disruptions  The cost of loss of reputation.
JMU GenCyber Boot Camp Summer, Introduction to Penetration Testing Elevating privileges – Getting code run in a privileged context Exploiting misconfigurations.
Buffer overflow and stack smashing attacks Principles of application software security.
A Survey on Runtime Smashed Stack Detection 坂井研究室 M 豊島隆志.
Buffer Overflows Taught by Scott Coté.-. _ _.-. / \.-. ((___)).-. / \ /.ooM \ / \.-. [ x x ].-. / \ /.ooM \ -/ \ /-----\-----/---\--\ /--/---\-----/-----\ / \-
Web Security Firewalls, Buffer overflows and proxy servers.
Information Security - 2. A Stack Frame. Pushed to stack on function CALL The return address is copied to the CPU Instruction Pointer when the function.
Slides by Kent Seamons and Tim van der Horst Last Updated: Nov 11, 2011.
VM: Chapter 7 Buffer Overflows. csci5233 computer security & integrity (VM: Ch. 7) 2 Outline Impact of buffer overflows What is a buffer overflow? Types.
CAP6135: Malware and Software Vulnerability Analysis Buffer Overflow : Example of Using GDB to Check Stack Memory Cliff Zou Spring 2014.
Basic of Buffer Over Flow
Computer Forensics Use of Malicious Input.
Software Security. Bugs Most software has bugs Some bugs cause security vulnerabilities Incorrect processing of security related data Incorrect processing.
@Yuan Xue Worm Attack Yuan Xue Fall 2012.
Mitigation against Buffer Overflow Attacks
Buffer Overflow Buffer overflows are possible because C doesn’t check array boundaries Buffer overflows are dangerous because buffers for user input are.
Protecting Memory What is there to protect in memory?
The Hardware/Software Interface CSE351 Winter 2013
Protecting Memory What is there to protect in memory?
Protecting Memory What is there to protect in memory?
A Security Review Process for Existing Software Applications
Security mechanisms and vulnerabilities in .NET
CS 465 Buffer Overflow Slides by Kent Seamons and Tim van der Horst
Software Security Lesson Introduction
CSE451 Fall 2008 Section 1 Roxana Geambasu
CAP6135: Malware and Software Vulnerability Analysis Buffer Overflow : Example of Using GDB to Check Stack Memory Cliff Zou Spring 2015.
CNT4704: Analysis of Computer Communication Network Buffer Overflow : Example of Using GDB to Check Stack Memory Cliff Zou Fall 2011.
CS5123 Software Validation and Quality Assurance
CAP6135: Malware and Software Vulnerability Analysis Buffer Overflow : Example of Using GDB to Check Stack Memory Cliff Zou Spring 2016.
Understanding and Preventing Buffer Overflow Attacks in Unix
CAP6135: Malware and Software Vulnerability Analysis Buffer Overflow : Example of Using GDB to Check Stack Memory Cliff Zou Spring 2013.
System and Cyber Security
CAP6135: Malware and Software Vulnerability Analysis Buffer Overflow : Example of Using GDB to Check Stack Memory Cliff Zou Spring 2010.
Outline Introduction Memory protection Buffer overflows
Presentation transcript:

Computer Forensics Use of Malicious Input

Buffer and Heap Overflow Attacks Standard Tool to Break Into Systems. Used for Access Escalation. Very Common. Prototype of an Attack Mode.

Beware of User Input Anonymous FTP should allow access to files selectively. One implementation parsed the file name. Assume /pub/acc is an allowed directory. Request: get /pub/acc/../../../etc/passwd

Beware of User Input This implementation only parsed the first part of the string. Decided access is OK get /pub/acc/../../../etc/passwd Allowed access to any file. Took several versions before the security breach was firmly patched.

Morale: Don’t reinvent the wheel. Other implementations used a sandbox. Community had learned how to get it right. Parsing input is difficult. Users have an incentive to be inventive. ALL INPUT IS EVIL

Canonical Representation Issues Canonicalization: Translates name to standard representation. Canonical Filenames Napster Name Filtering. Ordered to restrict access to certain songs. Access was denied based on name of the song. Users bypassed it with uncanonical song names Deepest Chill  Deepest Chi11 Candyman  AndymanCay (in pig latin)

ALL INPUT IS EVIL Mac OS X and Apache Vulnerability HFS+ is case insensitive. Apache uses text-based configuration files, that are case sensitive, to determine Disallow access to directory scripts: order deny, allow deny from all </Location

ALL INPUT IS EVIL Denies user request Allows user request

ALL INPUT IS EVIL Sun StarOffice /tmp directory symbolic link vulnerability Symbolic link: file that points to another file. Symbolic links do not share access rights with the file they point to.

ALL INPUT IS EVIL Sun StarOffice creates file /tmp/soffice.tmp with 0777 access mask. Attacker links /tmp/soffice.tmp to /etc/passwd. Root runs StarOffice Permissions on /etc/passwd would get changed to 0777.

Canonicalization Issues Subsystems cooperate. First subsystem does not canonicalize input in the way the second one does.

Canonicalization Issues Common when software make decisions on file names 8.3 representation of file names IIS looks at extensions. Request to ***.asp::$DATA is routed to asp.dll. But this is a NTFS stream, that sends the ASP source code to the user. Trailing dots or slashes “secretFile.doc.” is same as “secretFile.doc” for windows.

Canonicalization Issues \\?\temp\myfile is the same as \temp\myfile Directory traversal../ AOL 5.0 parental controls: Bypass restriction on URL by adding period to file name. Secure IIS verifies incoming and outgoing data Use hexcode: %64elete instead of delete for key words. Use “%2e%2e/” for “../” Two canonalization issues in Security Software!

Canonicalization Issues Lines with carriage returns: Assume logging of file access: Attacker accesses file: Log entry: Mike :02:12 file.txt Tom :02:12 secret.doc file.txt\r\n \tTom \t13:02:12\tsecret.doc

Canonicalization Issues Escaping: Many ways to represent a character US-ASCII Hexadecimal escape codes UTF-8 variable width encoding UCS-2 Unicode encoding HTML escape codes Double Escaping

Canonicalization Issues Homograph Attacks Characters look the same, but are not Latin letter “o” Cyrillic character “o” (U+043E)

Morale Software should not make decisions based on names. If it has do, enforce name restrictions Don’t trust relative paths.

Data Base Inputs Don’t trust the user. Data base access over the web lead to execution of sql code. string sql = “select * from client where name = ‘” + name + “’” Variable name provided by user If name is Schwarz, this executes string sql = “select * from client where name = ‘schwarz’”

Data Base Inputs User enters: Schwarz’ or 1=1 - - The sql statement becomes string sql = “select * from client where name = ‘schwarz’ or 1=1 - -” Selects all clients - - SQL comment, comments out everything behind.

Buffer Overflow Attacks Stack: push and pop

Buffer Overflow Attacks Stack is area of program memory that contains static allocated variables, return addresses, etc.

Buffer Overflow Attack void foo(const char* input) { char buf[10]; printf("Hello World\n"); } int main(int argc, char* argv[]) { foo(argv[1]); return 0; }

Buffer Overflow Attack

Works by overwriting the return address to jump somewhere else.

Buffer Overflow Attack #pragma check_stack(off) #include void foo(const char* input) { char buf[10]; printf("My stack looks like:\n%p\n%p\n%p\n%p\n%p\n%p\n\n"); strcpy(buf, input); printf("%s\n", buf); printf("Now the stack looks like:\n%p\n%p\n%p\n%p\n%p\n%p\n\n"); }

Buffer Overflow Attack void bar(void) { printf("Augh! I've been hacked!\n"); }

Buffer Overflow Attack int main(int argc, char* argv[]) { printf("Address of foo = %p\n", foo); printf("Address of bar = %p\n", bar); if (argc != 2) { printf("Please supply a string as an argument!\n"); return -1; } foo(argv[1]); return 0; }

Buffer Overflow Attack Chapter05>stackoverrun.exe Hello Address of foo = Address of bar = My stack looks like: A28 7FFDF FEE BB D Hello Now the stack looks like: 6C6C F 7FFDF FEE BB D

Buffer Overflow Attack

Fun, but useless. Real attack: overwrite return address so that code execution jumps into the input given by attacker.

Buffer Overflow Attack To protect against signatures, structure input Varying stuff execve(/bin/sh) (gives new shell with program privileges in UNIX) Pointer to execve statement.

Buffer Overflow Attack Finding vulnerabilities Script-kiddies scan target with automated tool. Tool creator has detailed analysis of vulnerabilities. Look for strcpy, gets, getws, memcpy memmove, scanf, … Alternatively, just cram the application until it crashes. Crash used to give you locations of registers.

Buffer Overflow Attack Example: Cram in lots of input of As. Program crashes, EIP has value Sign of buffer overflow. Now try to feed more specific input.

Buffer Overflow Attack

Attack signature can be used by IDS. Vary the NOP commands. Many alternatives.

Buffer Overflow Attack Protection Make stack non-executable. Use canary birds.

Buffer Overflow Attack Stack Guard MS Visual Studio use canaries.

Buffer Overflow Attack MS Outlook Vcard: Virtual business card buffer overflow vulnerability. IIS 5 Internet Printing Protocol

Heap Overflow Attack These protections do not apply to heaps, where dynamically allocated memory resides. Some of this memory contains the addresses of functions that are going to be called. Harder to find, harder to protect against.

Remember: People attack computer systems because they can.