Skip to content

Conversation

@thw-nango
Copy link
Contributor

@thw-nango thw-nango commented Feb 3, 2026

CVE-2023-36019 is out of the bag. We are affected by a similar vulnerability.

To mitigate, we validate state against an OOB cookie carried by the OAuth2 flow initiator.

Consider this change high-risk, as some OAuth2 providers are known to not implement the specification correctly. That could lead to broken providers in Nango.

You can ignore the first commit in this PR, as it turned out to be tautological.


The controller now mints a secure, HTTP-only oauth2-${session.id} cookie whenever it issues an authorization URL, the callback handler refuses token exchanges until that cookie is presented and then clears it, and cookie parsing is confined to the /oauth/callback route so the rest of the public router remains unaffected.


This summary was automatically generated by @propel-code-bot

@linear
Copy link

linear bot commented Feb 3, 2026

@thw-nango thw-nango changed the title validate state session ID in Oauth2 callback fix(oauth): Validate state session ID in Oauth2 callback Feb 3, 2026
@thw-nango thw-nango marked this pull request as ready for review February 3, 2026 11:06
@thw-nango thw-nango force-pushed the thw/NAN-2156/validate-session-state branch from 2203853 to acbe22a Compare February 3, 2026 12:50
@thw-nango thw-nango force-pushed the thw/NAN-2156/validate-session-state branch from acbe22a to 7556959 Compare February 3, 2026 14:45
Copy link
Collaborator

@TBonnin TBonnin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tested this change? I don't think the public API currently support cookies.

Also what about the other oauth2 flows (mcp, oauth2cc, outbound, ...)? Are they also vulnerable?

@TBonnin TBonnin force-pushed the thw/NAN-2156/validate-session-state branch from afe5a0c to 46f08f3 Compare February 4, 2026 17:59
@NangoHQ NangoHQ deleted a comment from propel-code-bot bot Feb 4, 2026
@NangoHQ NangoHQ deleted a comment from propel-code-bot bot Feb 4, 2026
@NangoHQ NangoHQ deleted a comment from propel-code-bot bot Feb 4, 2026
@NangoHQ NangoHQ deleted a comment from propel-code-bot bot Feb 4, 2026
@NangoHQ NangoHQ deleted a comment from propel-code-bot bot Feb 4, 2026
@NangoHQ NangoHQ deleted a comment from propel-code-bot bot Feb 4, 2026
@hassan254-prog
Copy link
Contributor

Have you tested this change? I don't think the public API currently support cookies.

Also what about the other oauth2 flows (mcp, oauth2cc, outbound, ...)? Are they also vulnerable?

I have tested this with several OAUTH2 providers. This change applies only to OAUTH2; other auth modes such as CUSTOM, APP, OAUTH1, and OUTBOUND, are also affected and will require a separate pr (decided to split this) as they also rely on provider callbacks.

@TBonnin
Copy link
Collaborator

TBonnin commented Feb 11, 2026

Have you tested this change? I don't think the public API currently support cookies.
Also what about the other oauth2 flows (mcp, oauth2cc, outbound, ...)? Are they also vulnerable?

I have tested this with several OAUTH2 providers. This change applies only to OAUTH2; other auth modes such as CUSTOM, APP, OAUTH1, and OUTBOUND, are also affected and will require a separate pr (decided to split this) as they also rely on provider callbacks.

Thank you for checking. Makes sense to split the PRs. It would be good to address the other auth modes relatively quickly

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants