Authentication Authentication September 11, 2020 Administrative - - PDF document

authentication authentication
SMART_READER_LITE
LIVE PREVIEW

Authentication Authentication September 11, 2020 Administrative - - PDF document

Authentication Authentication September 11, 2020 Administrative new VM new VM Administrative for this lab exercise for this lab exercise import, then don't forget to create a snapshot named "base" 1 Administrative


slide-1
SLIDE 1

1

Authentication Authentication

September 11, 2020

Administrative Administrative – – new VM new VM

for this lab exercise for this lab exercise

import, then don't forget to create a snapshot named "base"

slide-2
SLIDE 2

2

Administrative Administrative – – VM login credentials VM login credentials

fedora30-fall20 student/c$l@bLinuX root /c$l@bLinuX

( mnemonic: compter science lab linux )

kali-linux1.0.7 root/c$l@bLinuX

Administrative Administrative – – submittal instructions submittal instructions

answer the lab assignment’s questions in written

report form, as a text, pdf, or Word document file (no obscure formats please)

email to csci530l@usc.edu exact subject title must be “authenticationlab” deadline is start of your lab session the following

week

reports not accepted (zero for lab) if

– late – you did not attend the lab (except DEN or prior arrangement) – email subject title deviates

slide-3
SLIDE 3

3

Authentication definition Authentication definition

binding an identity to a subject – withdrawing money at a bank counter

verifying a bank customer (subject) is the person/name (identity) on a savings account (e.g., by driver's license evaluation)

– logging in

verifying a keyboard user (subject) is the person/name (identity) on a user account (e.g., by password evaluation)

– using a secure website

verifying the web server (subject) is that of an organization (identity) (e.g., by digital signature evaluation)

“ “Auth Auth” ”entication entication vs vs “ “auth auth” ”orization

  • rization

authentication != authorization

– authorization establishes what user can do

  • nce authenticated

authentication happens first authorization comes later

– employing the information established during authentication

slide-4
SLIDE 4

4

Usage of a login ID Usage of a login ID

user account’s ID number (UID) gets

“embedded” in its human user(if any)’s shell/gui process and other processes they then spawn (which is their job)

user accounts in/of processes are revealed

by ps (process status) command in linux

the users in/of 3 processes

Bigger picture Bigger picture -

  • how we think of it

how we think of it

user file

reads

slide-5
SLIDE 5

5

#include <unistd.h> #include <sys/stat.h> #include <fcntl.h> int main() { char c; int in, out; in = open("file.in", O_RDONLY);

  • ut = open("file.out", O_WRONLY|O_CREAT, S_IRUSR|S_IWUSR);

while(read(in,&c,1) == 1) write(out,&c,1); exit(0); }

Bigger picture Bigger picture -

  • how it actually works

how it actually works

user file

reads

process

runs

note system calls “open” “read” “write” They do the file access user? isn’t even mentioned in the calls

UID

users don’t read files, processes do

program that copies one file to another

#include <unistd.h> #include <sys/stat.h> #include <fcntl.h> int main() { char c; int in, out; in = open("file.in", O_RDONLY);

  • ut = open("file.out", O_WRONLY|O_CREAT, S_IRUSR|S_IWUSR);

while(read(in,&c,1) == 1) write(out,&c,1); exit(0); }

user file

reads

process

runs

note system calls “open” “read” “write” They do the file access user? isn’t even mentioned in the calls

UID

AUTHENTICATION HERE up front, determines account for first (shell) process

same account, carried forward by inheritance from shell process to this spawned one

Bigger picture Bigger picture -

  • how it actually works

how it actually works

slide-6
SLIDE 6

6

Bases for authentication Bases for authentication

something people know

password pin number

something about them

retina/iris fingerprint DNA voice ear face

something they have

smart card sim (subscriber identity module) card hardware token

somewhere they are

login only works at certain terminals

Extent of authentication Extent of authentication

  • ne or a combination of methods may be used

– depending on needed degree of protection – “single-factor” “multi-factor”

examples

– system login

for user account, the matching password (single-factor)

– system with fingerprint reader (e.g. modern laptop)

for user account, the matching password and finger (2-factor)

– ATM transaction

for bank account, the card and matching pin (2-factor)

slide-7
SLIDE 7

7

TFA at TFA at myviterbi.usc.edu myviterbi.usc.edu

Step 1, 1st factor Step 2, 2nd factor

Example: passwords Example: passwords

something people know most common, familiar basis for authentication

slide-8
SLIDE 8

8

What What’ ’s makes bad ones? s makes bad ones?

  • nly letters or only numbers (hackme, 09112002)

recognizable words (john1, R2D2) foreign language words (bonjour1, hastalavistababy) hacker terminology (H4XOR, 1337) personal info (names, birthdates, addresses) reverse words (nauj, esrever) what do these all have in common?

they are predictable

What What’ ’s makes good ones? s makes good ones?

at least 8 characters (conventionally, but why 8?? still “enough” today? no) mixed case mixed letters and numerals punctuation/non-alphanumeric symbols included something you can remember

slide-9
SLIDE 9

9

Making a good one Making a good one

think of a memorable phrase

– “wasn’t that a dainty dish to set before the king” – “in the beginning god created the heavens and the earth”

make it an acronym

– wtaddtsbtk – itbgcthate

substitute non-letters for letters ("leetspeak")

– w7@dd7$b7k – i7bgcth@te

capitalize something

– w7@DD7$b7k – i7BGCTH@te

Forcing strong passwords Forcing strong passwords

create them for users, don’t let users choose them use PAM’s pam_cracklib module

– enforces a password strength policy at creation time

  • r other PAM password evaluation modules

– pam_passwdqc (http://www.openwall.com/passwdqc)

slide-10
SLIDE 10

10

PAM architecture PAM architecture (

(“ “pluggable authentication modules pluggable authentication modules” ”) )

PAM

1 2

/etc/pam.d

per-application configuration files

(text)

PAM modules

(executable)

PAM-aware applications

(e.g., /bin/login /bin/su /bin/ssh /bin/passwd, etc )

3 4

Operation sequence Operation sequence

app calls PAM

(1)

PAM reads app’s PAM config file

(2)

PAM calls PAM modules as listed in the file

(3)

– each succeeds or fails independently

PAM itself succeeds or fails, depending on the

modules’ outcomes

– returns its overall outcome to app (4)

app proceeds (if success) or terminates (if failure)

slide-11
SLIDE 11

11

Password crackers Password crackers

John the Ripper

(http://www.openwall.com/)

Cain and Abel hashcat

(http://hashcat.net/hashcat/)

Is guesswork easy or hard? Is guesswork easy or hard?

an alphabet is a set of symbols how many words of a certain length can you compose

from an alphabet?

depends on

– the number of symbols in the alphabet – the particular wordlength

slide-12
SLIDE 12

12

Two password strength determinants Two password strength determinants

the number of possible characters it contains

– its character set

its length

– its character count

Is guesswork easy or hard? Is guesswork easy or hard?

a 2-symbol alphabet has

– 2 one-letter words – 4 two-letter words – 8 three-letter words

a 3-symbol alphabet has

– 3 one-letter words – 9 two-letter words – 27 three-letter words

a 10-symbol alphabet has

– 10 one-letter words – 100 two-letter words – 1000 three-letter words

an -symbol alphabet has

– one-letter words – 2 two-letter words – 3 three-letter words – p p-letter words

(alphabet length raised to password length)

slide-13
SLIDE 13

13

How many words are there? How many words are there?

26-letter alphabet, wordlength 3: 263 = 17576 52-letter alphabet, wordlength 3: 523 = 140,608 – double alphabet length yields 8 times as many words 26-letter alphabet, wordlength 6: 266 = 308,915,776 – double word length yields 17576 times as many words 52-letter alphabet, wordlength 6: 526 = 19,770,609,660 a fish is in a pond – harder to catch in a bigger pond

https://www.grc.com/passwords.htm

16-character alphabet 94-character alphabet 62-character alphabet 1664 = 1077 9463 = 10124 6263 = 10112 Password space:

How many words are there? * How many words are there? *

* * i.e.

i.e. “

“What What’ ’s the password space? s the password space?” ”

comparatively IPv6 address space, considered “really really big” - 1038

slide-14
SLIDE 14

14

Password strength determinants Password strength determinants

the number of possible characters it contains its length the randomness of character selection

a 3rd criterion!! human-dependent!

(arguably, the most important factor these days)

2013 dynamic attack, 2013 dynamic attack, my UCLA server

my UCLA server *

*

  • about 700000 login attempts
  • from about 2100 remote IPs
  • from several to 53000 login attempts each
  • using about 26000 user name guesses
  • with unknown password guesses

– but no doubt predicable ones

log file, victim machine *but real-world attacks are not “dynamic” they are in-situ at attacker’s place upon an exfiltrated user/password file

slide-15
SLIDE 15

15

How you can help the cracker: How you can help the cracker:

  • - shrink the pond!

shrink the pond!

the cracker’s task:

– finding the password = = eliminating all the other candidates

how you can do part of the cracker’s task for him

– eliminate candidates, reduce the candidate-space

how you can eliminate candidates: – use only letters, or only numbers (eliminates using both) – use recognizable words, foreign words (eliminates non-words) – use personal info … – use hacker terminology … – use reverse words …

better yet: just text the cracker your password

Stated differently Stated differently

cracking is process of eliminating the non-passwords by confining passwords to known (predictable) patterns

users pre-eliminate huge parts of the password space

“For instance, the cracking programs rely on the fact that a typical user will probably not start a password with a special character in the first position but will nearly always put it somewhere near the end of the space-- therefore you can shave enormous amounts of cracking time with a cracking program that is written to contemplate this - so that it will not start a brute force guessing attack on a password that assumes a special character is in the first position.... “In essence, these cracking programs go through a protocol of routines or hacking steps from greatest reward/least effort to finally greatest effort/least reward (i.e. purely random) hoping to get lucky and snag an answer before they have to go through the entire keyspace.” BFTCalc.xls from http://www.mandylionlabs.com/PRCCalc/BruteForceCalc.htm

slide-16
SLIDE 16

16

Human factor discovery Human factor discovery

From passwords captured in large volume in recent publicized leaks, more commonly than expected, people chose 9-character passwords whose first 5 characters are letters, last 4 are numbers, first character is sometimes capitalized, others are not.

10 10 10 10 26 26 26 26 52

num num num num lower lower lower lower alpha

96 96 96 96 96 96 96 96 96

any any any any any any any any any Random: Observed: wordspace 96^9 = 7 * 10^17 wordspace 52*26*26*26*26*10*10*10*10 = 2 * 10^11

1 million times bigger 1 million times smaller

Password cracking methods Password cracking methods

dictionary attack brute force attack hybrid attacks

(e.g., hashcat’s “Combination,” “Toggle-Case,” “Permutation” attack modes)

normally applied against a (captured) file containing

the password hashes, offline

slide-17
SLIDE 17

17

Where Where unix unix stores passwords stores passwords

historical

– /etc/passwd –list of users & their hashed passwords

was readable by any user (rw-r--r--)

current (since ~1990)

– /etc/passwd –list of users only (no passwords)

is readable by any user (rw-r--r--)

– /etc/shadow –their hashed passwords

is readable by root user only (rw-------)

/etc/ /etc/passwd passwd entries hold entries hold user information user information

craig:x:507:507:Craig Smith:/home/craig:/bin/bash

  • fficial

name password (placeholder, was historical storage location) UID GID real name home directory login shell

slide-18
SLIDE 18

18

/etc/shadow entries hold /etc/shadow entries hold ancillary user information ancillary user information

craig:$1$2YL52jhL$:11992:60:75:3:14:12417:134550548

user name stored password

(based on a hash algorithm)

  • ther, unrelated items

reserved

Newer distributions, Newer distributions, longer default stored password lengths longer default stored password lengths

MD5 SHA512

slide-19
SLIDE 19

19

Password Password “ “scrambling scrambling” ” is not precisely is not precisely “ “hashing hashing” ”

what gets stored actual hash of salted password

Hash algorithm Hash algorithm selectability selectability (fedora)

(fedora)

red – algorithm code green – salt purple – hash of (salt+ password)

slide-20
SLIDE 20

20

Dictionary attack Dictionary attack

generated/dynamic dictionary attack

– list of dictionary words that are tried (i.e., hashed and

compared to hash of actual password)

– very quick

file-based/static dictionary attack

– pre-compute hashes of all the words in the dictionary – re-sort it, on the hashes instead of the words – password crack becomes a computationless hash lookup

if the password is not an exact match to a word on

the list, crack will fail

Hybrid attack Hybrid attack

uses a dictionary list but can detect slight

variations to words, or combinations of words.

example: if the word hello is in the database, but

the password is Hello, a dictionary attack will not break the password, but a hybrid attack will

generally finds many more words than a

dictionary attack

not as quick as dictionary attack

slide-21
SLIDE 21

21

Bruteforce Bruteforce attack attack

tries every character combination until it finds

the password

time-consuming in proportion to password space will always find the password, given time

  • cf. “The Library of Babel” by Jose Luis Borges

Bruteforce Bruteforce attack time estimator attack time estimator

http://www.mandylionlabs.com/PRCCalc/BruteForceCalc.htm

slide-22
SLIDE 22

22

Next Next-

  • gen cracking platform

gen cracking platform

“This $12,000 computer, dubbed Project Erebus v2.5 by creator d3ad0ne, contains eight AMD Radeon HD7970 GPU cards. Running version 0.10 of oclHashcat-lite, it requires just 12 hours to brute force the entire keyspace for any eight-character password containing upper- or lower-case letters, digits or symbols. “

http://arstechnica.com/security/2012/08/passwords-under-assault/

Raw speed estimated advances Raw speed estimated advances

2004 PC: 2^34/hr

(per Mandylion spreadsheet, from 2004)

2012 PC, single HD7970 GPU: 8.2 billion/sec Factor of 1718 2012 dedicated cracker, 8 GPUs: 8x? 64 billion/sec? 2020??

slide-23
SLIDE 23

23

Last week Last week – – why did it work? why did it work?

We solved “Encrypting the whole message is too slow!” by hashing the whole message instead. It works because: hashing is fast (with most algorithms) that’s good for signatures also good for for password cracking

Deliberate obstacles to cracking Deliberate obstacles to cracking

add extra code to hash algorithm code to slow it

– diminish brute force attempts possible per unit time – bcrypt is a deliberately slow, and tunable, algorithm

password salting

– render static dictionary attack infeasible

slide-24
SLIDE 24

24

unsalted password: generating unsalted password: generating

typed password

hash-based algorithm “hash”

Generate time Storage:

“hash”

* “hash” is quoted because the algorithm that produced it is based on a hash algorithm but isn’t that hash algorithm itself. The output therefore is not the hash itself.

*

hash-based algorithm “hash”

Generate time Authenticate time Storage:

“hash” hash-based algorithm “hash” comparison match or mismatch

unsalted password: authenticating unsalted password: authenticating

typed password typed password

slide-25
SLIDE 25

25

Generate time Storage:

“hash” salt hash-based algorithm “hash”

salted password: generating salted password: generating

salt typed password

Generate time Authenticate time Storage:

hash-based algorithm “hash” comparison match or mismatch

“hash” salt

hash-based algorithm

“hash”

salted password: authenticating salted password: authenticating

salt typed password salt typed password

slide-26
SLIDE 26

26

Benefit of salt Benefit of salt

a given password is no longer deterministically

mapped to a particular hash

– greatly raises cost of file-based/static dictionary attack – identical passwords not detectable by their hashes

Hardware authentication tokens Hardware authentication tokens

RSA SecureID Yubico YubiKey

slide-27
SLIDE 27

27

Pressing Pressing yubikey yubikey, in Notepad , in Notepad

yubikey is a USB keyboard device – it types 44 letters whenever pressed right 32 letters

  • ne-time password, generated this time

left 12 letters invariant public ID of this yubikey, generated every time

from command history recall buffer 2 seconds later (one-time key, used 2nd time, is stale)

Good play, bad replay Good play, bad replay

from pressing keyboard from pressing yubikey ykclient utility queries validation server with key

slide-28
SLIDE 28

28

play: play: replay: replay:

red – client to server blue – server to client

PAM for PAM for sshd sshd: :

involving involving yubikey yubikey in in ssh ssh logins logins

PAM

1 2

/etc/pam.d

configuration file for sshd program PAM module for yubikey a PAM-aware application 3 4

sshd pam_yubico.so sshd

specifies pam_yubico.so

slide-29
SLIDE 29

29

Configuration details Configuration details

corresponds this machine’s “david” account to the particular white yubikey I bought recently, so a valid key from that yubikey device is “good for admission” to this account

client client

yubikey pressed here

s e r v e r i n c r e a s i n g t i m e

1 yubikey types one-time key to client PuTTY 2 client PuTTY sends key to server sshd 3 sshd passes key to pam_yubico.so 4 pam_yubico.so ships it to api.yubico.com for validation 5 api.yubico.com returns “OK” to pam_yubico.so 6 pam_yubico.so returns “OK” to sshd 7 sshd launches shell per yubico authentication server

s s h s s h l

  • g

i n b y l

  • g

i n b y y u b i k e y y u b i k e y

slide-30
SLIDE 30

30

encrypt

Construction of output Construction of output

cccccccvrjbctjjneccdnuerugkclcvenbilblgkdiie cccccccvrjbc s t a t i c a l l y s t o r e d d y n a m i c a l l y g e n e r a t e d tjjneccdnuerugkclcvenbilblgkdiie cccccccvrjbc cccccccvrjbc = unique public ID 00000000B3D6 = unique secret ID = unique symmetric key (for AES) c o n c a t e n a t e

  • utput

179 00000000B3D6 cccccccvrjbc etc last sequence number symmetric key secret ID public ID “serial no.”

Authentication processing Authentication processing

application client application server authentication server d a t a b a s e a p p r e q u e s t a p p r e s p

  • n

s e validation request validation response

slide-31
SLIDE 31

31

This week This week’ ’s lab exercise s lab exercise

use hashcat to crack passwords in a supplied file holding 50 scrambled passwords extracted from /etc/shadow