Classification: Public 1 Protect Y Your User Accounts Like Its - - PowerPoint PPT Presentation

classification public 1 protect y your user accounts
SMART_READER_LITE
LIVE PREVIEW

Classification: Public 1 Protect Y Your User Accounts Like Its - - PowerPoint PPT Presentation

Classification: Public 1 Protect Y Your User Accounts Like Its 2019 Thomas Konrad, SBA Research sec4dev, Feb 27 th , 2019 SBA Research gGmbH, 2019 Classification: Public 2 $ whoami Thomas Konrad $ id uid=123(tom) gid=0(SBA Research)


slide-1
SLIDE 1

Classification: Public 1

slide-2
SLIDE 2

Classification: Public 2

Protect Y Your User Accounts Like It’s 2019

Thomas Konrad, SBA Research sec4dev, Feb 27th, 2019

SBA Research gGmbH, 2019

slide-3
SLIDE 3

Classification: Public 3 SBA Research gGmbH, 2019

$ whoami Thomas Konrad $ id uid=123(tom) gid=0(SBA Research) gid=1(Software Security) gid=2(Penetration Testing) gid=3(Software Development) gid=4(Security Training)

slide-4
SLIDE 4

Classification: Public 4

Why Are We We Here?

The starting point.

SBA Research gGmbH, 2019

slide-5
SLIDE 5

Classification: Public 5

Some Assumptions

1. We’re developing an application (web or mobile) 2. The application has user accounts 3. The processed data is at least somewhat sensitive 4. We have a hard time coming up with proper account security solutions

SBA Research gGmbH, 2019

slide-6
SLIDE 6

Classification: Public 6

What Do We We Want To Protect Against?

Motivations for account security measures

SBA Research gGmbH, 2019

slide-7
SLIDE 7

Classification: Public 7

What do we strive for?

SBA Research gGmbH, 2019 Image source: https://i2.wp.com/www.thesecurityawarenesscompany.com/wp-content/uploads/2015/05/CIAtriad- copy2.png?zoom=2.625&fit=2702%2C2448&ssl=1

slide-8
SLIDE 8

Classification: Public 8

A Basic Threat Model

Threat Severity1 C/I/A Countermeasures Password guessing High C/I/- ? Account lockout Medium

  • /-/A

? Misuse of known passwords (public lists, other apps, ...) Medium C/I/- ? Someone dumps the DB on the Internet Medium C/I/- ? Enumerating valid user names Low C/-/- ?

SBA Research gGmbH, 2019

1 The severity really depends on the classification of your data. Don’t see them as absolute and unchangeable values.

slide-9
SLIDE 9

Classification: Public 9

The Game Is On: Account Security Hammer Head

SBA Research gGmbH, 2019 Image source: https://i.ytimg.com/vi/X4pSjBqbE0Y/maxresdefault.jpg

slide-10
SLIDE 10

Classification: Public 10

The C/I And The A

  • In (account) security, these two are often

contradictory

  • Often, we have to find a balance
  • Password guessing (C/I) vs. account lockout (A)

SBA Research gGmbH, 2019

slide-11
SLIDE 11

Classification: Public 11

Thou Shalt Not Pass!

Protecting against credentials guessing attacks, a.k.a. “achieving the C and the I”

SBA Research gGmbH, 2019

slide-12
SLIDE 12

Classification: Public 12

What Can We We Do For The C And The A?

Gimme some ideas!

SBA Research gGmbH, 2019 Image source: https://giphy.com/gifs/WilsonTennis-karen-khachanov-1o1iwQngXCF5guav2G

slide-13
SLIDE 13

Classification: Public 13

Password Policy

  • NIST 800-63-3 Digital Identity Guidelines
  • Major overhaul in June 2017

SBA Research gGmbH, 2019

slide-14
SLIDE 14

Classification: Public 14

Password Policy

  • Current recommendations in a nutshell
  • Nuke periodic changes
  • Nuke complexity rules

– Only require a minimum length

  • Screen passwords against compromised

passwords

  • Maximum length must be at least 64 cars
  • Require MFA for high-privilege accounts

SBA Research gGmbH, 2019 Image source: http://37wz5x2r8vbh3om46wmfhy71-wpengine.netdna-ssl.com/wp-content/uploads/2016/10/yeah-600px.png

slide-15
SLIDE 15

Classification: Public 15

Password Policy: Tips By NIST

SBA Research gGmbH, 2019

slide-16
SLIDE 16

Classification: Public 16

Password Policy: Screen Passwords

  • Troy Hunt’s Pwned Passwords API:

https://haveibeenpwned.com/API/v2

SBA Research gGmbH, 2019

GET https://api.pwnedpasswords.com/range/{first 5 hash chars} 0018A45C4D1DEF81644B54AB7F969B88D65:1 00D4F6E8FA6EECAD2A3AA415EEC418D38EC:2 011053FD0102E94D6AE2F8B83D76FAF94F6:1 012A7CA357541F0AC487871FEEC1891C49C:2 0136E006E24E7D152139815FB0FC6A50B15:2 ...

slide-17
SLIDE 17

Classification: Public 17

Password Policy: Screen Passwords

SBA Research gGmbH, 2019

slide-18
SLIDE 18

Classification: Public 18

Use Proper Hashes

  • Hash algorithms are designed to be fast
  • If our DB gets breached, we wish they’d be slow
  • So how should we persist passwords?
  • Use an algorithm that intentionally makes

brute-force attacks slow

  • If you have the choice, use Argon2
  • bcrypt is ok, but has some pitfalls
  • PBKDF2 is also ok

SBA Research gGmbH, 2019

slide-19
SLIDE 19

Classification: Public 19

Lock Users After Too Many Failed Attempts

  • Soft lock vs. hard lock
  • Soft == temporarily
  • Hard == permanently
  • Have both implemented!
  • I’d generally recommend a soft lock
  • E.g., lock for 5 minutes after 5 wrong attempts
  • But it really depends on the C/I requirements

SBA Research gGmbH, 2019

slide-20
SLIDE 20

Classification: Public 20

Multi-Factor Authentication

  • Require not just user name and password, but also

something else (optional, but mandatory for admins)

  • Even if the credentials are breached, the attackers

cannot log in

  • Some examples
  • A one-time password sent via SMS
  • A TOTP app (e.g., Google Authenticator)
  • A hardware token
  • U2F

SBA Research gGmbH, 2019

slide-21
SLIDE 21

Classification: Public 21

Multi-Factor Authentication: TOTP

SBA Research gGmbH, 2019

slide-22
SLIDE 22

Classification: Public 22

Transparency

  • Even if we do all we can, there might still be

malicious activity

  • If fishy things happen, we at least want ...
  • ... the user to know it.
  • ... have the ability to react on it.

SBA Research gGmbH, 2019

slide-23
SLIDE 23

Classification: Public 23

Transparency: Notifications

SBA Research gGmbH, 2019

slide-24
SLIDE 24

Classification: Public 24

Transparency: Device List

SBA Research gGmbH, 2019

slide-25
SLIDE 25

Classification: Public 25

Transparency: How Do We We Track Devices?

  • With Device Tokens (Device Cookies)!

SBA Research gGmbH, 2019

slide-26
SLIDE 26

Classification: Public 26

Detour: Device Tokens

  • Device Tokens in a nutshell
  • Catch successful login events
  • If this is a new device

– Issue a Device Token – Send a notification (as you saw before)

  • The cookie (token) must be long-running
  • Connect the new session to it
  • Store source IP

, user agent, first access, last access

SBA Research gGmbH, 2019

slide-27
SLIDE 27

Classification: Public 27

Detour: Device Tokens

SBA Research gGmbH, 2019

slide-28
SLIDE 28

Classification: Public 28

Detour: Device Tokens

  • Device Tokens enable us to do tons of good

things

  • List devices (transparency, remember?)
  • Notifications upon a login from a new device

(transparency, remember?)

  • Remember MFA for specific devices
  • Remember previously logged-in users
  • Slow down password guessing (you’ll see later)
  • ...
  • They are very helpful for good account

security!

SBA Research gGmbH, 2019

slide-29
SLIDE 29

Classification: Public 29

Detour: Device Tokens

SBA Research gGmbH, 2019

slide-30
SLIDE 30

Classification: Public 30

User Enumeration

SBA Research gGmbH, 2019

slide-31
SLIDE 31

Classification: Public 31

User Enumeration

SBA Research gGmbH, 2019

slide-32
SLIDE 32

Classification: Public 32

User Enumeration

  • Actually protecting against user enumeration is

really hard

  • Login form?
  • Login form after a user lockout?
  • Registration form?
  • Password reset?
  • Timing differences?
  • Other services that use the same user DB?
  • ...

SBA Research gGmbH, 2019

slide-33
SLIDE 33

Classification: Public 33

User Enumeration

  • It’s mostly about error messages with really

bad usability

  • “Username and/or password wrong.”
  • “Invalid credentials. Note that you might get

locked out after too many failed login attempts.”

  • “Password reset request received. If that account

exists, you should have gotten an email with further instructions.”

SBA Research gGmbH, 2019

slide-34
SLIDE 34

Classification: Public 34

User Enumeration

  • Again, this depends on the

sensitivity of the fact that somebody is registered.

  • Think “Ashley Madison vs. The

Recipe Collection”

  • Sometimes, it is ok to accept

the risk of user enumeration

SBA Research gGmbH, 2019

slide-35
SLIDE 35

Classification: Public 35

What Can We We Do For The C And The I?

  • 1. Use a good password policy
  • 2. User proper hashes
  • 3. Lock out users (hard lock vs. soft lock)
  • 4. Multi-factor authentication (MFA)
  • 5. Transparency (device lists, notifications)
  • 6. Protect against user enumeration (?)

SBA Research gGmbH, 2019

slide-36
SLIDE 36

Classification: Public 36

Thou Shalt Not Lock!

Keeping attackers from systematically locking out users, a.k.a. “achieving the A”

SBA Research gGmbH, 2019

slide-37
SLIDE 37

Classification: Public 37

Preventing User Lockout

  • This is the harder part!
  • Remember the Hammer Head?

SBA Research gGmbH, 2019 https://giphy.com/gifs/cuteness-Hnv3oVMOkmHiE

slide-38
SLIDE 38

Classification: Public 38

Preventing User Lockout: A Question Of Trust

SBA Research gGmbH, 2019 Image source: https://www.supermarketguru.com/site/assets/files/6521/bakerycounter.jpg

slide-39
SLIDE 39

Classification: Public 39

Preventing User Lockout: A Question Of Trust

SBA Research gGmbH, 2019

slide-40
SLIDE 40

Classification: Public 40

Preventing User Lockout: A Question Of Trust

SBA Research gGmbH, 2019

slide-41
SLIDE 41

Classification: Public 41

Preventing User L Lockout: T The Pareto Principle

  • You can save most users from being locked out
  • But not 100 %!
  • A note for apps with public registration forms
  • An attacker could register and issue themselves

new device token via a script

  • Therefore: Count failed login attempts also for

users and hard-lock them in case they’re attacking

SBA Research gGmbH, 2019

slide-42
SLIDE 42

Classification: Public 42

Let’s Update the Threat Model

What do all the countermeasures mean to our model?

SBA Research gGmbH, 2019

slide-43
SLIDE 43

Classification: Public 43

A Basic Threat Model

Threat Severity1 C/I/A Countermeasures Password guessing High C/I/- (Temporary) user lockout, password policy, MFA, transparency (device lists and notifications, with Device Tokens) Account lockout Medium

  • /-/A

Selective lockout (with Device Tokens) Misuse of known passwords (public lists, other apps, ...) Medium C/I/- MFA Someone dumps the DB on the Internet Medium C/I/- Proper hashes (Argon2) Enumerating valid user names Low C/-/- (Generic error messages, constant timing

  • n all requests containing the user name)

SBA Research gGmbH, 2019

1 The severity really depends on the classification of your data. Don’t see them as absolute and unchangeable values.

slide-44
SLIDE 44

Classification: Public 44

Advanced C Countermeasures

Where to go from here

SBA Research gGmbH, 2019

slide-45
SLIDE 45

Classification: Public 45

Advanced Countermeasures

  • Geo IP blocking
  • Heuristics
  • Conditional CAPTCHA
  • Conditional MFA
  • ...
  • A lot more can be cone, but think about

taking this as a starting point!

SBA Research gGmbH, 2019

slide-46
SLIDE 46

Classification: Public 46

Account S Security F For End Users

How to minimize the risk of a data breach for yourself

SBA Research gGmbH, 2019

slide-47
SLIDE 47

Classification: Public 47

Account Security For End Users

  • 1. Use a password manager (not the browsers’)
  • 2. Don’t re-use passwords
  • 3. Turn on MFA where possible
  • 4. Register on https://haveibeenpwned.com

SBA Research gGmbH, 2019 Image source: https://i.1password.com/media/ios-hero.png

slide-48
SLIDE 48

Classification: Public 48

Summing Up

Things to do for better account security

SBA Research gGmbH, 2019

slide-49
SLIDE 49

Classification: Public 49

Summary

  • 1. Define the CIA requirements for your data!
  • 2. Do your Threat Model
  • 3. Implement Device Tokens
  • 4. Protect the C/I (password policy, proper hashes,

lock users, (optional) MFA, transparency)

  • 5. Protect the A (selective lock-out with Device

Trokens)

SBA Research gGmbH, 2019

slide-50
SLIDE 50

Classification: Public 50

Thomas Konrad

SBA Research gGmbH Favoritenstraße 16, 1040 Vienna tkonrad@sba-research.org @_thomaskonrad

SBA Research gGmbH, 2019 Photo by Kelly Sikkema on Unsplash

slide-51
SLIDE 51

Classification: Public 51

sec4dev

  • Thank you all for being here!
  • Save The Date: 24 to 27 Feb 2020
  • Let’s build a community!
  • Security Meetup by SBA Research

(meetup.com)

  • Twitter: @sec4dev
  • Please spread the world!

SBA Research gGmbH, 2019

slide-52
SLIDE 52

Classification: Public 52 SBA Research gGmbH, 2019