I am trying to figure out what state
and nonce
are good for in the OpenID Connect code flow.
From what I read so far, the main attack seems to be that an attacker could intercept the authentication response, including the authorization code. If the attacker replayed the authentication response, however, the auth code would already be used and the OP would reject the token request. I saw, that the spec does not require the auth code to be a one time password, in that case I see how a replay would be possible. We, however, invalidate the auth code after use.
I also understand that, using CSRF, an attacker could call my clients redirect-uri, using a different auth code. I yet don't see how that code would be valid at the OP. Is the idea that the attacker could guess a valid auth code?
Can anybody show me an attack vector, that is solved with state and/or nonce?