Slide 1

Slide 1 text

Passwords and how to handle them Christopher Riley PHP North West, 2016 1

Slide 2

Slide 2 text

Introduction

Slide 3

Slide 3 text

6 Rules of password storage

Slide 4

Slide 4 text

Rule 1 We must protect passwords not just for our own services security but for the security of all internet services. Users reuse passwords, in an ever connected internet, the value of a password is ever increasing. 2

Slide 5

Slide 5 text

Rule 2 We must not store plain text passwords because databases have a habit of falling into the wrong hands. 3

Slide 6

Slide 6 text

Rule 3 We must not use reversible encryption because keys are required all the time and have a habit of falling into the same wrong hands at the same time as the database. 4

Slide 7

Slide 7 text

Rule 4 We must not simply hash the passwords. With a simple hash, every password that is the same hashes to the same value an attackers work to recover the passwords is therefore greatly reduced. 5

Slide 8

Slide 8 text

Rule 5 We must not use a hash which has been intentionally built for speed such as Md5, Sha1 or Sha2. Dedicated hardware and GPU’s can calculate Billions to TRILLIONS of hashes per second. Password recovery by an attacker is inevitable. 6

Slide 9

Slide 9 text

Rule 6 We must use a hashing algorithm designed for password storage such as PBKDF2, Bcrypt or Argon2i with appropriate cost parameters. 7

Slide 10

Slide 10 text

Bonus rule We may encrypt hashes. 8

Slide 11

Slide 11 text

PHP functions 9

Slide 12

Slide 12 text

PHP functions 10

Slide 13

Slide 13 text

PHP functions 11

Slide 14

Slide 14 text

Good password policies

Slide 15

Slide 15 text

Don’t disable copy + paste

Slide 16

Slide 16 text

Don’t force password expiry...

Slide 17

Slide 17 text

... Unless compromised

Slide 18

Slide 18 text

Don’t add complex requirements

Slide 19

Slide 19 text

Entropy 12

Slide 20

Slide 20 text

Thanks • @giveupalready • https://github.com/carnage • https://github.com/carnage/entropy • http://joind.in/bc6b8 13