SlideShare a Scribd company logo
Object Oriented Code RE with
HexRaysCodeXplorer
Eugene Rodionov
@vxradius
Alex Matrosov
@matrosov
Agenda
* Object Oriented Code Reversing Challenges
-- virtual methods
-- templates
* Reversing Object Oriented Malware
-- Flamer
-- Sednit
* HexRaysCodeXplorer in use
Modern C++ Malware for Targeted Attacks
Why reversing C++ code
is a hard problem?
Virtual Methods & Templates
Virtual Methods
class Cat {
private:
int _weight;
public:
Cat(int weight) : _weight(weight) {};
int eat(int food) {
return _weight += food;
};
};
int _tmain(int argc, _TCHAR* argv[])
{
Cat* cat = new Cat(130);
int newWeigth = cat->eat(20);
}
class Animal {
protected:
int _weight;
public:
Animal(int weight) : _weight(weight) {};
virtual int eat(int food) = 0;
};
class Cat : Animal {
public:
Cat(int weight) : Animal(weight) {};
virtual int eat(int food) {
return _weight += food;
};
};
int _tmain(int argc, _TCHAR* argv[])
{
Animal* cat = new Cat(130);
int newWeight = cat->eat(20);
}
vs
Virtual Methods
class Cat {
private:
int _weight;
public:
Cat(int weight) : _weight(weight) {};
int eat(int food) {
return _weight += food;
};
};
int _tmain(int argc, _TCHAR* argv[])
{
Cat* cat = new Cat(130);
int newWeigth = cat->eat(20);
}
class Animal {
protected:
int _weight;
public:
Animal(int weight) : _weight(weight) {};
virtual int eat(int food) = 0;
};
class Cat : Animal {
public:
Cat(int weight) : Animal(weight) {};
virtual int eat(int food) {
return _weight += food;
};
};
int _tmain(int argc, _TCHAR* argv[])
{
Animal* cat = new Cat(130);
int newWeight = cat->eat(20);
}
vs
Virtual Function Tables
Class A
vfPtr
attr_1
attr_2
A::vfTable
A::a1()
A::a2()
A::a3()
RTTI Object
Locator
signature
pTypeDescriptor
pClassDescriptor
meta
Virtual Function Tables
Class A
vfPtr
attr_1
attr_2
A::vfTable
A::a1()
A::a2()
A::a3()
RTTI Object
Locator
signature
pTypeDescriptor
pClassDescriptor
meta
Virtual Function Tables
* lead to indirect method calls
-- difficult to analyze statically
* initialized in constructors
-- need to track back object creation
C++ Templates
* extra code to analyze
-- another way to create polymorphic types
* problematic to recognize standard library
code (FLIRT)
-- playing with compiler optimization
options
std::vector<int> std::vector<char>
std::vector<std::string> std::vector<custom_type>
C++ Code Reconstruction Problems
* Object identification
-- type reconstruction
* Class layout reconstruction
-- Identify constructors/destructors
-- Identify class members
-- Local/global type reconstruction
-- Associate object with exact method calls
* RTTI reconstruction
-- vftable reconstruction
-- Associate vftable object with exact object
-- class hierarchy reconstruction
Reversing Object
Oriented Malware
Practical Approaches: REconstructing Flamer Framework
REconstructing Flamer Framework
Vector<Command Executor>
DB_Query ClanCmd
Vector<Task>
IDLER CmdExec
Vector<DelayedTasks>
Euphoria
Share
Supplier
Vector<Consumer>
Mobile
Consumer
Cmd
Consumer
MunchSniffer FileFinder
FileCollect Driller GetConfig
LSS
Sender
Frog Beetlejuice
Lua
Consumer
Media
Consumer
http://www.welivesecurity.com/2012/08/02/flamer-analysis-framework-reconstruction/
REconstructing Flamer Framework
Vector<Command Executor>
DB_Query ClanCmd
Vector<Task>
IDLER CmdExec
Vector<DelayedTasks>
Euphoria
Share
Supplier
Vector<Consumer>
Mobile
Consumer
Cmd
Consumer
MunchSniffer FileFinder
FileCollect Driller GetConfig
LSS
Sender
Frog Beetlejuice
Lua
Consumer
Media
Consumer
http://www.welivesecurity.com/2012/08/02/flamer-analysis-framework-reconstruction/
Identifying Used Types
* Smart pointers
* Strings
* Vectors to maintain objects
* Custom data types:
-- tasks
-- triggers
-- and etc.
Data Types Being Used: Smart pointers
struct SMART_PTR
{
void *pObject; // pointer to the object
int *RefNo; // reference counter
};
Data Types Being Used: Smart pointers
Data Types Being Used: Vectors
struct VECTOR
{
void *vTable; // pointer to the virtual table
int NumberOfItems; // self-explanatory
int MaxSize; // self-explanatory
void *vector; // pointer to buffer with elements
};
* Used for handling objects:
-- tasks
-- triggers
Data Types Being Used: Strings
struct USTRING_STRUCT
{
void *vTable; // pointer to the table
int RefNo; // reference counter
int Initialized;
wchar_t *UnicodeBuffer; // pointer to unicode string
char *AsciiBuffer; // pointer to ASCII string
int AsciiLength; // length of the ASCII string
int Reserved;
int Length; // Length of unicode string
int LengthMax; // Size of UnicodeBuffer
};
Approaching Flamer
* Identify Object Constructors
* Reconstruct Object
Attributes
* Reconstruct Object Methods
Type
reconstruction
Control Flow Graph
Reconstruction
Identifying Object Constructors
REconstructing Object’s Attributes
REconstructing Object’s Attributes
REconstructing Object’s Methods
REconstructing Object’s Methods
REconstructing Object’s Methods
Reversing Object
Oriented Malware
Practical Approaches: REconstructing XAgent Framework
XAgent Framework
Communication Channels
Vector<IAgentChannel>
AgentKernel
Local
Storage
Cryptor
Agent Modules
Vector<IAgentModule>
AgentKernel
Module
FileSystem
Channel
Controller
DNameNode
Module
Remote
KeyLogger
Process
Retranslator
Module
WinHttp
http://www.welivesecurity.com/2014/10/08/sednit-espionage-group-now-using-custom-exploit-kit/
Object Interconnection: IAgentModule
struct IAgentModule {
LPVOID receiveMessage;
LPVOID sendMessage;
LPVOID getModuleId;
LPVOID setModuleId;
LPVOID executeModule;
};
AgentKernel
Module
FileSystem
Module
Remote
Keylogger
Process
Retranslator
Module
IAgentModule
Exploring RTTI*
* recover type names
* reconstruct class hierarchy
* identify object virtual function tables
* IDA ClassInformer plugin
Exploring RTTI*
* recover type names
* reconstruct class hierarchy
* identify object virtual function tables
* IDA ClassInformer plugin
XAgent: LocalDataStorage
Local
DataStorage
Registry
reader/writer
File
reader/writer
XAgent: Cryptor
XAgent: Cryptor
encrypted message
salt
(4 bytes)
RC4key
plain text
XAgent: IReservedApi
XAgent: Identifying Used Types
* Strings: std::string
* Containers to maintain objects:
-- std::vector
-- std::list
XAgent: Identifying Used Types
* Strings: std::string
* Containers to maintain objects:
-- std::vector
-- std::list
HexRaysCodeXplorer
HexRaysCodeXplorer since 2013
* CodeXplorer V1.0 released
on REcon’2013
* First third-party plugin
for Hex-Rays Decompiler
* v1.0 supports IDA v6.4 and
Decompiler for x86 v1.8
HexRaysCodeXplorer Features
* Hex-Rays decompiler plugin x86/x64
* The plugin was designed to facilitate static analysis of:
-- object oriented code
-- position independent code
* The plugin allows to:
-- partially reconstruct object type
-- navigate through decompiled virtual methods
Hex-Rays Decompiler Plugin SDK
* At the heart of the decompiler lies ctree structure:
-- syntax tree structure
-- consists of citem_t objects
-- there are 9 maturity levels of the ctree structure
* Type citem_t is a base class for:
-- cexpr_t – expression type
-- cinsn_t – statement type
* Expressions have attached type information
* Statements include:
-- block, if, for, while, do, switch, return, goto, asm
* Hex-Rays provides iterators for traversing the citem_t objects within
ctree structure:
-- ctree_visitor_t, ctree_parentee_t
Hex-Rays Decompiler Plugin SDK
citem_t
cexpr_t cinsn_t
* Type citem_t is a base class for:
-- cexpr_t – expression type
-- cinsn_t – statement type
* Expressions have attached type information
* Statements include:
-- block, if, for, while, do, switch, return, goto, asm
* Hex-Rays provides iterators for traversing the citem_t objects within
ctree structure:
-- ctree_visitor_t, ctree_parentee_t
Hex-Rays Decompiler Plugin SDK
citem_t
cexpr_t cinsn_t
DEMO time :)
HexRaysCodeXplorer: Gapz Position Independent Code
HexRaysCodeXplorer: Virtual Methods
IDA’s ‘Local Types’ is used to represent
object type
HexRaysCodeXplorer: Virtual Methods
IDA’s ‘Local Types’ is used to represent
object type
HexRaysCodeXplorer: Virtual Methods
* Hex-Rays decompiler plugin is used to navigate through the
virtual methods
HexRaysCodeXplorer: Object Type REconstruction
* Hex-Rays’s ctree structure may be used to partially
reconstruct object type
* Input:
-- pointer to the object instance
-- object initialization routine entry point
* Output:
-- C structure-like object representation
HexRaysCodeXplorer: Object Type REconstruction
* citem_t objects:
-- memptr, idx, memref
-- call, ptr, asg
HexRaysCodeXplorer: Object Type REconstruction
* citem_t objects:
-- memptr, idx, memref
-- call, ptr, asg
HexRaysCodeXplorer: Object Type REconstruction
// reference of DWORD at offset 12 in buffer a1
*(DWORD *)(a1 + 12) = 0xEFCDAB89;
HexRaysCodeXplorer: v1.7 [NSEC Edition]
Automatic virtual table identification
+
Type reconstruction
HexRaysCodeXplorer: v1.7 [NSEC Edition]
* Automatic virtual table identification
HexRaysCodeXplorer: v1.7 [NSEC Edition]
* Automatic virtual table identification
HexRaysCodeXplorer: v1.7 [NSEC Edition]
* Automatic virtual table identification
* Support for IDA Pro x64
* Bugfixes
DEMO time :)
HexRaysCodeXplorer: Next plans
* Switch to IdaPython
Why python?
HexRaysCodeXplorer: Next plans
* Switch to IdaPython
* Further research & development:
-- find cross-references to
object attributes
-- handling nested structures
-- code similarity based on data
flow analysis
Thank you for your attention!
http://REhints.com
@Rehints
https://github.com/REhints/HexRaysCodeXplorer

More Related Content

What's hot

Python twisted
Python twistedPython twisted
Python twisted
Mahendra M
 
[2009 CodeEngn Conference 03] koheung - 윈도우 커널 악성코드에 대한 분석 및 방법
[2009 CodeEngn Conference 03] koheung - 윈도우 커널 악성코드에 대한 분석 및 방법[2009 CodeEngn Conference 03] koheung - 윈도우 커널 악성코드에 대한 분석 및 방법
[2009 CodeEngn Conference 03] koheung - 윈도우 커널 악성코드에 대한 분석 및 방법
GangSeok Lee
 
Where destructors meet threads
Where destructors meet threadsWhere destructors meet threads
Where destructors meet threads
Shuo Chen
 
Codetainer: a Docker-based browser code 'sandbox'
Codetainer: a Docker-based browser code 'sandbox'Codetainer: a Docker-based browser code 'sandbox'
Codetainer: a Docker-based browser code 'sandbox'
Jen Andre
 
POCO C++ Libraries Intro and Overview
POCO C++ Libraries Intro and OverviewPOCO C++ Libraries Intro and Overview
POCO C++ Libraries Intro and OverviewGünter Obiltschnig
 
Hibernate Import.Sql I18n
Hibernate Import.Sql I18nHibernate Import.Sql I18n
Hibernate Import.Sql I18nyifi2009
 
Wtf is happening_inside_my_android_phone_public
Wtf is happening_inside_my_android_phone_publicWtf is happening_inside_my_android_phone_public
Wtf is happening_inside_my_android_phone_publicJaime Blasco
 
Mem forensic
Mem forensicMem forensic
Mem forensic
Chong-Kuan Chen
 
Malware analysis using volatility
Malware analysis using volatilityMalware analysis using volatility
Malware analysis using volatilityYashashree Gund
 
An introduction to Rust: the modern programming language to develop safe and ...
An introduction to Rust: the modern programming language to develop safe and ...An introduction to Rust: the modern programming language to develop safe and ...
An introduction to Rust: the modern programming language to develop safe and ...
Claudio Capobianco
 
Java Symmetric
Java SymmetricJava Symmetric
Java Symmetricphanleson
 
The Art of Exploiting Unconventional Use-after-free Bugs in Android Kernel by...
The Art of Exploiting Unconventional Use-after-free Bugs in Android Kernel by...The Art of Exploiting Unconventional Use-after-free Bugs in Android Kernel by...
The Art of Exploiting Unconventional Use-after-free Bugs in Android Kernel by...
CODE BLUE
 
Return of c++
Return of c++Return of c++
Return of c++
Yongwei Wu
 
Meetup mini conférences AFUP Paris Deezer Janvier 2017
Meetup mini conférences AFUP Paris Deezer Janvier 2017Meetup mini conférences AFUP Paris Deezer Janvier 2017
Meetup mini conférences AFUP Paris Deezer Janvier 2017
Alexis Von Glasow
 
2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)
2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)
2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)
JiandSon
 
Csw2016 gong pwn_a_nexus_device_with_a_single_vulnerability
Csw2016 gong pwn_a_nexus_device_with_a_single_vulnerabilityCsw2016 gong pwn_a_nexus_device_with_a_single_vulnerability
Csw2016 gong pwn_a_nexus_device_with_a_single_vulnerability
CanSecWest
 
NodeJS: an Introduction
NodeJS: an IntroductionNodeJS: an Introduction
NodeJS: an Introduction
Roberto Casadei
 
Cryptography for Java Developers: Nakov jProfessionals (Jan 2019)
Cryptography for Java Developers: Nakov jProfessionals (Jan 2019)Cryptography for Java Developers: Nakov jProfessionals (Jan 2019)
Cryptography for Java Developers: Nakov jProfessionals (Jan 2019)
Svetlin Nakov
 
From Zero To Production (NixOS, Erlang) @ Erlang Factory SF 2016
From Zero To Production (NixOS, Erlang) @ Erlang Factory SF 2016From Zero To Production (NixOS, Erlang) @ Erlang Factory SF 2016
From Zero To Production (NixOS, Erlang) @ Erlang Factory SF 2016
Susan Potter
 

What's hot (20)

Python twisted
Python twistedPython twisted
Python twisted
 
Mach-O Internals
Mach-O InternalsMach-O Internals
Mach-O Internals
 
[2009 CodeEngn Conference 03] koheung - 윈도우 커널 악성코드에 대한 분석 및 방법
[2009 CodeEngn Conference 03] koheung - 윈도우 커널 악성코드에 대한 분석 및 방법[2009 CodeEngn Conference 03] koheung - 윈도우 커널 악성코드에 대한 분석 및 방법
[2009 CodeEngn Conference 03] koheung - 윈도우 커널 악성코드에 대한 분석 및 방법
 
Where destructors meet threads
Where destructors meet threadsWhere destructors meet threads
Where destructors meet threads
 
Codetainer: a Docker-based browser code 'sandbox'
Codetainer: a Docker-based browser code 'sandbox'Codetainer: a Docker-based browser code 'sandbox'
Codetainer: a Docker-based browser code 'sandbox'
 
POCO C++ Libraries Intro and Overview
POCO C++ Libraries Intro and OverviewPOCO C++ Libraries Intro and Overview
POCO C++ Libraries Intro and Overview
 
Hibernate Import.Sql I18n
Hibernate Import.Sql I18nHibernate Import.Sql I18n
Hibernate Import.Sql I18n
 
Wtf is happening_inside_my_android_phone_public
Wtf is happening_inside_my_android_phone_publicWtf is happening_inside_my_android_phone_public
Wtf is happening_inside_my_android_phone_public
 
Mem forensic
Mem forensicMem forensic
Mem forensic
 
Malware analysis using volatility
Malware analysis using volatilityMalware analysis using volatility
Malware analysis using volatility
 
An introduction to Rust: the modern programming language to develop safe and ...
An introduction to Rust: the modern programming language to develop safe and ...An introduction to Rust: the modern programming language to develop safe and ...
An introduction to Rust: the modern programming language to develop safe and ...
 
Java Symmetric
Java SymmetricJava Symmetric
Java Symmetric
 
The Art of Exploiting Unconventional Use-after-free Bugs in Android Kernel by...
The Art of Exploiting Unconventional Use-after-free Bugs in Android Kernel by...The Art of Exploiting Unconventional Use-after-free Bugs in Android Kernel by...
The Art of Exploiting Unconventional Use-after-free Bugs in Android Kernel by...
 
Return of c++
Return of c++Return of c++
Return of c++
 
Meetup mini conférences AFUP Paris Deezer Janvier 2017
Meetup mini conférences AFUP Paris Deezer Janvier 2017Meetup mini conférences AFUP Paris Deezer Janvier 2017
Meetup mini conférences AFUP Paris Deezer Janvier 2017
 
2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)
2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)
2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)
 
Csw2016 gong pwn_a_nexus_device_with_a_single_vulnerability
Csw2016 gong pwn_a_nexus_device_with_a_single_vulnerabilityCsw2016 gong pwn_a_nexus_device_with_a_single_vulnerability
Csw2016 gong pwn_a_nexus_device_with_a_single_vulnerability
 
NodeJS: an Introduction
NodeJS: an IntroductionNodeJS: an Introduction
NodeJS: an Introduction
 
Cryptography for Java Developers: Nakov jProfessionals (Jan 2019)
Cryptography for Java Developers: Nakov jProfessionals (Jan 2019)Cryptography for Java Developers: Nakov jProfessionals (Jan 2019)
Cryptography for Java Developers: Nakov jProfessionals (Jan 2019)
 
From Zero To Production (NixOS, Erlang) @ Erlang Factory SF 2016
From Zero To Production (NixOS, Erlang) @ Erlang Factory SF 2016From Zero To Production (NixOS, Erlang) @ Erlang Factory SF 2016
From Zero To Production (NixOS, Erlang) @ Erlang Factory SF 2016
 

Viewers also liked

Win32/Duqu: involution of Stuxnet
Win32/Duqu: involution of StuxnetWin32/Duqu: involution of Stuxnet
Win32/Duqu: involution of StuxnetAlex Matrosov
 
Festi botnet analysis and investigation
Festi botnet analysis and investigationFesti botnet analysis and investigation
Festi botnet analysis and investigation
Alex Matrosov
 
Defeating x64: The Evolution of the TDL Rootkit
Defeating x64: The Evolution of the TDL RootkitDefeating x64: The Evolution of the TDL Rootkit
Defeating x64: The Evolution of the TDL Rootkit
Alex Matrosov
 
Modern malware techniques for attacking RBS systems in Russia
Modern malware techniques for attacking RBS systems in RussiaModern malware techniques for attacking RBS systems in Russia
Modern malware techniques for attacking RBS systems in RussiaAlex Matrosov
 
Modern Bootkit Trends: Bypassing Kernel-Mode Signing Policy
Modern Bootkit Trends: Bypassing Kernel-Mode Signing PolicyModern Bootkit Trends: Bypassing Kernel-Mode Signing Policy
Modern Bootkit Trends: Bypassing Kernel-Mode Signing PolicyAlex Matrosov
 
Advanced Evasion Techniques by Win32/Gapz
Advanced Evasion Techniques by Win32/GapzAdvanced Evasion Techniques by Win32/Gapz
Advanced Evasion Techniques by Win32/GapzAlex Matrosov
 
Carberp Evolution and BlackHole: Investigation Beyond the Event Horizon
Carberp Evolution and BlackHole: Investigation Beyond the Event HorizonCarberp Evolution and BlackHole: Investigation Beyond the Event Horizon
Carberp Evolution and BlackHole: Investigation Beyond the Event Horizon
Alex Matrosov
 
BERserk: New RSA Signature Forgery Attack
BERserk: New RSA Signature Forgery AttackBERserk: New RSA Signature Forgery Attack
BERserk: New RSA Signature Forgery AttackAlex Matrosov
 
Smartcard vulnerabilities in modern banking malware
Smartcard vulnerabilities in modern banking malwareSmartcard vulnerabilities in modern banking malware
Smartcard vulnerabilities in modern banking malware
Alex Matrosov
 
インテルMEの秘密 - チップセットに隠されたコードと、それが一体何をするかを見出す方法 - by イゴール・スコチンスキー - Igor Skochinsky
インテルMEの秘密 - チップセットに隠されたコードと、それが一体何をするかを見出す方法 - by イゴール・スコチンスキー - Igor SkochinskyインテルMEの秘密 - チップセットに隠されたコードと、それが一体何をするかを見出す方法 - by イゴール・スコチンスキー - Igor Skochinsky
インテルMEの秘密 - チップセットに隠されたコードと、それが一体何をするかを見出す方法 - by イゴール・スコチンスキー - Igor Skochinsky
CODE BLUE
 
Defeating x64: Modern Trends of Kernel-Mode Rootkits
Defeating x64: Modern Trends of Kernel-Mode RootkitsDefeating x64: Modern Trends of Kernel-Mode Rootkits
Defeating x64: Modern Trends of Kernel-Mode Rootkits
Alex Matrosov
 
Bootkits: past, present & future
Bootkits: past, present & futureBootkits: past, present & future
Bootkits: past, present & future
Alex Matrosov
 
Win32/Flamer: Reverse Engineering and Framework Reconstruction
Win32/Flamer: Reverse Engineering and Framework ReconstructionWin32/Flamer: Reverse Engineering and Framework Reconstruction
Win32/Flamer: Reverse Engineering and Framework Reconstruction
Alex Matrosov
 
Cybercrime in Russia: Trends and Issues
Cybercrime in Russia: Trends and IssuesCybercrime in Russia: Trends and Issues
Cybercrime in Russia: Trends and Issues
Alex Matrosov
 
BIOS and Secure Boot Attacks Uncovered
BIOS and Secure Boot Attacks UncoveredBIOS and Secure Boot Attacks Uncovered
BIOS and Secure Boot Attacks UncoveredAlex Matrosov
 
AMSI: How Windows 10 Plans to Stop Script-Based Attacks and How Well It Does It
AMSI: How Windows 10 Plans to Stop Script-Based Attacks and How Well It Does ItAMSI: How Windows 10 Plans to Stop Script-Based Attacks and How Well It Does It
AMSI: How Windows 10 Plans to Stop Script-Based Attacks and How Well It Does It
Nikhil Mittal
 
Visiting the Bear Den
Visiting the Bear DenVisiting the Bear Den
Visiting the Bear Den
ESET
 
CSW2017 Yuhao song+Huimingliu cyber_wmd_vulnerable_IoT
CSW2017 Yuhao song+Huimingliu cyber_wmd_vulnerable_IoTCSW2017 Yuhao song+Huimingliu cyber_wmd_vulnerable_IoT
CSW2017 Yuhao song+Huimingliu cyber_wmd_vulnerable_IoT
CanSecWest
 
Моделирование угроз для BIOS и UEFI
Моделирование угроз для BIOS и UEFIМоделирование угроз для BIOS и UEFI
Моделирование угроз для BIOS и UEFI
Aleksey Lukatskiy
 

Viewers also liked (20)

Win32/Duqu: involution of Stuxnet
Win32/Duqu: involution of StuxnetWin32/Duqu: involution of Stuxnet
Win32/Duqu: involution of Stuxnet
 
Festi botnet analysis and investigation
Festi botnet analysis and investigationFesti botnet analysis and investigation
Festi botnet analysis and investigation
 
Defeating x64: The Evolution of the TDL Rootkit
Defeating x64: The Evolution of the TDL RootkitDefeating x64: The Evolution of the TDL Rootkit
Defeating x64: The Evolution of the TDL Rootkit
 
Modern malware techniques for attacking RBS systems in Russia
Modern malware techniques for attacking RBS systems in RussiaModern malware techniques for attacking RBS systems in Russia
Modern malware techniques for attacking RBS systems in Russia
 
Modern Bootkit Trends: Bypassing Kernel-Mode Signing Policy
Modern Bootkit Trends: Bypassing Kernel-Mode Signing PolicyModern Bootkit Trends: Bypassing Kernel-Mode Signing Policy
Modern Bootkit Trends: Bypassing Kernel-Mode Signing Policy
 
Advanced Evasion Techniques by Win32/Gapz
Advanced Evasion Techniques by Win32/GapzAdvanced Evasion Techniques by Win32/Gapz
Advanced Evasion Techniques by Win32/Gapz
 
Carberp Evolution and BlackHole: Investigation Beyond the Event Horizon
Carberp Evolution and BlackHole: Investigation Beyond the Event HorizonCarberp Evolution and BlackHole: Investigation Beyond the Event Horizon
Carberp Evolution and BlackHole: Investigation Beyond the Event Horizon
 
BERserk: New RSA Signature Forgery Attack
BERserk: New RSA Signature Forgery AttackBERserk: New RSA Signature Forgery Attack
BERserk: New RSA Signature Forgery Attack
 
42054960
4205496042054960
42054960
 
Smartcard vulnerabilities in modern banking malware
Smartcard vulnerabilities in modern banking malwareSmartcard vulnerabilities in modern banking malware
Smartcard vulnerabilities in modern banking malware
 
インテルMEの秘密 - チップセットに隠されたコードと、それが一体何をするかを見出す方法 - by イゴール・スコチンスキー - Igor Skochinsky
インテルMEの秘密 - チップセットに隠されたコードと、それが一体何をするかを見出す方法 - by イゴール・スコチンスキー - Igor SkochinskyインテルMEの秘密 - チップセットに隠されたコードと、それが一体何をするかを見出す方法 - by イゴール・スコチンスキー - Igor Skochinsky
インテルMEの秘密 - チップセットに隠されたコードと、それが一体何をするかを見出す方法 - by イゴール・スコチンスキー - Igor Skochinsky
 
Defeating x64: Modern Trends of Kernel-Mode Rootkits
Defeating x64: Modern Trends of Kernel-Mode RootkitsDefeating x64: Modern Trends of Kernel-Mode Rootkits
Defeating x64: Modern Trends of Kernel-Mode Rootkits
 
Bootkits: past, present & future
Bootkits: past, present & futureBootkits: past, present & future
Bootkits: past, present & future
 
Win32/Flamer: Reverse Engineering and Framework Reconstruction
Win32/Flamer: Reverse Engineering and Framework ReconstructionWin32/Flamer: Reverse Engineering and Framework Reconstruction
Win32/Flamer: Reverse Engineering and Framework Reconstruction
 
Cybercrime in Russia: Trends and Issues
Cybercrime in Russia: Trends and IssuesCybercrime in Russia: Trends and Issues
Cybercrime in Russia: Trends and Issues
 
BIOS and Secure Boot Attacks Uncovered
BIOS and Secure Boot Attacks UncoveredBIOS and Secure Boot Attacks Uncovered
BIOS and Secure Boot Attacks Uncovered
 
AMSI: How Windows 10 Plans to Stop Script-Based Attacks and How Well It Does It
AMSI: How Windows 10 Plans to Stop Script-Based Attacks and How Well It Does ItAMSI: How Windows 10 Plans to Stop Script-Based Attacks and How Well It Does It
AMSI: How Windows 10 Plans to Stop Script-Based Attacks and How Well It Does It
 
Visiting the Bear Den
Visiting the Bear DenVisiting the Bear Den
Visiting the Bear Den
 
CSW2017 Yuhao song+Huimingliu cyber_wmd_vulnerable_IoT
CSW2017 Yuhao song+Huimingliu cyber_wmd_vulnerable_IoTCSW2017 Yuhao song+Huimingliu cyber_wmd_vulnerable_IoT
CSW2017 Yuhao song+Huimingliu cyber_wmd_vulnerable_IoT
 
Моделирование угроз для BIOS и UEFI
Моделирование угроз для BIOS и UEFIМоделирование угроз для BIOS и UEFI
Моделирование угроз для BIOS и UEFI
 

Similar to Object Oriented Code RE with HexraysCodeXplorer

Aleksandr Matrosov, Eugene Rodionov - HexRaysCodeXplorer make object-oriented...
Aleksandr Matrosov, Eugene Rodionov - HexRaysCodeXplorer make object-oriented...Aleksandr Matrosov, Eugene Rodionov - HexRaysCodeXplorer make object-oriented...
Aleksandr Matrosov, Eugene Rodionov - HexRaysCodeXplorer make object-oriented...DefconRussia
 
Developing your first application using FIWARE
Developing your first application using FIWAREDeveloping your first application using FIWARE
Developing your first application using FIWAREFIWARE
 
Introduction to c_plus_plus (6)
Introduction to c_plus_plus (6)Introduction to c_plus_plus (6)
Introduction to c_plus_plus (6)
Sayed Ahmed
 
Introduction to c_plus_plus
Introduction to c_plus_plusIntroduction to c_plus_plus
Introduction to c_plus_plus
Sayed Ahmed
 
4Developers 2018: Ile (nie) wiesz o strukturach w .NET (Łukasz Pyrzyk)
4Developers 2018: Ile (nie) wiesz o strukturach w .NET (Łukasz Pyrzyk)4Developers 2018: Ile (nie) wiesz o strukturach w .NET (Łukasz Pyrzyk)
4Developers 2018: Ile (nie) wiesz o strukturach w .NET (Łukasz Pyrzyk)
PROIDEA
 
Developing your first application using FI-WARE
Developing your first application using FI-WAREDeveloping your first application using FI-WARE
Developing your first application using FI-WAREFermin Galan
 
OSCON 2014 - API Ecosystem with Scala, Scalatra, and Swagger at Netflix
OSCON 2014 - API Ecosystem with Scala, Scalatra, and Swagger at NetflixOSCON 2014 - API Ecosystem with Scala, Scalatra, and Swagger at Netflix
OSCON 2014 - API Ecosystem with Scala, Scalatra, and Swagger at Netflix
Manish Pandit
 
QA Lab: тестирование ПО. Станислав Шмидт: "Self-testing REST APIs with API Fi...
QA Lab: тестирование ПО. Станислав Шмидт: "Self-testing REST APIs with API Fi...QA Lab: тестирование ПО. Станислав Шмидт: "Self-testing REST APIs with API Fi...
QA Lab: тестирование ПО. Станислав Шмидт: "Self-testing REST APIs with API Fi...
GeeksLab Odessa
 
Whidbey old
Whidbey old Whidbey old
Whidbey old grenaud
 
Use Eclipse technologies to build a modern embedded IDE
Use Eclipse technologies to build a modern embedded IDEUse Eclipse technologies to build a modern embedded IDE
Use Eclipse technologies to build a modern embedded IDEBenjamin Cabé
 
Domain-Specific Languages for Composable Editor Plugins (LDTA 2009)
Domain-Specific Languages for Composable Editor Plugins (LDTA 2009)Domain-Specific Languages for Composable Editor Plugins (LDTA 2009)
Domain-Specific Languages for Composable Editor Plugins (LDTA 2009)
lennartkats
 
Applying Compiler Techniques to Iterate At Blazing Speed
Applying Compiler Techniques to Iterate At Blazing SpeedApplying Compiler Techniques to Iterate At Blazing Speed
Applying Compiler Techniques to Iterate At Blazing Speed
Pascal-Louis Perez
 
Drd secr final1_3
Drd secr final1_3Drd secr final1_3
Drd secr final1_3Devexperts
 
Python-oop
Python-oopPython-oop
Python-oop
RTS Tech
 
Windows Remote Management - EN
Windows Remote Management - ENWindows Remote Management - EN
Windows Remote Management - ENKirill Nikolaev
 
NET Systems Programming Learned the Hard Way.pptx
NET Systems Programming Learned the Hard Way.pptxNET Systems Programming Learned the Hard Way.pptx
NET Systems Programming Learned the Hard Way.pptx
petabridge
 
Dynamic data race detection in concurrent Java programs
Dynamic data race detection in concurrent Java programsDynamic data race detection in concurrent Java programs
Dynamic data race detection in concurrent Java programsDevexperts
 
Dart for Java Developers
Dart for Java DevelopersDart for Java Developers
Dart for Java Developers
Yakov Fain
 
Bigger Stronger Faster
Bigger Stronger FasterBigger Stronger Faster
Bigger Stronger Faster
Chris Love
 

Similar to Object Oriented Code RE with HexraysCodeXplorer (20)

Aleksandr Matrosov, Eugene Rodionov - HexRaysCodeXplorer make object-oriented...
Aleksandr Matrosov, Eugene Rodionov - HexRaysCodeXplorer make object-oriented...Aleksandr Matrosov, Eugene Rodionov - HexRaysCodeXplorer make object-oriented...
Aleksandr Matrosov, Eugene Rodionov - HexRaysCodeXplorer make object-oriented...
 
Developing your first application using FIWARE
Developing your first application using FIWAREDeveloping your first application using FIWARE
Developing your first application using FIWARE
 
Introduction to c_plus_plus (6)
Introduction to c_plus_plus (6)Introduction to c_plus_plus (6)
Introduction to c_plus_plus (6)
 
Introduction to c_plus_plus
Introduction to c_plus_plusIntroduction to c_plus_plus
Introduction to c_plus_plus
 
4Developers 2018: Ile (nie) wiesz o strukturach w .NET (Łukasz Pyrzyk)
4Developers 2018: Ile (nie) wiesz o strukturach w .NET (Łukasz Pyrzyk)4Developers 2018: Ile (nie) wiesz o strukturach w .NET (Łukasz Pyrzyk)
4Developers 2018: Ile (nie) wiesz o strukturach w .NET (Łukasz Pyrzyk)
 
Developing your first application using FI-WARE
Developing your first application using FI-WAREDeveloping your first application using FI-WARE
Developing your first application using FI-WARE
 
OSCON 2014 - API Ecosystem with Scala, Scalatra, and Swagger at Netflix
OSCON 2014 - API Ecosystem with Scala, Scalatra, and Swagger at NetflixOSCON 2014 - API Ecosystem with Scala, Scalatra, and Swagger at Netflix
OSCON 2014 - API Ecosystem with Scala, Scalatra, and Swagger at Netflix
 
QA Lab: тестирование ПО. Станислав Шмидт: "Self-testing REST APIs with API Fi...
QA Lab: тестирование ПО. Станислав Шмидт: "Self-testing REST APIs with API Fi...QA Lab: тестирование ПО. Станислав Шмидт: "Self-testing REST APIs with API Fi...
QA Lab: тестирование ПО. Станислав Шмидт: "Self-testing REST APIs with API Fi...
 
Whidbey old
Whidbey old Whidbey old
Whidbey old
 
Use Eclipse technologies to build a modern embedded IDE
Use Eclipse technologies to build a modern embedded IDEUse Eclipse technologies to build a modern embedded IDE
Use Eclipse technologies to build a modern embedded IDE
 
Domain-Specific Languages for Composable Editor Plugins (LDTA 2009)
Domain-Specific Languages for Composable Editor Plugins (LDTA 2009)Domain-Specific Languages for Composable Editor Plugins (LDTA 2009)
Domain-Specific Languages for Composable Editor Plugins (LDTA 2009)
 
Applying Compiler Techniques to Iterate At Blazing Speed
Applying Compiler Techniques to Iterate At Blazing SpeedApplying Compiler Techniques to Iterate At Blazing Speed
Applying Compiler Techniques to Iterate At Blazing Speed
 
Drd secr final1_3
Drd secr final1_3Drd secr final1_3
Drd secr final1_3
 
Python-oop
Python-oopPython-oop
Python-oop
 
Windows Remote Management - EN
Windows Remote Management - ENWindows Remote Management - EN
Windows Remote Management - EN
 
NET Systems Programming Learned the Hard Way.pptx
NET Systems Programming Learned the Hard Way.pptxNET Systems Programming Learned the Hard Way.pptx
NET Systems Programming Learned the Hard Way.pptx
 
Dynamic data race detection in concurrent Java programs
Dynamic data race detection in concurrent Java programsDynamic data race detection in concurrent Java programs
Dynamic data race detection in concurrent Java programs
 
Dart for Java Developers
Dart for Java DevelopersDart for Java Developers
Dart for Java Developers
 
Reflection
ReflectionReflection
Reflection
 
Bigger Stronger Faster
Bigger Stronger FasterBigger Stronger Faster
Bigger Stronger Faster
 

Recently uploaded

Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Dr.Costas Sachpazis
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
obonagu
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
seandesed
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
Jayaprasanna4
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
addressing modes in computer architecture
addressing modes  in computer architectureaddressing modes  in computer architecture
addressing modes in computer architecture
ShahidSultan24
 
TECHNICAL TRAINING MANUAL GENERAL FAMILIARIZATION COURSE
TECHNICAL TRAINING MANUAL   GENERAL FAMILIARIZATION COURSETECHNICAL TRAINING MANUAL   GENERAL FAMILIARIZATION COURSE
TECHNICAL TRAINING MANUAL GENERAL FAMILIARIZATION COURSE
DuvanRamosGarzon1
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
Massimo Talia
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
Amil Baba Dawood bangali
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
TeeVichai
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
AhmedHussein950959
 
Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.
PrashantGoswami42
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
MdTanvirMahtab2
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
AJAYKUMARPUND1
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
R&R Consult
 
Halogenation process of chemical process industries
Halogenation process of chemical process industriesHalogenation process of chemical process industries
Halogenation process of chemical process industries
MuhammadTufail242431
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdfCOLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
Kamal Acharya
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
Osamah Alsalih
 

Recently uploaded (20)

Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
 
addressing modes in computer architecture
addressing modes  in computer architectureaddressing modes  in computer architecture
addressing modes in computer architecture
 
TECHNICAL TRAINING MANUAL GENERAL FAMILIARIZATION COURSE
TECHNICAL TRAINING MANUAL   GENERAL FAMILIARIZATION COURSETECHNICAL TRAINING MANUAL   GENERAL FAMILIARIZATION COURSE
TECHNICAL TRAINING MANUAL GENERAL FAMILIARIZATION COURSE
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
 
Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
 
Halogenation process of chemical process industries
Halogenation process of chemical process industriesHalogenation process of chemical process industries
Halogenation process of chemical process industries
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
 
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdfCOLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
 

Object Oriented Code RE with HexraysCodeXplorer

  • 1. Object Oriented Code RE with HexRaysCodeXplorer Eugene Rodionov @vxradius Alex Matrosov @matrosov
  • 2. Agenda * Object Oriented Code Reversing Challenges -- virtual methods -- templates * Reversing Object Oriented Malware -- Flamer -- Sednit * HexRaysCodeXplorer in use
  • 3. Modern C++ Malware for Targeted Attacks
  • 4. Why reversing C++ code is a hard problem? Virtual Methods & Templates
  • 5. Virtual Methods class Cat { private: int _weight; public: Cat(int weight) : _weight(weight) {}; int eat(int food) { return _weight += food; }; }; int _tmain(int argc, _TCHAR* argv[]) { Cat* cat = new Cat(130); int newWeigth = cat->eat(20); } class Animal { protected: int _weight; public: Animal(int weight) : _weight(weight) {}; virtual int eat(int food) = 0; }; class Cat : Animal { public: Cat(int weight) : Animal(weight) {}; virtual int eat(int food) { return _weight += food; }; }; int _tmain(int argc, _TCHAR* argv[]) { Animal* cat = new Cat(130); int newWeight = cat->eat(20); } vs
  • 6. Virtual Methods class Cat { private: int _weight; public: Cat(int weight) : _weight(weight) {}; int eat(int food) { return _weight += food; }; }; int _tmain(int argc, _TCHAR* argv[]) { Cat* cat = new Cat(130); int newWeigth = cat->eat(20); } class Animal { protected: int _weight; public: Animal(int weight) : _weight(weight) {}; virtual int eat(int food) = 0; }; class Cat : Animal { public: Cat(int weight) : Animal(weight) {}; virtual int eat(int food) { return _weight += food; }; }; int _tmain(int argc, _TCHAR* argv[]) { Animal* cat = new Cat(130); int newWeight = cat->eat(20); } vs
  • 7. Virtual Function Tables Class A vfPtr attr_1 attr_2 A::vfTable A::a1() A::a2() A::a3() RTTI Object Locator signature pTypeDescriptor pClassDescriptor meta
  • 8. Virtual Function Tables Class A vfPtr attr_1 attr_2 A::vfTable A::a1() A::a2() A::a3() RTTI Object Locator signature pTypeDescriptor pClassDescriptor meta
  • 9. Virtual Function Tables * lead to indirect method calls -- difficult to analyze statically * initialized in constructors -- need to track back object creation
  • 10. C++ Templates * extra code to analyze -- another way to create polymorphic types * problematic to recognize standard library code (FLIRT) -- playing with compiler optimization options std::vector<int> std::vector<char> std::vector<std::string> std::vector<custom_type>
  • 11. C++ Code Reconstruction Problems * Object identification -- type reconstruction * Class layout reconstruction -- Identify constructors/destructors -- Identify class members -- Local/global type reconstruction -- Associate object with exact method calls * RTTI reconstruction -- vftable reconstruction -- Associate vftable object with exact object -- class hierarchy reconstruction
  • 12. Reversing Object Oriented Malware Practical Approaches: REconstructing Flamer Framework
  • 13. REconstructing Flamer Framework Vector<Command Executor> DB_Query ClanCmd Vector<Task> IDLER CmdExec Vector<DelayedTasks> Euphoria Share Supplier Vector<Consumer> Mobile Consumer Cmd Consumer MunchSniffer FileFinder FileCollect Driller GetConfig LSS Sender Frog Beetlejuice Lua Consumer Media Consumer http://www.welivesecurity.com/2012/08/02/flamer-analysis-framework-reconstruction/
  • 14. REconstructing Flamer Framework Vector<Command Executor> DB_Query ClanCmd Vector<Task> IDLER CmdExec Vector<DelayedTasks> Euphoria Share Supplier Vector<Consumer> Mobile Consumer Cmd Consumer MunchSniffer FileFinder FileCollect Driller GetConfig LSS Sender Frog Beetlejuice Lua Consumer Media Consumer http://www.welivesecurity.com/2012/08/02/flamer-analysis-framework-reconstruction/
  • 15. Identifying Used Types * Smart pointers * Strings * Vectors to maintain objects * Custom data types: -- tasks -- triggers -- and etc.
  • 16. Data Types Being Used: Smart pointers struct SMART_PTR { void *pObject; // pointer to the object int *RefNo; // reference counter };
  • 17. Data Types Being Used: Smart pointers
  • 18. Data Types Being Used: Vectors struct VECTOR { void *vTable; // pointer to the virtual table int NumberOfItems; // self-explanatory int MaxSize; // self-explanatory void *vector; // pointer to buffer with elements }; * Used for handling objects: -- tasks -- triggers
  • 19. Data Types Being Used: Strings struct USTRING_STRUCT { void *vTable; // pointer to the table int RefNo; // reference counter int Initialized; wchar_t *UnicodeBuffer; // pointer to unicode string char *AsciiBuffer; // pointer to ASCII string int AsciiLength; // length of the ASCII string int Reserved; int Length; // Length of unicode string int LengthMax; // Size of UnicodeBuffer };
  • 20. Approaching Flamer * Identify Object Constructors * Reconstruct Object Attributes * Reconstruct Object Methods Type reconstruction Control Flow Graph Reconstruction
  • 27. Reversing Object Oriented Malware Practical Approaches: REconstructing XAgent Framework
  • 28. XAgent Framework Communication Channels Vector<IAgentChannel> AgentKernel Local Storage Cryptor Agent Modules Vector<IAgentModule> AgentKernel Module FileSystem Channel Controller DNameNode Module Remote KeyLogger Process Retranslator Module WinHttp http://www.welivesecurity.com/2014/10/08/sednit-espionage-group-now-using-custom-exploit-kit/
  • 29. Object Interconnection: IAgentModule struct IAgentModule { LPVOID receiveMessage; LPVOID sendMessage; LPVOID getModuleId; LPVOID setModuleId; LPVOID executeModule; }; AgentKernel Module FileSystem Module Remote Keylogger Process Retranslator Module IAgentModule
  • 30. Exploring RTTI* * recover type names * reconstruct class hierarchy * identify object virtual function tables * IDA ClassInformer plugin
  • 31. Exploring RTTI* * recover type names * reconstruct class hierarchy * identify object virtual function tables * IDA ClassInformer plugin
  • 34. XAgent: Cryptor encrypted message salt (4 bytes) RC4key plain text
  • 36. XAgent: Identifying Used Types * Strings: std::string * Containers to maintain objects: -- std::vector -- std::list
  • 37. XAgent: Identifying Used Types * Strings: std::string * Containers to maintain objects: -- std::vector -- std::list
  • 39. HexRaysCodeXplorer since 2013 * CodeXplorer V1.0 released on REcon’2013 * First third-party plugin for Hex-Rays Decompiler * v1.0 supports IDA v6.4 and Decompiler for x86 v1.8
  • 40. HexRaysCodeXplorer Features * Hex-Rays decompiler plugin x86/x64 * The plugin was designed to facilitate static analysis of: -- object oriented code -- position independent code * The plugin allows to: -- partially reconstruct object type -- navigate through decompiled virtual methods
  • 41. Hex-Rays Decompiler Plugin SDK * At the heart of the decompiler lies ctree structure: -- syntax tree structure -- consists of citem_t objects -- there are 9 maturity levels of the ctree structure
  • 42. * Type citem_t is a base class for: -- cexpr_t – expression type -- cinsn_t – statement type * Expressions have attached type information * Statements include: -- block, if, for, while, do, switch, return, goto, asm * Hex-Rays provides iterators for traversing the citem_t objects within ctree structure: -- ctree_visitor_t, ctree_parentee_t Hex-Rays Decompiler Plugin SDK citem_t cexpr_t cinsn_t
  • 43. * Type citem_t is a base class for: -- cexpr_t – expression type -- cinsn_t – statement type * Expressions have attached type information * Statements include: -- block, if, for, while, do, switch, return, goto, asm * Hex-Rays provides iterators for traversing the citem_t objects within ctree structure: -- ctree_visitor_t, ctree_parentee_t Hex-Rays Decompiler Plugin SDK citem_t cexpr_t cinsn_t
  • 46. HexRaysCodeXplorer: Virtual Methods IDA’s ‘Local Types’ is used to represent object type
  • 47. HexRaysCodeXplorer: Virtual Methods IDA’s ‘Local Types’ is used to represent object type
  • 48. HexRaysCodeXplorer: Virtual Methods * Hex-Rays decompiler plugin is used to navigate through the virtual methods
  • 49. HexRaysCodeXplorer: Object Type REconstruction * Hex-Rays’s ctree structure may be used to partially reconstruct object type * Input: -- pointer to the object instance -- object initialization routine entry point * Output: -- C structure-like object representation
  • 50. HexRaysCodeXplorer: Object Type REconstruction * citem_t objects: -- memptr, idx, memref -- call, ptr, asg
  • 51. HexRaysCodeXplorer: Object Type REconstruction * citem_t objects: -- memptr, idx, memref -- call, ptr, asg
  • 52. HexRaysCodeXplorer: Object Type REconstruction // reference of DWORD at offset 12 in buffer a1 *(DWORD *)(a1 + 12) = 0xEFCDAB89;
  • 53. HexRaysCodeXplorer: v1.7 [NSEC Edition] Automatic virtual table identification + Type reconstruction
  • 54. HexRaysCodeXplorer: v1.7 [NSEC Edition] * Automatic virtual table identification
  • 55. HexRaysCodeXplorer: v1.7 [NSEC Edition] * Automatic virtual table identification
  • 56. HexRaysCodeXplorer: v1.7 [NSEC Edition] * Automatic virtual table identification * Support for IDA Pro x64 * Bugfixes
  • 58. HexRaysCodeXplorer: Next plans * Switch to IdaPython
  • 60. HexRaysCodeXplorer: Next plans * Switch to IdaPython * Further research & development: -- find cross-references to object attributes -- handling nested structures -- code similarity based on data flow analysis
  • 61. Thank you for your attention! http://REhints.com @Rehints https://github.com/REhints/HexRaysCodeXplorer