State value in callback query doesn't compared with session stored value · Issue #218 · SimpleAuthentication/SimpleAuthentication · GitHub
Skip to content

State value in callback query doesn't compared with session stored value #218

Open

Description

@AlexanderSysoev

At BaseOAuth20Provider.cs:

        // Start with the Cross Site Request Forgery check.
        var callbackState = queryStringParameters[StateKey];
        if (string.IsNullOrEmpty(callbackState))
        {
            var errorMessage =
                "The callback querystring doesn't include a state key/value parameter. We need one of these so we can to a CSRF check. Please check why the request url from the provider is missing the parameter: " +
                StateKey + ". eg. &state=something...";
            TraceSource.TraceError(errorMessage);
            throw new AuthenticationException(errorMessage);
        }

May be this line of code needed:
callbackState.Equals(state, StringComparison.OrdinalIgnoreCase)

Activity

  1. changed the title [-]State value in callback query string doesn't compared with session stored value[/-] [+]State value in callback query doesn't compared with session stored value[/+] on Jul 21, 2017
  2. PureKrome commented on Jul 21, 2017

    @PureKrome
    Member

    Hi @AlexanderSysoev - thanks for filing this issue.

    can you please give some sample data where this fails the check, so I can understand the problem more.

    plz?

  3. AlexanderSysoev commented on Jul 21, 2017

    @AlexanderSysoev
    Author

    @PureKrome I've not tested yet, but I didn't find any comparison inside this region:
    Cross Site Request Forgery checks -> state == state?

  4. PureKrome commented on Jul 21, 2017

    @PureKrome
    Member

    OK - so what you're saying is that I'm missing the state check in this part of the code?

    (still trying to grok the problem)

  5. AlexanderSysoev commented on Jul 21, 2017

    @AlexanderSysoev
    Author

    OK - so what you're saying is that I'm missing the state check in this part of the code?

    Exactly

  6. PureKrome commented on Jul 21, 2017

    @PureKrome
    Member

    Ok - ta. gotcha! Phew :)

    BTW - how did you figure this out?

  7. AlexanderSysoev commented on Jul 21, 2017

    @AlexanderSysoev
    Author

    @PureKrome sorry for my bad communication skills)

    how did you figure this out?

    Just viewing the code)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions