SlideShare a Scribd company logo
1 of 52
by Anton Dorfman
PHDAYS 2014, Moscow
 Fan of & Fun with Assembly language
 Researcher
 Scientist
 Teach Reverse Engineering since 2001
 Candidate of technical science
 Lecturer at Samara State Technical University
and Samara State Aerospace University
 Intro
 Simple
 Trace & Coverage
 Graph
 Program Slicing
 All Together
 Iterative process
 Understand small piece of code – make
abstraction in mind
 Understand all pieces of code in procedure –
unite all abstractions – make abstraction
about function
 And etc
 Good visualization important
 Many routine tasks
 Code localization
 Data flow dependencies
 Code flow dependencies
 Local variables checking
 Input output procedures parameters checking
 Variables range checking
 Labels naming
 Function naming
 Function prototyping
 Biggest science school - Professor Thomas W.
Reps - University of Wisconsin-Madison -
http://pages.cs.wisc.edu/~reps/
 In Russia – Institute for System Programming
Russian Academy of Science -
http://www.ispras.ru
 Dynamic Binary Instrumentation (DBI)
 Intermediate representation (IR)
 System emulators
 Function
 Variable
 Label
 Also called Execution Trace
 Trace of program execution
 Simpe case - just a list of addresses that
instruction pointer takes on single run
 Firstly used as a measure to describe the
degree to which the source code of a
program is tested by a particular test suite.
 List of instructions that executed during
single run
 List of unique addresses from program trace
 Difference between code coverage can help to
locate code that do some functionality
 Common code coverage – common
functionality
 More runs – more diff between code coverage
– precise code localization
 The collection of all memory accesses
performed by an application in single run
 Include both writes and reads
 Include Code Trace
 Include all registers values and memory
values at every execution point
 May be absolute – save all values
 Relative – just save values that changed at
this execution point
 Directed graph that shows control
dependencies between blocks of commands
 Each node represents basic block
 Basic block – piece of code ends with jump,
starts with jump target without any jump or
jump target inside block
 Two special blocks – entry block and exit
block
 Directed graph that represents calling
relationships between subroutines in a computer
program
 Each node represents procedure
 Each edge (a, b) indicates that procedure a calls
procedure b
 Cycle in the graph indicates recursive procedure
calls
 Static call graph represents every possible run of
the program
 Dynamic call graph is a record of an execution of
the program
 Directed graph that represents data
dependencies between a number of
operations
 Each node represents operation
 Each edge represents variable
 Ottenstein & Ottenstein – PDG, 1984
 Actually – Procedure dependence graph because
introduced for programs with one procedure
 Each node represents a statement
 Two types of edges
 Control Dependence – between a predicate and
the statements it controls
 Data Dependence – between statements
modifying a variable and those that may
reference it
 Special “Entry” node is connected to all nodes
that are not control dependant
 Horowitz, Reps & Binkly – SDG, 1990
 PDG included for procedures
 New nodes: Call Site, Procedure Entry, Actual-in-
argument, Actual-out-argument, Formal-in-
parameter, Formal-out-parameter
 3 new edge types
 Call Edge – connect “call site” and “procedure
entry”
 Parameter-In Edge – connect “Actual-in” with
“Formal-in”
 Parameter-Out-Edge – connect “Actual-out” with
“Formal-out”
 Large programs must be decomposed for
understanding and manipulation.
 However, it should be into procedures and
abstract data types.
 Program Slicing is decomposition based on
data flow and control flow analysis.
 A study showed, experienced programmers
mentally slicing while debugging.
 “The mental abstraction people make when
they are debugging a program” [Weiser]
 All the statements of a program that may
affect the values of some variables in a set V
at some point of interest i.
 A slicing criterion of a program P is a tuple (i,
V), where i is a statement in P and V is a
subset of variables in P.
 Slicing Criterion:
C = (i , V)
 Direction of slicing
◦ Backward
◦ Forward
 Slicing techniques
◦ Static
◦ Dynamic
◦ Conditioned
 Levels of slices
◦ Intraprocedural slicing
◦ Interprocedural slicing
 Original Slicing Method
 Backward slice of a program with respect to a
program point i and set of program variables V
consists of all statements and predicates in the
program that may affect the value of variables in
V at I
 Answer the question “what program components
might effect a selected computation?”
 Preserve the meaning of the variable (s) in the
slicing criterion for all possible inputs to the
program
 Slice criterion <12,i>
◦ 1 main( )
◦ 2 {
◦ 3 int i, sum;
◦ 4 sum = 0;
◦ 5 i = 1;
◦ 6 while(i <= 10)
◦ 7 {
◦ 8 Sum = sum + 1;
◦ 9 ++ i;
◦ 10 }
◦ 11 Cout<< sum;
◦ 12 Cout<< i;
◦ 13 }
• Forward slice of a program with respect to a program
point i and set of program variables V consists of all
statements and predicates in the program that may
be affected by the value of variables in V at I
• Answers the question “what program components
might be effected by a selected computation?”
• Can show the code affected by a modification to a
single statement
 Slice criterion <3,sum>
◦ 1 main( )
◦ 2 {
◦ 3 int i, sum;
◦ 4 sum = 0;
◦ 5 i = 1;
◦ 6 while(i <= 10)
◦ 7 {
◦ 8 sum = sum + 1;
◦ 9 ++ i;
◦ 10 }
◦ 11 Cout<< sum;
◦ 12 Cout<< i;
◦ 13}
 Static Slicing does not make any assumptions
regarding the input.
 Slices derived from the source code for all
possible input values
 May lead to relatively big slices
 Contains all statements that may affect a
variable for every possible execution
 Current static methods can only compute
approximations
 Slice criterion (12,i)
◦ 1 main( )
◦ 2 {
◦ 3 int i, sum;
◦ 4 sum = 0;
◦ 5 i = 1;
◦ 6 while(i <= 10)
◦ 7 {
◦ 8 sum = sum + 1;
◦ 9 ++ i;
◦ 10 }
◦ 11 Cout<< sum;
◦ 12 Cout<< i;
◦ 13 }
 First introduced by Korel and Laski
 Dynamic Slicing assumes a fixed input for a
program.
 Only the dependences that occur in a specific
execution of the program are taken into account
 Computed on a given input
 Dynamic slicing criterion is a triple (input,
occurrence of a statement, variable) – it specifies
the input, and distinguishes between different
occurrences of a statement in the execution
history
1. read (n)
2. for I := 1 to n do
3. a := 2
4. if c1==1 then
5. if c2==1 then
6. a := 4
7. else
8. a := 6
9. z := a
10. write (z)
• Assumptions
– Input n is 1
– C1, c2 both true
– Execution history is
11, 21, 31, 41, 51, 61, 91, 22,
101
– Slice criterion<1, 101,
z>
 Assumptions - Input ‘a’ is positive number
1. read(a)
2. if (a < 0)
3. a = -a
4. x = 1/a
 Computes slice within one procedure
 Consists basically of two steps:
 A single slice of the procedure containing the
slicing criterion is made.
 Procedure calls from within this procedure
are sliced using new criteria.
 Compute slice over an entire program
 Two ways for crossing procedure boundary
 Up – going from sliced procedure into
calling procedure
 Down – going from sliced procedure into
called procedure
 Must Be Context Sensitive
 Chopping
 Value Set Analysis
 CodeSurfer
◦ Commercial product by GammaTech Inc.
◦ GUI Based
◦ Scripting language-Tk
 Unravel
◦ Static program slicer developed at NIST
◦ Slices ANSI C programs
◦ Limitations are in the treatment of Unions, Forks
and pointers to functions
 Slicing of Register on Code Coverage
 Graph based view of file reading and moves
between memory blocks
 dorfmananton@gmail.com

More Related Content

What's hot

Verilog Lecture3 hust 2014
Verilog Lecture3 hust 2014Verilog Lecture3 hust 2014
Verilog Lecture3 hust 2014Béo Tú
 
Verilog Lecture2 thhts
Verilog Lecture2 thhtsVerilog Lecture2 thhts
Verilog Lecture2 thhtsBéo Tú
 
TMPA-2017: Evolutionary Algorithms in Test Generation for digital systems
TMPA-2017: Evolutionary Algorithms in Test Generation for digital systemsTMPA-2017: Evolutionary Algorithms in Test Generation for digital systems
TMPA-2017: Evolutionary Algorithms in Test Generation for digital systemsIosif Itkin
 
VLSI Anna University Practical Examination
VLSI Anna University Practical ExaminationVLSI Anna University Practical Examination
VLSI Anna University Practical ExaminationGouthaman V
 
Matlab m files and scripts
Matlab m files and scriptsMatlab m files and scripts
Matlab m files and scriptsAmeen San
 
Day2 Verilog HDL Basic
Day2 Verilog HDL BasicDay2 Verilog HDL Basic
Day2 Verilog HDL BasicRon Liu
 
VLSI Lab manual PDF
VLSI Lab manual PDFVLSI Lab manual PDF
VLSI Lab manual PDFUR11EC098
 
The Use of Static Code Analysis When Teaching or Developing Open-Source Software
The Use of Static Code Analysis When Teaching or Developing Open-Source SoftwareThe Use of Static Code Analysis When Teaching or Developing Open-Source Software
The Use of Static Code Analysis When Teaching or Developing Open-Source SoftwareAndrey Karpov
 
Delays in verilog
Delays in verilogDelays in verilog
Delays in verilogJITU MISTRY
 
Matlab Programming Tips Part 1
Matlab Programming Tips Part 1Matlab Programming Tips Part 1
Matlab Programming Tips Part 1Shameer Ahmed Koya
 
Address/Thread/Memory Sanitizer
Address/Thread/Memory SanitizerAddress/Thread/Memory Sanitizer
Address/Thread/Memory SanitizerPlatonov Sergey
 
TMPA-2017: Static Checking of Array Objects in JavaScript
TMPA-2017: Static Checking of Array Objects in JavaScriptTMPA-2017: Static Checking of Array Objects in JavaScript
TMPA-2017: Static Checking of Array Objects in JavaScriptIosif Itkin
 

What's hot (20)

Verilog Lecture3 hust 2014
Verilog Lecture3 hust 2014Verilog Lecture3 hust 2014
Verilog Lecture3 hust 2014
 
Verilog Lecture2 thhts
Verilog Lecture2 thhtsVerilog Lecture2 thhts
Verilog Lecture2 thhts
 
Verilog tutorial
Verilog tutorialVerilog tutorial
Verilog tutorial
 
Vlsi lab2
Vlsi lab2Vlsi lab2
Vlsi lab2
 
TMPA-2017: Evolutionary Algorithms in Test Generation for digital systems
TMPA-2017: Evolutionary Algorithms in Test Generation for digital systemsTMPA-2017: Evolutionary Algorithms in Test Generation for digital systems
TMPA-2017: Evolutionary Algorithms in Test Generation for digital systems
 
Ch7
Ch7Ch7
Ch7
 
VLSI Anna University Practical Examination
VLSI Anna University Practical ExaminationVLSI Anna University Practical Examination
VLSI Anna University Practical Examination
 
Matlab m files and scripts
Matlab m files and scriptsMatlab m files and scripts
Matlab m files and scripts
 
Day2 Verilog HDL Basic
Day2 Verilog HDL BasicDay2 Verilog HDL Basic
Day2 Verilog HDL Basic
 
VLSI Lab manual PDF
VLSI Lab manual PDFVLSI Lab manual PDF
VLSI Lab manual PDF
 
Java 8
Java 8Java 8
Java 8
 
Verilog tutorial
Verilog tutorialVerilog tutorial
Verilog tutorial
 
04 sequentialbasics 1
04 sequentialbasics 104 sequentialbasics 1
04 sequentialbasics 1
 
The Use of Static Code Analysis When Teaching or Developing Open-Source Software
The Use of Static Code Analysis When Teaching or Developing Open-Source SoftwareThe Use of Static Code Analysis When Teaching or Developing Open-Source Software
The Use of Static Code Analysis When Teaching or Developing Open-Source Software
 
Delays in verilog
Delays in verilogDelays in verilog
Delays in verilog
 
Verilog lab manual (ECAD and VLSI Lab)
Verilog lab manual (ECAD and VLSI Lab)Verilog lab manual (ECAD and VLSI Lab)
Verilog lab manual (ECAD and VLSI Lab)
 
Matlab Programming Tips Part 1
Matlab Programming Tips Part 1Matlab Programming Tips Part 1
Matlab Programming Tips Part 1
 
Address/Thread/Memory Sanitizer
Address/Thread/Memory SanitizerAddress/Thread/Memory Sanitizer
Address/Thread/Memory Sanitizer
 
MATLAB Scripts - Examples
MATLAB Scripts - ExamplesMATLAB Scripts - Examples
MATLAB Scripts - Examples
 
TMPA-2017: Static Checking of Array Objects in JavaScript
TMPA-2017: Static Checking of Array Objects in JavaScriptTMPA-2017: Static Checking of Array Objects in JavaScript
TMPA-2017: Static Checking of Array Objects in JavaScript
 

Similar to Reverse Engineering automation

Software Engineering
Software EngineeringSoftware Engineering
Software Engineeringpoonam.rwalia
 
Slicing of Object-Oriented Programs
Slicing of Object-Oriented ProgramsSlicing of Object-Oriented Programs
Slicing of Object-Oriented ProgramsPraveen Penumathsa
 
Principal Sources of Optimization in compiler design
Principal Sources of Optimization in compiler design Principal Sources of Optimization in compiler design
Principal Sources of Optimization in compiler design LogsAk
 
A Comparative Analysis of Slicing for Structured Programs
A Comparative Analysis of Slicing for Structured ProgramsA Comparative Analysis of Slicing for Structured Programs
A Comparative Analysis of Slicing for Structured ProgramsEditor IJCATR
 
Qat09 presentations dxw07u
Qat09 presentations dxw07uQat09 presentations dxw07u
Qat09 presentations dxw07uShubham Sharma
 
Compiler Construction | Lecture 10 | Data-Flow Analysis
Compiler Construction | Lecture 10 | Data-Flow AnalysisCompiler Construction | Lecture 10 | Data-Flow Analysis
Compiler Construction | Lecture 10 | Data-Flow AnalysisEelco Visser
 
Parasoft .TEST, Write better C# Code Using Data Flow Analysis
Parasoft .TEST, Write better C# Code Using  Data Flow Analysis Parasoft .TEST, Write better C# Code Using  Data Flow Analysis
Parasoft .TEST, Write better C# Code Using Data Flow Analysis Engineering Software Lab
 
7-White Box Testing.ppt
7-White Box Testing.ppt7-White Box Testing.ppt
7-White Box Testing.pptHirenderPal
 
Slicing of Object-Oriented Programs
Slicing of Object-Oriented ProgramsSlicing of Object-Oriented Programs
Slicing of Object-Oriented ProgramsPraveen Penumathsa
 
Problem-solving and design 1.pptx
Problem-solving and design 1.pptxProblem-solving and design 1.pptx
Problem-solving and design 1.pptxTadiwaMawere
 
How to calculte Cyclomatic Complexity through various methods
How to calculte Cyclomatic Complexity through various methodsHow to calculte Cyclomatic Complexity through various methods
How to calculte Cyclomatic Complexity through various methodsharsimratDeo
 
Cs 568 Spring 10 Lecture 5 Estimation
Cs 568 Spring 10  Lecture 5 EstimationCs 568 Spring 10  Lecture 5 Estimation
Cs 568 Spring 10 Lecture 5 EstimationLawrence Bernstein
 
1414_lecturueueueueuueueeueueueuusuee_7.ppt
1414_lecturueueueueuueueeueueueuusuee_7.ppt1414_lecturueueueueuueueeueueueuusuee_7.ppt
1414_lecturueueueueuueueeueueueuusuee_7.pptabdulbasetalselwi
 
source code metrics and other maintenance tools and techniques
source code metrics and other maintenance tools and techniquessource code metrics and other maintenance tools and techniques
source code metrics and other maintenance tools and techniquesSiva Priya
 

Similar to Reverse Engineering automation (20)

Software Engineering
Software EngineeringSoftware Engineering
Software Engineering
 
Software maintenance
Software maintenanceSoftware maintenance
Software maintenance
 
Rseminarp
RseminarpRseminarp
Rseminarp
 
Slicing of Object-Oriented Programs
Slicing of Object-Oriented ProgramsSlicing of Object-Oriented Programs
Slicing of Object-Oriented Programs
 
Principal Sources of Optimization in compiler design
Principal Sources of Optimization in compiler design Principal Sources of Optimization in compiler design
Principal Sources of Optimization in compiler design
 
A Comparative Analysis of Slicing for Structured Programs
A Comparative Analysis of Slicing for Structured ProgramsA Comparative Analysis of Slicing for Structured Programs
A Comparative Analysis of Slicing for Structured Programs
 
Qat09 presentations dxw07u
Qat09 presentations dxw07uQat09 presentations dxw07u
Qat09 presentations dxw07u
 
Compiler Construction | Lecture 10 | Data-Flow Analysis
Compiler Construction | Lecture 10 | Data-Flow AnalysisCompiler Construction | Lecture 10 | Data-Flow Analysis
Compiler Construction | Lecture 10 | Data-Flow Analysis
 
11 whiteboxtesting
11 whiteboxtesting11 whiteboxtesting
11 whiteboxtesting
 
Parasoft .TEST, Write better C# Code Using Data Flow Analysis
Parasoft .TEST, Write better C# Code Using  Data Flow Analysis Parasoft .TEST, Write better C# Code Using  Data Flow Analysis
Parasoft .TEST, Write better C# Code Using Data Flow Analysis
 
7-White Box Testing.ppt
7-White Box Testing.ppt7-White Box Testing.ppt
7-White Box Testing.ppt
 
Slicing of Object-Oriented Programs
Slicing of Object-Oriented ProgramsSlicing of Object-Oriented Programs
Slicing of Object-Oriented Programs
 
Problem-solving and design 1.pptx
Problem-solving and design 1.pptxProblem-solving and design 1.pptx
Problem-solving and design 1.pptx
 
How to calculte Cyclomatic Complexity through various methods
How to calculte Cyclomatic Complexity through various methodsHow to calculte Cyclomatic Complexity through various methods
How to calculte Cyclomatic Complexity through various methods
 
Oop lec 1
Oop lec 1Oop lec 1
Oop lec 1
 
Software metrics
Software metricsSoftware metrics
Software metrics
 
Cs 568 Spring 10 Lecture 5 Estimation
Cs 568 Spring 10  Lecture 5 EstimationCs 568 Spring 10  Lecture 5 Estimation
Cs 568 Spring 10 Lecture 5 Estimation
 
Vedic Calculator
Vedic CalculatorVedic Calculator
Vedic Calculator
 
1414_lecturueueueueuueueeueueueuusuee_7.ppt
1414_lecturueueueueuueueeueueueuusuee_7.ppt1414_lecturueueueueuueueeueueueuusuee_7.ppt
1414_lecturueueueueuueueeueueueuusuee_7.ppt
 
source code metrics and other maintenance tools and techniques
source code metrics and other maintenance tools and techniquessource code metrics and other maintenance tools and techniques
source code metrics and other maintenance tools and techniques
 

More from Positive Hack Days

Инструмент ChangelogBuilder для автоматической подготовки Release Notes
Инструмент ChangelogBuilder для автоматической подготовки Release NotesИнструмент ChangelogBuilder для автоматической подготовки Release Notes
Инструмент ChangelogBuilder для автоматической подготовки Release NotesPositive Hack Days
 
Как мы собираем проекты в выделенном окружении в Windows Docker
Как мы собираем проекты в выделенном окружении в Windows DockerКак мы собираем проекты в выделенном окружении в Windows Docker
Как мы собираем проекты в выделенном окружении в Windows DockerPositive Hack Days
 
Типовая сборка и деплой продуктов в Positive Technologies
Типовая сборка и деплой продуктов в Positive TechnologiesТиповая сборка и деплой продуктов в Positive Technologies
Типовая сборка и деплой продуктов в Positive TechnologiesPositive Hack Days
 
Аналитика в проектах: TFS + Qlik
Аналитика в проектах: TFS + QlikАналитика в проектах: TFS + Qlik
Аналитика в проектах: TFS + QlikPositive Hack Days
 
Использование анализатора кода SonarQube
Использование анализатора кода SonarQubeИспользование анализатора кода SonarQube
Использование анализатора кода SonarQubePositive Hack Days
 
Развитие сообщества Open DevOps Community
Развитие сообщества Open DevOps CommunityРазвитие сообщества Open DevOps Community
Развитие сообщества Open DevOps CommunityPositive Hack Days
 
Методика определения неиспользуемых ресурсов виртуальных машин и автоматизаци...
Методика определения неиспользуемых ресурсов виртуальных машин и автоматизаци...Методика определения неиспользуемых ресурсов виртуальных машин и автоматизаци...
Методика определения неиспользуемых ресурсов виртуальных машин и автоматизаци...Positive Hack Days
 
Автоматизация построения правил для Approof
Автоматизация построения правил для ApproofАвтоматизация построения правил для Approof
Автоматизация построения правил для ApproofPositive Hack Days
 
Мастер-класс «Трущобы Application Security»
Мастер-класс «Трущобы Application Security»Мастер-класс «Трущобы Application Security»
Мастер-класс «Трущобы Application Security»Positive Hack Days
 
Формальные методы защиты приложений
Формальные методы защиты приложенийФормальные методы защиты приложений
Формальные методы защиты приложенийPositive Hack Days
 
Эвристические методы защиты приложений
Эвристические методы защиты приложенийЭвристические методы защиты приложений
Эвристические методы защиты приложенийPositive Hack Days
 
Теоретические основы Application Security
Теоретические основы Application SecurityТеоретические основы Application Security
Теоретические основы Application SecurityPositive Hack Days
 
От экспериментального программирования к промышленному: путь длиной в 10 лет
От экспериментального программирования к промышленному: путь длиной в 10 летОт экспериментального программирования к промышленному: путь длиной в 10 лет
От экспериментального программирования к промышленному: путь длиной в 10 летPositive Hack Days
 
Уязвимое Android-приложение: N проверенных способов наступить на грабли
Уязвимое Android-приложение: N проверенных способов наступить на граблиУязвимое Android-приложение: N проверенных способов наступить на грабли
Уязвимое Android-приложение: N проверенных способов наступить на граблиPositive Hack Days
 
Требования по безопасности в архитектуре ПО
Требования по безопасности в архитектуре ПОТребования по безопасности в архитектуре ПО
Требования по безопасности в архитектуре ПОPositive Hack Days
 
Формальная верификация кода на языке Си
Формальная верификация кода на языке СиФормальная верификация кода на языке Си
Формальная верификация кода на языке СиPositive Hack Days
 
Механизмы предотвращения атак в ASP.NET Core
Механизмы предотвращения атак в ASP.NET CoreМеханизмы предотвращения атак в ASP.NET Core
Механизмы предотвращения атак в ASP.NET CorePositive Hack Days
 
SOC для КИИ: израильский опыт
SOC для КИИ: израильский опытSOC для КИИ: израильский опыт
SOC для КИИ: израильский опытPositive Hack Days
 
Honeywell Industrial Cyber Security Lab & Services Center
Honeywell Industrial Cyber Security Lab & Services CenterHoneywell Industrial Cyber Security Lab & Services Center
Honeywell Industrial Cyber Security Lab & Services CenterPositive Hack Days
 
Credential stuffing и брутфорс-атаки
Credential stuffing и брутфорс-атакиCredential stuffing и брутфорс-атаки
Credential stuffing и брутфорс-атакиPositive Hack Days
 

More from Positive Hack Days (20)

Инструмент ChangelogBuilder для автоматической подготовки Release Notes
Инструмент ChangelogBuilder для автоматической подготовки Release NotesИнструмент ChangelogBuilder для автоматической подготовки Release Notes
Инструмент ChangelogBuilder для автоматической подготовки Release Notes
 
Как мы собираем проекты в выделенном окружении в Windows Docker
Как мы собираем проекты в выделенном окружении в Windows DockerКак мы собираем проекты в выделенном окружении в Windows Docker
Как мы собираем проекты в выделенном окружении в Windows Docker
 
Типовая сборка и деплой продуктов в Positive Technologies
Типовая сборка и деплой продуктов в Positive TechnologiesТиповая сборка и деплой продуктов в Positive Technologies
Типовая сборка и деплой продуктов в Positive Technologies
 
Аналитика в проектах: TFS + Qlik
Аналитика в проектах: TFS + QlikАналитика в проектах: TFS + Qlik
Аналитика в проектах: TFS + Qlik
 
Использование анализатора кода SonarQube
Использование анализатора кода SonarQubeИспользование анализатора кода SonarQube
Использование анализатора кода SonarQube
 
Развитие сообщества Open DevOps Community
Развитие сообщества Open DevOps CommunityРазвитие сообщества Open DevOps Community
Развитие сообщества Open DevOps Community
 
Методика определения неиспользуемых ресурсов виртуальных машин и автоматизаци...
Методика определения неиспользуемых ресурсов виртуальных машин и автоматизаци...Методика определения неиспользуемых ресурсов виртуальных машин и автоматизаци...
Методика определения неиспользуемых ресурсов виртуальных машин и автоматизаци...
 
Автоматизация построения правил для Approof
Автоматизация построения правил для ApproofАвтоматизация построения правил для Approof
Автоматизация построения правил для Approof
 
Мастер-класс «Трущобы Application Security»
Мастер-класс «Трущобы Application Security»Мастер-класс «Трущобы Application Security»
Мастер-класс «Трущобы Application Security»
 
Формальные методы защиты приложений
Формальные методы защиты приложенийФормальные методы защиты приложений
Формальные методы защиты приложений
 
Эвристические методы защиты приложений
Эвристические методы защиты приложенийЭвристические методы защиты приложений
Эвристические методы защиты приложений
 
Теоретические основы Application Security
Теоретические основы Application SecurityТеоретические основы Application Security
Теоретические основы Application Security
 
От экспериментального программирования к промышленному: путь длиной в 10 лет
От экспериментального программирования к промышленному: путь длиной в 10 летОт экспериментального программирования к промышленному: путь длиной в 10 лет
От экспериментального программирования к промышленному: путь длиной в 10 лет
 
Уязвимое Android-приложение: N проверенных способов наступить на грабли
Уязвимое Android-приложение: N проверенных способов наступить на граблиУязвимое Android-приложение: N проверенных способов наступить на грабли
Уязвимое Android-приложение: N проверенных способов наступить на грабли
 
Требования по безопасности в архитектуре ПО
Требования по безопасности в архитектуре ПОТребования по безопасности в архитектуре ПО
Требования по безопасности в архитектуре ПО
 
Формальная верификация кода на языке Си
Формальная верификация кода на языке СиФормальная верификация кода на языке Си
Формальная верификация кода на языке Си
 
Механизмы предотвращения атак в ASP.NET Core
Механизмы предотвращения атак в ASP.NET CoreМеханизмы предотвращения атак в ASP.NET Core
Механизмы предотвращения атак в ASP.NET Core
 
SOC для КИИ: израильский опыт
SOC для КИИ: израильский опытSOC для КИИ: израильский опыт
SOC для КИИ: израильский опыт
 
Honeywell Industrial Cyber Security Lab & Services Center
Honeywell Industrial Cyber Security Lab & Services CenterHoneywell Industrial Cyber Security Lab & Services Center
Honeywell Industrial Cyber Security Lab & Services Center
 
Credential stuffing и брутфорс-атаки
Credential stuffing и брутфорс-атакиCredential stuffing и брутфорс-атаки
Credential stuffing и брутфорс-атаки
 

Recently uploaded

Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
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 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
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
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
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
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
 
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
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
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
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
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
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 

Recently uploaded (20)

Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
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 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
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
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
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
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
 
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
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
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
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
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!
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 

Reverse Engineering automation

  • 1. by Anton Dorfman PHDAYS 2014, Moscow
  • 2.  Fan of & Fun with Assembly language  Researcher  Scientist  Teach Reverse Engineering since 2001  Candidate of technical science  Lecturer at Samara State Technical University and Samara State Aerospace University
  • 3.  Intro  Simple  Trace & Coverage  Graph  Program Slicing  All Together
  • 4.
  • 5.  Iterative process  Understand small piece of code – make abstraction in mind  Understand all pieces of code in procedure – unite all abstractions – make abstraction about function  And etc  Good visualization important  Many routine tasks
  • 6.  Code localization  Data flow dependencies  Code flow dependencies  Local variables checking  Input output procedures parameters checking  Variables range checking  Labels naming  Function naming  Function prototyping
  • 7.  Biggest science school - Professor Thomas W. Reps - University of Wisconsin-Madison - http://pages.cs.wisc.edu/~reps/  In Russia – Institute for System Programming Russian Academy of Science - http://www.ispras.ru
  • 8.  Dynamic Binary Instrumentation (DBI)  Intermediate representation (IR)  System emulators
  • 9.
  • 11.
  • 12.  Also called Execution Trace  Trace of program execution  Simpe case - just a list of addresses that instruction pointer takes on single run
  • 13.
  • 14.  Firstly used as a measure to describe the degree to which the source code of a program is tested by a particular test suite.  List of instructions that executed during single run  List of unique addresses from program trace
  • 15.
  • 16.  Difference between code coverage can help to locate code that do some functionality  Common code coverage – common functionality  More runs – more diff between code coverage – precise code localization
  • 17.
  • 18.  The collection of all memory accesses performed by an application in single run  Include both writes and reads
  • 19.  Include Code Trace  Include all registers values and memory values at every execution point  May be absolute – save all values  Relative – just save values that changed at this execution point
  • 20.
  • 21.  Directed graph that shows control dependencies between blocks of commands  Each node represents basic block  Basic block – piece of code ends with jump, starts with jump target without any jump or jump target inside block  Two special blocks – entry block and exit block
  • 22.
  • 23.  Directed graph that represents calling relationships between subroutines in a computer program  Each node represents procedure  Each edge (a, b) indicates that procedure a calls procedure b  Cycle in the graph indicates recursive procedure calls  Static call graph represents every possible run of the program  Dynamic call graph is a record of an execution of the program
  • 24.
  • 25.  Directed graph that represents data dependencies between a number of operations  Each node represents operation  Each edge represents variable
  • 26.
  • 27.  Ottenstein & Ottenstein – PDG, 1984  Actually – Procedure dependence graph because introduced for programs with one procedure  Each node represents a statement  Two types of edges  Control Dependence – between a predicate and the statements it controls  Data Dependence – between statements modifying a variable and those that may reference it  Special “Entry” node is connected to all nodes that are not control dependant
  • 28.
  • 29.  Horowitz, Reps & Binkly – SDG, 1990  PDG included for procedures  New nodes: Call Site, Procedure Entry, Actual-in- argument, Actual-out-argument, Formal-in- parameter, Formal-out-parameter  3 new edge types  Call Edge – connect “call site” and “procedure entry”  Parameter-In Edge – connect “Actual-in” with “Formal-in”  Parameter-Out-Edge – connect “Actual-out” with “Formal-out”
  • 30.
  • 31.
  • 32.
  • 33.  Large programs must be decomposed for understanding and manipulation.  However, it should be into procedures and abstract data types.  Program Slicing is decomposition based on data flow and control flow analysis.  A study showed, experienced programmers mentally slicing while debugging.  “The mental abstraction people make when they are debugging a program” [Weiser]
  • 34.  All the statements of a program that may affect the values of some variables in a set V at some point of interest i.  A slicing criterion of a program P is a tuple (i, V), where i is a statement in P and V is a subset of variables in P.  Slicing Criterion: C = (i , V)
  • 35.
  • 36.  Direction of slicing ◦ Backward ◦ Forward  Slicing techniques ◦ Static ◦ Dynamic ◦ Conditioned  Levels of slices ◦ Intraprocedural slicing ◦ Interprocedural slicing
  • 37.  Original Slicing Method  Backward slice of a program with respect to a program point i and set of program variables V consists of all statements and predicates in the program that may affect the value of variables in V at I  Answer the question “what program components might effect a selected computation?”  Preserve the meaning of the variable (s) in the slicing criterion for all possible inputs to the program
  • 38.  Slice criterion <12,i> ◦ 1 main( ) ◦ 2 { ◦ 3 int i, sum; ◦ 4 sum = 0; ◦ 5 i = 1; ◦ 6 while(i <= 10) ◦ 7 { ◦ 8 Sum = sum + 1; ◦ 9 ++ i; ◦ 10 } ◦ 11 Cout<< sum; ◦ 12 Cout<< i; ◦ 13 }
  • 39. • Forward slice of a program with respect to a program point i and set of program variables V consists of all statements and predicates in the program that may be affected by the value of variables in V at I • Answers the question “what program components might be effected by a selected computation?” • Can show the code affected by a modification to a single statement
  • 40.  Slice criterion <3,sum> ◦ 1 main( ) ◦ 2 { ◦ 3 int i, sum; ◦ 4 sum = 0; ◦ 5 i = 1; ◦ 6 while(i <= 10) ◦ 7 { ◦ 8 sum = sum + 1; ◦ 9 ++ i; ◦ 10 } ◦ 11 Cout<< sum; ◦ 12 Cout<< i; ◦ 13}
  • 41.  Static Slicing does not make any assumptions regarding the input.  Slices derived from the source code for all possible input values  May lead to relatively big slices  Contains all statements that may affect a variable for every possible execution  Current static methods can only compute approximations
  • 42.  Slice criterion (12,i) ◦ 1 main( ) ◦ 2 { ◦ 3 int i, sum; ◦ 4 sum = 0; ◦ 5 i = 1; ◦ 6 while(i <= 10) ◦ 7 { ◦ 8 sum = sum + 1; ◦ 9 ++ i; ◦ 10 } ◦ 11 Cout<< sum; ◦ 12 Cout<< i; ◦ 13 }
  • 43.  First introduced by Korel and Laski  Dynamic Slicing assumes a fixed input for a program.  Only the dependences that occur in a specific execution of the program are taken into account  Computed on a given input  Dynamic slicing criterion is a triple (input, occurrence of a statement, variable) – it specifies the input, and distinguishes between different occurrences of a statement in the execution history
  • 44. 1. read (n) 2. for I := 1 to n do 3. a := 2 4. if c1==1 then 5. if c2==1 then 6. a := 4 7. else 8. a := 6 9. z := a 10. write (z) • Assumptions – Input n is 1 – C1, c2 both true – Execution history is 11, 21, 31, 41, 51, 61, 91, 22, 101 – Slice criterion<1, 101, z>
  • 45.  Assumptions - Input ‘a’ is positive number 1. read(a) 2. if (a < 0) 3. a = -a 4. x = 1/a
  • 46.  Computes slice within one procedure  Consists basically of two steps:  A single slice of the procedure containing the slicing criterion is made.  Procedure calls from within this procedure are sliced using new criteria.
  • 47.  Compute slice over an entire program  Two ways for crossing procedure boundary  Up – going from sliced procedure into calling procedure  Down – going from sliced procedure into called procedure  Must Be Context Sensitive
  • 48.  Chopping  Value Set Analysis
  • 49.  CodeSurfer ◦ Commercial product by GammaTech Inc. ◦ GUI Based ◦ Scripting language-Tk  Unravel ◦ Static program slicer developed at NIST ◦ Slices ANSI C programs ◦ Limitations are in the treatment of Unions, Forks and pointers to functions
  • 50.
  • 51.  Slicing of Register on Code Coverage  Graph based view of file reading and moves between memory blocks