Fix authentication bypass with AllowIDPInitiated#659
Open
aashh wants to merge 1 commit intocrewjam:mainfrom
Open
Fix authentication bypass with AllowIDPInitiated#659aashh wants to merge 1 commit intocrewjam:mainfrom
aashh wants to merge 1 commit intocrewjam:mainfrom
Conversation
Previously, when AllowIDPInitiated was true, InResponseTo was completely skipped at both the Response and SubjectConfirmation levels. This allowed replay of assertions with arbitrary InResponseTo values. Now, InResponseTo is only skipped when it is empty AND AllowIDPInitiated is true (a genuine IDP-initiated flow). When InResponseTo is present and non-empty, it is validated against tracked request IDs regardless of AllowIDPInitiated. IDPs that set InResponseTo to arbitrary values in IDP-initiated flows (e.g. Rippling) can use the existing ValidateRequestID hook to customize this behavior. Fixes #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When
AllowIDPInitiatedis true,InResponseTovalidation is skipped at both theResponseandAssertionlevels - even for SP-initiated flows that have anInResponseTovalue. This allows replay attacks against SPs that enable IdP-initiated SSO.The validation logic treated
AllowIDPInitiatedas "skip allInResponseTochecks" rather than "allow emptyInResponseTofor unsolicited responses."Fix: Only skip
InResponseTovalidation when both conditions are met: (1)InResponseTois empty (genuinely unsolicited) and (2)AllowIDPInitiatedis true. WhenInResponseTois present and non-empty, validate it against tracked request IDs regardless of theAllowIDPInitiatedflag.Some IdPs (notably Rippling) set
InResponseToto arbitrary values in IdP-initiated flows. Users can handle this with the existingValidateRequestIDhook.Changes:
service_provider.go: Fix validation logic invalidateAssertionandparseResponseservice_provider_test.go: AddTestSPValidateRequestIDWithAllowIDPInitiatedTesting:
AllowIDPInitiated=true, InResponseTo="": accepted (IdP-initiated)AllowIDPInitiated=true, InResponseTo="wrong-id": rejected (replay attack blocked)AllowIDPInitiated=true, InResponseTo="valid-id": accepted (SP-initiated works)AllowIDPInitiated=false: existing behavior preservedFixes aashh#3