Tib3rius Profile picture
Jul 28, 2024 1 tweets 2 min read Read on X
The "where to store JWTs" debate is complicated and not without nuance. It's important to realize that there is no 100% secure answer.

That is to say, whatever answer you give, there are associated weaknesses that you must be aware of.

A lot of people will argue that if your app is vulnerable to XSS, cookies with HttpOnly are at least protected from JavaScript, while Session/Local Storage are designed to be accessed by JavaScript.

This might seem like cookies have a big advantage, but what this really means is that cookies cannot be stolen. However, since the browser automatically adds cookies to requests, any XSS attack could send valid requests and steal the data from them. So yes, while you don't get the actual session token, you can still use it, which is ultimately what an attacker wants to do anyway.

Moreover, if you rely on cookies, your app needs to protect itself against CSRF. This has become easier with SameSite cookie attributes, but they are not without their limitations ().

If you use Session/Local Storage and set session tokens via a non-Cookie header (e.g. Authorization), CSRF is impossible. It's important to note that if your app is vulnerable to XSS, all your CSRF protections will fail regardless of how you store session tokens.

Finally, people suggesting Session Storage over Local Storage face the issue that Session Storage is per-tab not per-site. If you store a session token in Session Storage, then right-click a link in your app and "Open in new tab", you will be logged out in that new tab.

This is not me arguing for / against a particular method. As I said at the start, there is no 100% secure solution. This is a brain dump of some of the weaknesses each has so people can make more educated decisions. 🤷portswigger.net/web-security/c…

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Tib3rius

Tib3rius Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @0xTib3rius

May 12
10 Burp extensions I actually use... BUT none of them are in the top 30 most popular in the BApp Store!

I get tired of seeing the same extensions come up in "top 10" lists. Here are some hidden gems you might not have tried... yet. In no particular order.

🧵👇 Image
Authentication Token Obtain and Replace (ATOR)

Session expiration is the bane of automation. If a session token expires mid scan, you're left with incomplete results. ATOR detects expired tokens, re-authenticates, and updates requests with the fresh token. Perfect for non-cookie session tokens!Image
SAML Raider

If you've never tested an API that uses SAML, you're lucky. If you have, you know how frustrating of an experience it can be. SAML Raider is a must have, allowing you to edit, sign, and manipulate SAML messages directly within Burp. Image
Read 12 tweets
May 11
I often get asked what tools I use for web app pentesting, and people are surprised when I say it's 99% Burp Suite Pro. Here's why...

🧵👇 Image
It's called a "Suite" for a reason. It has a lot of features baked in: interception, scanning, fuzzing, analysis, plus extensions that make most external tools redundant. Image
Need to brute-force parameters, fuzz and detect interesting responses, or send large numbers of payloads? Intruder is powerful, fast, and fully customizable. It handles most use cases where you'd otherwise use wfuzz or ffuf. Image
Read 10 tweets
Aug 5, 2023
OK, I have no idea how long this series of tweets will be, but I've heard from several people associated or previously associated with NCC. While I've verified the association, bear in mind that a lot of this is from single sources.

To start with, here's some backstory on the… twitter.com/i/web/status/1…
Since February, NCC NA has tried to diversify its customer base more and has slashed its day rates to remain competitive. NCC Group also started an initiative to create a new center in Manila, where they can offshore cheap scan work.

One source alleged that the team sent to help… twitter.com/i/web/status/1…
Round 2 of the layoffs started on Wednesday, August 2nd. Another short-notice North American all-hands meeting was called with the new COO. Prior to this meeting occurring, employees become aware that several people are being called by senior leadership and let go.

This… twitter.com/i/web/status/1…
Read 5 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us!

:(