Giter Club home page Giter Club logo

Comments (3)

vickymicky avatar vickymicky commented on August 12, 2024

We could implement a new feature to support this something like (if it doesn't exist already),

  1. https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Session_Management_Cheat_Sheet.md#binding-the-session-id-to-other-user-properties
  2. https://security.stackexchange.com/questions/123536/replay-attack-example-for-validating-nonce?rq=1

High-level solution:

  1. Application client generates nonce and passes it to auth server to create JWT, with passed nonce as JTI claim and sets this nonce as http-only, secure cookie.
  2. Further on, whenever the JWT is passed on to microservice, it could cross check the JTI claim against the passed nonce cookie.

This way, the attacker needs the cookie set by the application to perform the attack.

We could introduce a new property called, "smallrye.jwt.verify.jti.cookie" and the value could be the cookie name which it needs to use to validate against with.
For ex: smallrye.jwt.verify.jti.cookie = nonce

sample request: curl -v -X GET http://api.microservice.com/abcservice -H "Authorization: Bearer *" --cookie "nonce=478948"

from smallrye-jwt.

sberyozkin avatar sberyozkin commented on August 12, 2024

@vickymicky I believe it is not in scope of smallrye-jwt to deal with such concerns, there is no notion of session in smallrye-jwt - it verifies bearer access tokens, even if they may be coming as cookie values. Such issues has to be dealt at the higher level, EAP, Quarkus, firewalls.
The nonce solution you propose does not work because we can't expect every user use the same nonce value.

I think what smallrye-jwt can help with is to restrict how long an access token can be accepted for, using its time to live property. For example, the token can be valid for 1 day, but you can restrict to be usable for 1 hour only from the moment it was issued. Beyond that, indeed, using HTTPS, if needed, MTLS, as well as not making access tokens valid for a long time, all all the good measures.

from smallrye-jwt.

sberyozkin avatar sberyozkin commented on August 12, 2024

@vickymicky This is a good discussion, let me convert this issue to Discussion for now, thanks

from smallrye-jwt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.