A Moose Once Bit My Honeypot - Botconf 2018 · $ whoami Malware Researcher at ESET Infosec lecturer...

97
A Moose Once Bit My Honeypot A Story of an Embedded Linux Botnet by Olivier Bilodeau ( ) @obilodeau

Transcript of A Moose Once Bit My Honeypot - Botconf 2018 · $ whoami Malware Researcher at ESET Infosec lecturer...

AMooseOnceBitMyHoneypot

AStoryofanEmbeddedLinuxBotnetbyOlivierBilodeau( )@obilodeau

$aproposEmbeddedLinuxMalwareMooseDNA(description)MooseHerding(theOperation)What’sNew?TakeAways

$whoamiMalwareResearcheratESETInfoseclectureratETSUniversityinMontrealPreviously

infosecdeveloper,networkadmin,linuxsystemadmin

Co-founderMontrehack(hands-onsecurityworkshops)FounderNorthSecHackerJeopardy

EmbeddedLinuxMalwareWhatmarketinglikestocall"InternetofThingsMalware"

MalwareRunningOnAnEmbeddedLinuxSystem

LikeconsumerroutersconsumerroutersDVRSmartTVsIPCameramonitoringsystems…

CaracteristicsofEmbeddedLinuxSystems

SmallamountofmemorySmallamountofflashNonx86architectures:ARM,MIPSWide-varietyoflibcimplementations/versionsSameABI-compatibleLinuxkernel(2.4<x<4.3)SupportELFbinariesRarelyanintegratedUINetworked

WhyThreatsOnTheseSystemsMatters?

HardtodetectHardtoremediateHardtofixLowhangingfruitforbadguys

It’sRealSeveralcasesdisclosedinthelasttwoyearsAlotofsame-oldbackgroundnoise(DDoSer)Thingsareonlygettingworse

Wait,isIoTmalwarereallyaboutthings?

No.Notyet.No.Notyet.

Sowhatkindofmalwarecanwefindonsuchinsecuredevices?Linux/AidraLinux/BassoboChinaZfamily(XOR.DDoS,…)Linux/DoflooLinux/DNSAmp(MrBlack,BillGates)Linux/Gafgyt(LizardStresser)Linux/HydraLinux/Tsunami…

LessonLearned#0LessonLearned#0Statically-linkedstrippedbinaries

Static/strippedELFprimerNoimports(librarycalls)presentAllthecodebundledtogetherdowntokernelsyscallDisassembler(ifavailableforarch)doesn’thelpmuch

Linux/MoosebinaryinIDA

printffamily

Ecosystemmakesitworst[forreversers]

GCCandGNUlibcarealwayschangingsocompiledbinariesalwayschangeLittleIDAFLIRTsignaturesavailable(ifany)VariousClibraries:µClibc,eglibc,glibc,musl,…

AFailedAttemptMapsyscallswithIDAscriptButlibcistoobigStilltoomuchcodetoREProvidedtool:https://github.com/eset/malware-research/blob/master/moose/ida/mips_identify_syscalls.py

BetterSolutionReproduceenvironment(arch,libc/compilerversions)Buildlibrariesw/symbolsundersameconditionsUsebindifftomaplibraryfunctionsFocusonmalwarecode

Lesson#0Lesson#0GoingdowntosyscallsistoolonginlargebinariesFindaclosematchofClibraryBuildwithsymbolsBindiffit(ormaybeFLIRTit)

LessonLearned#1LessonLearned#1BecarefulofstringsandAVvariantnames

Anti-VirusVariants

andStrings$stringsmoose_mips.elf[...]cat/proc/cpuinfoGET/xx/rnde.php?p=%d&f=%d&m=%dHTTP/1.1Host:www.getcool.comConnection:Keep-Alive127.0.0.1[...]

Lesson#1Lesson#1BecarefulwithdetectionnamesDon’trequestdomaintakedownbasedonoutputofstringsanddon’tdosoforotherpeople’sresearch!

MisleadingStrings

MooseDNAMooseDNAakaMalwaredescription

Hangtight,thisisarecap

Linux/MooseDiscoveredinNovember2014Thoroughlyanalyzedinearly2015PublishedareportinlateMay2015

Linux/Moose…Namedafterthestring"elan"presentinthemalware

executable

ElanisFrenchfor

TheLotusElan

ElánTheSlovakrockband(from1969andstillactive)

SampleStaticallylinkedstrippedELFbinaryARM(GNUEABIandEABI5)MIPS(littleandbigendian)Nox86samplefoundC&CIPinintegerformburiedinallthiscode

MIPS/ARM+staticallylinked+stripped+nox86

Stringsnotobfuscated

NetworkcapabilitiesPivotthroughfirewallsHome-madeNATtraversalCustom-madeProxyservice

onlyavailabletoasetofauthorizedIPaddressesRemotelyconfiguredgenericnetworksnifferDNSHijacking

LessonLearned#2LessonLearned#2Don’tassumeit’scustomwhenitcanbeastandard

protocol

ProxywithaccessfromC&CauthorizedIPsonly

C&CIPishardcodedNofallbackdomainsorDGA

AttackVectorTelnetcredentialsbruteforceWordlistof304user/passentriessentbyserver

CompromiseProtocol

Canperformcross-archinfections

NofurtherspreadingifC&Cisdown

Missing:Persistence

Literallykillscompetition

LessonLearned#3LessonLearned#3LessRE,morehoneypot!

Stuck

SolutionLaunchthebinaryinadebianMIPSqemuimageReachablefromtheInternetWatchitbehaveFirewallit

HintsAurelimages:

Qemucommand:https://people.debian.org/~aurel32/qemu/mips/

qemu-system-mips-Mmalta\-no-reboot-nographic\-kernelvmlinux-3.2.0-4-4kc-malta\-hdadebian_wheezy_mips_standard.qcow2\-append"root=/dev/sda1console=ttyS0"\-redirtcp:10073::10073-redirtcp:22::22-redirtcp:23::23

Lesson#3Lesson#3WeweretoocarefulEverythingwelearnedoperationallywasbecauseofinfectedhost

Hardtotrackmalware

MooseHerdingTheMalwareOperation

ViaC&CConfigurationNetworksnifferwasusedtostealHTTPCookies

Twitter:twll,twidFacebook:c_userInstagram:ds_user_idGoogle:SAPISID,APISIDGooglePlay/Android:LAY_ACTIVE_ACCOUNTYoutube:LOGIN_INFO

SniffingHTTPSCookies

ViaProxyUsageAnalysisNatureoftrafficProtocolTargetedsocialnetworks

75%+HTTPSbut…

AnExample

AnExample(cont.)

AnExample(cont.)

AnExample(cont.)

FraudhiddeninHTTPS

ExceptInstagramfirsthit

LatestDevelopmentsLatestDevelopments

WhitepaperImpactFewweeksafterthepublicationtheC&Cserverswentdark

Afterareboot,allaffecteddevicesshouldbecleanedButvictimscompromisedviaweakcredentials,sotheycanalwaysreinfect

Aliveordead?

Aliveordead?(cont.)OnthelookoutforMoosev2Lookedatover150newsamplestargetingembeddedLinuxplatforms

FoundUpdateNewproxyserviceport(20012)C&CselectiononCLIC&Cserverreturns404onunknownbotsStillunderanalysisStilltryingtogetinfected

Readingresearchpapersandadapting

TakeAwaysTakeAways

Researchartifactsreleased

PythonandShellScriptsProtocoldissectors,fakeservers,tsharkwrappers

YararulesIOCshttps://github.com/eset/malware-research/tree/master/moose

EmbeddedmalwareNotyetcomplexToolsandprocessesneedtocatchupalowhangingfruitPreventionsimple

Questions?Questions?

Questions?Thankyou!

andspecialthankstoThomasDupuy(@nyx__o)@obilodeau