• No results found

Win32Flamer Reverse Engineering And Framwork Reconstruction [Aleksandr Matrosov] pdf

N/A
N/A
Protected

Academic year: 2020

Share "Win32Flamer Reverse Engineering And Framwork Reconstruction [Aleksandr Matrosov] pdf"

Copied!
60
0
0

Loading.... (view fulltext now)

Full text

(1)

Win32/Flamer: Reverse Engineering and

Framework Reconstruction

(2)

Outline of The Presentation

Typical malware vs. Stuxnet/Flame What the difference?

Flamer code reconstruction problems C++ code reconstruction

Library code identification

Flamer framework overview

Object oriented code reconstruction

(3)
(4)
(5)

What’s the Difference?

Typical malware

Different motivation, budget … Use 1-days for distribution

Anti-stealth for bypassing AV Stealth timing: months

Developed in C or C++ in C style Simple architecture for plugins Traditional ways for obfuscation:

packers

polymorphic code vm-based protection

Stuxnet/Flame …

Different motivation, budget … Use 0-days for distribution

Anti-stealth for bypassing all sec soft

Stealth timing: years

Tons of C++ code with OOP

Industrial OO framework platform Other ways of code obfuscation:

tons of embedded static code specific compilers/options object oriented wrappers for

(6)
(7)

Code Complexity Growth

(8)
(9)
(10)

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

(11)
(12)
(13)
(14)
(15)
(16)
(17)
(18)
(19)
(20)
(21)

Library Code Identification Problems

Compiler optimization

Wrappers for WinAPI calls

Embedded library code

Library version identification problem

IDA signatures used syntax based detection methods

(22)
(23)
(24)
(25)
(26)
(27)

Main Festi Functionality store in kernel mode Win32/Festi Dropper Win32/Festi kernel-mode driver Win32/Festi Plugin 1 Win32/Festi

Plugin 2

...

Win32/FestiPlugin N Install kernel-mode

driver

Download plugins

(28)

Main Festi Functionality store in kernel mode Win32/Festi Dropper Win32/Festi kernel-mode driver Win32/Festi Plugin 1 Win32/Festi

Plugin 2

...

Win32/FestiPlugin N Install kernel-mode

driver

Download plugins

(29)
(30)

Festi: Plugin Interface

Plugin1 Plugin 1

struct PLUGIN_INTERFACE Plugin 1 struct PLUGIN_INTERFACE Plugin2 Plugin3 PluginN Plugin 2 struct PLUGIN_INTERFACE Plugin 3 struct PLUGIN_INTERFACE Plugin N struct PLUGIN_INTERFACE

...

(31)

Festi: Plugins

Festi plugins are volatile modules in kernel-mode address space:

 downloaded each time the bot is activated

never stored on the hard drive

The plugins are capable of:

 sending spam – BotSpam.dll

 performing DDoS attacks – BotDoS.dll

(32)
(33)

An overview of the Flamer Framework

The main types used in Flamer Framework are:

Command Executers –the objects exposing interface that allows the malware to dispatch commands received from C&C servers

Tasks – objects of these type represent tasks executed in

separate threads which constitute the backbone of the main module of Flamer

Consumers – objects which are triggered on specific events

(creation of new module, insertion of removable media and etc.)

(34)

An overview of the Flamer Framework Vector<Command Executor> DB_Query ClanCmd Vector<Task> IDLER CmdExec Vector<DelayedTasks> Euphoria Share Supplier Vector<Consumer> Mobile Consumer Cmd Consumer Munch Sniffer FileFinder FileCollect Driller GetConfig

LSS

Sender Frog Beetlejuice Lua

Consumer

(35)

Some of Flamer Framework Components

Security

Identifying processes in the systems corresponding to security software: antiviruses, HIPS, firewalls, system information utilities and etc.

Microbe Leverages voice recording capabilities of the system

Idler Running tasks in the background

BeetleJuice Utilizes bluetooth facilities of the system

Telemetry Logging of all the events

(36)
(37)
(38)
(39)

Data Types Being Used

Smart pointers

Strings

Vectors to maintain the objects

(40)

Data Types Being Used: Smart pointers

typedef struct SMART_PTR {

void *pObject; // pointer to the object

int *RefNo; // reference counter

(41)

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

(42)

Data Types Being Used: Vectors

struct VECTOR {

void *vTable; // pointer to the table

int NumberOfItems; // self-explanatory

int MaxSize; // self-explanatory

void *vector; // pointer to buffer with elements

};

Used to handle the objects:

(43)

Using Hex-Rays Decompiler

Identifying constructors/destructors

Usually follow memory allocation

The pointer to object is passed in ecx (sometimes in other registers)

Reconstructing object’s attributes

Creating custom type in “Local Types” for an object

Analyzing object’s methods

(44)

Using Hex-Rays Decompiler

Identifying constructors/destructors

Usually follow memory allocation

The pointer to object is passed in ecx (sometimes in other registers)

Reconstructing object’s attributes

Creating custom type in “Local Types” for an object

Analyzing object’s methods

(45)
(46)
(47)
(48)
(49)
(50)
(51)

Relationship

(52)
(53)

Exploit Implementations

Stuxnet Duqu Flame Gauss

(54)

Exploit Implementations: Stuxnet & Duqu

The payload is injected into processes from both kernel-mode driver & user-kernel-mode module

Hooks: ZwMapViewOfSection ZwCreateSection ZwOpenFile ZwClose ZwQueryAttributesFile ZwQuerySection

Executes LoadLibraryW passing as a parameter either:

KERNEL32.DLL.ASLR.XXXXXXXX

(55)

Exploit Implementations: Stuxnet & Duqu

The payload is injected into processes from both kernel-mode driver & user-kernel-mode module

Hooks: ZwMapViewOfSection ZwCreateSection ZwOpenFile ZwClose ZwQueryAttributesFile ZwQuerySection

Executes LoadLibraryW passing as a parameter either:

KERNEL32.DLL.ASLR.XXXXXXXX

(56)

Injection mechanism: Flame

The payload is injected into processes from user-mode module

The injection technique is based on using:

VirtualAllocEx

WriteProcessMemory\ReadProcessMemory

CreateRemoteThread\RtlCreateUserThread

The injected module is disguised as shell32.dll

(57)

Injection mechanism: Flame

The payload is injected into processes from user-mode module

The injection technique is based on using:

VirtualAllocEx

WriteProcessMemory\ReadProcessMemory

CreateRemoteThread\RtlCreateUserThread

The injected module is disguised as shell32.dll

(58)

Exploit Implementations: Gauss

(59)
(60)

Thank you for your attention!

Aleksandr Matrosov

[email protected] @matrosov

Eugene Rodionov

References

Related documents

completed eight years of public middle school Montessori Academic Instruction (MAI) to determine their current levels of lOth-grade transition adjustment into a

The pilot-tested guide explored: (i) parents’ beliefs and attitudes related to eating and PA; (ii) parents’ perceptions of children’s eating and PA experiences at home; (iii)

If the Northern Irish identity operates as a common ingroup category it would be expected that Northern Irish participants perceive less threat from their religious

Nussbaum has served as president of the Disease Management Association of America, chairman of the National Committee for Quality Health Care, chair of America's Health

Seven principal sources of error were identified: tracker jumps, wind, CAS deceleration, speed conformance, target mach, atmosphere/altitude, and path distance.. The white

Since our proposed module only stores the link of the folder contains the submitted assignments and not the real files, our module, from one hand, easily retrieves the

The distorted Fourier transform causes a quadratic distance error in addition to beat frequency chirp..

benefits to embedded benefits to embedded Provides full Win32 API Provides full Win32 API compatibility enabling users compatibility enabling users to leverage DTOS work to