33
NetFlow Based Botnet Detection SEYEDALIREZA VAZIRI – RIPE 75

NetFlowBased Botnet Detection - ripe75.ripe.net · Agenda • Botnets, Usage, History • Modern Botnets • Botnet detection and countermeasure • Netflowbased detection • Machine

  • Upload
    ngomien

  • View
    224

  • Download
    2

Embed Size (px)

Citation preview

Page 1: NetFlowBased Botnet Detection - ripe75.ripe.net · Agenda • Botnets, Usage, History • Modern Botnets • Botnet detection and countermeasure • Netflowbased detection • Machine

NetFlow BasedBotnetDetectionSEYEDALIREZA VAZIRI – RIPE75

Page 2: NetFlowBased Botnet Detection - ripe75.ripe.net · Agenda • Botnets, Usage, History • Modern Botnets • Botnet detection and countermeasure • Netflowbased detection • Machine

AboutMe

SeyedAlireza Vaziri

• Network/SystemEngineersince2007• SecurityAdministratorsince2016• MachineLearningnewbie

SEYEDALIREZA VAZIRI - RIPE 75 2

Page 3: NetFlowBased Botnet Detection - ripe75.ripe.net · Agenda • Botnets, Usage, History • Modern Botnets • Botnet detection and countermeasure • Netflowbased detection • Machine

Agenda• Botnets,Usage,History• ModernBotnets• Botnetdetectionandcountermeasure• Netflow baseddetection• Machinelearningclassification• Questions

SEYEDALIREZA VAZIRI - RIPE 75 3

Page 4: NetFlowBased Botnet Detection - ripe75.ripe.net · Agenda • Botnets, Usage, History • Modern Botnets • Botnet detection and countermeasure • Netflowbased detection • Machine

BotVulnerableandunattendedDevices:

• Computers

• Smartphones

• IoT (e.g.CCTV,xDSL Modem)

SEYEDALIREZA VAZIRI - RIPE 75 4

Page 5: NetFlowBased Botnet Detection - ripe75.ripe.net · Agenda • Botnets, Usage, History • Modern Botnets • Botnet detection and countermeasure • Netflowbased detection • Machine

BotnetUsageNetworkofbotsisnamedBotnetandbeingused

for:

• Spams

• DDoS

• MalwareDistribution

SEYEDALIREZA VAZIRI - RIPE 75 5

Page 6: NetFlowBased Botnet Detection - ripe75.ripe.net · Agenda • Botnets, Usage, History • Modern Botnets • Botnet detection and countermeasure • Netflowbased detection • Machine

BotnetHistory• Marina

• Zeus

• Cutwail

• Mirai

SEYEDALIREZA VAZIRI - RIPE 75 6

Page 7: NetFlowBased Botnet Detection - ripe75.ripe.net · Agenda • Botnets, Usage, History • Modern Botnets • Botnet detection and countermeasure • Netflowbased detection • Machine

BotnetDictionary• Bot

• Botnet

• CnC (CommandandControl)

• Botmaster

SEYEDALIREZA VAZIRI - RIPE 75 7

Page 8: NetFlowBased Botnet Detection - ripe75.ripe.net · Agenda • Botnets, Usage, History • Modern Botnets • Botnet detection and countermeasure • Netflowbased detection • Machine

BotnetDiagram

SEYEDALIREZA VAZIRI - RIPE 75 8

Page 9: NetFlowBased Botnet Detection - ripe75.ripe.net · Agenda • Botnets, Usage, History • Modern Botnets • Botnet detection and countermeasure • Netflowbased detection • Machine

ModernBotnetDiagram

SEYEDALIREZA VAZIRI - RIPE 75 9

Page 10: NetFlowBased Botnet Detection - ripe75.ripe.net · Agenda • Botnets, Usage, History • Modern Botnets • Botnet detection and countermeasure • Netflowbased detection • Machine

ModernBotnet• P2PCommunication

• NoSPOF(SinglePointofFailure)

• Encryption

• Randomness

• Obfuscation

SEYEDALIREZA VAZIRI - RIPE 75 10

Page 11: NetFlowBased Botnet Detection - ripe75.ripe.net · Agenda • Botnets, Usage, History • Modern Botnets • Botnet detection and countermeasure • Netflowbased detection • Machine

Botlifecycle

Execute Command

Listen For Command

Join CnCInfection

ReportCnC

Retrieve Payload

SEYEDALIREZA VAZIRI - RIPE 75 11

Page 12: NetFlowBased Botnet Detection - ripe75.ripe.net · Agenda • Botnets, Usage, History • Modern Botnets • Botnet detection and countermeasure • Netflowbased detection • Machine

BotnetDetectionCurrentmethods:

• IDPS

• DPI

• SignatureBased,AnomalyBased

SEYEDALIREZA VAZIRI - RIPE 75 12

Page 13: NetFlowBased Botnet Detection - ripe75.ripe.net · Agenda • Botnets, Usage, History • Modern Botnets • Botnet detection and countermeasure • Netflowbased detection • Machine

DealingwithBotnets

InternalWeareattackingothers

ExternalOthersattackingus

SEYEDALIREZA VAZIRI - RIPE 75 13

Page 14: NetFlowBased Botnet Detection - ripe75.ripe.net · Agenda • Botnets, Usage, History • Modern Botnets • Botnet detection and countermeasure • Netflowbased detection • Machine

NetFlow/S-Flow/IPFIX• src/dst IP/Port

• Packet

• Bytes

• ASN

• Duration

SEYEDALIREZA VAZIRI - RIPE 75 14

Page 15: NetFlowBased Botnet Detection - ripe75.ripe.net · Agenda • Botnets, Usage, History • Modern Botnets • Botnet detection and countermeasure • Netflowbased detection • Machine

BlacklistListsofCnC IPaddresses:

• ISC

• CYMRU

• Spamhaus

• Manymore

SEYEDALIREZA VAZIRI - RIPE 75 15

Page 16: NetFlowBased Botnet Detection - ripe75.ripe.net · Agenda • Botnets, Usage, History • Modern Botnets • Botnet detection and countermeasure • Netflowbased detection • Machine

ELKStackPowerfull SearchEngine:

• Elasticsearch,Logstash,Kibana

• OpenSource

• Handlemillionsofrecordswithease

• Scalable

SEYEDALIREZA VAZIRI - RIPE 75 16

Page 17: NetFlowBased Botnet Detection - ripe75.ripe.net · Agenda • Botnets, Usage, History • Modern Botnets • Botnet detection and countermeasure • Netflowbased detection • Machine

Netflow toELK

NetFlow Logstash Elasticsearch Kibana

SEYEDALIREZA VAZIRI - RIPE 75 17

Page 18: NetFlowBased Botnet Detection - ripe75.ripe.net · Agenda • Botnets, Usage, History • Modern Botnets • Botnet detection and countermeasure • Netflowbased detection • Machine

Logstash Filtering• BlacklistIPDictionaries

• Markingmalicioustraffic

• GeoIP translation

SEYEDALIREZA VAZIRI - RIPE 75 18

Page 19: NetFlowBased Botnet Detection - ripe75.ripe.net · Agenda • Botnets, Usage, History • Modern Botnets • Botnet detection and countermeasure • Netflowbased detection • Machine

Logstash Diagram

Logstash • Capturedflows

GeoIP • AddExtraInformation

Blacklist• MarkMalicioustraffic

SEYEDALIREZA VAZIRI - RIPE 75 19

Page 20: NetFlowBased Botnet Detection - ripe75.ripe.net · Agenda • Botnets, Usage, History • Modern Botnets • Botnet detection and countermeasure • Netflowbased detection • Machine

CorporateMaliciousTraffic

SEYEDALIREZA VAZIRI - RIPE 75 20

Page 21: NetFlowBased Botnet Detection - ripe75.ripe.net · Agenda • Botnets, Usage, History • Modern Botnets • Botnet detection and countermeasure • Netflowbased detection • Machine

MachineLearningFindingSimilarFlows

• SupervisedLearning

• InfectedFlowsasTrain/Testdata

• Classifyflowsbasedonlearneddata

SEYEDALIREZA VAZIRI - RIPE 75 21

Page 22: NetFlowBased Botnet Detection - ripe75.ripe.net · Agenda • Botnets, Usage, History • Modern Botnets • Botnet detection and countermeasure • Netflowbased detection • Machine

FeaturesforML• Maliciousmarkedtraffic• SRCIP• DSTport• SRCport• Byte• Packets• Duration• ASN

SEYEDALIREZA VAZIRI - RIPE 75 22

Page 23: NetFlowBased Botnet Detection - ripe75.ripe.net · Agenda • Botnets, Usage, History • Modern Botnets • Botnet detection and countermeasure • Netflowbased detection • Machine

TargetsforML• MaliciousFlows

• Zeus

• Mirai

• anyothermaliciousflow

SEYEDALIREZA VAZIRI - RIPE 75 23

Page 24: NetFlowBased Botnet Detection - ripe75.ripe.net · Agenda • Botnets, Usage, History • Modern Botnets • Botnet detection and countermeasure • Netflowbased detection • Machine

ReduceFalsePositives• TrustedFlows

• DNS

• HTTP

• HTTPS

• …

SEYEDALIREZA VAZIRI - RIPE 75 24

Page 25: NetFlowBased Botnet Detection - ripe75.ripe.net · Agenda • Botnets, Usage, History • Modern Botnets • Botnet detection and countermeasure • Netflowbased detection • Machine

Scikit Learn• PythonbasedMLlibrary

• Easytouse

SEYEDALIREZA VAZIRI - RIPE 75 25

Page 26: NetFlowBased Botnet Detection - ripe75.ripe.net · Agenda • Botnets, Usage, History • Modern Botnets • Botnet detection and countermeasure • Netflowbased detection • Machine

Zeus(UDP)CaseStudy

SEYEDALIREZA VAZIRI - RIPE 75 26

Classifier Dataset Train/Test AccuracyKNN– K=7 60000 50/50 82.9%KNN – K=7 80000 50/50 86.8%KNN– K=7 100000 50/50 89.3%

More data beats better algorithm!

Page 27: NetFlowBased Botnet Detection - ripe75.ripe.net · Agenda • Botnets, Usage, History • Modern Botnets • Botnet detection and countermeasure • Netflowbased detection • Machine

Whynot100%

SEYEDALIREZA VAZIRI - RIPE 75 27

• Flowsareunidirectional

• Flowsarenotclassifiedintolifecyclesteps

• Timeoutsandretry

• SpeedandBandwidth

• DifferentversionsofZeus

Page 28: NetFlowBased Botnet Detection - ripe75.ripe.net · Agenda • Botnets, Usage, History • Modern Botnets • Botnet detection and countermeasure • Netflowbased detection • Machine

FinalDiagram

NetFlow Logstash Elasticsearch

ScikitBlacklistUpdate

SEYEDALIREZA VAZIRI - RIPE 75 28

Page 29: NetFlowBased Botnet Detection - ripe75.ripe.net · Agenda • Botnets, Usage, History • Modern Botnets • Botnet detection and countermeasure • Netflowbased detection • Machine

ASNwhitelist

• Google

• Facebook

• Akamai

• Telegram

SEYEDALIREZA VAZIRI - RIPE 75 29

Page 30: NetFlowBased Botnet Detection - ripe75.ripe.net · Agenda • Botnets, Usage, History • Modern Botnets • Botnet detection and countermeasure • Netflowbased detection • Machine

ToDo

• BidirectionalandrelatedFlows

• ASN/Prefixreputation/anomaly

• Actionsfordetectedbotnets

SEYEDALIREZA VAZIRI - RIPE 75 30

Page 31: NetFlowBased Botnet Detection - ripe75.ripe.net · Agenda • Botnets, Usage, History • Modern Botnets • Botnet detection and countermeasure • Netflowbased detection • Machine

Finalwords

• Netflow ischeapandhandy

• Machinelearningisamazing

• MListhetoolthatwillrescueusfrominternet

threats

SEYEDALIREZA VAZIRI - RIPE 75 31

Page 32: NetFlowBased Botnet Detection - ripe75.ripe.net · Agenda • Botnets, Usage, History • Modern Botnets • Botnet detection and countermeasure • Netflowbased detection • Machine

aliereza/flyzer

SEYEDALIREZA VAZIRI - RIPE 75 32

Page 33: NetFlowBased Botnet Detection - ripe75.ripe.net · Agenda • Botnets, Usage, History • Modern Botnets • Botnet detection and countermeasure • Netflowbased detection • Machine

QuestionsComments

SEYEDALIREZA VAZIRI - RIPE 75 33