SlideShare una empresa de Scribd logo
1 de 21
Descargar para leer sin conexión
TSC Summit #3 - Reverse
Engineering & Anti
Debugging techniques
Why reverse engineering?
● Because it’s fun
● Malware hunting
● Curiousity
● Military or commercial espionage
● Security auditing
● Increase (reduce) public security
● Product analysis
● Loss of documentation and/or source code
What can be reverse engineered?
● Physical hardware
● PHP/Javascript/Python/Ruby code
● Microsoft’s .NET family
● Java/Scala/Clojure and other JVM languages
● C/C++/Rust and other system languages
● Swift/Objective-C and other Apple products
● More or less everything
What tools is used for reverse engineering?
● Physical hardware
● Debug tools
● Dynamic binary instrumentation
● Forensics tools
● System monitoring
● Kernel drivers
● Hardware breakpoints
● Hex editors
What about decompilers?
● Assembly/Bytecode to “source code” again
● The quality of produced code is varying
● Works best with script and VM languages
What about decompilers?
● Assembly/Bytecode to “source code” again
● The quality of produced code is varying
● Works best with script and VM languages
● Script languages are usually never “compiled”
● The .NET family is without doubt easiest
● The JVM family is next in line
● Erlang? Sorry, forgot about it, but google says it’s
doable in the minutes before this presentation :)
Decompilers in action (.NET)
● 100% reversible
● 100% readable
● Can recompile
● Symbols (names)
● Strings (text)
● Keep all metadata
Decompilers in action (JVM)
● 30-60% reversible
● 70% readable
● Can’t recompile
● Symbols (names)
● Strings (text)
● Some metadata
Decompilers in action (Apple’s Objective-C/C++)
● 20-30% reversible
● 30% readable
● Can’t recompile
● Symbols (names)
● Strings (text)
● Some metadata
Decompilers in action (Native code)
● 0-10% reversible
● 5% readable
● Can’t recompile
● Symbols optional
● Strings (text)
● Barely metadata
Why anti debug?
● Protect proprietary software
● Malware in need of hiding
● Hide baaaaad code
● Just being a douchebag
Help text
How to do anti debugging for VM code?
● Obfuscation mostly for JVM/.NET
● Hide functionality in native shared libraries
● Runtime decryption of strings
● Multiple entry points (start of application)
○
● Various of debugger detection techniques
How to do anti debugging for native code?
● All the same ways as VM code can
● Deny run in virtual machine
● Operating system hooks/API to disable “debuggable”
● Debug yourself :)
● Make sure LD_PRELOAD/DYLD_INSERT_LIBRARIES is empty
● Screw up ELF/Mach-O headers just enough
● Entry point via Unix signals (Linux / OSX)
● Entry point via Thread Local Storage (TLS) (Windows only)
How to do anti debugging
● We’ll focus on VM based languages
● Anti debugger / evasion techniques in native code
○ Hard for n00bs
○ Requires much system knowledge
● String decryption at runtime might help
● Decryption of code at runtime (Not easily done in JVM)
● Transform your code to something a little more ugly
Before obfuscation
Obfuscation in JVM: Packing local vars into bitfields (PLVB)
After obfuscation
Obfuscation in JVM: Packing local vars into bitfields (PLVB)
Before obfuscation
Obfuscation in JVM: Reorder instructions (LRAII)
After obfuscation
Obfuscation in JVM: Reorder instructions (LRAII)
Inject JavaScript to explore native apps on Windows, macOS,
Linux, iOS, Android, and QNX.
● Scriptable
○ Python
○ Javascript
○ Swift
○ C
● No root needed
● No jailbreak either
● Easy to start with
Compile your whole application with the “mov” instruction
● Horrible
○ No control flow
○ No syscalls
● C/asm products
● Only x86?
● Binary size rises
Mikal Villa
mikal.villa@knowit.no, @mikalv
2017-06-19 The Security Chapter - Summit #3
Thanks

Más contenido relacionado

La actualidad más candente

Lighning Talk: PHP build process
Lighning Talk: PHP build processLighning Talk: PHP build process
Lighning Talk: PHP build process
Bryan Agee
 
Robot framework
Robot frameworkRobot framework
Robot framework
boriau
 

La actualidad más candente (20)

Robot Framework Introduction
Robot Framework IntroductionRobot Framework Introduction
Robot Framework Introduction
 
JavaScript Introduction
JavaScript IntroductionJavaScript Introduction
JavaScript Introduction
 
Lighning Talk: PHP build process
Lighning Talk: PHP build processLighning Talk: PHP build process
Lighning Talk: PHP build process
 
Automation using RobotFramework for embedded device
Automation using RobotFramework for embedded deviceAutomation using RobotFramework for embedded device
Automation using RobotFramework for embedded device
 
Swift for back end: A new generation of full stack languages?
Swift for back end: A new generation of full stack languages?Swift for back end: A new generation of full stack languages?
Swift for back end: A new generation of full stack languages?
 
Sonar
SonarSonar
Sonar
 
Why Rust? - Matthias Endler - Codemotion Amsterdam 2016
Why Rust? - Matthias Endler - Codemotion Amsterdam 2016Why Rust? - Matthias Endler - Codemotion Amsterdam 2016
Why Rust? - Matthias Endler - Codemotion Amsterdam 2016
 
Introduction to Robot Framework – Exove
Introduction to Robot Framework – ExoveIntroduction to Robot Framework – Exove
Introduction to Robot Framework – Exove
 
eLabFTW review
eLabFTW revieweLabFTW review
eLabFTW review
 
Robot Framework with actual robot
Robot Framework with actual robot Robot Framework with actual robot
Robot Framework with actual robot
 
Technical screening .Net Developer
Technical screening  .Net DeveloperTechnical screening  .Net Developer
Technical screening .Net Developer
 
All Aboard The Stateful Train
All Aboard The Stateful TrainAll Aboard The Stateful Train
All Aboard The Stateful Train
 
Network Protocol Testing Using Robot Framework
Network Protocol Testing Using Robot FrameworkNetwork Protocol Testing Using Robot Framework
Network Protocol Testing Using Robot Framework
 
How aspects clean your code
How aspects clean your codeHow aspects clean your code
How aspects clean your code
 
Complete python toolbox for modern developers
Complete python toolbox for modern developersComplete python toolbox for modern developers
Complete python toolbox for modern developers
 
Acceptance Test Driven Development and Robot Framework
Acceptance Test Driven Development and Robot FrameworkAcceptance Test Driven Development and Robot Framework
Acceptance Test Driven Development and Robot Framework
 
Robot framework
Robot frameworkRobot framework
Robot framework
 
Introduction to Robot Framework (external)
Introduction to Robot Framework (external)Introduction to Robot Framework (external)
Introduction to Robot Framework (external)
 
I believe in rust
I believe in rustI believe in rust
I believe in rust
 
Robot Framework with Python | Edureka
Robot Framework with Python | EdurekaRobot Framework with Python | Edureka
Robot Framework with Python | Edureka
 

Similar a TSC Summit #3 - Reverse engineering and anti debugging techniques

Compilers and interpreters
Compilers and interpretersCompilers and interpreters
Compilers and interpreters
RAJU KATHI
 
Native client (Евгений Эльцин)
Native client (Евгений Эльцин)Native client (Евгений Эльцин)
Native client (Евгений Эльцин)
Ontico
 
A Kernel of Truth: Intrusion Detection and Attestation with eBPF
A Kernel of Truth: Intrusion Detection and Attestation with eBPFA Kernel of Truth: Intrusion Detection and Attestation with eBPF
A Kernel of Truth: Intrusion Detection and Attestation with eBPF
oholiab
 

Similar a TSC Summit #3 - Reverse engineering and anti debugging techniques (20)

(phpconftw2012) PHP as a Middleware in Embedded Systems
(phpconftw2012) PHP as a Middleware in Embedded Systems(phpconftw2012) PHP as a Middleware in Embedded Systems
(phpconftw2012) PHP as a Middleware in Embedded Systems
 
Rooted con 2020 - from the heaven to hell in the CI - CD
Rooted con 2020 - from the heaven to hell in the CI - CDRooted con 2020 - from the heaven to hell in the CI - CD
Rooted con 2020 - from the heaven to hell in the CI - CD
 
Debugging in .Net
Debugging in .NetDebugging in .Net
Debugging in .Net
 
12 tricks to avoid hackers breaks your CI / CD
12 tricks to avoid hackers breaks your  CI / CD12 tricks to avoid hackers breaks your  CI / CD
12 tricks to avoid hackers breaks your CI / CD
 
Sonatype DevSecOps Leadership forum 2020
Sonatype DevSecOps Leadership forum 2020Sonatype DevSecOps Leadership forum 2020
Sonatype DevSecOps Leadership forum 2020
 
Serverless Functions and Machine Learning: Putting the AI in APIs
Serverless Functions and Machine Learning: Putting the AI in APIsServerless Functions and Machine Learning: Putting the AI in APIs
Serverless Functions and Machine Learning: Putting the AI in APIs
 
Compilers and interpreters
Compilers and interpretersCompilers and interpreters
Compilers and interpreters
 
Hacking Vulnerable Websites to Bypass Firewalls
Hacking Vulnerable Websites to Bypass FirewallsHacking Vulnerable Websites to Bypass Firewalls
Hacking Vulnerable Websites to Bypass Firewalls
 
Common technique in Bypassing Stuff in Python.
Common technique in Bypassing Stuff in Python.Common technique in Bypassing Stuff in Python.
Common technique in Bypassing Stuff in Python.
 
Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5
Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5
Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5
 
.Net Debugging Techniques
.Net Debugging Techniques.Net Debugging Techniques
.Net Debugging Techniques
 
.NET Debugging Tips and Techniques
.NET Debugging Tips and Techniques.NET Debugging Tips and Techniques
.NET Debugging Tips and Techniques
 
Joomla Code Quality Control and Automation Testing
Joomla Code Quality Control and Automation TestingJoomla Code Quality Control and Automation Testing
Joomla Code Quality Control and Automation Testing
 
Native client (Евгений Эльцин)
Native client (Евгений Эльцин)Native client (Евгений Эльцин)
Native client (Евгений Эльцин)
 
Anatomy of PHP Shells
Anatomy of PHP ShellsAnatomy of PHP Shells
Anatomy of PHP Shells
 
Debugging ZFS: From Illumos to Linux
Debugging ZFS: From Illumos to LinuxDebugging ZFS: From Illumos to Linux
Debugging ZFS: From Illumos to Linux
 
Introduction to .net FrameWork by QuontraSolutions
Introduction to .net FrameWork by QuontraSolutionsIntroduction to .net FrameWork by QuontraSolutions
Introduction to .net FrameWork by QuontraSolutions
 
Higher Level Malware
Higher Level MalwareHigher Level Malware
Higher Level Malware
 
Assembly thy Web
Assembly thy WebAssembly thy Web
Assembly thy Web
 
A Kernel of Truth: Intrusion Detection and Attestation with eBPF
A Kernel of Truth: Intrusion Detection and Attestation with eBPFA Kernel of Truth: Intrusion Detection and Attestation with eBPF
A Kernel of Truth: Intrusion Detection and Attestation with eBPF
 

Último

introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
masabamasaba
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 

Último (20)

introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
Generic or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisionsGeneric or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisions
 
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
SHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions PresentationSHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions Presentation
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 

TSC Summit #3 - Reverse engineering and anti debugging techniques

  • 1. TSC Summit #3 - Reverse Engineering & Anti Debugging techniques
  • 2. Why reverse engineering? ● Because it’s fun ● Malware hunting ● Curiousity ● Military or commercial espionage ● Security auditing ● Increase (reduce) public security ● Product analysis ● Loss of documentation and/or source code
  • 3. What can be reverse engineered? ● Physical hardware ● PHP/Javascript/Python/Ruby code ● Microsoft’s .NET family ● Java/Scala/Clojure and other JVM languages ● C/C++/Rust and other system languages ● Swift/Objective-C and other Apple products ● More or less everything
  • 4. What tools is used for reverse engineering? ● Physical hardware ● Debug tools ● Dynamic binary instrumentation ● Forensics tools ● System monitoring ● Kernel drivers ● Hardware breakpoints ● Hex editors
  • 5. What about decompilers? ● Assembly/Bytecode to “source code” again ● The quality of produced code is varying ● Works best with script and VM languages
  • 6. What about decompilers? ● Assembly/Bytecode to “source code” again ● The quality of produced code is varying ● Works best with script and VM languages ● Script languages are usually never “compiled” ● The .NET family is without doubt easiest ● The JVM family is next in line ● Erlang? Sorry, forgot about it, but google says it’s doable in the minutes before this presentation :)
  • 7. Decompilers in action (.NET) ● 100% reversible ● 100% readable ● Can recompile ● Symbols (names) ● Strings (text) ● Keep all metadata
  • 8. Decompilers in action (JVM) ● 30-60% reversible ● 70% readable ● Can’t recompile ● Symbols (names) ● Strings (text) ● Some metadata
  • 9. Decompilers in action (Apple’s Objective-C/C++) ● 20-30% reversible ● 30% readable ● Can’t recompile ● Symbols (names) ● Strings (text) ● Some metadata
  • 10. Decompilers in action (Native code) ● 0-10% reversible ● 5% readable ● Can’t recompile ● Symbols optional ● Strings (text) ● Barely metadata
  • 11. Why anti debug? ● Protect proprietary software ● Malware in need of hiding ● Hide baaaaad code ● Just being a douchebag Help text
  • 12. How to do anti debugging for VM code? ● Obfuscation mostly for JVM/.NET ● Hide functionality in native shared libraries ● Runtime decryption of strings ● Multiple entry points (start of application) ○ ● Various of debugger detection techniques
  • 13. How to do anti debugging for native code? ● All the same ways as VM code can ● Deny run in virtual machine ● Operating system hooks/API to disable “debuggable” ● Debug yourself :) ● Make sure LD_PRELOAD/DYLD_INSERT_LIBRARIES is empty ● Screw up ELF/Mach-O headers just enough ● Entry point via Unix signals (Linux / OSX) ● Entry point via Thread Local Storage (TLS) (Windows only)
  • 14. How to do anti debugging ● We’ll focus on VM based languages ● Anti debugger / evasion techniques in native code ○ Hard for n00bs ○ Requires much system knowledge ● String decryption at runtime might help ● Decryption of code at runtime (Not easily done in JVM) ● Transform your code to something a little more ugly
  • 15. Before obfuscation Obfuscation in JVM: Packing local vars into bitfields (PLVB)
  • 16. After obfuscation Obfuscation in JVM: Packing local vars into bitfields (PLVB)
  • 17. Before obfuscation Obfuscation in JVM: Reorder instructions (LRAII)
  • 18. After obfuscation Obfuscation in JVM: Reorder instructions (LRAII)
  • 19. Inject JavaScript to explore native apps on Windows, macOS, Linux, iOS, Android, and QNX. ● Scriptable ○ Python ○ Javascript ○ Swift ○ C ● No root needed ● No jailbreak either ● Easy to start with
  • 20. Compile your whole application with the “mov” instruction ● Horrible ○ No control flow ○ No syscalls ● C/asm products ● Only x86? ● Binary size rises
  • 21. Mikal Villa mikal.villa@knowit.no, @mikalv 2017-06-19 The Security Chapter - Summit #3 Thanks