question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Mitigate replay of modified JWT from Passport-JS

See original GitHub issue

The issue seems to be in the way that passport communicates the completion of sign-in back to oxAuth when a user logs into a third party provider. The provider sends a saml assertion back to passport, and then passport sends a post with a JWT to oxAuth to assert that the authentication has completed. That JWT is signed, but can attacker an change the signing algorithm to ‘none’ and remove the signature, and then change the expiration time. Using that modified JWT they can replay that to oxAuth at any time later, without the user having completed sign-in at the partner, and it continues the flow sending a saml success back to the RP.

This may be partially fixed in 4.1 when encryption is included.`

Possible Solution/Recommendations

Actually - “JWT tokens shall travel over https”, that’s the prerequisite to use JWT and we are doing and recommending so.

But let say theoretically we assume said is possible (man-in-middle), Then at oxAuth can be enhanced to reject JWT, which are without signing algo defined (and can publish a guideline in docs - like shibb says unspecified nameid is not allowed)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
nynymikecommented, Apr 14, 2020

I believe this needs to be implemented in the passport-saml authn interception script.

0reactions
yuriyzcommented, Jun 8, 2020

Closing as fixed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Prevention against replay attacks · Issue #36 - GitHub
The JWT spec provides the jti field as a way to prevent replay attacks. That being said tokens return by Auth0 currently (we...
Read more >
A Step-by-Step Guide to Setting Up a Node.js API With ...
A Step-by-Step Guide to Setting Up a Node.js API With Passport-JWT · The Basics of JWT · Before You Begin · Server Setup...
Read more >
Express, Passport and JSON Web Token (jwt) Authentication ...
When I try to modify this code to verify the id_token (JWT Token signed using RS256) from OpenID Connect, then I get 401...
Read more >
Preventing replay attacks with JWT
JTI, EXP and IAT are designed more to give you the tools to mitigate an attack if it's been compromised. TLS is used...
Read more >
passport-jwt
A Passport strategy for authenticating with a JSON Web Token. This module lets you authenticate endpoints using a JSON web token. It is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found