the mummy 2018 - microsoft summons back ugly …...“fragmentation considered vulnerable”, gilad,...

46
The Mummy 2018 - Microsoft Summons Back Ugly Attacks From The Past

Upload: others

Post on 19-Jul-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: The Mummy 2018 - Microsoft Summons Back Ugly …...“Fragmentation Considered Vulnerable”, Gilad, Herzberg 2011 So the vendors were quick to seal the curse • Global Counter in

TheMummy2018- MicrosoftSummonsBackUglyAttacksFromThePast

Page 2: The Mummy 2018 - Microsoft Summons Back Ugly …...“Fragmentation Considered Vulnerable”, Gilad, Herzberg 2011 So the vendors were quick to seal the curse • Global Counter in

WhoamI

• RanMenscher– Israel

• IndependentSoftwareResearcher– ReverseEngineering

• OSinternals,Embedded,Applications…

• Past:VPResearch,XMCyber

– Vulnerabilities• YesJ

Page 3: The Mummy 2018 - Microsoft Summons Back Ugly …...“Fragmentation Considered Vulnerable”, Gilad, Herzberg 2011 So the vendors were quick to seal the curse • Global Counter in

I’mgoingtotellyouabout

• AnunusualbuginWindowsIPstack

• FragmentationandIPIDrandomization– Overview,pastattacks– Thebug(CVE-2018-8493)– Exploitation

• Othercoolconsequences

Page 4: The Mummy 2018 - Microsoft Summons Back Ugly …...“Fragmentation Considered Vulnerable”, Gilad, Herzberg 2011 So the vendors were quick to seal the curse • Global Counter in

FragmentationandReassembly

Page 5: The Mummy 2018 - Microsoft Summons Back Ugly …...“Fragmentation Considered Vulnerable”, Gilad, Herzberg 2011 So the vendors were quick to seal the curse • Global Counter in

UndeniablyCursed

Page 6: The Mummy 2018 - Microsoft Summons Back Ugly …...“Fragmentation Considered Vulnerable”, Gilad, Herzberg 2011 So the vendors were quick to seal the curse • Global Counter in

UndeniablyCursed

Page 7: The Mummy 2018 - Microsoft Summons Back Ugly …...“Fragmentation Considered Vulnerable”, Gilad, Herzberg 2011 So the vendors were quick to seal the curse • Global Counter in

UndeniablyCursed• Reassemblysensitive toresourceexhaustion/otherDoS

Page 8: The Mummy 2018 - Microsoft Summons Back Ugly …...“Fragmentation Considered Vulnerable”, Gilad, Herzberg 2011 So the vendors were quick to seal the curse • Global Counter in

UndeniablyCursed• Reassemblysensitive toresourceexhaustion/otherDoSMore

fragmentscomingup You’re

kidding…

Page 9: The Mummy 2018 - Microsoft Summons Back Ugly …...“Fragmentation Considered Vulnerable”, Gilad, Herzberg 2011 So the vendors were quick to seal the curse • Global Counter in

UndeniablyCursed• Reassemblysensitive toresourceexhaustion/otherDoS• LotsofattacksurfacetoevadeIDS

Page 10: The Mummy 2018 - Microsoft Summons Back Ugly …...“Fragmentation Considered Vulnerable”, Gilad, Herzberg 2011 So the vendors were quick to seal the curse • Global Counter in

Undeniablycursed• Reassemblysensitive toresourceexhaustion/otherDoS• LotsofattacksurfacetoevadeIDS

(source:onlinepresentationbyTobiasRenwick)

Page 11: The Mummy 2018 - Microsoft Summons Back Ugly …...“Fragmentation Considered Vulnerable”, Gilad, Herzberg 2011 So the vendors were quick to seal the curse • Global Counter in

UndeniablyCursed• Reassemblysensitive toresourceexhaustion/otherDoS• LotsofattacksurfacetoevadeIDS• MostImplementations:IPIDsasGlobalCounter

Page 12: The Mummy 2018 - Microsoft Summons Back Ugly …...“Fragmentation Considered Vulnerable”, Gilad, Herzberg 2011 So the vendors were quick to seal the curse • Global Counter in

CurseofGlobalCounter• DeNATing• IdleScanning

Page 13: The Mummy 2018 - Microsoft Summons Back Ugly …...“Fragmentation Considered Vulnerable”, Gilad, Herzberg 2011 So the vendors were quick to seal the curse • Global Counter in

CurseofGlobalCounter• DeNATing• IdleScanning• Blindpacketinjection(Zalewski 03)

Page 14: The Mummy 2018 - Microsoft Summons Back Ugly …...“Fragmentation Considered Vulnerable”, Gilad, Herzberg 2011 So the vendors were quick to seal the curse • Global Counter in

CurseofGlobalCounter• DeNATing• IdleScanning• Blindpacketinjection(Zalewski 03)

Valid DST Port

Page 15: The Mummy 2018 - Microsoft Summons Back Ugly …...“Fragmentation Considered Vulnerable”, Gilad, Herzberg 2011 So the vendors were quick to seal the curse • Global Counter in

CurseofGlobalCounter• DeNATing• IdleScanning• Blindpacketinjection(Zalewski 03)• Trafficinterception byNAT/Tunnel(Gilad,Herzberg11)

Page 16: The Mummy 2018 - Microsoft Summons Back Ugly …...“Fragmentation Considered Vulnerable”, Gilad, Herzberg 2011 So the vendors were quick to seal the curse • Global Counter in

CurseofGlobalCounter• DeNATing• IdleScanning• Blindpacketinjection(Zalewski 03)• Trafficinterception byNAT/Tunnel(Gilad,Herzberg11)

“Fragmentation Considered Vulnerable”, Gilad, Herzberg2011

Page 17: The Mummy 2018 - Microsoft Summons Back Ugly …...“Fragmentation Considered Vulnerable”, Gilad, Herzberg 2011 So the vendors were quick to seal the curse • Global Counter in

Sothevendorswerequicktosealthecurse

Page 18: The Mummy 2018 - Microsoft Summons Back Ugly …...“Fragmentation Considered Vulnerable”, Gilad, Herzberg 2011 So the vendors were quick to seal the curse • Global Counter in

Sothevendorswerequicktosealthecurse• GlobalCounterinWindowsuntil2012(perinterface)• windows8• DifferentIPIDperIPpath• Andtheyweresafeandhappy

Page 19: The Mummy 2018 - Microsoft Summons Back Ugly …...“Fragmentation Considered Vulnerable”, Gilad, Herzberg 2011 So the vendors were quick to seal the curse • Global Counter in

For8.1,a“major”refactorhadtakenplaceforIPIDs:Mostprominentchanges:• Afunctionisn’tinline’d anymore– (but thatcouldbethecompiler)

• Anarraywaschangedtoapointer

• Whydidtheychangeit?

Page 20: The Mummy 2018 - Microsoft Summons Back Ugly …...“Fragmentation Considered Vulnerable”, Gilad, Herzberg 2011 So the vendors were quick to seal the curse • Global Counter in

IPIDGENERATION

Page 21: The Mummy 2018 - Microsoft Summons Back Ugly …...“Fragmentation Considered Vulnerable”, Gilad, Herzberg 2011 So the vendors were quick to seal the curse • Global Counter in

• IsaboutIP PATH

Page 22: The Mummy 2018 - Microsoft Summons Back Ugly …...“Fragmentation Considered Vulnerable”, Gilad, Herzberg 2011 So the vendors were quick to seal the curse • Global Counter in

• IsaboutIP PATH

identification = base + increment

Page 23: The Mummy 2018 - Microsoft Summons Back Ugly …...“Fragmentation Considered Vulnerable”, Gilad, Herzberg 2011 So the vendors were quick to seal the curse • Global Counter in

• IsaboutIP PATH

identification = base + increment

Random4bytes(init @boot)⨁

hash(key,IPPATH)

Page 24: The Mummy 2018 - Microsoft Summons Back Ugly …...“Fragmentation Considered Vulnerable”, Gilad, Herzberg 2011 So the vendors were quick to seal the curse • Global Counter in

• IsaboutIP PATH

identification = base + increment

Random4bytes(init @boot)⨁

hash(key,IPPATH)increments[ hash(key,IPPATH)]

Page 25: The Mummy 2018 - Microsoft Summons Back Ugly …...“Fragmentation Considered Vulnerable”, Gilad, Herzberg 2011 So the vendors were quick to seal the curse • Global Counter in

Oops

• Allocate0x8000• Initialize8… bytes• Sizeof(int *)• Mostlyzeros

Page 26: The Mummy 2018 - Microsoft Summons Back Ugly …...“Fragmentation Considered Vulnerable”, Gilad, Herzberg 2011 So the vendors were quick to seal the curse • Global Counter in

Oops

• Allocate0x8000• Initialize8… bytes• Sizeof(int *)• Mostlyzeros

Page 27: The Mummy 2018 - Microsoft Summons Back Ugly …...“Fragmentation Considered Vulnerable”, Gilad, Herzberg 2011 So the vendors were quick to seal the curse • Global Counter in

Oops

• 5

Page 28: The Mummy 2018 - Microsoft Summons Back Ugly …...“Fragmentation Considered Vulnerable”, Gilad, Herzberg 2011 So the vendors were quick to seal the curse • Global Counter in

• IsaboutIP PATH

identification = base + increment

Random4bytes (init @boot)⨁

hash(key,IPPATH)increments[ hash(key,IPPATH)]

Page 29: The Mummy 2018 - Microsoft Summons Back Ugly …...“Fragmentation Considered Vulnerable”, Gilad, Herzberg 2011 So the vendors were quick to seal the curse • Global Counter in

• key is40randombytes• hash isaToeplitz hash(RSS)• Toeplitz matrices

Key

00000 45678 67456 7867420384 09234 93759 1298747823 28002 23532 7593066783 48759 28465 93732

00000 55080 90366 9829588998 33569 56486 1716689406 29886 53232 4467887289 20230 91489 43798, …

Page 30: The Mummy 2018 - Microsoft Summons Back Ugly …...“Fragmentation Considered Vulnerable”, Gilad, Herzberg 2011 So the vendors were quick to seal the curse • Global Counter in

• key is40randombytes• hash isaToeplitz hash• Toeplitz matrices

INPUT2 F 3

00000 45678 67456 7867420384 09234 93759 1298747823 28002 23532 7593066783 48759 28465 93732

00000 55080 90366 9829588998 33569 56486 1716689406 29886 53232 4467887289 20230 91489 43798,

Hash=tbl1[0x2] ⨁ tbl2[0xF]⨁ …

00000 45678 67456 7867420384 09234 93759 1298747823 28002 23532 7593066783 48759 28465 93732,

Page 31: The Mummy 2018 - Microsoft Summons Back Ugly …...“Fragmentation Considered Vulnerable”, Gilad, Herzberg 2011 So the vendors were quick to seal the curse • Global Counter in

• key is40randombytes• hash isaToeplitz hash• Toeplitz matrices

INPUT2 F 3

00000 45678 67456 7867420384 09234 93759 1298747823 28002 23532 7593066783 48759 28465 93732

00000 55080 90366 9829588998 33569 56486 1716689406 29886 53232 4467887289 20230 91489 43798,

Hash=tbl1[0x2] ⨁ tbl2[0xF]⨁ …

00000 45678 67456 7867420384 09234 93759 1298747823 28002 23532 7593066783 48759 28465 93732,

Page 32: The Mummy 2018 - Microsoft Summons Back Ugly …...“Fragmentation Considered Vulnerable”, Gilad, Herzberg 2011 So the vendors were quick to seal the curse • Global Counter in

• key is40randombytes• hash isaToeplitz hash• Toeplitz matrices

INPUT2 F 3

00000 45678 67456 7867420384 09234 93759 1298747823 28002 23532 7593066783 48759 28465 93732

00000 55080 90366 9829588998 33569 56486 1716689406 29886 53232 4467887289 20230 91489 43798,

Hash=tbl1[0x2] ⨁ tbl2[0xF]⨁ …

00000 45678 67456 7867420384 09234 93759 1298747823 28002 23532 7593066783 48759 28465 93732,

Page 33: The Mummy 2018 - Microsoft Summons Back Ugly …...“Fragmentation Considered Vulnerable”, Gilad, Herzberg 2011 So the vendors were quick to seal the curse • Global Counter in

• Nibblesofinput,thatareXOR8ofeachother–TheirhashesareXOR key[i]ofeachother!

Hash=tbl1[0x2] ⨁ tbl2[0xF]⨁ …

Page 34: The Mummy 2018 - Microsoft Summons Back Ugly …...“Fragmentation Considered Vulnerable”, Gilad, Herzberg 2011 So the vendors were quick to seal the curse • Global Counter in

• Nibblesofinput,thatareXOR8ofeachother–TheirhashesareXORkey[i]ofeachother!

Hash=tbl1[0x2] ⨁ tbl2[0xF]⨁ …

Inputsthatdifferonlybyanibblewilloutputacell’scontent!

Page 35: The Mummy 2018 - Microsoft Summons Back Ugly …...“Fragmentation Considered Vulnerable”, Gilad, Herzberg 2011 So the vendors were quick to seal the curse • Global Counter in

• Nibblesofinput,thatareXOR8ofeachother–TheirhashesareXORkey[i]ofeachother!

• Hash(10.0.0.1,10.0.0.2) =1234⨁ 5453⨁ … ⨁ 0• Hash(0x80|10.0.0.1,10.0.0.2)=1234⨁ 5453⨁ …⨁ key[i]

Hash=tbl1[0x2] ⨁ tbl2[0xF]⨁ …

Inputsthatdifferonlybyanibblewilloutputacell’scontent!

Page 36: The Mummy 2018 - Microsoft Summons Back Ugly …...“Fragmentation Considered Vulnerable”, Gilad, Herzberg 2011 So the vendors were quick to seal the curse • Global Counter in

• Nibblesofinput,thatareXOR8ofeachother–TheirhashesareXORkey[i]ofeachother!

• id(10.0.0.1,10.0.0.2) =1234⨁ 5453⨁ … ⨁ 0 ⨁ secret• id(0x80|10.0.0.1,10.0.0.2)=1234⨁ 5453⨁ … ⨁ key[i] ⨁ secret

Hash=tbl1[0x2] ⨁ tbl2[0xF]⨁ …

Inputsthatdifferonlybyanibblewilloutputacell’scontent!

Page 37: The Mummy 2018 - Microsoft Summons Back Ugly …...“Fragmentation Considered Vulnerable”, Gilad, Herzberg 2011 So the vendors were quick to seal the curse • Global Counter in

• Nibblesofinput,thatareXOR8ofeachother–TheirhashesareXORkey[i]ofeachother!

• id(10.0.0.1,10.0.0.2) =1234⨁ 5453⨁ … ⨁ 0 ⨁ secret• id(0x80|10.0.0.1,10.0.0.2)=1234⨁ 5453⨁ … ⨁ key[i] ⨁ secret

Hash=tbl1[0x2] ⨁ tbl2[0xF]⨁ …

Inputsthatdifferonlybyanibblewilloutputacell’scontent!

Page 38: The Mummy 2018 - Microsoft Summons Back Ugly …...“Fragmentation Considered Vulnerable”, Gilad, Herzberg 2011 So the vendors were quick to seal the curse • Global Counter in

• Nibblesofinput,thatareXOR8ofeachother–TheirhashesareXORkey[i]ofeachother!

• id(10.0.0.1,10.0.0.2) =1234⨁ 5453⨁ … ⨁ 0 ⨁ secret• id(0x80|10.0.0.1,10.0.0.2)=1234⨁ 5453⨁ … ⨁ key[i] ⨁ secret

ID1⨁ ID2=key[i]

Page 39: The Mummy 2018 - Microsoft Summons Back Ugly …...“Fragmentation Considered Vulnerable”, Gilad, Herzberg 2011 So the vendors were quick to seal the curse • Global Counter in

ATTACK(keyrecovery):• GettwosamplesofIPIDs• ForIPPATHs thatdifferbyanibble.XOR8ofeachother.• Key[0]=ID1 ^ID2 (ifwehitincrement=0)• Repeatuntilconfidentofkey[0]• Repeatforotherkeyparts

Page 40: The Mummy 2018 - Microsoft Summons Back Ugly …...“Fragmentation Considered Vulnerable”, Gilad, Herzberg 2011 So the vendors were quick to seal the curse • Global Counter in

identification1 = key[i]⨁ identification2

Page 41: The Mummy 2018 - Microsoft Summons Back Ugly …...“Fragmentation Considered Vulnerable”, Gilad, Herzberg 2011 So the vendors were quick to seal the curse • Global Counter in

identification1 = key[i]⨁ identification2

• Butifincrement≠0• Wecandeducecontentfromthetable(=uninitializedmem)

Ifincrement1 ==0 Ifincrement2 ==0

Page 42: The Mummy 2018 - Microsoft Summons Back Ugly …...“Fragmentation Considered Vulnerable”, Gilad, Herzberg 2011 So the vendors were quick to seal the curse • Global Counter in

ATTACK(readingkernelmem)• ChooseIPIDforIPPATHsknowntohaveincrement=0• UserecoveredkeytoinitializeToeplitz matrixvalues• GetIPIDsforIPPATHsdifferingbyanibblefromchosenIPPATH• CalculateexpectedIPIDsaccordingtomatrix• Sample – Expected =Tablecontent=uninitializedmem

Page 43: The Mummy 2018 - Microsoft Summons Back Ugly …...“Fragmentation Considered Vulnerable”, Gilad, Herzberg 2011 So the vendors were quick to seal the curse • Global Counter in

DEMO

Page 44: The Mummy 2018 - Microsoft Summons Back Ugly …...“Fragmentation Considered Vulnerable”, Gilad, Herzberg 2011 So the vendors were quick to seal the curse • Global Counter in

PredictingIPIDs• Whenincrement=0,predictionispractical• Workssimilarlytothememoryread• Problemreducedtoassessing#ofpacketssent

Page 45: The Mummy 2018 - Microsoft Summons Back Ugly …...“Fragmentation Considered Vulnerable”, Gilad, Herzberg 2011 So the vendors were quick to seal the curse • Global Counter in

TakeAways

• DontFragment (DF)isnotjustanIPflag.it’sgoodadvice.

• Yes,Coderswhorefactorworkingcodearegraverobbers.

• Ifyoumixperformanceandsecurity,asimplebugwillbringyoudown.

Page 46: The Mummy 2018 - Microsoft Summons Back Ugly …...“Fragmentation Considered Vulnerable”, Gilad, Herzberg 2011 So the vendors were quick to seal the curse • Global Counter in

Questions?

[email protected]:@menscherr