+ All Categories
Home > Documents > Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with...

Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with...

Date post: 24-Sep-2020
Category:
Upload: others
View: 0 times
Download: 0 times
Share this document with a friend
65
Domain Name Systems Chester Rebeiro IIT Madras Some of the slides borrowed from the book ‘Computer Security: A Hands on Approach’ by Wenliang Du
Transcript
Page 1: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

Domain Name Systems

ChesterRebeiroIITMadras

Someoftheslidesborrowedfromthebook‘ComputerSecurity:AHandsonApproach’byWenliangDu

Page 2: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

DNS Hierarchy

2

.com .gov .edu .in

gov ernet ac res mil

iitmiitkiisciitb

Rootdomain

Topleveldomain

Secondleveldomain

iitm.ac.in.

LookuprecordsformappingfromdomainnamestoIPaddresses

Page 3: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

DNS Hierarchy

3

.com .gov .edu .in

gov ernet ac res mil

iitmiitkiisciitb

Rootdomain

Topleveldomain

Secondleveldomain

iitm.ac.in.

LookuprecordsformappingfromdomainnamestoIPaddresses Domain:Isasubtree,sharingitsdomainnamewiththenameofthetopmostnodeinthesubtree

Page 4: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

DNS Hierarchy

4

.com .gov .edu .in

gov ernet ac res mil

iitmiitkiisciitb

Rootdomain

Topleveldomain

Secondleveldomain

iitm.ac.in.

LookuprecordsformappingfromdomainnamestoIPaddressesSubDomains:Isadomainthatbranchesoffanother.

Page 5: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

Root Domain

5

.com .gov .edu .in

gov ernet ac res mil

iitmiitkiisciitb

13rootdomainsmaintainedbyIANA

Topleveldomain

Secondleveldomain

iitm.ac.in.

Page 6: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

Root Domain

6

10inUSA1inNetherlands1inSweden1inJapanWhyonly13rootservers?567mirroredrootservers(9mirrorsinIndia–2015)(3Jrootservers;2Lrootservers;1I,1K,1F,andDrootserver)

https://internetdemocracy.in/wp-content/uploads/2016/03/Dr.-Anja-Kovacs-and-Rajat-Rai-Handa-India-at-the-Internets-Root.pdf

Page 7: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

Top Level Domains

7

.com .gov .edu .in

gov ernet ac res co

iitmiitkiisciitb

Topleveldomain

iitm.ac.in.

1547asonJuly2017EachTLDismanagedbydesignatedentitiescalledregistries.(forexample:.com,.netismanagedbyVerisign;.inismanagedbyNationalInternetExchangeofIndia)

https://en.wikipedia.org/wiki/INRegistry

Page 8: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

Top Level Domains

8

.com .gov .edu .in

gov ernet ac res co

iitmiitkiisciitb

Topleveldomain

iitm.ac.in.

1547asonJuly2017

https://en.wikipedia.org/wiki/INRegistry

Page 9: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

DNS Zone

9

.com

example

usaukfrance

Zone:Isadomain(orsubdomain)thatbranchesisservedbyaNameserver.Azonemaybeanentiredomainwithallitschilddomains,oraportionofadomain.Azonecanbetheentiresubtreestartingatexample.comOrthecompanymaydecidetohaveseveralsubzones,forexampleoneatusa.example.com

newyork chicago

Page 10: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

Authoritative Name Servers

10

Startofauthority

2authorities.1primaryandtheothersecondary

EachDNSZonehasatleastoneauthoritativenameserverthatpublishesinformationaboutthatzone.Theyarecalled`authoritative’becausetheyprovideoriginalandanswerstoDNSqueriesasopposedtoobtaininganswersfromotherDNSservers.

Page 11: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

DNS Query Process

11

Page 12: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

Local DNS Server and Iterative Query Process

TheiterativeprocessstartsfromtheROOTServer.Ifitdoesn’tknowtheIPaddress,itsendsbacktheIPaddressofthenameserversofthenextlevelserver(.NETserver)andthenthelastlevelserver(example.net)whichprovidestheanswer.

Page 13: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

DNS Query Process

13

http://www.iitm.ac.in Enteredinweb-browser

LocalSystem:Lookup/etc/hostsfile.Canthe/etc/hostsfileresolve(havetheIPaddress)forwww.iitm.ac.in?

1

Page 14: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

DNS Query Process

14

http://www.iitm.ac.in Enteredinweb-browser

LocalDNSServer:LookupthelocalDNSserver(serverpresentintheLAN).HowtoidentifytheIPaddressoftheLocalDNSserver?(/etc/resolv.conf)Thisneedstobeconfiguredor,canbefound,ifthesystemisconfiguredforDHCP,thenthisfileisautomaticallymodified.IfthelocalDNSservercanresolvetheaddress;thenwearedone.Else,theresolverwouldbeactivated.TheresolverwouldneedtoqueryanotherDNSserver,higherupinthehierarchy.

2

Page 15: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

DNS Query Process

15

http://www.iitm.ac.in.

ResolverinLocalDNSwillquerytheRootNameServerà(fromresolver)WhatistheIPaddressofwww.iitm.ac.inß(fromrootserver)Idon’tknowtheanswer,youcanaskanyoftheseauthorities.

3

Directlysendthequerytothisserver.

Page 16: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

DNS Query Process

16

http://www.iitm.ac.in.

ResolverinLocalDNSwillquerytheTLDà(fromresolver)WhatistheIPaddressofwww.iitm.ac.inß(return)Idon’tknowtheanswer,youcanaskanyoftheseauthorities.

4

Page 17: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

DNS Query Process

17

http://www.iitm.ac.in.

ResolverinLocalDNSwillquerythenextlevelNSàWhatistheIPaddressofwww.iitm.ac.inßTheSOAisdns1.iitm.ac.in.

5

Page 18: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

DNS Cache

•  ThelocalDNSserverwillcacheallresponsesfromotherDNSservers(toreducequeries)

•  TTLavailablewithallresponses,whichdetermineswhentheentrywouldberemovedfromcache

18TTL

Page 19: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

DNS Cache

• Duetocaching•  Mostresolverqueriesdonotneedaquerytotherootserver•  2%ofallqueriestotheroot-serversarelegitimate

•  75%wereduetoincorrectornon-existentcaching•  12.5%tounknownTLDs•  7%wereforlookupstoIPaddresses,asif,theyweredomainnames

19https://en.wikipedia.org/wiki/Root_name_server

Page 20: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

Set Up DNS Zones on Local DNS Server Ø  UtilityinLinux:bind9Ø  Createzones:CreatetwozoneentriesintheDNSserverbyaddingthem

to/etc/bind/named.conf.

Forreverselookup(IPàhostname).

Forforwardlookup(HostnameàIP).

Page 21: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

Zone File for Forward Lookup /etc/bind/example.net.db (Thefilenameisspecifiedinnamed.conf)

@:Representstheoriginspecifiedinnamed.conf(stringafter“zone”)[example.net]

Page 22: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

Zone File for Reverse Lookup

/etc/bind/192.168.0.db:(Thefilenameisspecifiedinnamed.conf)

Page 23: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

Testing the setup

NeedtoensurethatResolv.confispointingtotherecentlysetupDNSserver

Page 24: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

DNS Queries

24http://www.zytrax.com/books/dns/ch15/

Page 25: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

DNS Query Format

25http://www.zytrax.com/books/dns/ch15/

MessageHeaderSentinthequeryandreflectedbackbytheresponse

QR=0query;QR=1response

0:query,1:inversequery;2:status

AuthoritativeAnswer

Page 26: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

DNS Question Section

26http://www.zytrax.com/books/dns/ch15/

QuestionSection

Page 27: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

DNS Question Section

27http://www.zytrax.com/books/dns/ch15/

AnswerSection

Page 28: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

DNS Question Section

28http://www.zytrax.com/books/dns/ch15/

AuthoritySection

ThissectionmentionstheserversthataretheultimateauthorityforansweringDNSqueries.Answers,maybeobtainedfromthecacheofotherDNSservers.Canbeusedtocheckwiththeauthoritativeresponse.

Page 29: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

Attacks on Local DNS Servers Cache Poisoning Attacks

29

Usermachine

LocalDNSserver DNShierarchy

1 234

Page 30: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

Attacks on Local DNS Servers Cache Poisoning Attacks

30

Usermachine

LocalDNSserver DNShierarchy

1 2

spoofedresponse

spoofedresponse

Page 31: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

Attacks on Local DNS Servers Cache Poisoning Attacks

31

Usermachine

LocalDNSserver DNShierarchy

1 2

spoofedresponse

spoofedresponse

Damagelimited;usermachinedoesnotstoretheresult Considerabledamage;DNSstoresthe

responseanditcanaffectallsystemsinthenetworkforalongtime

Cacheispoisoned

Page 32: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

Attacks on Local DNS Servers Cache Poisoning Attacks

32

Usermachine

LocalDNSserver DNShierarchy

1 2

spoof

Cacheispoisoned

www.example.net

3

sniff

4

Page 33: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

Local DNS Cache Poisoning Attack Goal:ForgeDNSrepliesafterseeingaqueryfromLocalDNSServerTechnique:SniffingandSpoofing

Page 34: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

Local DNS Cache Poisoning Attack

Result

Attack

Page 35: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

Inspect the Cache

●  Run“sudo rndc dumpdb –cache”andcheckthecontentsof“/var/cache/bind/dump.db”.

●  Cleanthecacheusing“sudo rndc flush”beforedoingtheattack.

Page 36: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

Targeting the Authority section

Cantargettheauthoritysection

ns.attacker.net

AnyDNSquerysenttothelocalDNSserverwillbe(ifneeded)directedtotheattacker’sns.attacker.net

Page 37: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

Attacks on Local DNS Servers Cache Poisoning Attacks

37

LocalDNSserver DNShierarchy

1 2

spoof

Cacheispoisoned

www.example.net

3

Whatifwecan’tsniffandcanonlyspoof

Page 38: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

Cache Poisoning Without Sniffing

38

Twodifficultiesincreatingavalidspoof:1.  NeedtoguessthelocalDNSserver’ssourceport(2^16possibilities)2.  TheresponseshouldhavethesameMessageIDastheDNSqueryinstep(2).

(Bruteforceattack2^32àat1000spoofedqueries/second,itwilltake50daystotryall2^32possibilities

Page 39: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

Further Difficulties: the Local DNS server’s cache

39

LocalDNSserver DNShierarchy

1 2

www.example.net

3

cache

5

46

7

Iftherealresponse(3)arrivesanditiscached(4).Thensubsequentquerieswillreadoffthecache(5à6à7)andnoqueryismadefromtheLocalDNS.Thus,tomakeanothertry,theattackershouldwaittillthecacheisflushed.

Page 40: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

Flaw in the Protocol ● Whenlookingupsiblingnameslike1.google.com,and2.google.com.

○  Attackerscandothisandsaythey’retheofficialserverforwww.google.com,tellingthelocalDNSserverwhatwww.needstobe,andthelocalDNSwillbelievetheattacker.

40https://duo.com/blog/the-great-dns-vulnerability-of-2008-by-dan-kaminsky

Page 41: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

Kaminsky Attack

41

HowtokeeptryingspoofedDNSresponses(2^32times)withoutworryingaboutthecacheeffect?

Kaminsky’sIdea:•  Askadifferentquestioneverytime,socachingtheanswerdoesnotmatter,andthelocalDNSserverwillsendoutanewqueryeachtime.

•  ProvideforgedanswerintheAuthoritysection

Page 42: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

Kaminsky Attack

42

Page 43: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

The Kaminsky Attack: A Sample Response

Thisrandomnamewillchangefor

eachattackattempt

Thisanswerdoesnotmatter

ThisiswhatwewantthelocalDNSservertocache

TelltheDNSservertousethisoneasthenameserverfortheexample.comdomain

Page 44: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

Spoofing Replies: IP and UDP headers

DNSResponseAnswerisauthoritative

Page 45: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

Spoofing Replies: DNS Header and Payload

Page 46: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

Digital Signatures

46

Page 47: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

Protection Against DNS Cache Poisoning Attacks DNSSEC●  DNSSECisasetofextensiontoDNS,aimingtoprovideauthentication

andintegritycheckingonDNSdata.●  WithDNSSEC,allanswersfromDNSSECprotectedzonesaredigitally

signed.●  Bycheckingthedigitalsignatures,aDNSresolverisabletocheckifthe

informationisauthenticornot.●  DNScachepoisoningwillbedefeatedbythismechanismasanyfake

datawillbedetectedbecausetheywillfailthesignaturechecking.

Page 48: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

Protection Using DNSSEC

Page 49: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

Protection Using TLS/SSL TransportLayerSecurity(TLS/SSL)protocolprovidesasolutionagainstthecachepoisoningattacks.●  AftergettingtheIPaddressforadomainname(www.example.net)

usingDNSprotocol,acomputerwillasktheowner(server)oftheIPaddresstoprovethatitisindeedwww.example.net.

●  Theserverhastopresentapublic-keycertificatesignedbyatrustedentityanddemonstratesthatitknowsthecorrespondingprivatekeyassociatedwithwww.example.net(i.e.,itistheownerofthecertificate).

●  HTTPSisbuiltontopofTLS/SSL.ItdefeatsDNScachepoisoningattacks.

Page 50: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

DNSSEC versus TLS/SSL ●  BothDNSSECandTLS/SSLarebasedonthepublickeytechnology,but

theirchainsoftrustaredifferent.●  DNSSECprovideschainoftrustusingDNSzonehierarchy,so

nameserversintheparentzonesvouchforthoseinthechildzones.●  TLS/SSLreliesonPublicKeyInfrastructurewhichcontainsCertificate

Authoritiesvouchingforothercomputers.

Page 51: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

Denial of Service Attacks on Root Servers AttacksontheRootandTLDServers:Rootnameservers:Iftheattackerscanbringdowntheserversoftherootzone,theycanbringdowntheentireInternet.However,attackrootserversisdifficult:●  Therootnameserversarehighlydistributed.Thereare13(A,B….M)rootnameservers(server

farm)consistingofalargenumberofredundantcomputerstoprovidereliableservices.●  AsthenameserversfortheTLDsareusuallycachedinthelocalDNSservers,therootservers

neednotbequeriedtillthecacheexpires(48hrs).Attacksontherootserversmustlastlongtoseeasignificanteffect.

Page 52: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

Denial of Service Attacks on TLD Servers NameserversfortheTLDsareeasiertoattack.TLDssuchasgov,com,netetchavequiteresilientinfrastructureagainstDOSattacks.ButcertainobscureTLDslikecountry-codeTLDsdonothavesufficientinfrastructure.Duetothis,theattackerscanbringdowntheInternetofatargetedcountry.

Page 53: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

Attacks on Nameservers of a Particular Domain Dynnetwork:In2016,multipleDDoSattackswerelaunchedagainstamajorDNSserviceproviderforcompanieslikeCNN,BBC,HBO,PayPaletc.TheattacksarebelievedtohavebeenlaunchedthroughbotnetconsistingofdifferentIoTdeviceslikeIPcameras,babymonitorsetc.ItcausedmajorInternetservicesunavailable.

Page 54: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

Mirai Botnet Malware ● NumberofIoTdevicesincreasingatarapidrate●  Thesedevicesarecharacterizedby

○  Lowprofile○  Lessuserinteractions○  Securityoftencompromised(forbetterperformance/smallerprofile)○  Notalwaysup-to-datewithsecuritypatches

● MalwarewithIoTdevicesastargets○  BashlightandMiraiarethemostpopular○  PNScan,targetsx86platforms.

■  Trytodeterminerouterloginbaedonaspecialdictionary■  Connectusingsshconnectionusingpredefinedusercredentials

54

Lowhangingfruitforhackers

Page 55: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

Mirai BotNet Malware

55TheMiraiBotnetandtheIoTZombieArmies,2017

280Gbpsmaxflooding50,000uniqueIps164countries

Page 56: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

Mirai BotNet Malware

56TheMiraiBotnetandtheIoTZombieArmies,2017

Bots:ELFimages,codedinC,Responsiblefor(1)  Propagationofthemalware(2)  Theactualattack

Bots

TargetsLinuxbasedIoTdevices.MostlybusyboxsystemslikeWebcams,Cameras,etc.

Page 57: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

Mirai BotNet Malware

57TheMiraiBotnetandtheIoTZombieArmies,2017

Infiltration

Bots

EverybotgeneratesrandomIPsandtriestoconnecttoPort23(telnet)orport2323(alternatetelnetport)Bruteforcedictionarysearchforvalidusernamesandpasswordsthatwillpermitlogin.Thedictionaryisbuiltof62possibleusername/passwords.Theseinclude,adminaccountcredentials,debuglogins,usernameswithnopasswords,etc.

SomeIPaddressesareblacklisted.Loopback,internalnetworks,multicastnetworks,USpostalservcie,DoD,GE,HP,IANA,

Page 58: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

Mirai BotNet Malware

58TheMiraiBotnetandtheIoTZombieArmies,2017

Onasuccessfullogin:•  Trytoestablishashell.Especiallyinterestedinbusyboxshell•  Reportasuccessfullogintothereportserver.

(doesnottrytochangethepasswordinthenewvictim)

Page 59: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

Mirai BotNet Malware

59TheMiraiBotnetandtheIoTZombieArmies,2017

Infrastructure

CommandandControl.Managementserver.ImplementedinGo.Atanytime,itcangetalistofactivebotsfromthereportserver.Itcan,also,atanytime,instructtheloadertoloadmalwareintothebot.Loader,dependingonthehardwarearchitectureofthebot,instructsittodownload(usingwgetortftp)andexecuterequiredbinaryimageofthemalware.

Page 60: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

Mirai BotNet Malware

60TheMiraiBotnetandtheIoTZombieArmies,2017

Infrastructure

Loader,dependingonthehardwarearchitectureofthebot,instructsittodownload(usingwgetortftp)andexecuterequiredbinaryimageofthemalware.Beforethisisdone,thebotneedstoknowapartitionthatiswriteable.Iftftporwgetclientsarenotavailable,themalwarewillemployechocommandstodynamicallycreatetheexecutable.

18hardwarevariantssupportedincludingARM,MIPS,x86,SPARC

Page 61: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

Mirai BotNet Malware

61

Infrastructure

NewlyformedbotestablishesconnectionwithC&C.Periodicheartbeatsbetweenthetwo.Otheractivitiesinthebot:*memoryscrapingtoidentifyothermalwarepresentinthebot.Iffound,killtheprocess.(wantstobetheownthedevice)•  Deletesitselffromthepersistentstorage.WillonlybeavailableinRAM(filelessmalware)•  Monitorsthewatchdogtimertodefendagainstsystemhangsandreboots.•  Oncommand,canstartavarietyoffloods:SYN,ACK,UDP,GRE,DNS,STOMP,ETH.Applicationlayerflooding.25,000SYNpacketspersecond.

Page 62: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

Mirai BotNet Malware

62

Infrastructure

AllbotnetsattackthetargetoncommandbyfloodingSYN,ACK,UDP,GREIP,ETH,STOMP,DNS.Applicationlevelflooding.Peak:620GbpsControls:0.5millionIOTdevicesOnraspberryPi3:25000packetspersecond

Page 63: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

Other Mirai Variants ● USuniversity(Feb2017)● Windowsbasedstrain● Miraistrainusedforbitcoinmining

63

Page 64: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

Detection ●  Patternsofcommunications

○  Hugecommunicationonports23,2323,22forauthorizationpurposes

○  Frequentexchangeoftrafficwithinfrastructure

○  Surgeofegresstrafficthroughoutthecourseoftheattack

64

Page 65: Domain Name Systemschester/courses/19e_ns/slides/5_DNS.pdf · A zone may be an entire domain with all its child domains, or a portion of a domain. A zone can be the entire subtree

Mitigation Short-termmitigations●  BlockingTCPportsusedforprobingandbruteforcingthedevice●  FilteringegressandingresspacketsbyTCPrules

Betterdesignstrategies●  Leastprivilegeimplementations●  capabilitybasedsystems● Microkernel/Unikernelbasedapproaches(Linuxistoolargeforembeddedapplications)

65


Recommended