Shellcode Development -Femi Oloyede -Pallavi Murudkar.

Slides:



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

Threads, SMP, and Microkernels
Smashing the Stack for Fun and Profit
Network Security Attack Analysis. cs490ns - cotter2 Outline Types of Attacks Vulnerabilities Exploited Network Attack Phases Attack Detection Tools.
Computer Security: Principles and Practice EECS710: Information Security Professor Hossein Saiedian Fall 2014 Chapter 10: Buffer Overflow.
Computer Security: Principles and Practice First Edition by William Stallings and Lawrie Brown Lecture slides by Lawrie Brown Chapter 11 – Buffer Overflow.
Lecture 16 Buffer Overflow modified from slides of Lawrie Brown.
Utilizing the GDB debugger to analyze programs Background and application.
Chap 2 System Structures.
Review: Software Security David Brumley Carnegie Mellon University.
Threads, SMP, and Microkernels Chapter 4. Process Resource ownership - process is allocated a virtual address space to hold the process image Scheduling/execution-
Stack-Based Buffer Overflows Attacker – Can take over a system remotely across a network. local malicious users – To elevate their privileges and gain.
CMSC 414 Computer and Network Security Lecture 24 Jonathan Katz.
Beyond Stack Smashing: Recent Advances in Exploiting Buffer Overruns Jonathan Pincus Microsoft Research Brandon Baker Microsoft Carl Hartung CSCI 7143:
Buffer Overflow. Process Memory Organization.
OllyDbg Debuger.
Control hijacking attacks Attacker’s goal: – Take over target machine (e.g. web server) Execute arbitrary code on target by hijacking application control.
INTRUSION DETECTION SYSTEMS Tristan Walters Rayce West.
Security Exploiting Overflows. Introduction r See the following link for more info: operating-systems-and-applications-in-
Introduction to InfoSec – Recitation 2 Nir Krakowski (nirkrako at post.tau.ac.il) Itamar Gilad (itamargi at post.tau.ac.il)
CAP6135: Malware and Software Vulnerability Analysis Buffer Overflow : Example of Using GDB to Check Stack Memory Cliff Zou Spring 2011.
Exploiting Buffer Overflows on AIX/PowerPC HP-UX/PA-RISC Solaris/SPARC.
More Network Security Threats Worm = a stand-alone program that can replicate itself and spread Worms can also contain manipulation routines to perform.
Introduction: Exploiting Linux. Basic Concepts Vulnerability A flaw in a system that allows an attacker to do something the designer did not intend,
Brian E. Brzezicki. This tutorial just illustrates the underlying concepts of buffer overflows by way of an extremely simple stack overflow  Most buffer.
Fall 2012 Chapter 2: x86 Processor Architecture. Irvine, Kip R. Assembly Language for x86 Processors 6/e, Chapter Overview General Concepts IA-32.
CNIT 127: Exploit Development Ch 4: Introduction to Format String Bugs.
Threads, SMP, and Microkernels Chapter 4. Process Resource ownership - process is allocated a virtual address space to hold the process image Scheduling/execution-
University of Virginia Department of Computer Science1 Applications of Software Dynamic Translation Jack Davidson University of Virginia February 27, 2002.
Exploitation Of Windows Buffer Overflows. What is a Buffer Overflow A buffer overflow is when memory is copied to a location that is outside of its allocated.
Introduction to InfoSec – Recitation 2 Nir Krakowski (nirkrako at post.tau.ac.il) Itamar Gilad (itamargi at post.tau.ac.il)
Smashing the Stack Overview The Stack Region Buffer Overflow
CNIT 127: Exploit Development Ch 3: Shellcode. Topics Protection rings Syscalls Shellcode nasm Assembler ld GNU Linker objdump to see contents of object.
Lecture 8: Buffer Overflow CS 436/636/736 Spring 2013 Nitesh Saxena *Adopted from a previous lecture by Aleph One (Smashing the Stack for Fun and Profit)
Buffer Overflow Proofing of Code Binaries By Ramya Reguramalingam Graduate Student, Computer Science Advisor: Dr. Gopal Gupta.
Buffer Overflow Group 7Group 8 Nathaniel CrowellDerek Edwards Punna ChalasaniAxel Abellard Steven Studniarz.
Buffer Overflow Attack Proofing of Code Binary Gopal Gupta, Parag Doshi, R. Reghuramalingam, Doug Harris The University of Texas at Dallas.
Lecture 9: Buffer Ovefflows and ROP EEN 312: Processors: Hardware, Software, and Interfacing Department of Electrical and Computer Engineering Spring 2014,
What is exactly Exploit writing?  Writing a piece of code which is capable of exploit the vulnerability in the target software.
Operating Systems Security
Hybrid Intelligent Systems for Detecting Network Anomalies Lane Thames ECE 8833 Intelligent Systems.
Introduction to Information Security ROP – Recitation 5.
JMU GenCyber Boot Camp Summer, Introduction to Penetration Testing Elevating privileges – Getting code run in a privileged context Exploiting misconfigurations.
Buffer Overflow Attack- proofing of Code Binaries Ramya Reguramalingam Gopal Gupta Gopal Gupta Department of Computer Science University of Texas at Dallas.
Reminder Bomb lab is due tomorrow! Attack lab is released tomorrow!!
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.
Foundations of Network and Computer Security J J ohn Black CSCI 6268/TLEN 5550, Spring 2013.
CAP6135: Malware and Software Vulnerability Analysis Buffer Overflow : Example of Using GDB to Check Stack Memory Cliff Zou Spring 2014.
Exploiting & Defense Day 1 Recap
Introduction to Information Security
Shellcode COSC 480 Presentation Alison Buben.
Mitigation against Buffer Overflow Attacks
Introduction to Information Security
Microprocessor and Assembly Language
Introduction to Information Security
CSC 495/583 Topics of Software Security Stack Overflows (2)
Recitation: Attack Lab
Lecture 9: Buffer Overflow*
Smashing the Stack for Fun and Profit
CAP6135: Malware and Software Vulnerability Analysis Buffer Overflow : Example of Using GDB to Check Stack Memory Cliff Zou Spring 2015.
Week 2: Buffer Overflow Part 2.
Reverse engineering through full system simulations
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
Chapter 14: Protection.
CAP6135: Malware and Software Vulnerability Analysis Buffer Overflow : Example of Using GDB to Check Stack Memory Cliff Zou Spring 2013.
Exploitation Part 1.
Computer Architecture and System Programming Laboratory
Return-to-libc Attacks
Presentation transcript:

Shellcode Development -Femi Oloyede -Pallavi Murudkar

Agenda Introduction What can Shellcode do? Tools for Shellcode Development Understanding Shellcode Developing Shellcode Methods of Detecting Shellcode

Introduction Shellcode is defined as a set of instructions injected and then executed by an exploited program Shellcodes are primarily used to exploit buffer overflows The most important task when creating shellcode is to make it small and executable

What can Shellcode do? Providing access to the attacked system Spawning /bin/sh [or] cmd.exe (local shell) Binding a shell to a port (remote shell) Adding root/admin user to the system Chmod()’ing /etc/shadow to be writeable

Tools for Shellcode development Nasm Used to write assembly code Gdb GNU debugger to analyze core dump files Objdump To disassemble file Ktrace Trace all system calls a process is using

Next ( Femi ) Understanding Shellcode Developing Shellcode Methods of Detecting Shellcode

Understanding Shellcode IA-32 Machine Architecture (instruction set & registers) Program Flow dynamics - Processes Memory Organization and context switching during function- calls and interrupt processing. Shellcode is injected via the modification of the return address of a function by way of a stack-based buffer overflow.

Machine Architecture Refer to IA-32 Intel® Architecture Software Developer's Manual Volume 1: Basic Architecture” A large amount of computer software supports the platform, including operating systems such as MS-DOS, Windows, Linux, BSD, Solaris, and Mac OS X. EBPBase pointer. Primarily used to hold the address of the current stack frame. Also sometimes used as a general data or address register. ESIGeneral register or "source index" for string operations. Also has a one-byte LODS[size] instruction for loading data from memory to the accumulator. EDIGeneral register or "destination index" for string operations. Also has a one-byte STOS[size] instruction to write data out of the accumulator. ESPStack pointer. Is used to hold the top address of the stack. EIPInstruction pointer. Holds the current instruction address.

Program Flow Dynamics

Program Flow Dynamics (cont)

Stack Based Buffer Overflow void A(char charPtr *str) { char buffer[4]; strcpy(buffer,str); } void main() { char BigggerString[12] = “AAAAAAAAAAAA”; A(Biggerstring); } SFP (4)charPtrRET (4)Buffer1 (4) AAAA Bottom of Stack Top of Stack Stack Buffer Overflow

Developing Shellcode Finding the Vulnerability Writing the Shellcode Shellcode is sequence of machine instructions or opcode. To take advantage of the injected code and to gain access to the target system, system calls must be used On Linux there are two ways of implementing a system call, they are icall87/icall27 gates and ‘INT 0x80’ software interrupts

Example – Spawning a Shell Write C code Extract the assembly code Extract the opcode Append an function exit opcodes to allow the function exit gracefully Initialize a buffer with the opcode.

Example – Spawning a Shell cont’

Methods for Detecting Shellcode NIDS (Network Intrusion Detection System) can be used to identify shellcode on the wire using Signature databases and Protocol analysis methods IPS (Intrusion Prevention System) identifies shellcode by running the code on a sandbox/virtualization in order to detect if the given code is malicious or not

Conclusion Shellcode is a powerful mechanism for the exploitation of software vulnerabilities. It is important that the shellcode developed is small in size Shellcode can be employed to automate software security tests, where the shellcode is written to expose and draw attention to security holes

Questions?