Download - Defending against malicious peripherals with Cinch · Peripherals’ firmware can be modified with BadUSB [Nohl and Lell, Black Hat 2014] USB architecture from 30,000 feet Your machine

Transcript
Page 1: Defending against malicious peripherals with Cinch · Peripherals’ firmware can be modified with BadUSB [Nohl and Lell, Black Hat 2014] USB architecture from 30,000 feet Your machine

DefendingagainstmaliciousperipheralswithCinch

PresentedbyAvestaHojjatiCS598

ComputerSecurityinthePhysicalWorldUniversityofIllinois

BasedonslidesbySebastianAngel

Page 2: Defending against malicious peripherals with Cinch · Peripherals’ firmware can be modified with BadUSB [Nohl and Lell, Black Hat 2014] USB architecture from 30,000 feet Your machine

Citation

• S.Angel,R.Wahby,M.Howald,J.Leners,M.Spilo,Z.Sun,A.Blumberg,M.Walfish."DefendingagainstMaliciousPeripheralswithCinch."USENIXSecurity2016

Page 3: Defending against malicious peripherals with Cinch · Peripherals’ firmware can be modified with BadUSB [Nohl and Lell, Black Hat 2014] USB architecture from 30,000 feet Your machine

Peripherals’firmwarecanbemodifiedwithBadUSB [Nohl andLell,BlackHat2014]

USBarchitecturefrom30,000feet

Yourmachine

Drivers

HostController Hub

Governmentagenciesinterceptandmodifyshipments[GlennGreenwald,TheGuardian2014]

Page 4: Defending against malicious peripherals with Cinch · Peripherals’ firmware can be modified with BadUSB [Nohl and Lell, Black Hat 2014] USB architecture from 30,000 feet Your machine

Peripheralscanexploitdrivervulnerabilities

13vulnerabilitiesinLinux’sUSBstackreportedin2016alone

Yourmachine

Drivers

HostController

$@$#$#%$%

Hub

Page 5: Defending against malicious peripherals with Cinch · Peripherals’ firmware can be modified with BadUSB [Nohl and Lell, Black Hat 2014] USB architecture from 30,000 feet Your machine

PeripheralscanleverageDMAtoattackOSes

Yourmachine

Drivers

HostController

write“evil”to<kerneladdress>

Inception [Maartmann-Moe2014], Funderbolt [BlackHat2013]Hu

b

Page 6: Defending against malicious peripherals with Cinch · Peripherals’ firmware can be modified with BadUSB [Nohl and Lell, Black Hat 2014] USB architecture from 30,000 feet Your machine

UsersReallyDoPluginUSBDrivesTheyFind[Tischer etal.,S&P2016]

Peripheralscanlieabouttheiridentity

Yourmachine

Drivers

HostController

Hi,whatareyou?

Hub

I’makeyboardJ

Page 7: Defending against malicious peripherals with Cinch · Peripherals’ firmware can be modified with BadUSB [Nohl and Lell, Black Hat 2014] USB architecture from 30,000 feet Your machine

Hubsbroadcastmessagesdownstream

Compromisedhubscaneavesdropandmodifyalltraffic

Yourmachine

Drivers

HostController

File_for_SSD.txt

Hub

File_for_SSD.txt

Page 8: Defending against malicious peripherals with Cinch · Peripherals’ firmware can be modified with BadUSB [Nohl and Lell, Black Hat 2014] USB architecture from 30,000 feet Your machine

• Don’tuseacomputer

• Closealltheports

Okay,sowhatcanwedo?

Page 9: Defending against malicious peripherals with Cinch · Peripherals’ firmware can be modified with BadUSB [Nohl and Lell, Black Hat 2014] USB architecture from 30,000 feet Your machine

Aspartofthisinteraction,ourmachineroutinely:

• Determinestowhomitistalking

• Preventseavesdroppinganddatatampering

• Defendsagainstmalicioustraffic

Ourmachineinteractswithuntrusteddeviceseveryday…ontheInternet!

Page 10: Defending against malicious peripherals with Cinch · Peripherals’ firmware can be modified with BadUSB [Nohl and Lell, Black Hat 2014] USB architecture from 30,000 feet Your machine

Howdoweapplythearsenalofnetworksecuritytoolstoperipheralbuses?

AndhowcanthisbedonewithminorornomodificationstoOSesandexistingdevices…

…whilekeepingthebusatarm’slength?Yourmachine

Drivers

HostController

Insertnetworksecuritylogicsomewherehere

Page 11: Defending against malicious peripherals with Cinch · Peripherals’ firmware can be modified with BadUSB [Nohl and Lell, Black Hat 2014] USB architecture from 30,000 feet Your machine

• Makingperipheralbuseslook“remote”,preventingdirectactionwiththerestofthecomputer

• Trafficbetweenthe“remote”devicesandrestofthecomputershouldtravelthrougha“narrowchokepoint”,thisisessentialtoapplydefense

• ThesolutionshouldNOTrequiremodificationofthebus• Portability,nore-design,orre-implementationfordifferentOSes• Flexibilityandextensibility• Imposingreasonableoverhead

Designrequirements

Page 12: Defending against malicious peripherals with Cinch · Peripherals’ firmware can be modified with BadUSB [Nohl and Lell, Black Hat 2014] USB architecture from 30,000 feet Your machine

• Cinchiseffective(butnotperfect!)againstthethreatsdescribed

• Cinchisportableandbackwards-compatible– WorkstransparentlyacrossOSes– RequiresnodriverorUSBprotocolmodifications

• Cinchseparatesthebusfromyourmachine,creatinganenforcementpoint

CinchbringsnetworkdefensestoUSB

Yourmachine

Drivers

Host

Controller

peripherals

Hub

Enforcer

Page 13: Defending against malicious peripherals with Cinch · Peripherals’ firmware can be modified with BadUSB [Nohl and Lell, Black Hat 2014] USB architecture from 30,000 feet Your machine

• HowdidtheybuildCinch?

• WhatdefensescanbebuiltonCinch?

• Howwelldodefensesworkandwhatistheircost?

Intherestofthistalk…

Page 14: Defending against malicious peripherals with Cinch · Peripherals’ firmware can be modified with BadUSB [Nohl and Lell, Black Hat 2014] USB architecture from 30,000 feet Your machine

• HowdidtheybuildCinch?

• WhatdefensescanbebuiltonCinch?

• Howwelldodefensesworkandwhatistheircost?

Intherestofthistalk…

Page 15: Defending against malicious peripherals with Cinch · Peripherals’ firmware can be modified with BadUSB [Nohl and Lell, Black Hat 2014] USB architecture from 30,000 feet Your machine

• Whereandhowcanonecreatealogicalseparationbetweenthebusandthehost,whilearrangingforanexplicitcommunicationchannelthatapolicyenforcementmechanismcaninterposeon?

• Howcanoneinstantiatethisseparationandchannelwithnomodificationstobusstandards,OSes,ordriverstacks?

Whatdoweneedtoanswer?

Page 16: Defending against malicious peripherals with Cinch · Peripherals’ firmware can be modified with BadUSB [Nohl and Lell, Black Hat 2014] USB architecture from 30,000 feet Your machine

Yourmachine

DriversHu

b

HostCon

troller

Yourmachine

HostController

Drivers

Hub

Whatwehavetoday

Whatwewant

Page 17: Defending against malicious peripherals with Cinch · Peripherals’ firmware can be modified with BadUSB [Nohl and Lell, Black Hat 2014] USB architecture from 30,000 feet Your machine

Devicescanbeattachedtoanothermachine

Yourmachine

Drivers

sacrificialmachine

HostController

Drivers

Butthisrequiresanadditionalmachine…

Pragmaticchoice:leveragevirtualizationtechnologytoinstantiatethe(sacrificial)machineonthesamehardware

Hubnetwork

Page 18: Defending against malicious peripherals with Cinch · Peripherals’ firmware can be modified with BadUSB [Nohl and Lell, Black Hat 2014] USB architecture from 30,000 feet Your machine

AnIOMMUcanbeusedtorestrictwhereinmemoryadevicemaywrite

VM

Hypervisor

VirtualCard

VM

Hypervisor

IOMMUData

Data Data

Devicecanonlywritetoconfiguredaddresses

RestrictI/OtoVM’saddressspace

Evil

Page 19: Defending against malicious peripherals with Cinch · Peripherals’ firmware can be modified with BadUSB [Nohl and Lell, Black Hat 2014] USB architecture from 30,000 feet Your machine

Yourmachine

HostController

Drivers

Hub

Whatwehavetoday

Yourmachine(VM)

Drivers

sacrificialmachine(VM)

HostController

Drivers

Hubnetwork

Hypervisor

UnderCinch

HypervisorconfiguresIOMMUtomapbustosacrificialmachine

DevicesareattachedtoasacrificialVM

Page 20: Defending against malicious peripherals with Cinch · Peripherals’ firmware can be modified with BadUSB [Nohl and Lell, Black Hat 2014] USB architecture from 30,000 feet Your machine

Yourmachine(VM)

Drivers

sacrificialmachine(VM)

HostController

Drivers

Hub

InterposingonVM-VMcommunication

Enforcer’sdesignisinspiredbytheClickmodularrouter[Kohleretal.,ACMTOCS2000]

Enforcer

Module3 Module2 Module1

Page 21: Defending against malicious peripherals with Cinch · Peripherals’ firmware can be modified with BadUSB [Nohl and Lell, Black Hat 2014] USB architecture from 30,000 feet Your machine

ThearchitectureofCinch

Enforcessecuritypolicy

NormalOSwith

strippeddownUSBSTACK

Driver

Page 22: Defending against malicious peripherals with Cinch · Peripherals’ firmware can be modified with BadUSB [Nohl and Lell, Black Hat 2014] USB architecture from 30,000 feet Your machine

• HowdidtheybuildCinch?

• WhatdefensescanbebuiltonCinch?

• Howwelldodefensesworkandwhatistheircost?

Intherestofthistalk…

Page 23: Defending against malicious peripherals with Cinch · Peripherals’ firmware can be modified with BadUSB [Nohl and Lell, Black Hat 2014] USB architecture from 30,000 feet Your machine

Defense1:Enforcingalloweddevicebehavior

USBspecifications Constraintson:• Packetformats• Individualfields• Packetsequences

• Restrictedfieldvalues• Sizeswithinallowedrange• Properencoding(e.g.UTF-16)

Page 24: Defending against malicious peripherals with Cinch · Peripherals’ firmware can be modified with BadUSB [Nohl and Lell, Black Hat 2014] USB architecture from 30,000 feet Your machine

Defense1:Enforcingalloweddevicebehavior

USBspecifications Constraintson:• Packetformats• Individualfields• Packetsequences

• Statesbasedonhistory• Transitionsbasedonincomingpackets

Allow/Droppacket

Page 25: Defending against malicious peripherals with Cinch · Peripherals’ firmware can be modified with BadUSB [Nohl and Lell, Black Hat 2014] USB architecture from 30,000 feet Your machine

Defense2:Filteringknownexploits

Download/populatedatabasewithknownmalicioussignatures

Inspectincomingtrafficformatches

Allow/Droppacket

Page 26: Defending against malicious peripherals with Cinch · Peripherals’ firmware can be modified with BadUSB [Nohl and Lell, Black Hat 2014] USB architecture from 30,000 feet Your machine

• Quickresponsetoanattack– Derivingasignatureisusuallyfasterthanunderstandingtheexploitandfindingtherootcause

• Usefulforclosed-sourceOSes– NoneedtowaitforOSvendorpatchvulnerability

Benefitsofsignature-baseddefenses

Page 27: Defending against malicious peripherals with Cinch · Peripherals’ firmware can be modified with BadUSB [Nohl and Lell, Black Hat 2014] USB architecture from 30,000 feet Your machine

• Cannotpreventzero-dayattacks

• Tensionbetweenprotectionandcompatibility– Exactsignaturesarenotveryeffective– Verygeneralsignatures(e.g.wildcard/regex)canpreventbenigntraffic

• Signaturesdonotfixtheunderlyingproblem

Limitationsofsignature-baseddefenses

Page 28: Defending against malicious peripherals with Cinch · Peripherals’ firmware can be modified with BadUSB [Nohl and Lell, Black Hat 2014] USB architecture from 30,000 feet Your machine

Defense3:authenticationandencryption

Page 29: Defending against malicious peripherals with Cinch · Peripherals’ firmware can be modified with BadUSB [Nohl and Lell, Black Hat 2014] USB architecture from 30,000 feet Your machine

Defense3:authenticationandencryption

Yourmachine(VM)

Drivers

Enforcer

sacrificialmachine(VM)

HostController

Drivers

Hub

Unauthenticatedcleartext communication

Page 30: Defending against malicious peripherals with Cinch · Peripherals’ firmware can be modified with BadUSB [Nohl and Lell, Black Hat 2014] USB architecture from 30,000 feet Your machine

Defense3:authenticationandencryption

AuthenticatedandencryptedcommunicationCleartext

InstallTLSendpointatdeviceandenforcer

Yourmachine(VM)

Drivers

Enforcer

sacrificialmachine(VM)

HostController

Drivers

Hub

Page 31: Defending against malicious peripherals with Cinch · Peripherals’ firmware can be modified with BadUSB [Nohl and Lell, Black Hat 2014] USB architecture from 30,000 feet Your machine

Defense3:authenticationandencryption

CleartextAuthenticatedandencryptedcommunicationCleartext

Existingdevicescanberetrofittedwithanadapter

Yourmachine(VM)

Drivers

Enforcer

sacrificialmachine(VM)

HostController

Drivers

Hub

Page 32: Defending against malicious peripherals with Cinch · Peripherals’ firmware can be modified with BadUSB [Nohl and Lell, Black Hat 2014] USB architecture from 30,000 feet Your machine

• CompliancewiththeUSBspecification– Preventscertaintypesofdriverbugsfrombeingexploited

• Signaturematching– Preventsknownexploitsandcanbeusedasaquickresponse

• Authenticationandencryption– Preventmasqueradingandeavesdroppingonthebus

• Other:Logandreplay,remoteauditing,exportingfunctionalityviahigher-layerprotocols(e.g.,accessflashdrivesviaNFS)

Summaryofdefenses

Page 33: Defending against malicious peripherals with Cinch · Peripherals’ firmware can be modified with BadUSB [Nohl and Lell, Black Hat 2014] USB architecture from 30,000 feet Your machine

• HowdidtheybuildCinch?

• WhatdefensescanbebuiltonCinch?

• Howwelldodefensesworkandwhatistheircost?

Intherestofthistalk…

Page 34: Defending against malicious peripherals with Cinch · Peripherals’ firmware can be modified with BadUSB [Nohl and Lell, Black Hat 2014] USB architecture from 30,000 feet Your machine

• HypervisorisLinuxrunningQEMU/KVM

• EnforcerisaLinuxuser-levelprocessanditiswritteninRust

• USBtransfersareencapsulated/decapsulated inTCP/IP

• TheybuilttheTLSadapteronaBeaglebone Black(arm-basedcomputer)

• Theyimplementedexploitsusingafacedancer21à

Implementationdetails

Page 35: Defending against malicious peripherals with Cinch · Peripherals’ firmware can be modified with BadUSB [Nohl and Lell, Black Hat 2014] USB architecture from 30,000 feet Your machine

Howwelldodefenseswork?

Page 36: Defending against malicious peripherals with Cinch · Peripherals’ firmware can be modified with BadUSB [Nohl and Lell, Black Hat 2014] USB architecture from 30,000 feet Your machine

• TheyimplementedexploitsforexistingUSBdrivervulnerabilities

• Theycarriedouta3-phasepenetrationtestingexercise

• Theyusedafuzzingtooltotest10,000invaliddevices– Summary:Cinch’senforcerpreventsall10,000– Subtlety:NoneofthetestsaffectedamachinewithoutCincheither

EvaluationofCinch’seffectivenesshappensin3ways

Page 37: Defending against malicious peripherals with Cinch · Peripherals’ firmware can be modified with BadUSB [Nohl and Lell, Black Hat 2014] USB architecture from 30,000 feet Your machine

• LinuxCVEsreportedfromJantoJune2016.TheyaffectLinux4.5.1

• 5exploitsthatworkonWindows8.1

[Boteanu andFowler,BlackHatEurope2015]

TheyimplementedexploitsforexistingUSBdrivervulnerabilities

Theirfindings:• 16outof18exploitswerepreventedimmediately

• 2exploitssucceeded,butcanbepreventedwithasignature

Page 38: Defending against malicious peripherals with Cinch · Peripherals’ firmware can be modified with BadUSB [Nohl and Lell, Black Hat 2014] USB architecture from 30,000 feet Your machine

• Phase1:RedteamhasvagueknowledgeofCinch• Phase2:Redteamhasaccesstoapre-configuredCinchbinary• Phase3:RedteamhasCinch’ssourcecode

Theycarriedouta3-phasepenetrationtestingexercise

Theirfindings:

• IncreasedknowledgeofCinch’sfunctionalityresultedinmoreintricateexploits

• Cinchisnotabletopreventpolymorphicattacks

Page 39: Defending against malicious peripherals with Cinch · Peripherals’ firmware can be modified with BadUSB [Nohl and Lell, Black Hat 2014] USB architecture from 30,000 feet Your machine

Whatisthecostofthesedefenses?

Page 40: Defending against malicious peripherals with Cinch · Peripherals’ firmware can be modified with BadUSB [Nohl and Lell, Black Hat 2014] USB architecture from 30,000 feet Your machine

Baseline:connectingdevicesdirectlytoyourmachine

Experiment1:transferring1GBfiletoaUSB3.0SSD

• Throughputreduction:38%(duetomemorycopies)• Memoryoverhead:200MB(duetosacrificialVM)• CPUoverhead:8X(duetovirtualizationandenforcer)

Experiment2:pingfromaremotemachineusingUSBEthernetadapter

• Round-triptimeincrease:~2ms

Performanceevaluationhighlights

Page 41: Defending against malicious peripherals with Cinch · Peripherals’ firmware can be modified with BadUSB [Nohl and Lell, Black Hat 2014] USB architecture from 30,000 feet Your machine

• Weakagainstpolymorphicattacksonvulnerabledrivers

• Requiresidentifyingtrustedmanufacturers

• Requiresdevicesupport(oranadapter)forTLS

• RequireshardwaresupportforvirtualizingIO(IOMMU)

CinchbringsnetworkdefensestoUSB…

…butitalsoinheritstheirlimitations

Page 42: Defending against malicious peripherals with Cinch · Peripherals’ firmware can be modified with BadUSB [Nohl and Lell, Black Hat 2014] USB architecture from 30,000 feet Your machine

• Cinchprovidesabackward-compatibleandportablewayofenhancingperipheralbuseswithtoolsfromnetworksecurity

• Cinch’senforcerismodularanddefensesarenaturalandeasytoimplement

• Cinchisnotperfect,buteliminatessomeattackclassesandincreasesthebarrierforothers

Summary

Page 43: Defending against malicious peripherals with Cinch · Peripherals’ firmware can be modified with BadUSB [Nohl and Lell, Black Hat 2014] USB architecture from 30,000 feet Your machine

• WhatdoyouthinkabouttheirworkcomparetoGoodUSB &USBFILTER?

• Isthe38%throughputreduction worthit?• AnyfundamentalissueswithQEMUandKVMmodel?• USBee• CanGoodUSB,USBFILTER,Cinch;protectusagainstUSBee?

Discussion