SlideShare a Scribd company logo
Amit Malik
SecurityXploded Research Group
Researcher @ FireEye Labs
The Content, Demonstration, Source Code and Programs presented here is "AS
IS" without any warranty or conditions of any kind. Also the
views/ideas/knowledge expressed here are solely mine and have nothing to do
with the company or the organization in which i am currently working.
However in no circumstances neither me nor SecurityXploded is responsible
for any damage or loss caused due to use or misuse of the information
presented here.
(c) SecurityXploded Research Group 2
 Objective
 Challenge
 Theory
 Properties of Call and RET
 Analysis
 Detection
 Conclusion
(c) SecurityXploded Research Group 3
 In defensive side of security we can define problems in two steps
 Analysis
 Detection
 Analysis – Understanding of the subject
 Detection – The Solution
 Detection depends on Analysis
(c) SecurityXploded Research Group 4
 At the top level the behavior of the malicious code can be divided into two
parts:
 Application execution hijacking
 System interaction and manipulation
 Application execution hijacking means deviation from the normal
execution path.
 System interaction and manipulation means using the system for malicious
activities.
(c) SecurityXploded Research Group 5
 Classic examples:
 Exploits
 Under normal circumstances (yes normal ) in execution hijacking the
execution will be transferred temporarily or permanently to stack or heap.
 After that the malicious code will always interact with the system (eg: file
system, Network, Processes etc.)
 *Normal hooks with code/DLL injection also comes under execution
hijacking but they are more part of system interaction so in execution
hijacking I am explicitly talking about the exploits.
(c) SecurityXploded Research Group 6
 Classic Examples:
 Malware binaries
 In this case the binaries or the code compromise the state of the
system.
 The scope here is the entire system so few things are difficult
(e.g.: detection).
(c) SecurityXploded Research Group 7
 The fundamental questions:
 Why a specific event/activity is happening in the system?
 Who started the event/activity.
 These questions in-fact are one of most difficult problems and at a
ground level even bigger than the software security problem.
 A very thin solution is try to identify the origin of the event/activity.
 In our case our focus is on API calls so if the API calls are the medium to
interact with the system then we need to identify the origin of the API
calls.
 It means that the return address is one of the most important pointer of
the entire execution cycle.
(c) SecurityXploded Research Group 8
 CALL ins:
 Push the address of the next instruction on to the stack i.e
Return Address
 Jump on to the destination address
 RET ins:
 Take the address from the current value of ESP (Return
Address) and load it into the EIP.
 The important point here is that the CALL and RET may be in a
relation or may not be in a relation but the return address will
always be on the stack [per ESP] so at any point of time if we hit
above ins then we can get the return address from stack [per
ESP].
(c) SecurityXploded Research Group 9
 Fundamentally Tracing is an approach to track the execution of the code.
 Roughly we can divide tracing in three parts:
1. Instruction level tracing i.e every instruction logging
2. Function and API level tracing i.e function and API call logging
3. API level tracing i.e only API call logging
 #2 and #3 are of our point of interest.
 But how we can log this information?
 Hooking
 Breakpoints
 Hooking is a clean approach but we need at least 5 bytes at the target
location on the other hand breakpoint is silly approach but we just need 1
byte.
(c) SecurityXploded Research Group 10
 Configuration-1: API calls Tracing
 Configuration-2: Function and API call tracing
 Configuration-1 is suitable for both analysis and detection.
 Configuration-2 is good for analysis.
Configuration-2 is also very useful for the analysis of normal applications.
(c) SecurityXploded Research Group 11
 Application execution hijacking:
 Configuration-1: API calls from heap or stack, basically calls from a
non-image mapped memory region indicates the hijacking of the
execution.
 Configurations-2: Function and API call tracing can provide in-depth
look into the execution cycle and possible locations for execution
deviation.
(c) SecurityXploded Research Group 12
 System Interaction and Manipulation
 Configuration-1:Based on the API calls and their return addresses
following information can be easily identified:
▪ Unpacked/run time generated/injected code in memory
▪ Interesting code segments
 My tool Malpimp is based on the same philosophy.
(c) SecurityXploded Research Group 13
 Benign File:
(c) SecurityXploded Research Group 14
 Malicious Files:
(c) SecurityXploded Research Group 15
 Execution Hijacking:
 Relatively easy* in comparison to malware binaries.
 In reality we have only two chances to detect this behavior from an external tool or
app.
 Bypass of DEP
 Execution of shellcode
 As mentioned in the theory we need to identify the origin of the API calls and if the
API calls are from a non-Image mapped memory region then we have some serious
problems.
 Practically speaking it is possible to make an exploit that is nearly impossible to
detect using an external tool because we have only two chances to catch the
abnormal execution.
 The checks for rop detection, heap spray, etc. are basically assumptions they are
not organic detection mechanisms. It all depends on the API call.
(c) SecurityXploded Research Group 16
 System interaction and Manipulation:
 The stages of unpacking/run time generated code can be easily
identified.
 Unpacking alone can not be really a detection mechanism.
 Abnormal behavior can be identified:
▪ Unpacking stages
▪ Some other events like (code injection etc.)
(c) SecurityXploded Research Group 17
 Return address is the invaluable pointer of the execution cycle.
 With the right implementation we can greatly improve the tasks related to
analysis and detection.
Thank You!
(c) SecurityXploded Research Group 18

More Related Content

What's hot (20)

PPTX
Investigating Malware using Memory Forensics
Cysinfo Cyber Security Community
 
PPTX
Reversing and decrypting communications of apt malware
Cysinfo Cyber Security Community
 
PPTX
Basic malware analysis
securityxploded
 
PPTX
Automating malware analysis
Cysinfo Cyber Security Community
 
PPTX
Anatomy of Exploit Kits
securityxploded
 
PPTX
Defeating public exploit protections (EMET v5.2 and more)
securityxploded
 
PPTX
Ch0 1
TylerDerdun
 
PPTX
Advanced malwareanalysis training session2 botnet analysis part1
Cysinfo Cyber Security Community
 
PPTX
Advanced malware analysis training session11 part2 dissecting the heart beat ...
Cysinfo Cyber Security Community
 
PPTX
Advanced malware analysis training session1 detection and removal of malwares
Cysinfo Cyber Security Community
 
PPTX
Advanced malware analysis training session6 malware sandbox analysis
Cysinfo Cyber Security Community
 
PPTX
Watering Hole Attacks Case Study and Analysis_SecurityXploded_Meet_june14
securityxploded
 
PPTX
Reversing malware analysis training part10 exploit development basics
Cysinfo Cyber Security Community
 
PPTX
Advanced Malware Analysis Training Session 1 - Detection and Removal of Malwares
securityxploded
 
PPTX
Advanced Malware Analysis Training Session 7 - Malware Memory Forensics
securityxploded
 
PPTX
Watering hole attacks case study analysis
Cysinfo Cyber Security Community
 
PDF
Understanding CryptoLocker (Ransomware) with a Case Study
securityxploded
 
PPTX
Advanced Malware Analysis Training Session 3 - Botnet Analysis Part 2
securityxploded
 
PPTX
Dissecting BetaBot
securityxploded
 
Investigating Malware using Memory Forensics
Cysinfo Cyber Security Community
 
Reversing and decrypting communications of apt malware
Cysinfo Cyber Security Community
 
Basic malware analysis
securityxploded
 
Automating malware analysis
Cysinfo Cyber Security Community
 
Anatomy of Exploit Kits
securityxploded
 
Defeating public exploit protections (EMET v5.2 and more)
securityxploded
 
Advanced malwareanalysis training session2 botnet analysis part1
Cysinfo Cyber Security Community
 
Advanced malware analysis training session11 part2 dissecting the heart beat ...
Cysinfo Cyber Security Community
 
Advanced malware analysis training session1 detection and removal of malwares
Cysinfo Cyber Security Community
 
Advanced malware analysis training session6 malware sandbox analysis
Cysinfo Cyber Security Community
 
Watering Hole Attacks Case Study and Analysis_SecurityXploded_Meet_june14
securityxploded
 
Reversing malware analysis training part10 exploit development basics
Cysinfo Cyber Security Community
 
Advanced Malware Analysis Training Session 1 - Detection and Removal of Malwares
securityxploded
 
Advanced Malware Analysis Training Session 7 - Malware Memory Forensics
securityxploded
 
Watering hole attacks case study analysis
Cysinfo Cyber Security Community
 
Understanding CryptoLocker (Ransomware) with a Case Study
securityxploded
 
Advanced Malware Analysis Training Session 3 - Botnet Analysis Part 2
securityxploded
 
Dissecting BetaBot
securityxploded
 

Similar to Return Address – The Silver Bullet (20)

PPTX
MINI PROJECT s.pptx
arjunchithanoor
 
PDF
DEFCON 21: EDS: Exploitation Detection System WP
Amr Thabet
 
PPTX
The Hacking Games - Operation System Vulnerabilities Meetup 29112022
lior mazor
 
PDF
Symbolic Execution (introduction and hands-on)
Emilio Coppa
 
PDF
HackInBo2k16 - Threat Intelligence and Malware Analysis
Antonio Parata
 
PDF
Classification of Malware based on Data Mining Approach
ijsrd.com
 
PDF
SmartphoneHacking_Android_Exploitation
Malachi Jones
 
PPTX
Malware Most Wanted: Security Ecosystem
Cyphort
 
PPT
MIT-6-determina-vps.ppt
webhostingguy
 
PDF
Attackers May Depend On Social Engineering To Gain...
Tiffany Sandoval
 
PDF
Purple Team - Offensive and Defensive collaborative simulation
Adam Nurudini
 
PDF
01_Metasploit - The Elixir of Network Security
Harish Chaudhary
 
PDF
Finetuning GenAI For Hacking and Defending
Priyanka Aash
 
PDF
.NET MALWARE THREAT: INTERNALS AND REVERSING DEF CON USA 2019
Alexandre Borges
 
PDF
Stuxnet redux. malware attribution & lessons learned
Yury Chemerkin
 
PDF
Automated Interpretation and Integration of Security Tools Using Semantic Kno...
Chadni Islam
 
PDF
AI for Cybersecurity Innovation
Pete Burnap
 
PDF
MALWARE DETECTION USING MACHINE LEARNING ALGORITHMS AND REVERSE ENGINEERING O...
IJNSA Journal
 
PDF
MALWARE DETECTION USING MACHINE LEARNING ALGORITHMS AND REVERSE ENGINEERING O...
IJNSA Journal
 
MINI PROJECT s.pptx
arjunchithanoor
 
DEFCON 21: EDS: Exploitation Detection System WP
Amr Thabet
 
The Hacking Games - Operation System Vulnerabilities Meetup 29112022
lior mazor
 
Symbolic Execution (introduction and hands-on)
Emilio Coppa
 
HackInBo2k16 - Threat Intelligence and Malware Analysis
Antonio Parata
 
Classification of Malware based on Data Mining Approach
ijsrd.com
 
SmartphoneHacking_Android_Exploitation
Malachi Jones
 
Malware Most Wanted: Security Ecosystem
Cyphort
 
MIT-6-determina-vps.ppt
webhostingguy
 
Attackers May Depend On Social Engineering To Gain...
Tiffany Sandoval
 
Purple Team - Offensive and Defensive collaborative simulation
Adam Nurudini
 
01_Metasploit - The Elixir of Network Security
Harish Chaudhary
 
Finetuning GenAI For Hacking and Defending
Priyanka Aash
 
.NET MALWARE THREAT: INTERNALS AND REVERSING DEF CON USA 2019
Alexandre Borges
 
Stuxnet redux. malware attribution & lessons learned
Yury Chemerkin
 
Automated Interpretation and Integration of Security Tools Using Semantic Kno...
Chadni Islam
 
AI for Cybersecurity Innovation
Pete Burnap
 
MALWARE DETECTION USING MACHINE LEARNING ALGORITHMS AND REVERSE ENGINEERING O...
IJNSA Journal
 
MALWARE DETECTION USING MACHINE LEARNING ALGORITHMS AND REVERSE ENGINEERING O...
IJNSA Journal
 
Ad

More from securityxploded (18)

PPTX
Fingerprinting healthcare institutions
securityxploded
 
PDF
Hollow Process Injection - Reversing and Investigating Malware Evasive Tactics
securityxploded
 
PDF
Buffer Overflow Attacks
securityxploded
 
PPTX
Malicious Client Detection Using Machine Learning
securityxploded
 
PDF
Linux Malware Analysis using Limon Sandbox
securityxploded
 
PPT
Introduction to SMPC
securityxploded
 
PPTX
Breaking into hospitals
securityxploded
 
PPTX
Bluetooth [in]security
securityxploded
 
PPTX
Automating Malware Analysis
securityxploded
 
PPTX
DLL Preloading Attack
securityxploded
 
PPTX
Partial Homomorphic Encryption
securityxploded
 
PPTX
Malicious Url Detection Using Machine Learning
securityxploded
 
PPTX
MalwareNet Project
securityxploded
 
PPTX
Advanced Malware Analysis Training Session 11 - (Part 2) Dissecting the Heart...
securityxploded
 
PPTX
Advanced Malware Analysis Training Session 8 - Introduction to Android
securityxploded
 
PPTX
Advanced Malware Analysis Training Session 6 - Malware Sandbox Analysis
securityxploded
 
PPTX
Advanced Malware Analysis Training Session 5 - Reversing Automation
securityxploded
 
PPTX
Advanced Malware Analysis Training Session 4 - Anti-Analysis Techniques
securityxploded
 
Fingerprinting healthcare institutions
securityxploded
 
Hollow Process Injection - Reversing and Investigating Malware Evasive Tactics
securityxploded
 
Buffer Overflow Attacks
securityxploded
 
Malicious Client Detection Using Machine Learning
securityxploded
 
Linux Malware Analysis using Limon Sandbox
securityxploded
 
Introduction to SMPC
securityxploded
 
Breaking into hospitals
securityxploded
 
Bluetooth [in]security
securityxploded
 
Automating Malware Analysis
securityxploded
 
DLL Preloading Attack
securityxploded
 
Partial Homomorphic Encryption
securityxploded
 
Malicious Url Detection Using Machine Learning
securityxploded
 
MalwareNet Project
securityxploded
 
Advanced Malware Analysis Training Session 11 - (Part 2) Dissecting the Heart...
securityxploded
 
Advanced Malware Analysis Training Session 8 - Introduction to Android
securityxploded
 
Advanced Malware Analysis Training Session 6 - Malware Sandbox Analysis
securityxploded
 
Advanced Malware Analysis Training Session 5 - Reversing Automation
securityxploded
 
Advanced Malware Analysis Training Session 4 - Anti-Analysis Techniques
securityxploded
 
Ad

Recently uploaded (20)

PDF
How ETL Control Logic Keeps Your Pipelines Safe and Reliable.pdf
Stryv Solutions Pvt. Ltd.
 
PDF
Presentation about Hardware and Software in Computer
snehamodhawadiya
 
PPTX
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
PDF
Generative AI vs Predictive AI-The Ultimate Comparison Guide
Lily Clark
 
PDF
The Future of Artificial Intelligence (AI)
Mukul
 
PPTX
AI Code Generation Risks (Ramkumar Dilli, CIO, Myridius)
Priyanka Aash
 
PPTX
Farrell_Programming Logic and Design slides_10e_ch02_PowerPoint.pptx
bashnahara11
 
PDF
Brief History of Internet - Early Days of Internet
sutharharshit158
 
PDF
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
PDF
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
PDF
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
PDF
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
PDF
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
PPTX
AVL ( audio, visuals or led ), technology.
Rajeshwri Panchal
 
PDF
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
PDF
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
PPTX
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
PDF
RAT Builders - How to Catch Them All [DeepSec 2024]
malmoeb
 
PDF
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
PDF
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
How ETL Control Logic Keeps Your Pipelines Safe and Reliable.pdf
Stryv Solutions Pvt. Ltd.
 
Presentation about Hardware and Software in Computer
snehamodhawadiya
 
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
Generative AI vs Predictive AI-The Ultimate Comparison Guide
Lily Clark
 
The Future of Artificial Intelligence (AI)
Mukul
 
AI Code Generation Risks (Ramkumar Dilli, CIO, Myridius)
Priyanka Aash
 
Farrell_Programming Logic and Design slides_10e_ch02_PowerPoint.pptx
bashnahara11
 
Brief History of Internet - Early Days of Internet
sutharharshit158
 
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
AVL ( audio, visuals or led ), technology.
Rajeshwri Panchal
 
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
RAT Builders - How to Catch Them All [DeepSec 2024]
malmoeb
 
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 

Return Address – The Silver Bullet

  • 1. Amit Malik SecurityXploded Research Group Researcher @ FireEye Labs
  • 2. The Content, Demonstration, Source Code and Programs presented here is "AS IS" without any warranty or conditions of any kind. Also the views/ideas/knowledge expressed here are solely mine and have nothing to do with the company or the organization in which i am currently working. However in no circumstances neither me nor SecurityXploded is responsible for any damage or loss caused due to use or misuse of the information presented here. (c) SecurityXploded Research Group 2
  • 3.  Objective  Challenge  Theory  Properties of Call and RET  Analysis  Detection  Conclusion (c) SecurityXploded Research Group 3
  • 4.  In defensive side of security we can define problems in two steps  Analysis  Detection  Analysis – Understanding of the subject  Detection – The Solution  Detection depends on Analysis (c) SecurityXploded Research Group 4
  • 5.  At the top level the behavior of the malicious code can be divided into two parts:  Application execution hijacking  System interaction and manipulation  Application execution hijacking means deviation from the normal execution path.  System interaction and manipulation means using the system for malicious activities. (c) SecurityXploded Research Group 5
  • 6.  Classic examples:  Exploits  Under normal circumstances (yes normal ) in execution hijacking the execution will be transferred temporarily or permanently to stack or heap.  After that the malicious code will always interact with the system (eg: file system, Network, Processes etc.)  *Normal hooks with code/DLL injection also comes under execution hijacking but they are more part of system interaction so in execution hijacking I am explicitly talking about the exploits. (c) SecurityXploded Research Group 6
  • 7.  Classic Examples:  Malware binaries  In this case the binaries or the code compromise the state of the system.  The scope here is the entire system so few things are difficult (e.g.: detection). (c) SecurityXploded Research Group 7
  • 8.  The fundamental questions:  Why a specific event/activity is happening in the system?  Who started the event/activity.  These questions in-fact are one of most difficult problems and at a ground level even bigger than the software security problem.  A very thin solution is try to identify the origin of the event/activity.  In our case our focus is on API calls so if the API calls are the medium to interact with the system then we need to identify the origin of the API calls.  It means that the return address is one of the most important pointer of the entire execution cycle. (c) SecurityXploded Research Group 8
  • 9.  CALL ins:  Push the address of the next instruction on to the stack i.e Return Address  Jump on to the destination address  RET ins:  Take the address from the current value of ESP (Return Address) and load it into the EIP.  The important point here is that the CALL and RET may be in a relation or may not be in a relation but the return address will always be on the stack [per ESP] so at any point of time if we hit above ins then we can get the return address from stack [per ESP]. (c) SecurityXploded Research Group 9
  • 10.  Fundamentally Tracing is an approach to track the execution of the code.  Roughly we can divide tracing in three parts: 1. Instruction level tracing i.e every instruction logging 2. Function and API level tracing i.e function and API call logging 3. API level tracing i.e only API call logging  #2 and #3 are of our point of interest.  But how we can log this information?  Hooking  Breakpoints  Hooking is a clean approach but we need at least 5 bytes at the target location on the other hand breakpoint is silly approach but we just need 1 byte. (c) SecurityXploded Research Group 10
  • 11.  Configuration-1: API calls Tracing  Configuration-2: Function and API call tracing  Configuration-1 is suitable for both analysis and detection.  Configuration-2 is good for analysis. Configuration-2 is also very useful for the analysis of normal applications. (c) SecurityXploded Research Group 11
  • 12.  Application execution hijacking:  Configuration-1: API calls from heap or stack, basically calls from a non-image mapped memory region indicates the hijacking of the execution.  Configurations-2: Function and API call tracing can provide in-depth look into the execution cycle and possible locations for execution deviation. (c) SecurityXploded Research Group 12
  • 13.  System Interaction and Manipulation  Configuration-1:Based on the API calls and their return addresses following information can be easily identified: ▪ Unpacked/run time generated/injected code in memory ▪ Interesting code segments  My tool Malpimp is based on the same philosophy. (c) SecurityXploded Research Group 13
  • 14.  Benign File: (c) SecurityXploded Research Group 14
  • 15.  Malicious Files: (c) SecurityXploded Research Group 15
  • 16.  Execution Hijacking:  Relatively easy* in comparison to malware binaries.  In reality we have only two chances to detect this behavior from an external tool or app.  Bypass of DEP  Execution of shellcode  As mentioned in the theory we need to identify the origin of the API calls and if the API calls are from a non-Image mapped memory region then we have some serious problems.  Practically speaking it is possible to make an exploit that is nearly impossible to detect using an external tool because we have only two chances to catch the abnormal execution.  The checks for rop detection, heap spray, etc. are basically assumptions they are not organic detection mechanisms. It all depends on the API call. (c) SecurityXploded Research Group 16
  • 17.  System interaction and Manipulation:  The stages of unpacking/run time generated code can be easily identified.  Unpacking alone can not be really a detection mechanism.  Abnormal behavior can be identified: ▪ Unpacking stages ▪ Some other events like (code injection etc.) (c) SecurityXploded Research Group 17
  • 18.  Return address is the invaluable pointer of the execution cycle.  With the right implementation we can greatly improve the tasks related to analysis and detection. Thank You! (c) SecurityXploded Research Group 18