Download - Festi botnet analysis and investigation

Transcript
Page 1: Festi botnet analysis and investigation

Festi Botnet Analysis & Investigation

Aleksandr Matrosov

Eugene Rodionov

Page 2: Festi botnet analysis and investigation

Outline of The Presentation

Investigation The purpose of the botnet

C&C migration

Who is behind the botnet?

Analysis Implementation details

The bot Architecture

components, interfaces, plugins, etc.

Self-defense

The botnet’s activities: Spam, DDoS, Proxy.

Page 3: Festi botnet analysis and investigation

Festi: Investigation

Page 4: Festi botnet analysis and investigation

Festi: Statistics

Page 5: Festi botnet analysis and investigation

Festi: C&C migration

Autumn 2011

vilturt.ru pyatochek.ru valdispit.ru

Beginning 2012

muduck.ru (173.212.248.51) moduck.ru (173.212.248.51) reghostin.ru (178.162.179.47) hostikareg.ru (178.162.179.47)

Autumn 2012

suduck.ru (37.59.50.89) 133import.ru (178.162.179.70) 02school33.ru (178.162.179.70)

C&C migration

Page 6: Festi botnet analysis and investigation

Festi: C&C Domain Names

There are two domain names in .config section:

primary C&C server

reserved C&C server

If neither of these are available Festi employs DGA:

DGA takes as input current day/month/year and bot version_info

Date Festi_v1 Festi_v2

07/11/2012 fzcbihskf.com hjbfherjhff.com

08/11/2012 pzcaihszf.com jjbjherchff.com

09/11/2012 dzcxifsff.com xjbnhcrwhff.com

10/11/2012 azcgnfsmf.com ljbnqcrnhff.com

11/11/2012 bzcfnfsif.com fjblqcrmhff.com

Page 7: Festi botnet analysis and investigation

Festi: C&C panel (2010)

Page 8: Festi botnet analysis and investigation

Who is behind the Festi botnet?

Page 9: Festi botnet analysis and investigation

http://krebsonsecurity.com/2012/06/who-is-the-festi-botmaster/

Page 10: Festi botnet analysis and investigation

Festi: Analysis

Page 11: Festi botnet analysis and investigation

Simple dropper used by third party PPI service

PPI service

Load PPI dropper

Run Festi dropper

Page 12: Festi botnet analysis and investigation

Main Festi Functionality store in kernel mode

Win32/FestiDropper

Win32/Festikernel-mode

driver

Win32/FestiPlugin 1

Win32/FestiPlugin 2

Win32/FestiPlugin N...

Install kernel-mode driver

Download plugins

user-mode

kernel-mode

Page 13: Festi botnet analysis and investigation

Main Festi Functionality store in kernel mode

Win32/FestiDropper

Win32/Festikernel-mode

driver

Win32/FestiPlugin 1

Win32/FestiPlugin 2

Win32/FestiPlugin N...

Install kernel-mode driver

Download plugins

user-mode

kernel-mode

Page 14: Festi botnet analysis and investigation

Festi: Configuration information

The bot’s configuration information is hardcoded into

the driver’s binary:

This section contains encrypted information:

URLs of C&C servers

Key to encrypt data transmitted between the bot and C&C

Bot version information and etc

Page 15: Festi botnet analysis and investigation

Festi: Configuration information

The bot’s configuration information is hardcoded into

the driver’s binary:

This section contains encrypted information:

URLs of C&C servers

Key to encrypt data transmitted between the bot and C&C

Bot version information and etc

Page 16: Festi botnet analysis and investigation

Festi: Configuration information

The bot’s configuration information is hardcoded into

the driver’s binary:

This section contains encrypted information:

URLs of C&C servers

Key to encrypt data transmitted between the bot and C&C

Bot version information and etc

Page 17: Festi botnet analysis and investigation

Festi: Entry Point Call Graph

Page 18: Festi botnet analysis and investigation

Festi: Architecture

Win32/FestiC&C Protocol

Parser

Win32/FestiNetwork Socket

Win32/FestiPlugin Manager

Win32/FestiMemory Manager

Page 19: Festi botnet analysis and investigation

Festi: Self-Defense

Page 20: Festi botnet analysis and investigation

Festi: Self-Defense Features

The bot implements rootkit functionality:

hides its kernel-mode driver

hides its kernel-mode driver registry key

conceals its network communication

The bot protects its kernel-mode driver and corresponding

registry entry from removal

The bot detects VMWare virtual environment and debuggers

Page 21: Festi botnet analysis and investigation

Festi: Protecting Kernel-Mode Driver

Hooking \Systemroot

Monitoring IRP_MJ_DIRECTORY_CONTROL request.

\SystemrootAttached device #1

Malicious device

...

IRP ...hook forward dispatch

File systemdriver

Filter driver #1

Festi driver

Page 22: Festi botnet analysis and investigation

Festi: Protecting Kernel-Mode Driver

Hooking \Systemroot

Monitoring IRP_MJ_DIRECTORY_CONTROL request.

\SystemrootAttached device #1

Malicious device

...

IRP ...hook forward dispatch

File systemdriver

Filter driver #1

Festi driver

Page 23: Festi botnet analysis and investigation

Festi: Protecting Kernel-Mode Driver

Hooking \Systemroot

Monitoring IRP_MJ_DIRECTORY_CONTROL request.

\SystemrootAttached device #1

Malicious device

...

IRP ...hook forward dispatch

File systemdriver

Filter driver #1

Festi driver

Page 24: Festi botnet analysis and investigation

Festi: Protecting Registry

Splicing ZwEnumerateKey system routine

Registering for receiving Shutdown notifications to restore the

registry.

Page 25: Festi botnet analysis and investigation

Festi: Anti-Debugging & VM

Detecting & counteracting system debuggers:

KdDebuggerEnabled

overwriting debugging registers dr0-dr3

Detecting WinPcap:

looking for driver npf.sys (network packet filter)

Detecting VMWare virtual environment:

using documented feature “get version”

Page 26: Festi botnet analysis and investigation

Festi: Anti-Debugging & VM

Detecting & counteracting system debuggers:

KdDebuggerEnabled

overwriting debugging registers dr0-dr3

Detecting WinPcap:

looking for driver npf.sys (network packet filter)

Detecting VMWare virtual environment:

using documented feature “get version”

Page 27: Festi botnet analysis and investigation

Festi: Anti-Debugging & VM

Detecting & counteracting system debuggers:

KdDebuggerEnabled

overwriting debugging registers dr0-dr3

Detecting WinPcap:

looking for driver npf.sys (network packet filter)

Detecting VMWare virtual environment:

using documented feature “get version”

Page 28: Festi botnet analysis and investigation

Festi: Anti-Debugging & VM

Detecting & counteracting system debuggers:

KdDebuggerEnabled

overwriting debugging registers dr0-dr3

Detecting WinPcap:

looking for driver npf.sys (network packet filter)

Detecting VMWare virtual environment:

using documented feature “get version”

Page 29: Festi botnet analysis and investigation

Festi: Network Communication

Page 30: Festi botnet analysis and investigation

Festi: Network Interface Architecture

Festi relies on custom implementation of network sockets in

kernel mode:

provides encrypted tunnel with C&C servers

bypasses personal firewalls and HIPS systems

provides unified network interface for the plugins

Bypassing personal firewalls & HIPS:

Employs custom implementation of ZwCreateFile system routine to

access \Device\Tcp and \Device\Udp devices

bypasses device filters in tcpip.sys driver stack

Page 31: Festi botnet analysis and investigation

Festi: Custom Implementation of ZwCreateFile

Execute ObCreateObject to create file object

Initialize security attributes of created file object

Execute ObInsertObject to insert created file object into FILE_OBJECT

type list

Create IRP request with MajorFunction code set to

IRP_MJ_CREATE

Send created IRP request directly to tcpip.sys driver

Page 32: Festi botnet analysis and investigation

Festi: Bypassing Filters in Tcpip.sys driver stack

\Device\Tcp or

\Device\Udp

Attached device #1

Attached device #N

...

IRP

...

forward

forward

dispatchTcpip.sys

driver

Filter driver #1

Filter driver #N

\Device\Tcp or

\Device\Udp

Attached device #1

Attached device #N

...

IRP

dispatch

Tcpip.sys driver

Filter driver #1

Filter driver #N

original Festi

Page 33: Festi botnet analysis and investigation

Festi: C&C Domain Names

There are two domain names in .config section:

primary C&C server

reserved C&C server

If neither of these are available Festi employs DGA:

DGA takes as input current day/month/year and bot version_info

Date Festi_v1 Festi_v2

07/11/2012 fzcbihskf.com hjbfherjhff.com

08/11/2012 pzcaihszf.com jjbjherchff.com

09/11/2012 dzcxifsff.com xjbnhcrwhff.com

10/11/2012 azcgnfsmf.com ljbnqcrnhff.com

11/11/2012 bzcfnfsif.com fjblqcrmhff.com

Page 34: Festi botnet analysis and investigation

Festi: C&C Domain Names

There are two domain names in .config section:

primary C&C server

reserved C&C server

If neither of these are available Festi employs DGA:

DGA takes as input current day/month/year and bot version_info

Date Festi_v1 Festi_v2

07/11/2012 fzcbihskf.com hjbfherjhff.com

08/11/2012 pzcaihszf.com jjbjherchff.com

09/11/2012 dzcxifsff.com xjbnhcrwhff.com

10/11/2012 azcgnfsmf.com ljbnqcrnhff.com

11/11/2012 bzcfnfsif.com fjblqcrmhff.com

Page 35: Festi botnet analysis and investigation

Festi: Communication Protocol Work Phase

The communication protocol with C&C consists of 2 stages:

initialization – resolving C&C domain name

work phase – downloading plugins & tasks

Initialization stage:

the bot manually resolves C&C domain name using Google DNS

servers: 8.8.8.8 and 8.8.4.4

Page 36: Festi botnet analysis and investigation

Festi: Communication Protocol

The message to C&C consists of:

message header

plugin specific data

Message header:

the bot version

presence of debugger

Presence of VMWare

System information

Plugin specific data:

tag – 16 bit integer

value – word, dword, null-

terminated string, etc.

Page 37: Festi botnet analysis and investigation

Festi: Plugin Interface

Page 38: Festi botnet analysis and investigation

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

providing proxy service – BotSocks.dll

Page 39: Festi botnet analysis and investigation

Festi: Plugin Interface

Plugin1Plugin 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

...

Array of pointers to plugins

Page 40: Festi botnet analysis and investigation

Festi: Loading of Plugins

Decompress plugin

Map plugin image into system address space

Initialize IAT and apply relocations to mapped image

Get exported routines: CreateModule & DeleteModule

Unmap plugin image Get plugin ID & version info

Register plugin by ID

Execute CreateModule

routine

Page 41: Festi botnet analysis and investigation

Festi: Plugin Activities

Page 42: Festi botnet analysis and investigation

Festi: DDoS Plugin (BotDos.dll)

Supports four types of DDoS attacks:

TCP flood

UDP flood

DNS flood

HTTP flood

Page 43: Festi botnet analysis and investigation

Festi: SOCKS Plugin (BotSocks.dll)

Support two types of proxy service:

SOCKS over TCP

SOCKS over UDP

Page 44: Festi botnet analysis and investigation

Festi: Spam Plugin

Page 45: Festi botnet analysis and investigation

Festi: Spam Plugin (BotSpam.dll)

Page 46: Festi botnet analysis and investigation

Festi: Spam Plugin (BotSpam.dll)

Page 47: Festi botnet analysis and investigation

Festi: Spam Plugin (BotSpam.dll)

Page 48: Festi botnet analysis and investigation

Festi: Obtaining Spam Information

Festi bot

spam-templates

email-list

smpt-list

sender-parameters

Festi C&C

initiate encrypted connection

update-list

1

2

3

start spam send 4

5

Page 49: Festi botnet analysis and investigation

Festi: Obtaining Spam Information

Festi bot

spam-templates

email-list

smpt-list

sender-parameters

Festi C&C

initiate encrypted connection

update-list

1

2

3

start spam send 4

5

Page 50: Festi botnet analysis and investigation

Festi: Obtaining Spam Information

Festi bot

spam-templates

email-list

smpt-list

sender-parameters

Festi C&C

initiate encrypted connection

update-list

1

2

3

start spam send 4

5

Page 51: Festi botnet analysis and investigation

Conclusion

Festi is one of the most powerful botnets for sending spam and

performing DDoS attacks

Design principles and implementation features of the bot:

allow it to counteract security software

harden tracking of the botnet

make it relatively easy to derive the bot implementations for other

platforms

Page 52: Festi botnet analysis and investigation
Page 53: Festi botnet analysis and investigation

Thank you for your attention!

Aleksandr Matrosov [email protected] @matrosov

Eugene Rodionov [email protected] @vxradius