Giter Site home page Giter Site logo

Comments (10)

adamw avatar adamw commented on July 18, 2024

It's been a while since I last looked into this so excuse me if I'm slightly out of date :).

As far as I remember, CSRF attacks are when a user submits a request by clicking a link or even visiting a malicious site. Last I checked (but this could have been 2 years ago), being able to submit anything in the header was sufficient to determine that a request is not a CSRF attack, as setting a header requires running a script (and if a script can be run, than we are dealing with XSS, which is a more serious problem but not in scope here).

But of course new attack vectors might have surfaced, and double-submit cookies might no longer be sufficient. I don't have the capacity right now to investigate, so maybe you could share some recommendations on an implementation that would be more secure? And how an attack against the current one can be carried out?

Thanks!

from akka-http-session.

willemvermeer avatar willemvermeer commented on July 18, 2024

Hi Adam,

Thanks for getting back on this one. The issue was detected during a security test by an external company.

On the OWASP site there are some recommendations on how to mitigate this risk: herehttps://owasp.org/www-community/attacks/csrf
What might be possible is to define a new CsrfCheckMode that ties the SessionManager and CsrfManager together, such that the CsrfManager can reuse the session cookie value to create a secure hash instead of the current SessionUtil.randomString(60)
I might be able to help out by working on a PR but would first like to know if you think this would be valuable addition to the library?
Thanks, Willem

from akka-http-session.

mszczygiel avatar mszczygiel commented on July 18, 2024

Hi Willem,
per OWASP recommendations using secure hash of session cookie is discouraged. Suggested approach is to either encrypt or to use HMAC of the token as a cookie. For sure it would be valuable addition to the library, so PR is welcome :) Looks like HMAC may be simpler to implement, but any of the solutions recommended by OWASP is fine.

from akka-http-session.

willemvermeer avatar willemvermeer commented on July 18, 2024

from akka-http-session.

willemvermeer avatar willemvermeer commented on July 18, 2024

Hi @adamw / @mszczygiel ,

I created a PR with a minimal implementation of the suggested CSRF improvement.
How do I move forward? I have no access rights to the repository to push a PR?

Thanks,
Willem

from akka-http-session.

adamw avatar adamw commented on July 18, 2024

@willemvermeer great! you should fork the repository to your account, push the branch, then you should be able to open a PR against the original one (this one :) )

from akka-http-session.

willemvermeer avatar willemvermeer commented on July 18, 2024

Hi @adamw happy new year :-) this is a gentle nudge to take a look at the PR I submitted for this issue - comments are appreciated when you can find some time, thanks!
See: #79

from akka-http-session.

adamw avatar adamw commented on July 18, 2024

@willemvermeer thanks, taking a look now. Sorry it took so long, but we've been mostly away for Christmas / New Year :)

from akka-http-session.

willemvermeer avatar willemvermeer commented on July 18, 2024

Thanks @adamw ; I addressed your comments in a followup commit. And no apologies required for taking a Xmas break :-)

from akka-http-session.

adamw avatar adamw commented on July 18, 2024

@willemvermeer I suppose this can be closed now?

from akka-http-session.

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.