Slide 1

Slide 1 text

You Shall (Maybe) Pass! Eric Mann

Slide 2

Slide 2 text

Poster by DirectArtPrint - https://amzn.to/2ZYAMGq

Slide 3

Slide 3 text

Authentication

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

Password Strength

Slide 11

Slide 11 text

(Full image slide with caption) Password Strength - xkcd - https://xkcd.com/936/

Slide 12

Slide 12 text

Information Entropy - https://www.itdojo.com/a-somewhat-brief-explanation-of-password-entropy/

Slide 13

Slide 13 text

Restrict passwords obtained from previously breached corpuses

Slide 14

Slide 14 text

Have I Been Pwned - https://haveibeenpwned.com/

Slide 15

Slide 15 text

Have I Been Pwned Password API - https://www.troyhunt.com/ive-just-launched-pwned-passwords-version-2/#cloudflareprivacyandkanonymity

Slide 16

Slide 16 text

Brute Force Protection

Slide 17

Slide 17 text

No content

Slide 18

Slide 18 text

No content

Slide 19

Slide 19 text

$cost]); $end = microtime(true); } while (($end - $start) < $timeTarget); echo "Appropriate Cost Found: " . $cost;

Slide 20

Slide 20 text

$cost]); $end = microtime(true); } while (($end - $start) < $timeTarget); echo "Appropriate Cost Found: " . $cost;

Slide 21

Slide 21 text

Secure Remote Passwords

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

PHP Example … in the July 2018 issue of php[architect]: https://www.phparch.com/magazine/2018-2/july/

Slide 24

Slide 24 text

$salt = random_bytes(SODIUM_CRYPTO_PWHASH_SALTBYTES); $seed = sodium_crypto_pwhash(/* ... */); $keypair = sodium_crypto_kx_seed_keypair($seed); $public_key = sodium_crypto_kx_publickey($keypair); // POST this data to the server to register $registration = [ 'identifier' => $email, 'salt' => sodium_bin2hex($salt), 'public_key' => sodium_bin2hex($public_key) ]; SRP - Client Registration

Slide 25

Slide 25 text

$user = get_user_from_database($email); $keypair = sodium_crypto_kx_keypair(); $public_key = sodium_crypto_kx_publickey($keypair); $keys = sodium_crypto_kx_server_session_keys($keypair, $user->key); $client_secret = $keys[1]; $server_secret = $keys[0]; $message = random_bytes(32); $hash = sodium_crypto_generichash($message, $server_secret); $proof = sodium_bin2hex($message . $hash); SRP - Initialize Auth Challenge (Server)

Slide 26

Slide 26 text

$keys = sodium_crypto_kx_server_session_keys($keypair, $server_key); $client_secret = $keys[0]; $server_secret = $keys[1]; $server_proof = sodium_hex2bin($server_proof); $message = substr($server_proof, 0, 32); $hash = substr($server_proof, 32); if (!hash_equals( sodium_crypto_generichash($message, $server_secret), $hash )) { exit; } SRP - Complete Auth Challenge (Client)

Slide 27

Slide 27 text

$keys = sodium_crypto_kx_server_session_keys($keypair, $server_key); $client_secret = $keys[0]; $server_secret = $keys[1]; /* ... */ $message = random_bytes(32); $hash = sodium_crypto_generichash($message, $client_secret); $proof = sodium_bin2hex($message . $hash); SRP - Complete Auth Challenge (Client)

Slide 28

Slide 28 text

$client_proof = sodium_hex2bin($proof); $message = substr($client_proof, 0, 32); $hash = substr($client_proof, 32); if (!hash_equals( sodium_crypto_generichash($message, $client_secret), $hash )) { exit; } // Store the user's email in a session for subsequent requests $_SESSION['identifier'] = $email; SRP - Complete Auth Challenge (Server)

Slide 29

Slide 29 text

The node-sodium project is a JS port of Libsodium for use on Node-powered servers.

Slide 30

Slide 30 text

The libsodium.js project uses transpiling to convert the raw C code directly to WebAssembly for use in the browser!

Slide 31

Slide 31 text

In Review ... Something you are, know (, and have) Strong passwords are a must Strong hashing is a must If you can, avoid ever seeing or interacting with passwords

Slide 32

Slide 32 text

Questions?

Slide 33

Slide 33 text

Thank you [email protected] | 503.925.6266