41
Nico Yturriaga September 27, 2014

Nico Yturriaga September 27, 2014

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Nico Yturriaga September 27, 2014

Nico YturriagaSeptember 27, 2014

Page 2: Nico Yturriaga September 27, 2014

Why Necurs?� Infected 80,000+ during December 2012

� Tagged as “Rootkit for Hire”

� In the wild

Page 3: Nico Yturriaga September 27, 2014

What is a Rootkit?

� Stealthy type of software

� Activated at boot up

� Removal can be complicated or practically impossible

Page 4: Nico Yturriaga September 27, 2014

Necurs is...

� Obfuscated / Encrypted

� Protective to itself and components

� Able to Prevent AV Installation

Page 5: Nico Yturriaga September 27, 2014

Basic Flow

MaliciousURL/Spam

DropperDownloadsNecurs

NecursProtectsitsRegistry,FilesandProcesses

DropperDownloads

Zeus

NecursAddsZeustoitsProtection

Page 6: Nico Yturriaga September 27, 2014

The Components

� The Dropper (Executable .exe)vInfection Symptoms, The Executable,

Rootkit Installation

� The Rootkit (Driver .sys)vThe Driver, Access Denial, AV and

Application Blocking

Page 7: Nico Yturriaga September 27, 2014

Infected by Necurs?The Dropper

§ Windows Platform (32 bit / 64 bit)

§ Query ‘Syshost32’ Service.

Page 8: Nico Yturriaga September 27, 2014

Query ‘Syshost32’ Service

The Dropper - Symptoms

Page 9: Nico Yturriaga September 27, 2014

Infected by Necurs?The Dropper

§ Windows Platform (32 bit / 64 bit)

§ Query ‘Syshost32’ Service.

§ ‘Syshost.exe’ in Device Manager

Page 10: Nico Yturriaga September 27, 2014

‘Syshost.exe’ in Device Manager

The Dropper - Symptoms

The Dropper Executable

Page 11: Nico Yturriaga September 27, 2014

Infected by Necurs?The Dropper

§ Windows Platform (32 bit / 64 bit)

§ Query ‘Syshost32’ Service.

§ ‘Syshost.exe’ in Device Manager

§ Parse “HKLM\ System\ CurrentControlSet\

Services”

Page 12: Nico Yturriaga September 27, 2014

Parse “HKLM\System\CurrentControlSet\Services”

The Dropper - Symptoms

Page 13: Nico Yturriaga September 27, 2014

Infected by Necurs?The Dropper

§ Windows Platform (32 bit / 64 bit)

§ Query ‘Syshost32’ Service.

§ ‘Syshost.exe’ in Device Manager

§ Parse “HKLM\ System\ CurrentControlSet\

Services”

§ Verify Driver File Access Denial

Page 14: Nico Yturriaga September 27, 2014

Verify Driver File Access Denial

The Dropper - Symptoms

16 characters length of driver file name [a-f, 0-9]

Page 15: Nico Yturriaga September 27, 2014

Infected by Necurs?The Dropper

§ Windows Platform (32 bit / 64 bit)

§ Query ‘Syshost32’ Service.

§ ‘Syshost.exe’ in Device Manager

§ Parse “HKLM\ System\ CurrentControlSet\

Services”

§ Verify Driver File Access Denial

Page 16: Nico Yturriaga September 27, 2014

The ExecutableThe Dropper

§ Sample was obtained June 2014.

§ MD5 : 917406e5d63a4538e7a4e28f5dd13bef

§ Obfuscated and will eventually decrypt a new

file : 39db776b96383b491362d7f003a1ffd0

Page 17: Nico Yturriaga September 27, 2014

Rootkit InstallationThe Dropper

DecryptedExecutable Administrator?

Exploitvulnerability

CVE-2010-4398

NO

Page 18: Nico Yturriaga September 27, 2014

Privilege EscalationThe Dropper

§ Vulnerability listed as CVE-2010-4398

§ allows local users to gain admin privileges

§ bypass the User Account Control (UAC)

Page 19: Nico Yturriaga September 27, 2014

Rootkit InstallationThe Dropper

DecryptedExecutable Administrator?

Exploitvulnerability

CVE-2010-4398

NO

DownloadRootkit

Page 20: Nico Yturriaga September 27, 2014

Rootkit DownloadThe Dropper

§ Manipulate Windows Firewall by netsh.exe

§ Decrypt a List of IP addresses

Page 21: Nico Yturriaga September 27, 2014

Rootkit InstallationThe Dropper

DecryptedExecutable Administrator?

Exploitvulnerability

CVE-2010-4398

NO

DownloadRootkit

InstallRootkitKERNELMODE

Page 22: Nico Yturriaga September 27, 2014

Rootkit InstallationThe Dropper

§ Create System file

Page 23: Nico Yturriaga September 27, 2014

Rootkit InstallationThe Dropper

§ Load Rootkit as a Service

Page 24: Nico Yturriaga September 27, 2014

The DriverThe Rootkit

§ MD5 : eaa43802c3801389911b6ad35c0ee71

§ Sample was Downloaded June 2014

§ Obfuscated and will eventually decrypt a new file : 787328fa36df1ce151eebf44fe07c0a6

§ 16 characters file name [0-9, a-f] “.sys” extension

Page 25: Nico Yturriaga September 27, 2014

The DriverThe Rootkit

§ Registry Entry at “\REGISTRY\MACHINE\SYSTEM\CurrentControlSet\Services”

LoadBootDeviceDrivers

Page 26: Nico Yturriaga September 27, 2014

The DriverThe Rootkit

§ Registry Entry at “\REGISTRY\MACHINE\SYSTEM\CurrentControlSet\Services”

LoadBootDeviceDrivers

SERVICE_BOOT_START

Page 27: Nico Yturriaga September 27, 2014

The DriverThe Rootkit

§ “\REGISTRY\MACHINE\SYSTEM\CurrentControlSet\Control\ServiceGroupOrder”

LoadBootDeviceDrivers

ServiceGroupOrderList

Page 28: Nico Yturriaga September 27, 2014

The DriverThe Rootkit

§ Registry Entry at “\REGISTRY\MACHINE\SYSTEM\CurrentControlSet\Services”

§ Able to load in Safe Mode

§ Load before other Drivers

LoadBootDeviceDrivers

ServiceGroupOrderList

CheckTagNumber

Page 29: Nico Yturriaga September 27, 2014

Driver – Dropper CommunicationThe Rootkit

§ Create device object "NtSecureSys" and a Symbolic link "\??\NtSecureSys"o 0x22000C – Request Rootkit File Patho 0x220010 – Request Rootkit Registry Patho 0x220018 – Update the rootkit driver file by a

supplied buffero 0x22001C – Uninstall the Rootkito 0x22002C – terminate a process using a

supplied process name

Page 30: Nico Yturriaga September 27, 2014

Access DenialThe Rootkit

§ Registry - CmRegisterCallback API

Page 31: Nico Yturriaga September 27, 2014

Access DenialThe Rootkit

§ Registry CallBack FlowAccessRegistry

RootkitThread?

Set/DelRootkitKey?

DenyAccess

GrantAccess

YES YES

YES Services.exe/Rootkit?

YES

NONO

OpenRootkitKey?

Page 32: Nico Yturriaga September 27, 2014

Access DenialThe Rootkit

§ File Access - Filesystem

Page 33: Nico Yturriaga September 27, 2014

Access DenialThe Rootkit

§ FileSystem Filter Flow

DenyAccess

GrantAccess

FileAccess

FilterFileAccessType

RemovefromFileObjects

CloseFileAccess?

Component?

Write/SetFileAccess?

CheckDatabase

Rootkit/Registered?

Open/OtherFileAccess?

NO

NO

YES

YES

YES

YES

YES

Page 34: Nico Yturriaga September 27, 2014

Access DenialThe Rootkit

§ Process / Thread v API ObRegisterCallbacksv NtOpenProcess, NtOpenThread [SSDT]

Page 35: Nico Yturriaga September 27, 2014

Access DenialThe Rootkit

§ Process / Thread Call Back

NO

NOYES

YES

OpenProcess/Thread

Thread?

GetThreadOwnerProcess

TargetRootkitProcess?

OwnProcess?

Svchost/Lsass?

ProceedNormally

DisAllowOperation

LimitOperations

YES

NO

NO

YES

Page 36: Nico Yturriaga September 27, 2014

Application BlockingThe Rootkit

§ Black and White Listing Capabilitiesv Values at “\REGISTRY\MACHINE\SYSTEM\

CurrentControlSet\Services”ParseRegistryValues

“ImagePath”

ParsePEfilesatSystem32and

System32\Drivers

VersionInfoandFileName?

ComputeMD5Hash

StoreatDB1/DB6

StoreatDB2/DB5

Not Blacklisted / To White list

ContinueParsing

Blacklisted ComputeFileNameFMV–

1Hash

Page 37: Nico Yturriaga September 27, 2014

Application BlockingThe Rootkit

§ API PsSetLoadImageNotifyRoutine

ApplicationLoadedinMemory

Black/White?

ModifyEntryCodeofApplicationinMemory

END

Black

Page 38: Nico Yturriaga September 27, 2014

Application BlockingThe Rootkit

Page 39: Nico Yturriaga September 27, 2014

GameOver Zeus

� Resurrected as of July 2014

� Used to install CryptoLocker ransomware.

� Blamed for more than $100 million theft from banks, businesses and consumers worldwide.

Page 40: Nico Yturriaga September 27, 2014

Removal Tips

� Use a Boot CD e.g. [Hiren’s]

� Demonstration

Page 41: Nico Yturriaga September 27, 2014

References

� http://stopmalvertising.com/rootkits/analysis-of-zeus-gameover-with-necurs.html

� http://www.f-secure.com/weblog/archives/00002717.html

� http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2010-4398

� http://www.infosecurity-magazine.com/view/29806/necurs-rootkit-not-new-but-spreading-fast-warns-microsoft

� krebsonsecurity.com/tag/gameover-zeus/� MSDN� Peter Ferrie http://pferrie.host22.com/papers/