mschap. chap È un protocollo di tipo challange-response esistono due version sviluppate dalla...

23
MSCHAP

Upload: tancredo-amore

Post on 01-May-2015

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: MSCHAP. CHAP È un protocollo di tipo challange-response Esistono due version sviluppate dalla Microsoft: –MS-CHAP v1 –MS-CHAP v2 È un protocollo a tre

MSCHAP

Page 2: MSCHAP. CHAP È un protocollo di tipo challange-response Esistono due version sviluppate dalla Microsoft: –MS-CHAP v1 –MS-CHAP v2 È un protocollo a tre

CHAP

• È un protocollo di tipo challange-response

• Esistono due version sviluppate dalla Microsoft:– MS-CHAP v1– MS-CHAP v2

• È un protocollo a tre vie

• La versione 2 consente la mutua autenticazione

Page 3: MSCHAP. CHAP È un protocollo di tipo challange-response Esistono due version sviluppate dalla Microsoft: –MS-CHAP v1 –MS-CHAP v2 È un protocollo a tre

Come funziona la v1

1. The client requests a login challenge from the Server.2. The Server sends back an 8-byte random challenge.3. The Client uses the LAN Manager hash of its password

to derive three DES keys.• Each of these keys is used to encrypt the challenge. • All three encrypted blocks are concatenated into a 24-byte

reply. • The Client creates a second 24-byte reply using the Windows

NT hash and the same procedure.

4. The server uses the hashes of the Client's password, stored in a database, to decrypt the replies.

Page 4: MSCHAP. CHAP È un protocollo di tipo challange-response Esistono due version sviluppate dalla Microsoft: –MS-CHAP v1 –MS-CHAP v2 È un protocollo a tre

I problemi

• Vengono inviati due pacchetti– Uno per domini NT– Un altro per domini non NT

• Ho due informazioni ed uno dei due messaggi è molto più attaccabile dell’altro

• L0phtcrack è in grado di attaccare efficientemente il pacchetto più debole

Page 5: MSCHAP. CHAP È un protocollo di tipo challange-response Esistono due version sviluppate dalla Microsoft: –MS-CHAP v1 –MS-CHAP v2 È un protocollo a tre

Protocollo v.21. Client requests a login challenge from the Server.

2. The Server sends back a 16-byte random challenge.

3a. The Client generates a random 16-byte number, called the “Peer Authenticator Challenge.“

3b. The Client generates an 8-byte challenge by hashing the 16-byte challenge received in step (2), the 16-byte Peer Authenticator Challenge generated in step (3a), and the Client's username.

3c. The Client creates a 24-byte reply, using the Windows NT hash function and the 8-byte challenge generated in step (3b). This process is identical to MS-CHAPv1.

3d. The Client sends the Server the results of steps (3a) and (3c).

Page 6: MSCHAP. CHAP È un protocollo di tipo challange-response Esistono due version sviluppate dalla Microsoft: –MS-CHAP v1 –MS-CHAP v2 È un protocollo a tre

Protocolo v2

4a. The Server uses the hashes of the Client's password, stored in a database, to decrypt the replies. If the decrypted blocks match the challenge, the Client is authenticated.

4b. The Server uses the 16-byte Peer Authenticator Challenge from the client, as well as the Client's hashed password, to create a 20-byte “Authenticator Response.“

5 The Client also computes the Authenticator Response. If

the computed response matches the received response, the Server is authenticated.

Page 7: MSCHAP. CHAP È un protocollo di tipo challange-response Esistono due version sviluppate dalla Microsoft: –MS-CHAP v1 –MS-CHAP v2 È un protocollo a tre

Forze e debolezze

• This protocol works, and eliminates the most serious weaknesses that plagued MS-CHAPv1. In MS-CHAPv1, two parallel hash values were sent from the Client to the Server: the LAN Manager hash and the Windows NT hash.

• Still, the security of this protocol is based on the password used, and L0phtcrack can still break weak passwords using a dictionary attack

Page 8: MSCHAP. CHAP È un protocollo di tipo challange-response Esistono due version sviluppate dalla Microsoft: –MS-CHAP v1 –MS-CHAP v2 È un protocollo a tre
Page 9: MSCHAP. CHAP È un protocollo di tipo challange-response Esistono due version sviluppate dalla Microsoft: –MS-CHAP v1 –MS-CHAP v2 È un protocollo a tre

Derivare l’eight byte

1. The Client creates a 16-byte random number, called the Peer Authenticator Challenge.

2. The Client concatenates the Peer Authenticator Challenge with the 16-byte challenge received from the server and the Client's username.

3. The client hashes the result with SHA-1

4. The first eight bytes of the hash become the 8-byte challenge.

Page 10: MSCHAP. CHAP È un protocollo di tipo challange-response Esistono due version sviluppate dalla Microsoft: –MS-CHAP v1 –MS-CHAP v2 È un protocollo a tre

Creazione Response

Both MS-CHAPv1 and MS-CHAPv2 use the same procedure to derive a 24-byte response from the 8-byte challenge and the 16-byte NT password hash:

• The 16-byte NT hash is padded to 21 bytes by appending ve zero bytes.

• Let X; Y;Z be the three consecutive 7-byte blocks of this 21-byte value, and let C be the 8-byte challenge. The 24-byte response R is calculatedas R = hDESX(C);DESY (C); DESZ(C)i.

Page 11: MSCHAP. CHAP È un protocollo di tipo challange-response Esistono due version sviluppate dalla Microsoft: –MS-CHAP v1 –MS-CHAP v2 È un protocollo a tre

Debolezze !!

• It is unclear to us why this protocol is so complicated. At first glance, it seems reasonable that the Client not use the challenge from the Server directly, since it is known to an eavesdropper.

• Instead of deriving a new challenge from some secret information (the password hash, for example) the Client uses a unique random number that is sent to the Server later in the protocol.

• There is no reason why the Client cannot use the Server's challenge directly and not use the Peer Authenticator Challenge at all.

Page 12: MSCHAP. CHAP È un protocollo di tipo challange-response Esistono due version sviluppate dalla Microsoft: –MS-CHAP v1 –MS-CHAP v2 È un protocollo a tre

Problema principale!!!

• This complicated procedure creates a serious weakness in the MS-CHAP protocols: it allows the attacker to speed up dictionary keysearch by a factor of 216, which is a pretty devastating given the relatively low entropy of most user passwords.

• Problema particolarmente grave per v2 poichè è quello principale

Page 13: MSCHAP. CHAP È un protocollo di tipo challange-response Esistono due version sviluppate dalla Microsoft: –MS-CHAP v1 –MS-CHAP v2 È un protocollo a tre

• È possibile attuare un attacco plain-text perché si conosce C e DESz(C).

• Z assume solo 216 possibili valori !!!• Inoltre effettuando off-line l’hash di tutte le

possibili password di un dizionario si possono selezionare solo quelle che hanno gli ultimi due bytes corretti.

• A questo punto si riduce il numero di password da provare di 216.

• R = SHA-1(NT hash;C) risolverebbe il problema

Page 14: MSCHAP. CHAP È un protocollo di tipo challange-response Esistono due version sviluppate dalla Microsoft: –MS-CHAP v1 –MS-CHAP v2 È un protocollo a tre

Creazione

1. The Server (or the Client) hashes the 16-byte NT password hash to get password-hash-hash. (The Server stores the clients password hashed with MD4; this is the NT password hash value.)

2. The Server then concatenates the password-hash-hash, the 24-byte NT response, and the literal string “Magic server to client constant", and then hashes the result with SHA.

3. The Server concatenates the 20-byte SHA output from step (2), the initial 8-byte generated challenge and the literal string “Pad to make it do more than one iteration", and then hashes the result with SHA.

Page 15: MSCHAP. CHAP È un protocollo di tipo challange-response Esistono due version sviluppate dalla Microsoft: –MS-CHAP v1 –MS-CHAP v2 È un protocollo a tre

Differenze * MS-CHAP-V2 is enabled by negotiating CHAP Algorithm 0x81 in LCP option

3, Authentication Protocol.

* MS-CHAP-V2 provides mutual authentication between peers by piggybacking a peer challenge on the Response packet and an authenticator reponse on the Success packet.

* The calculation of the "Windows NT compatible challenge response" sub-field in the Response packet has been changed to include the peer challenge and the user name.

* In MS-CHAP-V1, the "LAN Manager compatible challenge response“ sub-field was always sent in the Response packet. This field has been replaced in MS-CHAP-V2 by the Peer-Challenge field.

* The format of the Message field in the Failure packet has been changed.

* The Change Password (version 1) and Change Password (version 2) packets are no longer supported. They have been replaced with a single Change-Password packet.

Page 16: MSCHAP. CHAP È un protocollo di tipo challange-response Esistono due version sviluppate dalla Microsoft: –MS-CHAP v1 –MS-CHAP v2 È un protocollo a tre

S/KEY

Page 17: MSCHAP. CHAP È un protocollo di tipo challange-response Esistono due version sviluppate dalla Microsoft: –MS-CHAP v1 –MS-CHAP v2 È un protocollo a tre

Autenticazione S/Key

• Il sistema S/KEY provvede all'autenticazione, usando password one-time, su reti soggette all'attacco di risposta.

• La password segreta dell'utente non attraversa mai la rete durante il login, o quando sono eseguiti altri programmi che richiedono l'autenticazione dell'utente.

• Per installare il sistema S/KEY è necessario avere il software S/KEY. Esistono diverse versioni di questo software a seconda dei sistemi su cui lo si vuole installare: Dos, Windows, Mac ed Unix.

Page 18: MSCHAP. CHAP È un protocollo di tipo challange-response Esistono due version sviluppate dalla Microsoft: –MS-CHAP v1 –MS-CHAP v2 È un protocollo a tre

Caratteristiche di S/Key

Alcune delle proprietà del sistema S/KEY sono:• Protezione contro gli attacchi di tipo replay.• E’ concettualmente facile e semplice da usare.• E’ basato su password segrete memorizzate in

database.• Non richiede speciali dispositivi, né algoritmi

segreti.

Page 19: MSCHAP. CHAP È un protocollo di tipo challange-response Esistono due version sviluppate dalla Microsoft: –MS-CHAP v1 –MS-CHAP v2 È un protocollo a tre

Meccanismi

Ci sono due modi di operare: quello dell'utente e quello del sistema:– dal lato dell’utente, la password one-time deve essere generata– dal lato del sistema, la password one-time deve essere

verificata.

Queste password one-time sono generate e verificate usando funzioni one-way basate sull'MD4

La funzione one-way prende in input otto byte e restituisce in output otto byte, dopo che è stato eseguito l'MD4

Page 20: MSCHAP. CHAP È un protocollo di tipo challange-response Esistono due version sviluppate dalla Microsoft: –MS-CHAP v1 –MS-CHAP v2 È un protocollo a tre

Protocollo lato Server

• Client e server devono condividere un segreto

• Il client genera la one-time password all’istante i nel seguente modo:– PN=f(S)– Pi=fN-i(S)– P0=fN(S)

Dove s è il segreto ed f la funzione di Hash

Page 21: MSCHAP. CHAP È un protocollo di tipo challange-response Esistono due version sviluppate dalla Microsoft: –MS-CHAP v1 –MS-CHAP v2 È un protocollo a tre

Protocollo lato server

• Il server calcola la password e conserva ili risultato del penultimo calcolo

• Confronta le versioni e dà la risposta

• Il penultimo risultato può servire ad anticipare il calcolo della sequenza

Page 22: MSCHAP. CHAP È un protocollo di tipo challange-response Esistono due version sviluppate dalla Microsoft: –MS-CHAP v1 –MS-CHAP v2 È un protocollo a tre

Utilizzo

• L’utente chiede l’autenticazione• Il server risponde con un seed e un numero• Il seed serve ad identificare il segreto e può

essere usato per l’accesso a diverse macchine• Il numero serve a capire quante volte la funzione

di hash deve essere calcolata• Da quel momento le ulteriori password

userranno N-i per l’iesima autenticazione• Serve una reinizializzazione

Page 23: MSCHAP. CHAP È un protocollo di tipo challange-response Esistono due version sviluppate dalla Microsoft: –MS-CHAP v1 –MS-CHAP v2 È un protocollo a tre