Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does OAuth 2 use nonce?

Tags:

oauth-2.0

I don't see it mentioned anywhere in the 2.0 spec, is nonce not used by OAuth 2 and if not, now does it prevent replay attacks?

The 1.0 spec states:

3.3. Nonce and Timestamp

The timestamp value MUST be a positive integer. Unless otherwise specified by the server's documentation, the timestamp is expressed in the number of seconds since January 1, 1970 00:00:00 GMT.

A nonce is a random string, uniquely generated by the client to allow the server to verify that a request has never been made before and helps prevent replay attacks when requests are made over a non-secure channel. The nonce value MUST be unique across all requests with the same timestamp, client credentials, and token combinations.

To avoid the need to retain an infinite number of nonce values for future checks, servers MAY choose to restrict the time period after which a request with an old timestamp is rejected. Note that this restriction implies a level of synchronization between the client's and server's clocks. Servers applying such a restriction MAY provide a way for the client to sync with the server's clock; alternatively, both systems could synchronize with a trusted time service. Details of clock synchronization strategies are beyond the scope of this specification.

like image 277
schmoopy Avatar asked Aug 06 '12 23:08

schmoopy


People also ask

What is nonce in OAuth2?

Nonce. This is a random, unique string value to associate a user-session with an ID Token and to mitigate replay attacks.

Is OAuth Authz or Authn?

OAuth 2.0 is an authorization protocol and NOT an authentication protocol. As such, it is designed primarily as a means of granting access to a set of resources, for example, remote APIs or user's data. OAuth 2.0 uses Access Tokens.

What is nonce in ID token?

nonce. String. The nonce matches the parameter included in the original /authorize request to the IDP. If it does not match, your application should reject the token.


1 Answers

This is captured in a separate spec. See OAuth 2.0 Threat Model and Security Considerations for details/answers :)

like image 75
Steve Bazyl Avatar answered Nov 30 '22 21:11

Steve Bazyl