betabot

55
Dissecting BetaBot Raghav Pande Researcher @ FireEye

Upload: cysinfo-cyber-security-community

Post on 16-Apr-2017

28 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Betabot

Dissecting BetaBotRaghav PandeResearcher @ FireEye

Page 2: Betabot

Disclaimer

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 Cysinfo is responsible for any damage or loss caused due to use or misuse of the information presented here.

Page 3: Betabot

ContentIntroductionStaticBehavior

Anti R.E.Injection

Hooking MethodologyInteresting Areas

Page 4: Betabot

Why Betabot?Difficult to understandNo Cracked builderNo good WriteupSuper Duper Rootkit as AdvertisedComplaint for RemovalHarassment for other Criminals

Page 5: Betabot

InformationSamples used can be downloaded from malwarenet.comBetabot 1.7 was usedBot was analyzed on Win7 Sp1 64bitRequired Tools: Ollydbg, Windbg, x64dbg, Ida Pro

Page 6: Betabot

IntroductionTypical Botnet but with good featuresBotkillerAV KillerUAC SE trickUserKit for x86/x64Anti BootkitUsermode SandBox evasionProactive DefenseDnsBlocker/RedirectFile Search & GrabFormgrabber for IE/FF/CH (x86 & x64) including SPDY grabber

Page 7: Betabot

Advert

Page 8: Betabot
Page 9: Betabot

StaticThrow Wild binary in IDA

Page 10: Betabot

UnpackingUnpacking 101: Throw in Olly

Bp @ ntdll!NtWriteVirtualMemory

Bp @ ntdll!NtResumeThread

AutomateDump PE header

Page 11: Betabot

Unpacking

Page 12: Betabot

UnpackingPlace 0xEb 0xFe @ CreateProcessInternalWNo debugger usageAutomateAttach OllyBp @ CreateProcessInternalWHit, Then Automate till ntdll!NtWriteVirtualMemory comes up

Page 13: Betabot

Unpacking

Page 14: Betabot

Unpacking

Page 15: Betabot

Unpacking stage2

Page 16: Betabot

Unpacking stage2Random Routine & POI

Page 17: Betabot

Unpacking stage2Last Routine & POI

Page 18: Betabot

Unpacking Stage2 Et' Voila

Page 19: Betabot

BehaviorAnti RE

FS:[0x30] + 2DbgBreakPoint() = 0x90Ntdll!NtQueryInformationProcess()Ntdll!NtSetInformationThread()

Page 20: Betabot

BehaviorNtQueryInformationProcess

Page 21: Betabot

BehaviorNtQueryInformationProcess

Note: [119f590] = address of ZwQuerySectionif [Ebp - 1] == 1 (debugger found)modify Fs:[0xc0] from Far jump 0x0033:0x7*******to ZwQuerySection

Page 22: Betabot

BehaviorEIP result

Page 23: Betabot

BehaviorOther aspects

Page 24: Betabot

Injection & MigrationCreateProcessInternalW(suspended)CreateSection()MapViewOfSection(), Unmap(), MapViewOfSection()CreateSection(2)MapViewOfSection(), Unmap(), MapViewOfSection(2)ResumeThread()ExitProcess()

Page 25: Betabot

Injection & Migration

Page 26: Betabot

Injection & Migration

Page 27: Betabot

Injection & Migration

Page 28: Betabot

Injection & Migration

Page 29: Betabot

Injection & Migration

Page 30: Betabot

Injection & Migration

Page 31: Betabot

Injection & Migration

Page 32: Betabot

Injection & Migration

Page 33: Betabot

Injection & Migration

Page 34: Betabot

Injection & Migration

Page 35: Betabot

HooksHow Normal Applications Hook and why

Page 36: Betabot

Hooks32bit system without hooks

Page 37: Betabot

Hooks32bit API on WOW64bit system

without hooks

Page 38: Betabot

Hooks3 different areas of hooking in Betabot

Hook @ KiFastSystemCall (strictly x86 Environment)Hook @ Fs:[0xc0] (WOW64 handler for x86 API)Hook @ 64Bit Api directly

Page 39: Betabot

Hooks32bit

Page 40: Betabot

HooksWow64

Page 41: Betabot

Hooks64bit Process

Page 42: Betabot

Hooks

Page 43: Betabot

Explanation for 64bit handler

Page 44: Betabot

Interesting Areas

Page 45: Betabot

Interesting Areas

Page 46: Betabot

Interesting Areas

Page 47: Betabot

Interesting Areas

Page 48: Betabot

Interesting Areas

Page 49: Betabot

Interesting Areas

Page 50: Betabot

Interesting Areas

Page 51: Betabot

Interesting Areas

Page 52: Betabot

Interesting Areas

Page 53: Betabot

Interesting Areas

Page 54: Betabot

Referencesblog.gdatasoftware.comkernelmode.info

Page 55: Betabot

Queries?