SlideShare a Scribd company logo
Code Obfuscation


  Tool for Software Protection
Outline
 Why Code Obfuscation
 Features of a code obfuscator
   Potency
   Resilience
   Cost
 Classification of Obfuscating
  Transformations
Why use Code Obfuscation
Techniques
 Mainly to defend against Software
  Reverse Engineering
 We can only make it more difficult for
  reverse engineers
 Available obfuscating tools work in
  the same way as compiler optimizers
 Reduce required space and time for
  compilation
 The level of security that an
  Obfuscator adds depends on:
   The transformations used
   The power of available deobfuscators
   The amount of resources available to
    deobfuscators
Main features of a Code Obfuscator
 Potency: is the level up to which a
  human reader would be confused by
  the new code
 Resilience: is how well the obfuscated
  code resists attacks by deobfuscation
  tools
 Cost: is how much load is added to
  the application
Code Obfuscation
 Reverse                                                                       P1
                                                            Reverse Engineer
  engineering                           P1, P2, .., Pn
  exatracts piece of
                                                                                Pn
  program
 Obfuscation makes
  reverse
  engineering
  difficult
                     Obfuscation                         Reverse Engineering fails
  P1, P2, .., Pn                     Q1, Q2, .., Qm
                   Transformations
Protection through Obfuscation




http://www.cs.arizona.edu/~collberg/Research/Obfuscation/Resources.html
Obfuscation methods




 Mainly based on target information that we
  want to modify/obfuscate
Obfuscation Methods
 Lexical transformations
   Modify variable names
 Control transformations
   Change program flow while preserving
    semantics
 Data transformations
   Modify data structures
 Anti-disassembly
 Anti-debugging
Kinds of obfuscation for each target
information
Available JavaScript Obfuscators
 Most available commercial JavaScript
  obfuscators work by applying Lexical
  transformations
 Some obfuscators that were
  considered are:
   Stunnix JavaScript Obfuscator
   Shane Ng's GPL-licensed obfuscator
   Free JavaScript Obfuscator
Example:From Stunnix
   Actual code:                    Obfuscated code:
   function foo( arg1)             function z001c775808(
   {                                z3833986e2c) { var
     var myVar1 = "some             z0d8bd8ba25=
    string"; //first comment         "x73x6fx6dx65x20x73x
                                     74x72x69x6ex67"; var
     var intVar = 24 * 3600;        z0ed9bcbcc2= (0x90b+785-
    //second comment                 0xc04)* (0x1136+6437-
     /* here is                     0x1c4b); document. write(
   a long                           "x76x61x72x73x20x61
   multi-line comment blah */       x72x65x3a"+
                                     z0d8bd8ba25+ "x20"+
     document. write( "vars         z0ed9bcbcc2+ "x20"+
    are:" + myVar1 + " " +           z3833986e2c);};
    intVar + " " + arg1) ;
   };
Step by step examination
 The Stunnix obfuscator targets at obfuscating
  only the layout of the JavaScript code
 As the obfuscator parses the code, it removes
  spaces, comments and new line feeds
 While doing so, as it encounters user defined
  names, it replaces them with some random
  string
 It replaces print strings with their hexadecimal
  values
 It replaces integer values with complex
  equations
 In the sample code that was obfuscated, the following
  can be observed
 User defined variables:
   foo replaced with z001c775808
   arg1 replaced with z3833986e2c
   myvar1 replaced with z0d8bd8ba25
   intvar replaced with z0ed9bcbcc2
 Integers:
   20 replaced with (0x90b+785-0xc04)
   3600 replaced with (0x1136+6437-0x1c4b)
 Print strings:
   “vars are” replaced with
      x76x61x72x73x20x61x72x65x3a
   Space replaced with x20
References
 [Collberg] C. Collberg, “The Obfuscation and
  Software Watermarking homepage”,
  http://www.cs.arizona.edu/collberg/Research/
  Obfuscation/index.html
 [Stunnix JavaScript Obfuscator]
  www.stunnix.com
 [Shane Ng's GPL-licensed obfuscator]
  http://daven.se/usefulstuff/javascript-
  obfuscator.html
 [Free JavaScript Obfuscator]
  http://www.javascriptobfuscator.com/

More Related Content

PPTX
Code obfuscation
PDF
Enjeux et évolutions de la sécurite informatique
PPT
network security
PPTX
Application security models
PPTX
Offensive Security basics part 1
PPT
Secure Socket Layer
PPT
Information security
PDF
Cryptographie
Code obfuscation
Enjeux et évolutions de la sécurite informatique
network security
Application security models
Offensive Security basics part 1
Secure Socket Layer
Information security
Cryptographie

What's hot (20)

PDF
Code obfuscation theory and practices
PDF
Comprendre la securite web
PPT
PDF
RSA NetWitness Log Decoder
PPT
Network security cryptography ppt
PDF
Sécurité informatique - Etat des menaces
PDF
Web Security
PDF
IoT Honeypots: State of the Art
PDF
OWASP Secure Coding Practices - Quick Reference Guide
PDF
SE18_Lec 11_ Software Code of Ethics
PDF
Public key Infrastructure (PKI)
PPTX
ISA/IEC 62443: Intro and How To
PPTX
kerberos
PPTX
CYBER SECURITY
PPTX
Substitution techniques
PDF
Sécurité des Applications WEB -LEVEL1
PPTX
Cryptography.ppt
PPTX
Protection in general purpose operating system
PPT
SSL & TLS Architecture short
PPTX
Code obfuscation theory and practices
Comprendre la securite web
RSA NetWitness Log Decoder
Network security cryptography ppt
Sécurité informatique - Etat des menaces
Web Security
IoT Honeypots: State of the Art
OWASP Secure Coding Practices - Quick Reference Guide
SE18_Lec 11_ Software Code of Ethics
Public key Infrastructure (PKI)
ISA/IEC 62443: Intro and How To
kerberos
CYBER SECURITY
Substitution techniques
Sécurité des Applications WEB -LEVEL1
Cryptography.ppt
Protection in general purpose operating system
SSL & TLS Architecture short
Ad

Similar to Code obfuscation (20)

PDF
Documenting Bugs in Doxygen
PPTX
The operation principles of PVS-Studio static code analyzer
PDF
05 -working_with_the_preproce
PDF
100 bugs in Open Source C/C++ projects
PDF
An Embedded Error Recovery and Debugging Mechanism for Scripting Language Ext...
PDF
Brief analysis of Media Portal 2 bugs
PDF
Analyzing the Blender project with PVS-Studio
PDF
Checking the Source Code of FlashDevelop with PVS-Studio
PPTX
Advanced Malware Analysis Training Session 2 - Botnet Analysis Part 1
PDF
How to write clean & testable code without losing your mind
PPT
AntiRE en Masse
PDF
Android RenderScript on LLVM
PPTX
PVS-Studio. Static code analyzer. Windows/Linux, C/C++/C#. 2017
PDF
Consequences of using the Copy-Paste method in C++ programming and how to dea...
PDF
XConf 2022 - Code As Data: How data insights on legacy codebases can fill the...
PDF
Looking for Bugs in MonoDevelop
PDF
Binary code obfuscation through c++ template meta programming
PPTX
Grow and Shrink - Dynamically Extending the Ruby VM Stack
PDF
Code Difference Visualization by a Call Tree
PDF
MODERN MALWARE: OBFUSCATION AND EMULATION DEF CON CHINA 1.0 (2019)
Documenting Bugs in Doxygen
The operation principles of PVS-Studio static code analyzer
05 -working_with_the_preproce
100 bugs in Open Source C/C++ projects
An Embedded Error Recovery and Debugging Mechanism for Scripting Language Ext...
Brief analysis of Media Portal 2 bugs
Analyzing the Blender project with PVS-Studio
Checking the Source Code of FlashDevelop with PVS-Studio
Advanced Malware Analysis Training Session 2 - Botnet Analysis Part 1
How to write clean & testable code without losing your mind
AntiRE en Masse
Android RenderScript on LLVM
PVS-Studio. Static code analyzer. Windows/Linux, C/C++/C#. 2017
Consequences of using the Copy-Paste method in C++ programming and how to dea...
XConf 2022 - Code As Data: How data insights on legacy codebases can fill the...
Looking for Bugs in MonoDevelop
Binary code obfuscation through c++ template meta programming
Grow and Shrink - Dynamically Extending the Ruby VM Stack
Code Difference Visualization by a Call Tree
MODERN MALWARE: OBFUSCATION AND EMULATION DEF CON CHINA 1.0 (2019)
Ad

Recently uploaded (20)

PDF
Microbial disease of the cardiovascular and lymphatic systems
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PPTX
Pharma ospi slides which help in ospi learning
PPTX
Lesson notes of climatology university.
PDF
Computing-Curriculum for Schools in Ghana
PDF
Insiders guide to clinical Medicine.pdf
PDF
Classroom Observation Tools for Teachers
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PPTX
Cell Types and Its function , kingdom of life
PDF
Sports Quiz easy sports quiz sports quiz
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PPTX
Institutional Correction lecture only . . .
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
RMMM.pdf make it easy to upload and study
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
Microbial disease of the cardiovascular and lymphatic systems
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Pharma ospi slides which help in ospi learning
Lesson notes of climatology university.
Computing-Curriculum for Schools in Ghana
Insiders guide to clinical Medicine.pdf
Classroom Observation Tools for Teachers
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
O5-L3 Freight Transport Ops (International) V1.pdf
Cell Types and Its function , kingdom of life
Sports Quiz easy sports quiz sports quiz
Abdominal Access Techniques with Prof. Dr. R K Mishra
STATICS OF THE RIGID BODIES Hibbelers.pdf
human mycosis Human fungal infections are called human mycosis..pptx
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Institutional Correction lecture only . . .
O7-L3 Supply Chain Operations - ICLT Program
RMMM.pdf make it easy to upload and study
2.FourierTransform-ShortQuestionswithAnswers.pdf

Code obfuscation

  • 1. Code Obfuscation Tool for Software Protection
  • 2. Outline  Why Code Obfuscation  Features of a code obfuscator  Potency  Resilience  Cost  Classification of Obfuscating Transformations
  • 3. Why use Code Obfuscation Techniques  Mainly to defend against Software Reverse Engineering  We can only make it more difficult for reverse engineers  Available obfuscating tools work in the same way as compiler optimizers  Reduce required space and time for compilation
  • 4.  The level of security that an Obfuscator adds depends on:  The transformations used  The power of available deobfuscators  The amount of resources available to deobfuscators
  • 5. Main features of a Code Obfuscator  Potency: is the level up to which a human reader would be confused by the new code  Resilience: is how well the obfuscated code resists attacks by deobfuscation tools  Cost: is how much load is added to the application
  • 6. Code Obfuscation  Reverse P1 Reverse Engineer engineering P1, P2, .., Pn exatracts piece of Pn program  Obfuscation makes reverse engineering difficult Obfuscation Reverse Engineering fails P1, P2, .., Pn Q1, Q2, .., Qm Transformations
  • 8. Obfuscation methods  Mainly based on target information that we want to modify/obfuscate
  • 9. Obfuscation Methods  Lexical transformations  Modify variable names  Control transformations  Change program flow while preserving semantics  Data transformations  Modify data structures  Anti-disassembly  Anti-debugging
  • 10. Kinds of obfuscation for each target information
  • 11. Available JavaScript Obfuscators  Most available commercial JavaScript obfuscators work by applying Lexical transformations  Some obfuscators that were considered are:  Stunnix JavaScript Obfuscator  Shane Ng's GPL-licensed obfuscator  Free JavaScript Obfuscator
  • 12. Example:From Stunnix  Actual code:  Obfuscated code:  function foo( arg1)  function z001c775808(  { z3833986e2c) { var  var myVar1 = "some z0d8bd8ba25= string"; //first comment "x73x6fx6dx65x20x73x 74x72x69x6ex67"; var  var intVar = 24 * 3600; z0ed9bcbcc2= (0x90b+785- //second comment 0xc04)* (0x1136+6437-  /* here is 0x1c4b); document. write(  a long "x76x61x72x73x20x61  multi-line comment blah */ x72x65x3a"+ z0d8bd8ba25+ "x20"+  document. write( "vars z0ed9bcbcc2+ "x20"+ are:" + myVar1 + " " + z3833986e2c);}; intVar + " " + arg1) ;  };
  • 13. Step by step examination  The Stunnix obfuscator targets at obfuscating only the layout of the JavaScript code  As the obfuscator parses the code, it removes spaces, comments and new line feeds  While doing so, as it encounters user defined names, it replaces them with some random string  It replaces print strings with their hexadecimal values  It replaces integer values with complex equations
  • 14.  In the sample code that was obfuscated, the following can be observed  User defined variables:  foo replaced with z001c775808  arg1 replaced with z3833986e2c  myvar1 replaced with z0d8bd8ba25  intvar replaced with z0ed9bcbcc2  Integers:  20 replaced with (0x90b+785-0xc04)  3600 replaced with (0x1136+6437-0x1c4b)  Print strings:  “vars are” replaced with x76x61x72x73x20x61x72x65x3a  Space replaced with x20
  • 15. References  [Collberg] C. Collberg, “The Obfuscation and Software Watermarking homepage”, http://www.cs.arizona.edu/collberg/Research/ Obfuscation/index.html  [Stunnix JavaScript Obfuscator] www.stunnix.com  [Shane Ng's GPL-licensed obfuscator] http://daven.se/usefulstuff/javascript- obfuscator.html  [Free JavaScript Obfuscator] http://www.javascriptobfuscator.com/