Life of a Password - - PowerPoint PPT Presentation

life of a password
SMART_READER_LITE
LIVE PREVIEW

Life of a Password - - PowerPoint PPT Presentation

Life of a Password Arvind Mani Data & Infrastructure


slide-1
SLIDE 1

Life ¡of ¡a ¡Password ¡ ¡

¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡Arvind ¡Mani ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡Data ¡& ¡Infrastructure ¡Security ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡LinkedIn ¡

slide-2
SLIDE 2

¡ ¡ ¡ ¡ ¡ Secure ¡user ¡account. ¡ ¡

slide-3
SLIDE 3

Agenda ¡

We ¡cover ¡the ¡following ¡topics: ¡

  • Hashing ¡
  • Transport ¡
  • Storage ¡

¡ Not ¡covered: ¡ monitoring, ¡host ¡and ¡network ¡security, ¡access ¡ control, ¡other ¡account ¡protecFon ¡mechanisms. ¡

slide-4
SLIDE 4

Unsalted ¡Password ¡Hash ¡

User ¡id ¡ hash ¡ m1 ¡ F(“monkey”) ¡ m2 ¡ F(“123456”) ¡

  • Brute ¡force ¡short ¡passwords ¡
  • DicFonary ¡aTack ¡
  • Rainbow ¡Table ¡
slide-5
SLIDE 5

Salted ¡Password ¡Hashes ¡

User ¡id ¡ hash ¡ salt ¡(64/96 ¡bit) ¡ m1 ¡ F(“JI6aerwhm”, ¡s1) ¡ s1 ¡ m2 ¡ F(“$^%YRTYFYU”, ¡s2) ¡ s2 ¡

SuscepFble ¡to ¡Targeted ¡aTack ¡

User ¡id ¡ hash ¡ m1 ¡ F(“monkey”, ¡m1) ¡ m2 ¡ F(“123456”, ¡m2) ¡

Cheap ¡Salt ¡(performance; ¡what’s ¡wrong?) ¡ Random ¡Salt ¡

slide-6
SLIDE 6

Keyed ¡Crypto ¡Hash ¡(MAC) ¡

User ¡id ¡ hash ¡ m1 ¡ F(“JI6aerwhm”, ¡“secret”) ¡ m2 ¡ F(“$^%YRTYFYU”, ¡“secret”) ¡

  • Prevents ¡dicFonary ¡aTack ¡
  • Common ¡passwords ¡are ¡revealed ¡
  • Prevents ¡targeted ¡aTack ¡

Next: ¡Online ¡aTacks ¡

slide-7
SLIDE 7

Overwrite ¡ATack ¡

User ¡id ¡ hash ¡ salt ¡ m1 ¡ ¡ F(“ashjrgqwu3nk”, ¡s1) ¡ s2 ¡ m2 ¡ F(“%RYThj#WY”, ¡s2) ¡ s2 ¡ User ¡id ¡ hash ¡ salt ¡ m1 ¡ F(“password”, ¡s) ¡ s ¡ m2 ¡ F(“password”, ¡s) ¡ s ¡

ATacker ¡overwrites ¡m1 ¡and ¡m2’s ¡real ¡ passwords ¡

slide-8
SLIDE 8

Swap ¡ATack ¡

User ¡id ¡ hash ¡ salt ¡ m1 ¡ F(“password”, ¡s1, ¡“secret”) ¡ s1 ¡ m2 ¡ F(“$^%YRTYFYU”, ¡s2, ¡“secret”) ¡ s2 ¡ User ¡id ¡ hash ¡ salt ¡ m1 ¡(aTacker) ¡ F(“password”, ¡s1, ¡“secret”) ¡ s1 ¡ m2 ¡(vicFm) ¡ F(“password”, ¡s1, ¡“secret” ¡ s1 ¡

slide-9
SLIDE 9

Keyed ¡Hash ¡

Pros ¡

  • One-­‑way ¡
  • Correlated ¡input ¡secure ¡

¡ Cons ¡

  • Hash ¡computaFon ¡is ¡fast ¡
  • Fixed ¡input, ¡fixed ¡output ¡

¡

slide-10
SLIDE 10

Password ¡Recipe ¡

  • Key ¡DerivaFon ¡FuncFon ¡(KDF) ¡instead ¡of ¡

crypto ¡hash ¡

  • Random ¡salt ¡
  • User ¡or ¡member ¡id ¡
  • Work ¡factor ¡(acFve ¡accounts) ¡
  • ApplicaFon ¡secret ¡
  • Encrypted ¡Hashes ¡vs ¡MAC ¡
slide-11
SLIDE 11

Ongoing ¡Key ¡RotaFon ¡

  • Increase ¡likelihood ¡that ¡not ¡all ¡stored ¡

credenFals ¡can ¡be ¡cracked. ¡

  • You ¡have ¡fingerprinted ¡your ¡database ¡– ¡stolen ¡

hashes ¡can ¡pinpoint ¡“when” ¡

slide-12
SLIDE 12

Except ¡if… ¡

User ¡id ¡ hash ¡ salt ¡ m1 ¡ F(“password”, ¡s1, ¡m1, ¡ “secret”) ¡ s1 ¡ User ¡id ¡ hash ¡ salt ¡ m1 ¡ F(“^%$TRsfwe”, ¡s2, ¡m1, ¡ “secret”) ¡ s2 ¡ Password ¡History ¡Table ¡ Password ¡Table ¡

slide-13
SLIDE 13

Accidental ¡Logging ¡

proxy ¡ Tier(s) ¡ login/ registraFon ¡ frontend ¡ Login ¡ backend ¡ systems ¡ Logs ¡ 2014/02/25 ¡18:38:55.751 ¡[(prod-­‑host1,login-­‑app,/login,2014/02/25 ¡ 18:38:55.572) ¡verifyPassword(email=“foobar@yahoo.com”, ¡password=monkey, ¡ ip_address=”1.1.1.1"), ¡PASS, ¡11ms ¡ ¡

slide-14
SLIDE 14
slide-15
SLIDE 15

Transport ¡

User ¡ agent ¡ ¡ Frontend ¡ in ¡Server ¡ Frontend ¡ Login ¡Server ¡ TLS ¡ Internet ¡ TLS ¡

  • TLS ¡throughout, ¡so ¡on ¡network ¡password ¡is ¡always ¡encrypted ¡
  • Each ¡hop ¡sees ¡password ¡in ¡clear ¡– ¡potenFal ¡for ¡improper ¡handling ¡
slide-16
SLIDE 16

Fix ¡at ¡User ¡Agent ¡– ¡ATempt ¡1 ¡

Send ¡Hash(password) ¡

¡ Login ¡ Server ¡ User ¡ user1, ¡ H=sha1(“abc123”) ¡

  • 2. ¡read ¡entry ¡for ¡user1, ¡

say ¡Y ¡ ¡

  • 3. ¡Is ¡Y ¡== ¡

AES(PBKDF2(H))? ¡

  • EquaFon ¡in ¡Step ¡3 ¡holds ¡if ¡the ¡sha1 ¡is ¡done ¡consistently ¡

during ¡registraFon, ¡password ¡reset, ¡etc ¡

  • Problem ¡– ¡hashed ¡password ¡log ¡is ¡as ¡bad ¡as ¡logging ¡

cleartext ¡password! ¡

TLS ¡

slide-17
SLIDE 17

Fix ¡at ¡User ¡Agent ¡– ¡ATempt ¡2 ¡

Send ¡Hash(password, ¡salt) ¡

Login ¡ Server ¡ User ¡ user1, ¡H’=sha1(“abc123”, ¡ rand1) ¡

  • 2. ¡read ¡entry ¡for ¡user1, ¡

say ¡Y ¡ ¡

  • 3. ¡Is ¡Y ¡== ¡

AES(PBKDF2(H’))? ¡

  • Salt ¡used ¡in ¡compuFng ¡Y ¡using ¡PBKDF2 ¡can’t ¡be ¡same ¡as ¡

rand1 ¡ ¡

  • Problem ¡-­‑ ¡EquaFon ¡in ¡Step ¡3 ¡can’t ¡hold ¡for ¡any ¡verificaFon, ¡

scheme ¡not ¡feasible ¡ ¡

TLS ¡

slide-18
SLIDE 18

Fix ¡At ¡User ¡Agent ¡– ¡ATempt ¡3 ¡

Send ¡PublicKeyEncrypFon(password) ¡

¡

Problem ¡– ¡Can ¡replay ¡and ¡use ¡encrypted ¡password ¡ instead ¡of ¡real ¡password ¡to ¡login ¡as ¡user ¡

Web ¡App ¡ Login ¡ Server ¡ logfile ¡ VicFm ¡ ATacker ¡ user1, ¡ Y=PubKeyEnc(“abc 123”) ¡ ¡ Web ¡app ¡logs ¡user1, ¡Y ¡ and ¡contents ¡are ¡ leaked ¡to ¡outside ¡ user1, ¡Y ¡ TLS ¡

slide-19
SLIDE 19

Fix ¡At ¡User ¡Agent ¡-­‑ ¡Summary ¡

Send ¡PublicKeyEncrypFon(password) ¡+ ¡nonce ¡

  • Good ¡news ¡– ¡this ¡finally ¡works! ¡
  • Bad ¡news ¡– ¡must ¡support ¡all ¡user ¡agents ¡

including ¡naFve ¡mobile, ¡some ¡clients ¡can’t ¡be ¡ upgraded ¡ ¡

slide-20
SLIDE 20

Fix ¡at ¡Ingress ¡– ¡ATempt ¡1 ¡

Instead ¡of ¡sending ¡password, ¡over ¡TLS ¡send ¡ either: ¡

  • Hash(password, ¡salt) ¡
  • Password ¡token ¡not ¡derived ¡from ¡password ¡
slide-21
SLIDE 21

Fix ¡at ¡Ingress ¡– ¡ATempt ¡2 ¡

PublicKeyEncrypFon(password) ¡

¡ User ¡ Proxy ¡ Webapp ¡ Login ¡ server ¡ Logfile ¡ ATacker ¡ user1, ¡ “abc123” ¡ user1, ¡ Y=PubKeyEnc(“abc 123” ¡ user1, ¡Y ¡is ¡ leaked ¡

  • 2. ¡user1, ¡Y ¡
  • 2. ¡user1, ¡

RSA(Y) ¡

No ¡replay ¡from ¡outside, ¡can ¡replay ¡from ¡inside ¡ network ¡

slide-22
SLIDE 22

Cloaked ¡Password ¡ ¡

  • Password ¡encrypted ¡PublicKeyloginserver ¡
  • Ciphertext ¡is ¡randomized ¡
  • Replay ¡protecFon ¡via ¡short ¡expiry ¡or ¡nonce ¡

infrastructure ¡

  • Can ¡be ¡decrypted ¡only ¡by ¡verificaFon ¡end ¡

point ¡

slide-23
SLIDE 23

Storage ¡

  • SQL ¡injecFon ¡ ¡

¡ ¡

  • ATacker ¡has ¡username/password ¡of ¡database ¡
  • ATacker ¡has ¡access ¡to ¡filesystem ¡
slide-24
SLIDE 24

Dump ¡credenFals ¡

  • SQL ¡injecFon ¡(nosql ¡stores ¡are ¡not ¡by ¡default ¡safe) ¡

¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡password=‘foo’ ¡or ¡1=1 ¡-­‑-­‑ ¡

  • ATacker ¡with ¡DB ¡credenFal ¡

¡

CredenFal ¡ DB ¡ ATacker ¡on ¡ producFon ¡host ¡ select ¡* ¡from ¡ credenFal_table; ¡ ¡ ATacker ¡ Web ¡ ¡ ApplicaFon ¡ CredenFal ¡ DB ¡ internet ¡

slide-25
SLIDE 25

Centralizing ¡Storage ¡

  • Many ¡types ¡of ¡credenFals ¡– ¡isolate ¡applicaFon ¡

credenFals ¡ ¡ ¡ ¡

  • Single ¡point ¡of ¡aTack ¡

¡

login ¡ Api ¡ (pwned) ¡ CredenFal ¡DB ¡ passwords ¡

  • auth ¡tokens ¡

passwords ¡ Oauth ¡tokens ¡ all ¡credenFals ¡

slide-26
SLIDE 26

CredenFal ¡Store ¡

  • Access ¡via ¡Stored ¡Procedure ¡
  • Isolate ¡client ¡data ¡via ¡dual ¡encrypFon ¡ ¡
  • Access ¡Control ¡
  • AudiFng ¡ ¡
  • Monitoring ¡
  • Periodic ¡key ¡rotaFon ¡
slide-27
SLIDE 27

CredenFal ¡Store ¡

login ¡ api ¡ CredenFal ¡ Service ¡ CredenFal ¡DB ¡ id1, ¡Y ¡= ¡Elogin(password) ¡ id1, ¡ Y=Eapi(accessToken) ¡ id1, ¡Z= ¡Ecred(Y) ¡ ¡

  • listener ¡access ¡

IP ¡restricted ¡to ¡ cred ¡service ¡

  • Access ¡via ¡

Stored ¡procs ¡

  • All ¡communicaFon ¡over ¡TLS ¡
  • ACLs ¡on ¡operaFons ¡
  • Client ¡encrypFon ¡
slide-28
SLIDE 28

Summary ¡

  • Made ¡some ¡progress ¡securing ¡passwords ¡
  • Re-­‑usable ¡infrastructure ¡– ¡apply ¡to ¡credit ¡

cards, ¡OAuth ¡tokens, ¡etc ¡

  • Future ¡Work ¡– ¡Key ¡Management, ¡SRP?, ¡

miFgate ¡risk ¡of ¡compromise ¡of ¡criFcal ¡ applicaFons ¡

slide-29
SLIDE 29

Acknowledgement ¡

We ¡want ¡to ¡thank ¡Professor ¡Dan ¡Boneh, ¡Applied ¡ Crypto ¡Group, ¡Stanford ¡University ¡for ¡his ¡help ¡ with ¡password ¡hashing ¡scheme. ¡ ¡

slide-30
SLIDE 30

QuesFons? ¡

¡ ¡ ¡ amani@linkedin.com ¡ hTps://www.linkedin.com/in/arvindmani ¡ ¡