SlideShare una empresa de Scribd logo
1 de 12
Descargar para leer sin conexión
ART OF EXPLOIT WRITING
                         Ashfaq Ansari
   Security Researcher & Penetration Tester

                 Founder Of: HackSys Team
                    http://hacksys.vfreaks.com/


          null Meet @Bangalore – 19th Jan 2013
Buffer Overflow
• Writing more data into a buffer than the
  allocated size.

• Two types:
   – Stack Overflow
    corrupt the execution stack by writing past the
    end of an array (aka. smashing the stack/
    stack overflow)

  – Heap Overflow
    corrupt the heap
Process Memory Organization
                  • Fixed by the program
  Text            • Read-only
          Text
  Data
                  • Initialized & Uninitialized Data
                  • Static variables are stored here
  Heap    Data

                  • Local variables for functions
                  • Return address and local stack pointer
          Stack
  Stack
The Stack - We Must Know Him
       • Stack is LIFO – Last In First
LIFO     Out
       • PUSH & POP operation
                                         Buffer 2


       • Dynamically allocate local
                                         Buffer 1
Used     variables used in functions
       • Pass parameters to
         functions, etc.                  SFP
                                          RET
       • Stack Pointer (SP) points         a
Info     to the top of the stack
       • Contains return address
         and local stack pointer
                                            b
                                            c
x86 General Purpose Register
Fuzzing
Overview

     • Black Box software testing technique,
       which helps in finding implementation
 1     bugs using malformed /semi-malformed
       data injection in an automated fashion




 2   • Lazy mans tool
The Stack - Overflow

Buffer   • Overwritten by A’s &   AAAA
           B’s                    AAAA
1&2                               AAAA

                                  BBBB
 SFP     • Overwritten by C’s     BBBB
                                  CCCC
                                  DDDD
                                  AAAA
         • Return Overwritten
 RET       by D’s                 AAAA
                                  AAAA
Bad Characters

x00          x0a        x0d
       NULL          n          r
DEMO
Work Hard Toward Mastery

                                                   Achieve
                                                   Mastery
Exploits Worked On




                                        Get
                                     Experienced


                      Get Familiar



                                     Time Spent
Art of Exploit Writing

Más contenido relacionado

Similar a Art of Exploit Writing

Thoughts on Transaction and Consistency Models
Thoughts on Transaction and Consistency ModelsThoughts on Transaction and Consistency Models
Thoughts on Transaction and Consistency Modelsiammutex
 
Lessons Learned: Using Spark and Microservices
Lessons Learned: Using Spark and MicroservicesLessons Learned: Using Spark and Microservices
Lessons Learned: Using Spark and MicroservicesAlexis Seigneurin
 
Large scale preservation workflows with Taverna – SCAPE Training event, Guima...
Large scale preservation workflows with Taverna – SCAPE Training event, Guima...Large scale preservation workflows with Taverna – SCAPE Training event, Guima...
Large scale preservation workflows with Taverna – SCAPE Training event, Guima...SCAPE Project
 
Spark r under the hood with Hossein Falaki
Spark r under the hood with Hossein FalakiSpark r under the hood with Hossein Falaki
Spark r under the hood with Hossein FalakiDatabricks
 
Global Big Data Conference Sept 2014 AWS Kinesis Spark Streaming Approximatio...
Global Big Data Conference Sept 2014 AWS Kinesis Spark Streaming Approximatio...Global Big Data Conference Sept 2014 AWS Kinesis Spark Streaming Approximatio...
Global Big Data Conference Sept 2014 AWS Kinesis Spark Streaming Approximatio...Chris Fregly
 
Storm distributed processing
Storm distributed processingStorm distributed processing
Storm distributed processingducquoc_vn
 
Byteman and The Jokre, Sanne Grinovero (JBoss by RedHat)
Byteman and The Jokre, Sanne Grinovero (JBoss by RedHat)Byteman and The Jokre, Sanne Grinovero (JBoss by RedHat)
Byteman and The Jokre, Sanne Grinovero (JBoss by RedHat)OpenBlend society
 
Polyglot and Functional Programming (OSCON 2012)
Polyglot and Functional Programming (OSCON 2012)Polyglot and Functional Programming (OSCON 2012)
Polyglot and Functional Programming (OSCON 2012)Martijn Verburg
 
Combining the Strengths or Erlang and Ruby
Combining the Strengths or Erlang and RubyCombining the Strengths or Erlang and Ruby
Combining the Strengths or Erlang and RubyWooga
 
Performance Optimization Case Study: Shattering Hadoop's Sort Record with Spa...
Performance Optimization Case Study: Shattering Hadoop's Sort Record with Spa...Performance Optimization Case Study: Shattering Hadoop's Sort Record with Spa...
Performance Optimization Case Study: Shattering Hadoop's Sort Record with Spa...Databricks
 
Introduction to ArangoDB (nosql matters Barcelona 2012)
Introduction to ArangoDB (nosql matters Barcelona 2012)Introduction to ArangoDB (nosql matters Barcelona 2012)
Introduction to ArangoDB (nosql matters Barcelona 2012)ArangoDB Database
 
Introduction to Clojure and why it's hot for Sart-Ups
Introduction to Clojure and why it's hot for Sart-UpsIntroduction to Clojure and why it's hot for Sart-Ups
Introduction to Clojure and why it's hot for Sart-Upsedlich
 
Hanborq optimizations on hadoop map reduce 20120221a
Hanborq optimizations on hadoop map reduce 20120221aHanborq optimizations on hadoop map reduce 20120221a
Hanborq optimizations on hadoop map reduce 20120221aSchubert Zhang
 
Rethinking the debugger
Rethinking the debuggerRethinking the debugger
Rethinking the debuggerIulian Dragos
 
[Hic2011] using hadoop lucene-solr-for-large-scale-search by systex
[Hic2011] using hadoop lucene-solr-for-large-scale-search by systex[Hic2011] using hadoop lucene-solr-for-large-scale-search by systex
[Hic2011] using hadoop lucene-solr-for-large-scale-search by systexJames Chen
 
Yet another intro to Apache Spark
Yet another intro to Apache SparkYet another intro to Apache Spark
Yet another intro to Apache SparkSimon Lia-Jonassen
 
Top 5 mistakes when writing Spark applications
Top 5 mistakes when writing Spark applicationsTop 5 mistakes when writing Spark applications
Top 5 mistakes when writing Spark applicationsmarkgrover
 

Similar a Art of Exploit Writing (20)

Buffer overflow
Buffer overflowBuffer overflow
Buffer overflow
 
Thoughts on Transaction and Consistency Models
Thoughts on Transaction and Consistency ModelsThoughts on Transaction and Consistency Models
Thoughts on Transaction and Consistency Models
 
Far cry 3
Far cry 3Far cry 3
Far cry 3
 
Lessons Learned: Using Spark and Microservices
Lessons Learned: Using Spark and MicroservicesLessons Learned: Using Spark and Microservices
Lessons Learned: Using Spark and Microservices
 
Large scale preservation workflows with Taverna – SCAPE Training event, Guima...
Large scale preservation workflows with Taverna – SCAPE Training event, Guima...Large scale preservation workflows with Taverna – SCAPE Training event, Guima...
Large scale preservation workflows with Taverna – SCAPE Training event, Guima...
 
Spark r under the hood with Hossein Falaki
Spark r under the hood with Hossein FalakiSpark r under the hood with Hossein Falaki
Spark r under the hood with Hossein Falaki
 
Global Big Data Conference Sept 2014 AWS Kinesis Spark Streaming Approximatio...
Global Big Data Conference Sept 2014 AWS Kinesis Spark Streaming Approximatio...Global Big Data Conference Sept 2014 AWS Kinesis Spark Streaming Approximatio...
Global Big Data Conference Sept 2014 AWS Kinesis Spark Streaming Approximatio...
 
Storm distributed processing
Storm distributed processingStorm distributed processing
Storm distributed processing
 
Byteman and The Jokre, Sanne Grinovero (JBoss by RedHat)
Byteman and The Jokre, Sanne Grinovero (JBoss by RedHat)Byteman and The Jokre, Sanne Grinovero (JBoss by RedHat)
Byteman and The Jokre, Sanne Grinovero (JBoss by RedHat)
 
Polyglot and Functional Programming (OSCON 2012)
Polyglot and Functional Programming (OSCON 2012)Polyglot and Functional Programming (OSCON 2012)
Polyglot and Functional Programming (OSCON 2012)
 
Combining the Strengths or Erlang and Ruby
Combining the Strengths or Erlang and RubyCombining the Strengths or Erlang and Ruby
Combining the Strengths or Erlang and Ruby
 
Performance Optimization Case Study: Shattering Hadoop's Sort Record with Spa...
Performance Optimization Case Study: Shattering Hadoop's Sort Record with Spa...Performance Optimization Case Study: Shattering Hadoop's Sort Record with Spa...
Performance Optimization Case Study: Shattering Hadoop's Sort Record with Spa...
 
Introduction to ArangoDB (nosql matters Barcelona 2012)
Introduction to ArangoDB (nosql matters Barcelona 2012)Introduction to ArangoDB (nosql matters Barcelona 2012)
Introduction to ArangoDB (nosql matters Barcelona 2012)
 
Advanced Windows Exploitation
Advanced Windows ExploitationAdvanced Windows Exploitation
Advanced Windows Exploitation
 
Introduction to Clojure and why it's hot for Sart-Ups
Introduction to Clojure and why it's hot for Sart-UpsIntroduction to Clojure and why it's hot for Sart-Ups
Introduction to Clojure and why it's hot for Sart-Ups
 
Hanborq optimizations on hadoop map reduce 20120221a
Hanborq optimizations on hadoop map reduce 20120221aHanborq optimizations on hadoop map reduce 20120221a
Hanborq optimizations on hadoop map reduce 20120221a
 
Rethinking the debugger
Rethinking the debuggerRethinking the debugger
Rethinking the debugger
 
[Hic2011] using hadoop lucene-solr-for-large-scale-search by systex
[Hic2011] using hadoop lucene-solr-for-large-scale-search by systex[Hic2011] using hadoop lucene-solr-for-large-scale-search by systex
[Hic2011] using hadoop lucene-solr-for-large-scale-search by systex
 
Yet another intro to Apache Spark
Yet another intro to Apache SparkYet another intro to Apache Spark
Yet another intro to Apache Spark
 
Top 5 mistakes when writing Spark applications
Top 5 mistakes when writing Spark applicationsTop 5 mistakes when writing Spark applications
Top 5 mistakes when writing Spark applications
 

Más de n|u - The Open Security Community

Gibson 101 -quick_introduction_to_hacking_mainframes_in_2020_null_infosec_gir...
Gibson 101 -quick_introduction_to_hacking_mainframes_in_2020_null_infosec_gir...Gibson 101 -quick_introduction_to_hacking_mainframes_in_2020_null_infosec_gir...
Gibson 101 -quick_introduction_to_hacking_mainframes_in_2020_null_infosec_gir...n|u - The Open Security Community
 

Más de n|u - The Open Security Community (20)

Hardware security testing 101 (Null - Delhi Chapter)
Hardware security testing 101 (Null - Delhi Chapter)Hardware security testing 101 (Null - Delhi Chapter)
Hardware security testing 101 (Null - Delhi Chapter)
 
Osint primer
Osint primerOsint primer
Osint primer
 
SSRF exploit the trust relationship
SSRF exploit the trust relationshipSSRF exploit the trust relationship
SSRF exploit the trust relationship
 
Nmap basics
Nmap basicsNmap basics
Nmap basics
 
Metasploit primary
Metasploit primaryMetasploit primary
Metasploit primary
 
Api security-testing
Api security-testingApi security-testing
Api security-testing
 
Introduction to TLS 1.3
Introduction to TLS 1.3Introduction to TLS 1.3
Introduction to TLS 1.3
 
Gibson 101 -quick_introduction_to_hacking_mainframes_in_2020_null_infosec_gir...
Gibson 101 -quick_introduction_to_hacking_mainframes_in_2020_null_infosec_gir...Gibson 101 -quick_introduction_to_hacking_mainframes_in_2020_null_infosec_gir...
Gibson 101 -quick_introduction_to_hacking_mainframes_in_2020_null_infosec_gir...
 
Talking About SSRF,CRLF
Talking About SSRF,CRLFTalking About SSRF,CRLF
Talking About SSRF,CRLF
 
Building active directory lab for red teaming
Building active directory lab for red teamingBuilding active directory lab for red teaming
Building active directory lab for red teaming
 
Owning a company through their logs
Owning a company through their logsOwning a company through their logs
Owning a company through their logs
 
Introduction to shodan
Introduction to shodanIntroduction to shodan
Introduction to shodan
 
Cloud security
Cloud security Cloud security
Cloud security
 
Detecting persistence in windows
Detecting persistence in windowsDetecting persistence in windows
Detecting persistence in windows
 
Frida - Objection Tool Usage
Frida - Objection Tool UsageFrida - Objection Tool Usage
Frida - Objection Tool Usage
 
OSQuery - Monitoring System Process
OSQuery - Monitoring System ProcessOSQuery - Monitoring System Process
OSQuery - Monitoring System Process
 
DevSecOps Jenkins Pipeline -Security
DevSecOps Jenkins Pipeline -SecurityDevSecOps Jenkins Pipeline -Security
DevSecOps Jenkins Pipeline -Security
 
Extensible markup language attacks
Extensible markup language attacksExtensible markup language attacks
Extensible markup language attacks
 
Linux for hackers
Linux for hackersLinux for hackers
Linux for hackers
 
Android Pentesting
Android PentestingAndroid Pentesting
Android Pentesting
 

Art of Exploit Writing

  • 1. ART OF EXPLOIT WRITING Ashfaq Ansari Security Researcher & Penetration Tester Founder Of: HackSys Team http://hacksys.vfreaks.com/ null Meet @Bangalore – 19th Jan 2013
  • 2. Buffer Overflow • Writing more data into a buffer than the allocated size. • Two types: – Stack Overflow corrupt the execution stack by writing past the end of an array (aka. smashing the stack/ stack overflow) – Heap Overflow corrupt the heap
  • 3. Process Memory Organization • Fixed by the program Text • Read-only Text Data • Initialized & Uninitialized Data • Static variables are stored here Heap Data • Local variables for functions • Return address and local stack pointer Stack Stack
  • 4. The Stack - We Must Know Him • Stack is LIFO – Last In First LIFO Out • PUSH & POP operation Buffer 2 • Dynamically allocate local Buffer 1 Used variables used in functions • Pass parameters to functions, etc. SFP RET • Stack Pointer (SP) points a Info to the top of the stack • Contains return address and local stack pointer b c
  • 7. Overview • Black Box software testing technique, which helps in finding implementation 1 bugs using malformed /semi-malformed data injection in an automated fashion 2 • Lazy mans tool
  • 8. The Stack - Overflow Buffer • Overwritten by A’s & AAAA B’s AAAA 1&2 AAAA BBBB SFP • Overwritten by C’s BBBB CCCC DDDD AAAA • Return Overwritten RET by D’s AAAA AAAA
  • 9. Bad Characters x00 x0a x0d NULL n r
  • 10. DEMO
  • 11. Work Hard Toward Mastery Achieve Mastery Exploits Worked On Get Experienced Get Familiar Time Spent