SlideShare ist ein Scribd-Unternehmen logo
1 von 31
Downloaden Sie, um offline zu lesen
Automatic Program Analysis
                         with
            Dynamic Binary Instrumentation

                               Sunil Kumar
                     (sunil.kumar@ivizsecurity.com)


http://null.co.in/                                    http://nullcon.net/
#whoami
      •    Research Associate @ iViZ Techno Solutions
      •    MCA(007) from Goa University i.e. GUMCA07.
      •    http://www.linkedin.com/in/sunilkr86
      •    Twitter @_skare; @_ice_22




http://null.co.in/                              http://nullcon.net/
Sections
      •    .program analysis
      •    .dynamic behavior
      •    .dynamic binary instrumentation
      •    .Pin
      •    .puncture
      •    .conclusion



http://null.co.in/                           http://nullcon.net/
program analysis
      • In computer science, program analysis is the
        process of automatically analysing the
        behaviour of computer programs.
                     » http://en.wikipedia.org/wiki/Program_analysis

      • Two approaches:
             – Static Program Analysis.
             – Dynamic Program Analysis.



http://null.co.in/                                                     http://nullcon.net/
program analysis::Static Analysis
      • Static Properties
             – Hash
             – Signature/Byte Patterns
             – Strings
      • Code Analysis
      • Safe because we did not run it?
             – Mostly.
      • Match against known data.

http://null.co.in/                        http://nullcon.net/
program analysis::Static Analysis
      • One side of the coin.
      • May fail if
             – Obfuscated strings.
             – Variants.
             – Code in non-standard sections {.data,…}
             – Self modifying code.
             – Brand new.



http://null.co.in/                                       http://nullcon.net/
program analysis::Dynamic Analysis
      • a.k.a. Behavior Analysis
      • Let Us C (“see”)
      • Dynamic Properties
             – File Operations
             – Registry Operations
             – Network Operations
             – Interaction with other processes…
      • Dangerous unless run in controlled
        environment / sandbox.
http://null.co.in/                                 http://nullcon.net/
instrumentation
      • Instruments that record , analyze, summarize,
        organize, debate in explained information that
        are illustrative, non illustrative hard bound,
        paper bag, jacketed, non jacketed with
        forward introduction, table of content, index,
        that are intended for the enlightenment,
        understanding, enrichment, enhancement,
        education of human brain through sensory
        route of vision...sometimes touch!

http://null.co.in/                              http://nullcon.net/
Dynamic Binary Instrumentation
      • Instrument code just before it runs (Just In
        Time)
      • No need to re-link.
      • Discover code at runtime
      • Handle dynamically generated code.
      • Attach to running process.

                            • [cgo_2010_final.ppt]


http://null.co.in/                                   http://nullcon.net/
• A Dynamic Binary Instrumentation engine
        based on Post-Link Optimizer “Spike”.
      • Developed by Intel Corporation.
      • Oldest available release Pin-2.6-24110 dated
        13/01/2009.
      • Latest release Pin-2.8-39028 dated
        02/02/2011.
      • Alternatives: DynamoRIO, Valgrind

http://null.co.in/                              http://nullcon.net/
Advantages of Pin
      • Provides rich set of APIs in C/C++/Assembly for creating
        instrumentation tools a.k.a PinTools.
      • Multiplatform:
             – Supports IA-32, IA64, Intel64
             – Supports Windows, Linux MacOS
      • Robust:
             –   If you can run it, you can Pin it.
             –   Multithreaded applications
             –   Self modifying code
             –   Support signals and exceptions
      • Efficient
             – Compiler optimization and code inlining.




http://null.co.in/                                           http://nullcon.net/
Advantages of Pin
      • Provides rich set of APIs in C/C++/Assembly for creating
        instrumentation tools a.k.a PinTools.
      • Multiplatform:
             – Supports IA-32, IA64, Intel64
             – Supports Windows, Linux MacOS
      • Robust:
             –   If you can run it, you can Pin it.
             –   Multithreaded applications
             –   Self modifying code
             –   Support signals and exceptions
      • Efficient
             – Compiler optimization and code inlining.
      • Bypass Debug-Protection. (DEMO)


http://null.co.in/                                           http://nullcon.net/
Pin Capabilities
      • Inert code at arbitrary places in executable
        code.
      • Just-In-Time compilation
      • Automatic save/restore registers to avoid
        interference.
      • Dynamic code discovery.
      • Instrument anything ever executed*.


http://null.co.in/                                http://nullcon.net/
Pin Capabilities
      • Inert code at arbitrary places in executable
        code.
      • Just-In-Time compilation
      • Automatic save/restore registers to avoid
        interference.
      • Dynamic code discovery.
      • Instrument anything ever executed*.
                            • (*User Mode)


http://null.co.in/                                http://nullcon.net/
Pin Capabilities
      • Inert code at arbitrary places in executable
        code.
      • Just-In-Time compilation
      • Automatic save/restore registers to avoid
        interference.
      • Dynamic code discovery.
      • Instrument anything ever executed*.
                     If Pin doesn’t have it, you don’t want it

http://null.co.in/                                               http://nullcon.net/
but I do want these too…
      • Kernel Mode
      • Isolated I/O.
      • Handling exceptions of PinTools.




http://null.co.in/                              http://nullcon.net/
What for me but?
      Read                   Write
          Instructions         Instructions
          Operands             Operands
          Operations           Operations
          Methods              Methods
          Parameters           Parameters
          Return Values        Return Values
          Modules


http://null.co.in/                               http://nullcon.net/
Pin Design




http://null.co.in/                http://nullcon.net/
Pin Workflow




http://null.co.in/                  http://nullcon.net/
Pin Instrumentation
                             Modes
      • JIT
             – Using Code-Cache
             – All Instrumentation granularities
             – Flexible
      • Probe
             – Binary modified in place.
             – Limited to Routine level instrumentation.
             – Less flexible.
             – Faster than JIT in some cases.
http://null.co.in/                                         http://nullcon.net/
Pin Instrumentation
                         Granularities
      •    INS
      •    BBL
      •    Trace
      •    RTN
             – Requires symbol support- dbghelp.dll v6.11.1.404.
      • IMG



http://null.co.in/                                        http://nullcon.net/
a Simple PinTool
      #include “pin.H”
      int main(int argc, char *argv[])
      {
           if(PIN_Init(argc,argv))
                     return -1;
           IMG_AddInstrumentFunction(Image, 0);
           PIN_AddFiniFunction(Fini,0);


           PIN_StartProgram();
           return 0;
      }

http://null.co.in/                                http://nullcon.net/
.puncture
      • A PinTool for behavior analysis.
      • 3 Stage:
             – A text file of call logs.
             – XML of categorized events.
             – HTML Report = XML+XSL+CSS
      • Instrumentation Methods
             – Instrumentation at boundary
             – ReplaceSignature

http://null.co.in/                           http://nullcon.net/
Instrumentation at Boundary
      • UnPinned


                      FOO            BAAR
                      BAAR(x,x)          retn




                             *Conceptual View

http://null.co.in/                              http://nullcon.net/
Instrumentation at Boundary
      • Pinned

                       FOO            BAAR


    b4BAAR
                      b4BAAR(W,x,Z)                      afterBAAR
                                      afterBAAR(X,Y,Z)
                        BAAR(x,x)
                                           return




                             *Conceptual View

http://null.co.in/                                           http://nullcon.net/
ReplaceSignature
      • UnPinned


                     FOO            BAAR
                     call BAAR          retn




                            *Conceptual View

http://null.co.in/                             http://nullcon.net/
ReplaceSignature
      • Pinned


               FOO           wrappedBAAR                   BAAR
                call BAAR    PIN_CallApplicationFunction
                                                              retn




                                 *Conceptual View

http://null.co.in/                                                http://nullcon.net/
Logger Requirements
      • 3 Modules
             – Registry Logger       (ADVAPI32.DLL)
             – File Logger           (KERNEL32.DLL)
             – Network Logger        (WS2_32.DLL)
      • Final Output
             – A PinTool : Call Log in plain text.
             – PinParser : RawText => XML}
             – XSLT+CSS+JS for Visualization
      • [DEMO]
http://null.co.in/                                    http://nullcon.net/
.conclusion
      • Although DBI Frameworks like Pin are not
        primarily developed to test and optimize
        performance, code coverage etc., they have
        enough capabilities to be used as software
        security research tool too.




http://null.co.in/                             http://nullcon.net/
Contacts
      • Pin http://www.pintool.org
      • Pin user group pinheades@yahoo-groups
      • Me: badboy16a@gmail.com




http://null.co.in/                          http://nullcon.net/
Thanks…




http://null.co.in/             http://nullcon.net/

Weitere ähnliche Inhalte

Andere mochten auch

nullcon 2011 - Building an intelligence analysis systems using open source tools
nullcon 2011 - Building an intelligence analysis systems using open source toolsnullcon 2011 - Building an intelligence analysis systems using open source tools
nullcon 2011 - Building an intelligence analysis systems using open source toolsn|u - The Open Security Community
 
Sthack 2015 - Jonathan "@JonathanSalwan" Salwan - Dynamic Behavior Analysis U...
Sthack 2015 - Jonathan "@JonathanSalwan" Salwan - Dynamic Behavior Analysis U...Sthack 2015 - Jonathan "@JonathanSalwan" Salwan - Dynamic Behavior Analysis U...
Sthack 2015 - Jonathan "@JonathanSalwan" Salwan - Dynamic Behavior Analysis U...StHack
 
[2011 CodeEngn Conference 05] Deok9 - DBI(Dynamic Binary Instrumentation)를 이용...
[2011 CodeEngn Conference 05] Deok9 - DBI(Dynamic Binary Instrumentation)를 이용...[2011 CodeEngn Conference 05] Deok9 - DBI(Dynamic Binary Instrumentation)를 이용...
[2011 CodeEngn Conference 05] Deok9 - DBI(Dynamic Binary Instrumentation)를 이용...GangSeok Lee
 
nullcon 2011 - Automatic Program Analysis using Dynamic Binary Instrumentation
nullcon 2011 - Automatic Program Analysis using Dynamic Binary Instrumentationnullcon 2011 - Automatic Program Analysis using Dynamic Binary Instrumentation
nullcon 2011 - Automatic Program Analysis using Dynamic Binary Instrumentationn|u - The Open Security Community
 
Covering a function using a Dynamic Symbolic Execution approach
Covering a function using a Dynamic Symbolic Execution approach Covering a function using a Dynamic Symbolic Execution approach
Covering a function using a Dynamic Symbolic Execution approach Jonathan Salwan
 
Введение в динамический анализ приложений на примере Intel Pin
Введение в динамический анализ приложений на примере Intel PinВведение в динамический анализ приложений на примере Intel Pin
Введение в динамический анализ приложений на примере Intel PinSemen Martynov
 
PANDEMONIUM: Automated Identification of Cryptographic Algorithms using Dynam...
PANDEMONIUM: Automated Identification of Cryptographic Algorithms using Dynam...PANDEMONIUM: Automated Identification of Cryptographic Algorithms using Dynam...
PANDEMONIUM: Automated Identification of Cryptographic Algorithms using Dynam...CODE BLUE
 
TMPA-2015: The dynamic Analysis of Executable Code in ELF Format Based on Sta...
TMPA-2015: The dynamic Analysis of Executable Code in ELF Format Based on Sta...TMPA-2015: The dynamic Analysis of Executable Code in ELF Format Based on Sta...
TMPA-2015: The dynamic Analysis of Executable Code in ELF Format Based on Sta...Iosif Itkin
 

Andere mochten auch (9)

nullcon 2011 - Building an intelligence analysis systems using open source tools
nullcon 2011 - Building an intelligence analysis systems using open source toolsnullcon 2011 - Building an intelligence analysis systems using open source tools
nullcon 2011 - Building an intelligence analysis systems using open source tools
 
Sthack 2015 - Jonathan "@JonathanSalwan" Salwan - Dynamic Behavior Analysis U...
Sthack 2015 - Jonathan "@JonathanSalwan" Salwan - Dynamic Behavior Analysis U...Sthack 2015 - Jonathan "@JonathanSalwan" Salwan - Dynamic Behavior Analysis U...
Sthack 2015 - Jonathan "@JonathanSalwan" Salwan - Dynamic Behavior Analysis U...
 
[2011 CodeEngn Conference 05] Deok9 - DBI(Dynamic Binary Instrumentation)를 이용...
[2011 CodeEngn Conference 05] Deok9 - DBI(Dynamic Binary Instrumentation)를 이용...[2011 CodeEngn Conference 05] Deok9 - DBI(Dynamic Binary Instrumentation)를 이용...
[2011 CodeEngn Conference 05] Deok9 - DBI(Dynamic Binary Instrumentation)를 이용...
 
nullcon 2011 - Automatic Program Analysis using Dynamic Binary Instrumentation
nullcon 2011 - Automatic Program Analysis using Dynamic Binary Instrumentationnullcon 2011 - Automatic Program Analysis using Dynamic Binary Instrumentation
nullcon 2011 - Automatic Program Analysis using Dynamic Binary Instrumentation
 
Covering a function using a Dynamic Symbolic Execution approach
Covering a function using a Dynamic Symbolic Execution approach Covering a function using a Dynamic Symbolic Execution approach
Covering a function using a Dynamic Symbolic Execution approach
 
Введение в динамический анализ приложений на примере Intel Pin
Введение в динамический анализ приложений на примере Intel PinВведение в динамический анализ приложений на примере Intel Pin
Введение в динамический анализ приложений на примере Intel Pin
 
PANDEMONIUM: Automated Identification of Cryptographic Algorithms using Dynam...
PANDEMONIUM: Automated Identification of Cryptographic Algorithms using Dynam...PANDEMONIUM: Automated Identification of Cryptographic Algorithms using Dynam...
PANDEMONIUM: Automated Identification of Cryptographic Algorithms using Dynam...
 
TMPA-2015: The dynamic Analysis of Executable Code in ELF Format Based on Sta...
TMPA-2015: The dynamic Analysis of Executable Code in ELF Format Based on Sta...TMPA-2015: The dynamic Analysis of Executable Code in ELF Format Based on Sta...
TMPA-2015: The dynamic Analysis of Executable Code in ELF Format Based on Sta...
 
Dynamic Binary Instrumentation
Dynamic Binary Instrumentation	Dynamic Binary Instrumentation
Dynamic Binary Instrumentation
 

Ähnlich wie Automatic Program Analysis with Dynamic Binary Instrumentation

Demystifying Binary Reverse Engineering - Pixels Camp
Demystifying Binary Reverse Engineering - Pixels CampDemystifying Binary Reverse Engineering - Pixels Camp
Demystifying Binary Reverse Engineering - Pixels CampAndré Baptista
 
Reversing Microsoft patches to reveal vulnerable code
Reversing Microsoft patches to reveal vulnerable codeReversing Microsoft patches to reveal vulnerable code
Reversing Microsoft patches to reveal vulnerable codeHarsimran Walia
 
Practical IoT Exploitation (DEFCON23 IoTVillage) - Lyon Yang
Practical IoT Exploitation (DEFCON23 IoTVillage) - Lyon YangPractical IoT Exploitation (DEFCON23 IoTVillage) - Lyon Yang
Practical IoT Exploitation (DEFCON23 IoTVillage) - Lyon YangLyon Yang
 
Code quality par Simone Civetta
Code quality par Simone CivettaCode quality par Simone Civetta
Code quality par Simone CivettaCocoaHeads France
 
Security research over Windows #defcon china
Security research over Windows #defcon chinaSecurity research over Windows #defcon china
Security research over Windows #defcon chinaPeter Hlavaty
 
Reverse Engineering Malware - A Practical Guide
Reverse Engineering Malware - A Practical GuideReverse Engineering Malware - A Practical Guide
Reverse Engineering Malware - A Practical Guideintertelinvestigations
 
Running trusted payloads with Nomad and Waypoint
Running trusted payloads with Nomad and WaypointRunning trusted payloads with Nomad and Waypoint
Running trusted payloads with Nomad and WaypointBram Vogelaar
 
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
 
Property and MM with ARC in Objective-C
Property and MM with ARC in Objective-CProperty and MM with ARC in Objective-C
Property and MM with ARC in Objective-CYo Yo Chen
 
Scalable Automatic Machine Learning with H2O
Scalable Automatic Machine Learning with H2OScalable Automatic Machine Learning with H2O
Scalable Automatic Machine Learning with H2OSri Ambati
 
Expert JavaScript Programming
Expert JavaScript ProgrammingExpert JavaScript Programming
Expert JavaScript ProgrammingYoshiki Shibukawa
 
Static-Analysis-in-Industry.pptx
Static-Analysis-in-Industry.pptxStatic-Analysis-in-Industry.pptx
Static-Analysis-in-Industry.pptxShivashankarHR1
 
Dmitriy D1g1 Evdokimov - DBI Intro
Dmitriy D1g1 Evdokimov - DBI IntroDmitriy D1g1 Evdokimov - DBI Intro
Dmitriy D1g1 Evdokimov - DBI IntroDefconRussia
 
Ci for i-os-codemash-01.2013
Ci for i-os-codemash-01.2013Ci for i-os-codemash-01.2013
Ci for i-os-codemash-01.2013Kevin Munc
 
Advanced SOHO Router Exploitation XCON
Advanced SOHO Router Exploitation XCONAdvanced SOHO Router Exploitation XCON
Advanced SOHO Router Exploitation XCONLyon Yang
 
Introduction to Python Programming
Introduction to Python ProgrammingIntroduction to Python Programming
Introduction to Python ProgrammingAkhil Kaushik
 
Rust Programming Language
Rust Programming LanguageRust Programming Language
Rust Programming LanguageJaeju Kim
 

Ähnlich wie Automatic Program Analysis with Dynamic Binary Instrumentation (20)

Demystifying Binary Reverse Engineering - Pixels Camp
Demystifying Binary Reverse Engineering - Pixels CampDemystifying Binary Reverse Engineering - Pixels Camp
Demystifying Binary Reverse Engineering - Pixels Camp
 
Reversing Microsoft patches to reveal vulnerable code
Reversing Microsoft patches to reveal vulnerable codeReversing Microsoft patches to reveal vulnerable code
Reversing Microsoft patches to reveal vulnerable code
 
Practical IoT Exploitation (DEFCON23 IoTVillage) - Lyon Yang
Practical IoT Exploitation (DEFCON23 IoTVillage) - Lyon YangPractical IoT Exploitation (DEFCON23 IoTVillage) - Lyon Yang
Practical IoT Exploitation (DEFCON23 IoTVillage) - Lyon Yang
 
Code quality par Simone Civetta
Code quality par Simone CivettaCode quality par Simone Civetta
Code quality par Simone Civetta
 
Security research over Windows #defcon china
Security research over Windows #defcon chinaSecurity research over Windows #defcon china
Security research over Windows #defcon china
 
Reverse Engineering Malware - A Practical Guide
Reverse Engineering Malware - A Practical GuideReverse Engineering Malware - A Practical Guide
Reverse Engineering Malware - A Practical Guide
 
Running trusted payloads with Nomad and Waypoint
Running trusted payloads with Nomad and WaypointRunning trusted payloads with Nomad and Waypoint
Running trusted payloads with Nomad and Waypoint
 
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)
 
Zenoh Tutorial
Zenoh TutorialZenoh Tutorial
Zenoh Tutorial
 
Property and MM with ARC in Objective-C
Property and MM with ARC in Objective-CProperty and MM with ARC in Objective-C
Property and MM with ARC in Objective-C
 
Scalable Automatic Machine Learning with H2O
Scalable Automatic Machine Learning with H2OScalable Automatic Machine Learning with H2O
Scalable Automatic Machine Learning with H2O
 
Expert JavaScript Programming
Expert JavaScript ProgrammingExpert JavaScript Programming
Expert JavaScript Programming
 
Static-Analysis-in-Industry.pptx
Static-Analysis-in-Industry.pptxStatic-Analysis-in-Industry.pptx
Static-Analysis-in-Industry.pptx
 
Qtp - Introduction to synchronization
Qtp -  Introduction to synchronizationQtp -  Introduction to synchronization
Qtp - Introduction to synchronization
 
Dmitriy D1g1 Evdokimov - DBI Intro
Dmitriy D1g1 Evdokimov - DBI IntroDmitriy D1g1 Evdokimov - DBI Intro
Dmitriy D1g1 Evdokimov - DBI Intro
 
Ci for i-os-codemash-01.2013
Ci for i-os-codemash-01.2013Ci for i-os-codemash-01.2013
Ci for i-os-codemash-01.2013
 
Advanced SOHO Router Exploitation XCON
Advanced SOHO Router Exploitation XCONAdvanced SOHO Router Exploitation XCON
Advanced SOHO Router Exploitation XCON
 
Introduction to Python Programming
Introduction to Python ProgrammingIntroduction to Python Programming
Introduction to Python Programming
 
Embedded Rust
Embedded RustEmbedded Rust
Embedded Rust
 
Rust Programming Language
Rust Programming LanguageRust Programming Language
Rust Programming Language
 

Mehr von Sunil Kumar

Basics of Cryptography
Basics of CryptographyBasics of Cryptography
Basics of CryptographySunil Kumar
 
3Es of Ransomware
3Es of Ransomware3Es of Ransomware
3Es of RansomwareSunil Kumar
 
Http2 Security Perspective
Http2 Security PerspectiveHttp2 Security Perspective
Http2 Security PerspectiveSunil Kumar
 
Memory forensics
Memory forensicsMemory forensics
Memory forensicsSunil Kumar
 
n|u Dharamsala Humla : Memory Forensic by Tenzin Chokden
n|u Dharamsala Humla : Memory Forensic by Tenzin Chokdenn|u Dharamsala Humla : Memory Forensic by Tenzin Chokden
n|u Dharamsala Humla : Memory Forensic by Tenzin ChokdenSunil Kumar
 
Jsonp null-meet-02-2015
Jsonp null-meet-02-2015Jsonp null-meet-02-2015
Jsonp null-meet-02-2015Sunil Kumar
 
Dt5 varenni win_pcapdosdonts
Dt5 varenni win_pcapdosdontsDt5 varenni win_pcapdosdonts
Dt5 varenni win_pcapdosdontsSunil Kumar
 

Mehr von Sunil Kumar (7)

Basics of Cryptography
Basics of CryptographyBasics of Cryptography
Basics of Cryptography
 
3Es of Ransomware
3Es of Ransomware3Es of Ransomware
3Es of Ransomware
 
Http2 Security Perspective
Http2 Security PerspectiveHttp2 Security Perspective
Http2 Security Perspective
 
Memory forensics
Memory forensicsMemory forensics
Memory forensics
 
n|u Dharamsala Humla : Memory Forensic by Tenzin Chokden
n|u Dharamsala Humla : Memory Forensic by Tenzin Chokdenn|u Dharamsala Humla : Memory Forensic by Tenzin Chokden
n|u Dharamsala Humla : Memory Forensic by Tenzin Chokden
 
Jsonp null-meet-02-2015
Jsonp null-meet-02-2015Jsonp null-meet-02-2015
Jsonp null-meet-02-2015
 
Dt5 varenni win_pcapdosdonts
Dt5 varenni win_pcapdosdontsDt5 varenni win_pcapdosdonts
Dt5 varenni win_pcapdosdonts
 

Kürzlich hochgeladen

Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 

Kürzlich hochgeladen (20)

Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 

Automatic Program Analysis with Dynamic Binary Instrumentation

  • 1. Automatic Program Analysis with Dynamic Binary Instrumentation Sunil Kumar (sunil.kumar@ivizsecurity.com) http://null.co.in/ http://nullcon.net/
  • 2. #whoami • Research Associate @ iViZ Techno Solutions • MCA(007) from Goa University i.e. GUMCA07. • http://www.linkedin.com/in/sunilkr86 • Twitter @_skare; @_ice_22 http://null.co.in/ http://nullcon.net/
  • 3. Sections • .program analysis • .dynamic behavior • .dynamic binary instrumentation • .Pin • .puncture • .conclusion http://null.co.in/ http://nullcon.net/
  • 4. program analysis • In computer science, program analysis is the process of automatically analysing the behaviour of computer programs. » http://en.wikipedia.org/wiki/Program_analysis • Two approaches: – Static Program Analysis. – Dynamic Program Analysis. http://null.co.in/ http://nullcon.net/
  • 5. program analysis::Static Analysis • Static Properties – Hash – Signature/Byte Patterns – Strings • Code Analysis • Safe because we did not run it? – Mostly. • Match against known data. http://null.co.in/ http://nullcon.net/
  • 6. program analysis::Static Analysis • One side of the coin. • May fail if – Obfuscated strings. – Variants. – Code in non-standard sections {.data,…} – Self modifying code. – Brand new. http://null.co.in/ http://nullcon.net/
  • 7. program analysis::Dynamic Analysis • a.k.a. Behavior Analysis • Let Us C (“see”) • Dynamic Properties – File Operations – Registry Operations – Network Operations – Interaction with other processes… • Dangerous unless run in controlled environment / sandbox. http://null.co.in/ http://nullcon.net/
  • 8. instrumentation • Instruments that record , analyze, summarize, organize, debate in explained information that are illustrative, non illustrative hard bound, paper bag, jacketed, non jacketed with forward introduction, table of content, index, that are intended for the enlightenment, understanding, enrichment, enhancement, education of human brain through sensory route of vision...sometimes touch! http://null.co.in/ http://nullcon.net/
  • 9. Dynamic Binary Instrumentation • Instrument code just before it runs (Just In Time) • No need to re-link. • Discover code at runtime • Handle dynamically generated code. • Attach to running process. • [cgo_2010_final.ppt] http://null.co.in/ http://nullcon.net/
  • 10. • A Dynamic Binary Instrumentation engine based on Post-Link Optimizer “Spike”. • Developed by Intel Corporation. • Oldest available release Pin-2.6-24110 dated 13/01/2009. • Latest release Pin-2.8-39028 dated 02/02/2011. • Alternatives: DynamoRIO, Valgrind http://null.co.in/ http://nullcon.net/
  • 11. Advantages of Pin • Provides rich set of APIs in C/C++/Assembly for creating instrumentation tools a.k.a PinTools. • Multiplatform: – Supports IA-32, IA64, Intel64 – Supports Windows, Linux MacOS • Robust: – If you can run it, you can Pin it. – Multithreaded applications – Self modifying code – Support signals and exceptions • Efficient – Compiler optimization and code inlining. http://null.co.in/ http://nullcon.net/
  • 12. Advantages of Pin • Provides rich set of APIs in C/C++/Assembly for creating instrumentation tools a.k.a PinTools. • Multiplatform: – Supports IA-32, IA64, Intel64 – Supports Windows, Linux MacOS • Robust: – If you can run it, you can Pin it. – Multithreaded applications – Self modifying code – Support signals and exceptions • Efficient – Compiler optimization and code inlining. • Bypass Debug-Protection. (DEMO) http://null.co.in/ http://nullcon.net/
  • 13. Pin Capabilities • Inert code at arbitrary places in executable code. • Just-In-Time compilation • Automatic save/restore registers to avoid interference. • Dynamic code discovery. • Instrument anything ever executed*. http://null.co.in/ http://nullcon.net/
  • 14. Pin Capabilities • Inert code at arbitrary places in executable code. • Just-In-Time compilation • Automatic save/restore registers to avoid interference. • Dynamic code discovery. • Instrument anything ever executed*. • (*User Mode) http://null.co.in/ http://nullcon.net/
  • 15. Pin Capabilities • Inert code at arbitrary places in executable code. • Just-In-Time compilation • Automatic save/restore registers to avoid interference. • Dynamic code discovery. • Instrument anything ever executed*. If Pin doesn’t have it, you don’t want it http://null.co.in/ http://nullcon.net/
  • 16. but I do want these too… • Kernel Mode • Isolated I/O. • Handling exceptions of PinTools. http://null.co.in/ http://nullcon.net/
  • 17. What for me but? Read Write  Instructions  Instructions  Operands  Operands  Operations  Operations  Methods  Methods  Parameters  Parameters  Return Values  Return Values  Modules http://null.co.in/ http://nullcon.net/
  • 18. Pin Design http://null.co.in/ http://nullcon.net/
  • 19. Pin Workflow http://null.co.in/ http://nullcon.net/
  • 20. Pin Instrumentation Modes • JIT – Using Code-Cache – All Instrumentation granularities – Flexible • Probe – Binary modified in place. – Limited to Routine level instrumentation. – Less flexible. – Faster than JIT in some cases. http://null.co.in/ http://nullcon.net/
  • 21. Pin Instrumentation Granularities • INS • BBL • Trace • RTN – Requires symbol support- dbghelp.dll v6.11.1.404. • IMG http://null.co.in/ http://nullcon.net/
  • 22. a Simple PinTool #include “pin.H” int main(int argc, char *argv[]) { if(PIN_Init(argc,argv)) return -1; IMG_AddInstrumentFunction(Image, 0); PIN_AddFiniFunction(Fini,0); PIN_StartProgram(); return 0; } http://null.co.in/ http://nullcon.net/
  • 23. .puncture • A PinTool for behavior analysis. • 3 Stage: – A text file of call logs. – XML of categorized events. – HTML Report = XML+XSL+CSS • Instrumentation Methods – Instrumentation at boundary – ReplaceSignature http://null.co.in/ http://nullcon.net/
  • 24. Instrumentation at Boundary • UnPinned FOO BAAR BAAR(x,x) retn *Conceptual View http://null.co.in/ http://nullcon.net/
  • 25. Instrumentation at Boundary • Pinned FOO BAAR b4BAAR b4BAAR(W,x,Z) afterBAAR afterBAAR(X,Y,Z) BAAR(x,x) return *Conceptual View http://null.co.in/ http://nullcon.net/
  • 26. ReplaceSignature • UnPinned FOO BAAR call BAAR retn *Conceptual View http://null.co.in/ http://nullcon.net/
  • 27. ReplaceSignature • Pinned FOO wrappedBAAR BAAR call BAAR PIN_CallApplicationFunction retn *Conceptual View http://null.co.in/ http://nullcon.net/
  • 28. Logger Requirements • 3 Modules – Registry Logger (ADVAPI32.DLL) – File Logger (KERNEL32.DLL) – Network Logger (WS2_32.DLL) • Final Output – A PinTool : Call Log in plain text. – PinParser : RawText => XML} – XSLT+CSS+JS for Visualization • [DEMO] http://null.co.in/ http://nullcon.net/
  • 29. .conclusion • Although DBI Frameworks like Pin are not primarily developed to test and optimize performance, code coverage etc., they have enough capabilities to be used as software security research tool too. http://null.co.in/ http://nullcon.net/
  • 30. Contacts • Pin http://www.pintool.org • Pin user group pinheades@yahoo-groups • Me: badboy16a@gmail.com http://null.co.in/ http://nullcon.net/
  • 31. Thanks… http://null.co.in/ http://nullcon.net/