[00:00.000 --> 00:11.260] Welcome. Yeah, still waking up? Alright, there's a guy that's awake, right? Anybody else? Oh [00:11.260 --> 00:19.900] yeah, woo, I'm awake. Have a nice day. Alright, anyways, we've got, I'm going to try and say [00:19.900 --> 00:27.680] these names right. Narayan, Lakshmi and Divya. They are from a large application security [00:27.680 --> 00:33.440] team. Uh, they're going to be talking about, um, authentication, doing it right, doing it [00:33.440 --> 00:38.660] wrong, right? The name, the title of the talk is, Who Dis? Who Dis? The Right Way to [00:38.660 --> 00:51.590] Authenticate. And, uh, without further ado, here you go. Hey, good morning everybody and thank you [00:51.590 --> 00:56.110] for making it on a Sunday morning. So, welcome to our talk, Who Dis? The Right Way to [00:56.110 --> 01:02.630] Authenticate. Who are we? Thank you for the introduction, David. Uh, I'm Lakshmi Sudhir, she [01:02.630 --> 01:09.370] is Divya, and he's Narayan. We do all things application security, we try to be involved in [01:09.370 --> 01:14.810] the whole, all stages of, uh, SDLC to make sure it's secure. And we work with, and for [01:14.810 --> 01:18.890] developers and security engineers, we consider that our primary responsibility. So we work [01:18.890 --> 01:23.090] with them to make sure we have, uh, secure products that are being shipped out there and we [01:23.090 --> 01:29.430] help them with all the security guidelines around whatever they're building. So, before we [01:29.430 --> 01:35.310] go into the talk itself, just to note that everything we've used for our research is all [01:35.310 --> 01:41.170] publicly available data. We haven't used anything that's for a company or anything else as [01:41.170 --> 01:47.250] such. Also, one more thing is, we want to make this clear out there that we are not encouraging [01:47.250 --> 01:54.550] the use of anything that is inherently secure, uh, sorry, insecure. And, uh, this is just an [01:54.550 --> 02:00.250] attempt that, be it that, if you, uh, have to use, based on the business case, uh, [02:00.250 --> 02:06.610] relatively insecure part of, uh, protocol itself, then how do you go about making it secure? [02:06.710 --> 02:11.750] So, that is what we are trying to address in this talk. It's not to encourage any inherent [02:11.750 --> 02:18.350] insecure, uh, component of any technology or protocol. Let's dive right into the talk now. [02:21.000 --> 02:27.020] Okay. So, the agenda for today is, we're going to go with the background of, like, what is [02:27.020 --> 02:32.760] authentication, and then address, like, why is this a problem? Of course, that's what leads us [02:32.760 --> 02:36.560] to the problem statement. We're going to get more in details about a bunch of protocols and [02:36.560 --> 02:42.480] schemes with authentication. Then, we're going to drive out a conclusion around, hey, why is [02:42.480 --> 02:47.700] this still a problem, and what are the patterns we observed across different authorization [02:47.700 --> 02:54.760] schemes. Then, we want to have some time for, like, Q&A towards the end as well. So, what is [02:54.760 --> 03:00.400] authentication? What comes into mind as soon as I say authentication? It could be Kerberos, I [03:00.400 --> 03:07.200] think passwords might be the top one, API keys, OAuth, SAML, and a million of them. Also, [03:07.200 --> 03:13.100] something that is closely coupled with authentication is identity. What is identity? [03:13.100 --> 03:20.620] Identity is who you are. And authentication is what verifies your identity. So, [03:20.620 --> 03:26.960] authentication is what verifies who you are. Authentication is what actually verifies that I'm [03:26.960 --> 03:33.500] Lakshmi, she's Divya, and he's Narayan. Now, how do you authenticate? In general, we use [03:33.500 --> 03:38.180] passwords, which is pretty common when we log into any application. Or you might have used your [03:38.180 --> 03:42.960] pin to go draw some money to gamble a little bit when you're in the conference. Who doesn't [03:42.960 --> 03:48.440] want some fun? And that could be something that you know, a secret that you know that you use [03:48.440 --> 03:54.340] to identify yourself to an application saying, hey, it's me who's logging in. Then, [03:54.340 --> 03:59.920] something else could be YubiKeys or some device that you own, which is the possession aspect [03:59.920 --> 04:04.040] of it. And the other part is where you might have woken up and be like, hey, let me look at my [04:04.040 --> 04:09.000] phone, and that's your face ID, you might be using a touch ID, and that is what you inherently [04:09.000 --> 04:14.860] are. So, authentication boils down to three things. Something you know, that's knowledge. [04:14.860 --> 04:21.120] Something you have, that's possession. And something you inherently are, that's inheritance. [04:21.660 --> 04:27.180] Now, where does authentication come into play? It might be user authentication broadly and [04:27.180 --> 04:32.120] service authentication. With user authentication, I was talking about you logging into an [04:32.120 --> 04:37.360] application, drawing out some money, and other things that you interact with the system. For [04:37.360 --> 04:43.020] example, when we were trying to do this research, we wanted to pull up some of the CVs or some [04:43.020 --> 04:48.100] of the bugs that were associated to a bunch of authentication protocols. How did we do that? [04:48.100 --> 04:52.900] We logged into an application, and this application spoke to multiple applications in the [04:52.900 --> 04:58.400] background, and those applications reached out to their own data repositories, be it a [04:58.400 --> 05:03.860] database, be it an S3 bucket, and they pulled out all that information, brought it together, [05:03.860 --> 05:08.620] provided it to the requesting service, and this service fed it to a BI tool to make sure we get [05:08.620 --> 05:15.780] this readable and ingestible data. And in each of these interactions, the- each of the [05:15.780 --> 05:21.040] service, uh, talking to another entity, each of these entities had to authenticate saying, [05:21.040 --> 05:26.300] hey, this is me who's requesting, and I do have access to this. So, when each of these [05:26.300 --> 05:31.840] entities were interacting, they had to verify their identity. So, in this ecosystem, [05:31.840 --> 05:38.900] authentication is mostly a backbone to everything we do today. Now, in this complex [05:38.900 --> 05:44.120] ecosystem, we are using authentication. Do you think there's a problem? Of course, yes, and [05:44.120 --> 05:51.380] that is why we are on a Sunday morning talking about authentication right here. Now, why is [05:51.380 --> 05:55.640] there a problem? That's- let's look into that more, but if you're a skeptic, we have some [05:55.640 --> 06:01.560] data for you. In OS.M, the latest revision also puts broken authentication in the second [06:01.560 --> 06:08.440] place right after code injection. This shouldn't be the case in 2019, is what we thought. Then [06:08.440 --> 06:14.160] we pulled up more data, and we got this HackerOne report of how much companies are [06:14.160 --> 06:18.640] spending on bounties based on the classification of the kind of bugs that are being [06:18.640 --> 06:24.300] submitted. And this was surprising to us. I mean, cross-site scripting is expected, [06:24.300 --> 06:29.160] unfortunately we have that, that's probably for another talk, but broken authentication was [06:29.160 --> 06:34.340] still the second most common thing that companies spent a lot of their money on by giving [06:34.340 --> 06:39.360] out bounties. And this is where we thought, we have OAuth, we- we didn't want to remember [06:39.360 --> 06:43.200] passwords, we wanted to keep it complex, we didn't want one pass- I mean, we didn't want to [06:43.200 --> 06:46.680] remember passwords for each application, which would make it harder to make it complex, [06:46.680 --> 06:51.180] that's how we came up with single sign-on. So, there are solutions based on issues we have [06:51.180 --> 06:57.120] faced before, but why is this still the second most paid out bounty? So, that's- this was [06:57.120 --> 07:00.760] mostly the inception for our talk, we were like, this requires some research, what are we [07:00.760 --> 07:04.800] doing wrong, what is going wrong with this? So, this was mostly where we were like, hey, [07:04.800 --> 07:10.140] let's go dig into some of the protocols and see how we can go about this. Now, of course, [07:10.140 --> 07:14.620] we looked in deeper, there's been some leakage of tokens, there have been tokens that have [07:14.620 --> 07:19.980] been, uh, leaked because of, uh, uh, some redirect URIs and a bunch of other reports that we [07:19.980 --> 07:24.500] actually dived into. There were tokens which weren't expiring at all as well. So, we [07:24.500 --> 07:29.200] thought, we'll come up with an approach and figure out how do we approach this as a [07:29.200 --> 07:34.560] holistic problem. So, we identified how we went about our approaches, initially we [07:34.560 --> 07:38.060] identified, we went through like, uh, the top 200 applications and we were like, hey, [07:38.060 --> 07:42.000] let's identify the most commonly used authentication protocols. Then we identified the [07:42.000 --> 07:45.800] high-risk issues and we thought, let's attack them. Of course, after the research, our [07:45.800 --> 07:49.660] idea was to come up with like a remediation or like something that could be pragmatic and [07:49.660 --> 07:54.580] useful. And the end goal always, like I said, as security engineers, I feel we hold our [07:54.580 --> 07:58.940] responsibility towards helping developers build things securely. Implement all those [07:58.940 --> 08:04.660] existing protocols securely. So, that's how we approach the problem. For today's focus, [08:04.660 --> 08:08.440] we're gonna talk about, we're gonna start off with, uh, JSON web tokens, then we're gonna [08:08.440 --> 08:12.540] dig a little deeper into OAuth, then of course the passwordless solutions, that's [08:12.540 --> 08:16.440] MagicLinks, and then we're gonna talk a little bit about SAML as well. These are the four [08:16.440 --> 08:23.020] things we chose to go a little more in-depth for this talk. Let's start with JSON web tokens, [08:23.020 --> 08:30.460] JWTs, or JWTs. What is a JSON web token? A token is nothing but an identifier. With J- [08:30.460 --> 08:36.100] JSON web tokens, it is an encoded JSON blob that has some key value pairs, which is being [08:36.100 --> 08:41.620] digitally signed, and provided as a token by an authorization server. I know I said a lot of [08:41.620 --> 08:49.540] words. So, this is where it could be applicable. Let's say, as a user, I log into, uh, I log [08:49.540 --> 08:53.320] into an application using Facebook, Google, or any of the social auth. There is an [08:53.320 --> 08:58.400] authentication server which validates that, hey, this is a username, password, and then it [08:58.400 --> 09:04.760] provides a token, a JWT in this case, a JWT. Now, as a user, uh, my identity was verified, [09:04.760 --> 09:09.840] and this token is given to me as a unique identifier. And now when I want to log into, [09:09.840 --> 09:15.060] say, Quora search, uh, I pass this, uh, token itself. It validates, based on the signature, [09:15.060 --> 09:19.520] you could use both symmetric and asymmetric algorithms. So, let's say my application has a [09:19.520 --> 09:24.100] public key of the authentication server. It validates this token, and then if it's [09:24.100 --> 09:30.540] validated, saying it wasn't tampered, uh, over, uh, transit, it actually services this user, [09:30.540 --> 09:36.100] uh, to, like, uh, probably they're requesting to access data, so they just, this, uh, the [09:36.100 --> 09:43.140] user is serviced. Now, why do people, why do developers use JWTs in comparison to the [09:43.140 --> 09:47.840] session, uh, tokens itself, the session IDs, which have, like, a unique, uh, a random [09:47.840 --> 09:54.340] number that was being used? So, with JWTs, you achieve authentication because we are [09:54.340 --> 10:00.160] relying on the integrity of the token itself, and also you could achieve authorization by [10:00.160 --> 10:05.260] adding some of the scopes. One more most important key difference is that with a session [10:05.260 --> 10:10.300] identifier, you'd have to store these unique random strings, along with the user ID, or [10:10.300 --> 10:17.540] maintain some kind of state every time a request is made. So, with JWTs, it's out there, you [10:17.540 --> 10:21.180] just service the token, only when the token comes in, you validate it based on the, uh, you [10:21.180 --> 10:25.900] validate the digital signature, and you go about servicing it, which makes it stateless. So, [10:25.900 --> 10:30.920] this is one of the key reasons that most, uh, implementations have chosen JWT. Again, it's [10:30.920 --> 10:34.400] compact and lightweight. This is a little debatable because it depends on how much [10:34.400 --> 10:39.240] information you're putting into the JSON body. And other one is, uh, it's scalable compared [10:39.240 --> 10:43.120] to session tokens because you're not maintaining, like, all of these unique session IDs, and [10:43.120 --> 10:47.440] going about, like, servicing as and when they come. So, it's pretty scalable. Again, coming [10:47.440 --> 10:51.620] back to the point of this is a JSON body, you have key and values, so in, uh, in situations [10:51.620 --> 10:56.780] like OAuth and stuff, you could use this to even exchange information across third parties. [10:57.340 --> 11:02.160] So, yes, where is it popularly being used? It's being used in OpenID Connect as identity [11:02.160 --> 11:08.520] token. It's also being used in OAuth as access tokens and refresh tokens. And JWTs are also [11:08.520 --> 11:14.180] being a session, uh, user session object, so we are going to talk about this, uh, being a [11:14.180 --> 11:21.040] tricky place to be in a couple of slides. Now, now that we spoke about JWTs itself, let's [11:21.040 --> 11:27.580] look into structure of this JWT. You have, uh, on the left, uh, side of this is where you [11:27.580 --> 11:33.340] see the header, payload, and signature. This is nothing but an encoded, uh, Base64 URL [11:33.340 --> 11:38.440] encoded block. This is what is being passed on to the server. And in the header, when you [11:38.440 --> 11:42.900] decode this, so remember that there's no confidentiality since anyone can decode who gets [11:42.900 --> 11:48.440] this token. It's just based off integrity, that is validating the digital signature. Now, in [11:48.440 --> 11:52.880] the header, you see that there is the type of algorithm that was used to create this, uh, [11:52.880 --> 11:57.420] digital signature, and then you have the type. We are talking about JWT, so, uh, that's [11:57.420 --> 12:02.240] probably, it's just going to be JWT. In the payload is where you can have, uh, all these key [12:02.240 --> 12:07.620] value pairs. So, uh, that could be, like, the name of the user, what does the user have [12:07.620 --> 12:12.180] access to, or any kind of data. This is a section you mostly use to, uh, exchange [12:12.180 --> 12:16.800] information between third parties, or also add, like, assertions and stuff. So these are [12:16.800 --> 12:20.720] called claims, for the most part. And then you have the signature, which is basically [12:20.720 --> 12:25.540] hashed and digitally signed, such that when, uh, an application gets this token, it can [12:25.540 --> 12:30.560] validate and make sure that this wasn't tampered with. So, we have the header, we have the [12:30.560 --> 12:37.580] payload, and we have the signature for a chart. Let's move on. How many of you here, show of [12:37.580 --> 12:45.760] hands, think this is a valid chart? Okay. Okay, you guys are right. This is, uh, unfortunately [12:46.180 --> 12:51.640] a valid chart. One of the things I think you notice is, we have the header, we have the [12:51.640 --> 12:58.840] payload, but the algorithm says none. This is, uh, being used in some edge use cases, and [12:58.840 --> 13:05.340] allowed by the GWT RFC itself. So, when the algorithm is none, if you do not validate or [13:05.340 --> 13:10.120] handle the library that is actually validating this token, it looks at this algorithm, the [13:10.120 --> 13:14.940] algorithm says none, it's supported by the RFC itself, and then it just disregards the [13:14.940 --> 13:19.460] signature, and goes ahead and services this, uh, validates the token, says it's valid, and [13:19.460 --> 13:25.280] goes ahead with, uh, servicing the request. Now, with this, as an attacker, I can go ahead [13:25.280 --> 13:30.860] create any token, and every token would be valid. So, I can get any actions, I can make any [13:30.860 --> 13:35.580] request, and get all the information out there. This has been there since 2015, and [13:35.580 --> 13:40.780] unfortunately, I mean, uh, again, the GWT RFC has been there from about 2014, I guess, but [13:40.780 --> 13:46.060] this has been a problem that is known and still prevalent out there. Now, how do you go [13:46.060 --> 13:50.340] about, like, uh, remediating this problem? One of the things, of course, the best-case [13:50.340 --> 13:54.520] scenario with programmatic control could be that you might be using a particular algorithm, [13:54.520 --> 13:57.720] you could hard-code it while validating, saying, hey, this is algorithm that you need to [13:57.720 --> 14:01.860] validate every token against. Now, this is the best-case scenario, may not apply in most [14:01.860 --> 14:05.980] business cases. That's where it comes up, the second one, where you could whitelist the [14:05.980 --> 14:09.360] bunch of algorithms you're using, and validate against it, saying, hey, the algorithm [14:09.360 --> 14:14.180] should match one of these strings, and this is how we service it. So, uh, that, this is how [14:14.180 --> 14:17.260] we validate it. So this is one of the approaches you could take. And of course, [14:17.260 --> 14:22.540] verifying that the algorithm, uh, fails on none is also a reasonable solution here. What [14:22.540 --> 14:26.400] something else you could do is, I think with any software component, anything you're [14:26.400 --> 14:31.940] building, choosing the right library holds a huge lot of prominence. GWT.io has more [14:31.940 --> 14:36.500] detailed information, so based on your tech stack and what you're using to validate, uh, [14:36.500 --> 14:40.440] your JWTs itself, you could go ahead, make a choice, understand what are the inherent [14:40.440 --> 14:44.420] risks, and if it's supposed to none algorithm, you would want to implement that branch [14:44.420 --> 14:49.460] where you're like, hey, this is something I need to validate. Now, we are doing this [14:49.460 --> 14:55.260] well, we are validating all our, uh, uh, all our tokens for none, and then we are also [14:55.260 --> 15:00.140] making sure we're using the right library. What else could go wrong? Let's say we have a [15:00.140 --> 15:06.480] user, Joe, here, and he has access to a mail server. It's valid. He uses an authentication [15:06.500 --> 15:11.560] server. He gives his, uh, username, password, and it validates. It presents back the token. [15:11.560 --> 15:16.960] The token is valid. Joe puts, uh, sends this token to, uh, mail server, which is the client [15:16.960 --> 15:20.600] application. It validates the signature. It's perfect because Joe hasn't done anything [15:20.600 --> 15:25.720] malicious so far. It's, it's the right token. Now, what if Joe presents this to another [15:25.720 --> 15:29.800] service, which is a finance service? Maybe he wants to increase his payroll, get more [15:29.800 --> 15:34.560] money. So, even this finance service uses the same authentication server, but Joe doesn't [15:34.560 --> 15:41.400] have access to go to this finance ops. So, in this case, if the client application actually [15:41.400 --> 15:46.980] doesn't verify that Joe should not have access, just validating the token was not good [15:46.980 --> 15:52.500] enough, but the client application should also make sure that the user who is actually [15:52.500 --> 16:00.100] requesting access, uh, does have, like, uh, access to, uh, finance ops in this case. What is [16:00.100 --> 16:05.780] the mitigation for this? One of the things you could use alongside JWT itself is a [16:05.780 --> 16:10.040] predefined claim called audience, where you could put it in the JSON body and say that, [16:10.040 --> 16:14.960] like, you can see here, uh, this was a cool company. So, you can say that this user has [16:14.960 --> 16:20.160] access only to the user database. That way, when you are a client application that is [16:20.160 --> 16:23.560] servicing, uh, that is validating a JWT, you could look for this parameter and be like, [16:23.560 --> 16:27.940] hey, this was the issuer. I trust the issuer, but this is the audience. So, I am not the [16:27.940 --> 16:34.980] audience and I cannot really, uh, I shouldn't be providing access to Joe in this case. Now, we [16:34.980 --> 16:38.880] validated, we made sure that the algorithm is right. We made sure we chose the right [16:38.880 --> 16:43.800] library. We are also taking care of that user substitution or replay attacks as well. What [16:43.800 --> 16:49.300] else is something we should be worried about? If JWTs are being used as session objects, you [16:49.300 --> 16:57.040] remember I mentioned a couple of slides earlier, then how do you go about logging out? Now, [16:57.040 --> 17:01.140] to log out itself, it's a harder problem because just, even though they may have a shorter [17:01.140 --> 17:06.520] TTL, I mean, again, shorter TTL is debatable, but let's say you have it for two hours. And as a [17:06.520 --> 17:11.240] user, I log in, I log out, the token is right out there being valid. Because we don't have a [17:11.240 --> 17:15.560] back-end part of it, we just have its expiry on it, but logging out scenarios need to be [17:15.560 --> 17:21.160] handled very carefully. Something you could use, you do for this is have a JTI claim, which [17:21.160 --> 17:28.640] is the JWT token identifier itself, which is a unique number, and maintain this unique number [17:28.640 --> 17:34.820] with, on your back-end, and have like, hey, this is a user, that way once a user logs out, you [17:34.820 --> 17:41.880] could revoke it. The choice is made that it was stateless, but it's no longer stateless anymore [17:41.880 --> 17:46.640] because you need to have this revocation list. It's not enough if just your authorization [17:46.640 --> 17:52.100] server, authentication server has this revocation list, but in case of like asymmetric [17:52.100 --> 17:56.640] encryption or actually anything you use for digitally signing it, each of these client [17:56.640 --> 18:01.800] applications need to also maintain or subscribe to this revocation list itself. Otherwise, [18:01.800 --> 18:05.680] while validating the token, I mean, the token would still be valid because it hasn't [18:05.680 --> 18:11.040] expired. So revocation has to be handled while it maintains a list, looks for the JTI that [18:11.040 --> 18:14.660] is a unique identifier, goes through the list and makes sure that that wasn't revoked, and [18:14.660 --> 18:21.400] then goes about, like, servicing the request. So, putting all of this together. Some of the [18:21.400 --> 18:25.520] key takeaways could be that verify, I couldn't say this enough, validate your algorithm [18:25.520 --> 18:30.720] claim, make sure to verify that this is exactly what you use. The second one is, of course, [18:30.720 --> 18:36.140] use cryptographically strong algorithms. The third one is around, like, hey, utilize all [18:36.140 --> 18:41.080] the applicable claims that are already provided in the JWT RFC itself, because why not? [18:41.080 --> 18:46.280] Why, when the protocol does the heavy lifting for you, why not let it do its job? So make sure to [18:46.280 --> 18:51.760] validate that. Use those. And I couldn't say this enough that, unfortunately, even today, [18:51.760 --> 18:57.200] revocation is a very common problem we see. So please handle revocation carefully. Make sure [18:57.200 --> 19:01.840] that any time this is used as a session object, think of revocation automatically. So this is [19:01.840 --> 19:07.080] about JSON Web Tokens. Now, Divya is going to take up OAuth and talk more about that. Thank [19:07.080 --> 19:18.220] you. Okay. Still with us? All right. The next topic is open authentication or open authorization, [19:18.220 --> 19:24.980] however you want to call it. So in case you are unfamiliar or if you want a quick primer, OAuth [19:24.980 --> 19:28.920] deals with mainly three entities, where you have the client, the resource owner, and the [19:28.920 --> 19:34.440] authorization server. The client now wants to access some resource, and that is provided by [19:34.440 --> 19:39.480] the resource owner. And the resource owner needs to authenticate that it's the right client that [19:39.480 --> 19:45.420] is accessing the resource. So you have another party, which is the authorization server, which, [19:45.420 --> 19:50.160] like, before this traffic flow happens, knows who the client is and can provide that [19:50.160 --> 19:55.280] verification information to the resource owner. And the way all these happen is through a [19:55.280 --> 20:00.140] bunch of calls, but the main thing that gets exchanged between all these three entities is a [20:00.140 --> 20:05.060] bunch of tokens. And there are three kinds of tokens. There is access tokens, refresh tokens, [20:05.060 --> 20:11.160] and authorization code, which I'm still going to group it under the token. So what happens? If any [20:11.160 --> 20:16.900] of them, and especially a client, or a web browser on behalf of a client, or even a separate [20:16.900 --> 20:22.940] service who is acting on behalf of a client, is going to be in position of a token, that means [20:22.940 --> 20:27.940] they have access to a particular resource that they are trying to access. And this particularly [20:27.940 --> 20:35.420] works perfectly when every system follows the best practice possible. And I'm pretty sure all [20:35.420 --> 20:42.540] of us are familiar on how likely that is. So I was pretty surprised to see so many words. Maybe [20:42.540 --> 20:49.460] lost, stolen, intercepted, proxied, replayed, and altered. I thought this was excessive, but [20:49.460 --> 20:56.580] then I was able to find multiple cases of the tokens being, like, lost or stolen or intercepted, [20:56.580 --> 21:01.900] and this has still not been corrected. And one mitigation that is provided for this, for [21:01.900 --> 21:09.520] handling tokens properly, is to pass it over TLS and have a shorter TTL. And I distinctly [21:09.520 --> 21:14.620] remember one person saying to me that the TTL cannot be forever, so anything shorter than that [21:14.620 --> 21:20.200] is going to be a shorter TTL, right? So it should be okay. And I've had one person tell me, I'm [21:20.200 --> 21:24.960] going to keep it at five minutes, so it should be okay. For another person, short is half an hour. [21:24.960 --> 21:30.020] For another person, it's six months. For another service, it's going to be one year. So all of this [21:30.020 --> 21:35.860] is contextual. And even if it is the shortest case possible, like, are we okay with that open [21:35.860 --> 21:41.460] attack window? Not really, right? So what if that's not enough? What if we want to protect the [21:41.460 --> 21:51.040] tokens in all situations? Token binding. This is a new concept, and there have been varying [21:51.040 --> 21:56.400] opinions on that. So in this presentation, I'm just going to open up, like, there is a concept [21:56.400 --> 22:02.280] of token binding that is available, and also a kind of stopgap measure that could be applicable [22:02.280 --> 22:08.160] in case the full-fledged token binding is not available. So what exactly is token binding? [22:08.460 --> 22:13.520] So in a normal OAuth workflow, you have just a token that is being passed between all the entities. [22:13.880 --> 22:20.320] In case of token binding, there is some contextual metadata that is attached to it. So in this case, [22:20.320 --> 22:27.420] there is a pre-negotiation workflow that happens between the client and the authorization server, [22:27.420 --> 22:33.100] where the client registers a key pair with the authorization server. So with every subsequent [22:33.100 --> 22:37.820] call, the authorization server knows the payload that is coming in, and that's going to contain [22:37.820 --> 22:42.820] both the token as well as something attached to it. And the way this happens is during client [22:42.820 --> 22:48.200] and server negotiation, there is a payload that is being agreed upon between the client and the [22:48.200 --> 22:54.020] server. And this consists of a token binding ID, which could be anything, but the recommendation [22:54.020 --> 22:59.640] is that it be between 0 to 255 characters. And the other thing that they negotiate is what [22:59.640 --> 23:04.580] signature scheme is going to be used for digitally signing the payload. And this could be the [23:04.580 --> 23:10.880] algorithm specified on the slide, and this makes sure that the authorization properly rejects an [23:10.880 --> 23:14.440] incorrectly signed payload, because anybody could fake a signature and send it across. [23:15.060 --> 23:19.720] More on that later. But there are other metadata that is also available that the client can [23:19.720 --> 23:24.760] negotiate with the authorization server, and this could be extensions, binding type, or any other [23:24.760 --> 23:30.140] custom payload that you want to add, like a token binding message that only the client and the [23:30.140 --> 23:35.580] authorization are wary of. For the purposes of this presentation and tie-ups with other protocols, [23:35.580 --> 23:39.220] I am choosing to focus on the token binding ID and the signature schemes. [23:39.220 --> 23:45.720] So, what exactly happens? During negotiation, now the client has passed on the key pair and [23:45.720 --> 23:50.820] the authorization server has registered it. So, in subsequent calls, what happens is the, [23:50.820 --> 23:55.740] as usual, the TLS handshake happens between the client and the server. There is one additional [23:55.740 --> 24:01.300] call that happens, which contains the SEC token binding header that is provided by the client. [24:01.300 --> 24:05.340] Now, what this contains is the EKMI, which is the exporting key material, [24:05.340 --> 24:09.720] and this contains the payload and the message that was agreed upon between the [24:09.720 --> 24:14.800] client and the authorization server. Right now, there is API support. Like, [24:14.800 --> 24:19.220] if you're using NGINX or Apache, you do have this available. You could extend it. [24:19.340 --> 24:25.320] There is for Java 8 and 10 as well. I have seen rudimentary applications for Django, but wait [24:25.320 --> 24:30.740] until it becomes official. And as you can see in the workflow, you have the SEC token binding [24:30.740 --> 24:37.240] header, and then once the authorization server is ready to communicate or provide or provision [24:37.240 --> 24:42.840] the client with the tokens, then it basically attaches or connotates the token binding ID to [24:42.840 --> 24:47.820] the refresh token. So, for every subsequent message that comes from the client, you not [24:47.820 --> 24:52.460] just authenticate or verify the identity of the client just based on the token that was provided, [24:52.460 --> 24:57.740] which could be hijacked, but you also depend on another secret that was shared between the [24:57.740 --> 25:05.060] authorization server. So, some of you may be aware there is no browser support or there's [25:05.060 --> 25:10.960] dwindling browser support. So, what happens in that case? The developer could still go ahead [25:10.960 --> 25:17.300] and do a mutual TLS transaction, and this is expected in the format of JSON web keys, [25:17.300 --> 25:22.540] and it happens on a very similar note, except instead of passing you the header, you basically [25:22.540 --> 25:27.480] just send across the client certificate, and then the authorization still has to register it, [25:27.480 --> 25:31.020] still has to maintain a separate data store to have this context binding ID, [25:31.020 --> 25:36.420] and then with every subsequent call that goes on, you expect, instead of expecting a header or [25:37.060 --> 25:44.500] like a connotated, like a token, you would be expecting a token plus the certificate that was [25:44.500 --> 25:56.800] already registered. Now, if both the, if you're not taken with token binding, and you feel like, [25:56.800 --> 26:02.420] Pixie, raise of hands, how many of you are familiar with Pixie? Or heard of it? [26:03.180 --> 26:11.240] Awesome. So, Pixie is proof of key code exchange. This is available as one of the types of OAuth. [26:11.240 --> 26:17.280] This is mainly aimed at mobile and basically workflows where the client secret storage [26:17.280 --> 26:24.000] becomes cumbersome, but if you are looking for a context binding solution, then you could [26:24.000 --> 26:31.400] look to Pixie as an alternative. The only way this differs is the initial negotiation call [26:31.400 --> 26:37.860] that goes out. The client provides a code verifier, which is a code challenge, and also provides TM, [26:37.860 --> 26:41.940] which is a transformation method. So, the authorization server knows a code challenge [26:41.940 --> 26:46.960] and how it was derived, and that sets up the platform to expect any code challenge that [26:46.960 --> 26:53.980] comes with the subsequent workflows. So, as you can see, the client then provides, [26:53.980 --> 27:00.220] or even subsequently uses the access token, then all it needs to do is send a code verifier along [27:00.220 --> 27:06.200] with it. So, again, the assumption here is that you have the code verifier, you don't have the [27:06.200 --> 27:10.760] access token, or you have the access token, you don't have the code verifier. If you manage to [27:10.760 --> 27:19.440] sniff both of them, then the situation is FUBA. So, you saw a couple of screenshots before, [27:19.440 --> 27:25.620] and we saw a couple of open redirect CVEs there. This kind of stood out to me, because how [27:25.620 --> 27:33.160] simply it was achieved. The way this happened was, it was a manipulated redirection URI, [27:33.160 --> 27:39.620] and the only unexpected parameter that was passed here was a percentage symbol. The server side [27:39.620 --> 27:44.560] wasn't expecting an extra character, so the validation completely failed, but it didn't [27:44.560 --> 27:49.360] fail properly. So, it still managed to pass on the token to the manipulated redirect URI. [27:49.440 --> 27:54.220] And the other thing which went wrong here is passing the redirect URI in the header. [27:55.100 --> 28:03.240] So, how do you exactly mitigate against this? Now, the minimal viable solution here is that [28:03.240 --> 28:09.300] you extend your trust boundary to include your client. You are choosing to trust your client [28:09.300 --> 28:14.380] that it's going to pass the correct redirect URI in the header, and then the server is going to [28:14.380 --> 28:19.960] interpret it and pass the token along. Now, that is the minimum viable solution here, [28:19.960 --> 28:26.260] but if you want to increase your security, but you also want to support providing the access [28:26.260 --> 28:31.400] tokens to dynamic URLs, then the other option that is available is to maintain a whitelist of URLs [28:31.400 --> 28:36.200] at the server side, and you expect the client to pass the fully formed URIs, and then you do an [28:36.200 --> 28:41.440] exact string matching on a list of URIs rather than one of them. But then the burdens on the [28:41.440 --> 28:45.280] developer, like they have to go and maintain the whitelist, it has to be robust, and all the other [28:45.280 --> 28:50.000] things that comes along with that. The best possible solution, which I'm pretty sure will [28:50.000 --> 28:55.700] have some pushbacks, is to maintain exactly one URI which is statically registered with the server. [28:55.700 --> 29:01.260] You do not pass anything in the header, and any time the particular client interacts with the [29:01.260 --> 29:05.680] authorization server, because of the registration that happened, the server automatically knows [29:05.680 --> 29:09.800] where to send it. So, there is a one-time compromise that can happen, and subsequent [29:09.800 --> 29:16.480] workflows, you're preventing that from being leaked. So, that was OAuth, and the two issues [29:16.480 --> 29:23.900] were token binding and redirect URI. Moving on for MagicLinks. So, what exactly is MagicLinks? [29:23.900 --> 29:31.520] You are removing the burden of client secrets, and you expect no passwords. The only secret [29:31.520 --> 29:36.580] that you are generating is a short-lived, hopefully good entropy secret that you are [29:36.580 --> 29:41.040] passing along either to the network provider or the email service, who have the burden of [29:41.040 --> 29:48.400] storing it. And here, you depend on, again, short-lived secrets, and you also depend on [29:48.400 --> 29:53.500] secure transport for the secret to go from your server to whoever is handling it. [29:54.300 --> 30:00.440] So, in case you know somebody who is going to be implementing passwordless or is taken by it, [30:00.440 --> 30:05.200] make sure that they follow the best practices here, or at least these are based on what I have [30:05.200 --> 30:11.640] seen so far. First one is make sure that wherever the secret is being sent, or whichever entity [30:11.640 --> 30:15.860] it's being sent to, make sure that the mobile number is verified, and make sure that the email [30:15.860 --> 30:21.160] is verified. It's laughable how many times that the secret is shared for unverified email or [30:21.160 --> 30:26.440] mobile numbers. And the second part is when you're generating a token, make sure that it has [30:26.440 --> 30:33.640] sufficient entropy, and like Lakshmi mentioned before, use a good token-generating protocol [30:33.640 --> 30:39.260] here, and for example, that is JWT. And even in that, make sure that you specify who it is issued [30:39.260 --> 30:44.320] for, and also make sure that you use the right algorithm. Even though MD5 is available as an [30:44.320 --> 30:51.020] option, please don't head there. The third point is binding the tokens. Again, extending the context [30:51.020 --> 30:58.320] binding from JWT or OAuth, make sure that you keep track of where the request to generate a [30:58.320 --> 31:04.360] secret is coming from. Make sure that you have a store of whatever secrets you're generating, [31:04.360 --> 31:08.400] either in full form or truncated, just make sure you're able to identify it and track it, [31:08.400 --> 31:12.100] and also make sure that you're tracking where the responses are coming from. [31:12.100 --> 31:16.080] One of the rudimentary checks you could do is that it's coming from two separate devices, [31:16.080 --> 31:20.740] or if you don't want to do that, just keep a track of the source where it's coming from, [31:20.740 --> 31:26.040] or how many times it's coming from. And speaking of how many, make sure that you rate limit the [31:26.040 --> 31:32.740] requests that are coming in. Make sure that the secret generation, it's a finite number, [31:32.740 --> 31:36.900] if possible make it singleton, but I know the usability cases where you have to allow it at [31:36.900 --> 31:40.880] least like three times or five times, so make sure that you have a rate limit on that, because it's [31:40.880 --> 31:44.480] super easy to enumerate and just generate the secret and do a phishing attempt yourself. [31:45.080 --> 31:48.100] So that's on magic links, on to the next topic. [31:53.240 --> 31:59.420] Thank you Divya. The last part of the presentation today would be about SAML, [31:59.420 --> 32:06.000] Secure Assertion Markup Language, and before we talk about the security issues, the remediations, [32:06.000 --> 32:11.220] the mitigations that we can have for developers, I would take this opportunity to set some context [32:11.220 --> 32:18.480] on why we decided to talk about SAML, and what is SAML. So as you guys are aware, people are [32:18.480 --> 32:24.700] moving towards the cloud, and according to recent independent research, application developers on [32:24.700 --> 32:28.940] an average use around like eight different applications to do the day-to-day activities, [32:28.940 --> 32:34.900] to support ID, HR, payroll, payroll systems, and different internal operations as well. [32:34.900 --> 32:40.940] So we definitely need an enterprise setup, and that's where a single sign-on comes into play, [32:40.940 --> 32:48.000] and what we have seen is that the underlying protocol which powers single sign-on is SAML, [32:48.000 --> 32:54.900] and when you use a single sign-on, obviously you are not worried about password reuse or multiple [32:54.900 --> 33:02.140] password stores, because attackers always try to hit the weakest link in the chain, and you don't [33:02.140 --> 33:08.260] have to have multiple password stores, and talk about password hashing, and how we want to secure [33:08.260 --> 33:14.120] those password stores with network isolations as well. And as you guys are aware, IAM is definitely [33:14.300 --> 33:18.820] a challenge, having good authentication and authorization across the board is a challenge [33:18.820 --> 33:24.360] for organizations to come up with, and I have also seen that the vendor support is more like a [33:24.360 --> 33:29.980] marketing factor or a marketing metric for single sign-on vendors like Okta, OneLogin, where [33:29.980 --> 33:35.400] they try to support, or this is more like a marketing thing that they have, where it's easy [33:35.400 --> 33:43.420] single sign-on integrations for organizations. And what is SAML? SAML is nothing but an XML data, [33:43.420 --> 33:49.340] but with multiple distal signatures and assertions to it, and distal signatures are used to verify [33:49.340 --> 33:54.380] the authenticity of the service provider, and also the authenticity of the identity provider, [33:54.380 --> 34:00.280] which could be the underlying single sign-on. And SAML also provides authorization on top of [34:00.280 --> 34:07.520] authentication. They provide user IDs and metadata, which could be like user attributes, which can [34:07.520 --> 34:12.640] be used by your portal to do like authentication, and also like make it as granular as possible [34:12.640 --> 34:19.800] based on your context. And if you look at SAML, SAML, a SAML assertion is usually signed, [34:19.840 --> 34:25.640] a signed SAML assertion is usually around 7 to 9 kilobytes of data, which is pretty verbose for you [34:25.640 --> 34:30.320] or for a library to validate and like provide like the right authenticity and provide the right [34:30.320 --> 34:36.740] authorization. So let's, let's dive into the security issues that we have seen, uh, with SAML. [34:36.800 --> 34:42.100] And as Divya and Lakshmi already mentioned about having like short TTL, having like an [34:42.100 --> 34:47.260] expiration, SAML does have something similar to that. It has something called as not before or [34:47.260 --> 34:53.260] not on or after, which is basically the timestamp that your portal needs to like validate or like [34:53.260 --> 34:59.880] trust or honor a particular SAML assertion, which could be, which could be infused, infused into [34:59.880 --> 35:05.660] the SAML assertion that is signed by the identity provider. And one of the other things is using [35:05.660 --> 35:11.840] like a nonce, which can prevent replay-based attacks where your portal needs to cache the [35:11.840 --> 35:17.340] in-response to ID that is part of the SAML request, which is again sent back in the SAML [35:17.340 --> 35:22.880] response, which needs to be checked so that we have more like a nonce that would prevent a [35:22.880 --> 35:27.800] replay-based attacks where you should not have multiple SAML assertions create or a single SAML [35:27.800 --> 35:31.440] assertion create multiple sessions. It should be like one SAML assertion creating one, one [35:31.440 --> 35:38.300] particular user session. And SAML is, it's, it's, it's nothing but an XML file or just a [35:38.300 --> 35:44.980] signature, so we are also applicable to some XML-based issues, which could be external [35:44.980 --> 35:51.940] references that could be part of your XML file. Uh, which could lead to like a DDoS attack on [35:51.940 --> 35:56.980] your SAML endpoint, which for example, if you look at this particular diagram where you define [35:56.980 --> 36:01.240] an entity, and you recursively call this entity multiple times, which could like [36:01.240 --> 36:05.540] exponentially call it and that could lead to like a billion loss attack on your SAML endpoint, [36:05.540 --> 36:10.100] which could like bring down your SAML systems, uh, in, in such a way that it would not be [36:10.100 --> 36:14.960] available for alleged users. And also this could lead to ex, ex, external XML entity attacks [36:14.960 --> 36:20.360] where you can have like an XML file or you can have like an internal file like EDC host name [36:20.360 --> 36:25.620] sent to a remote server if you don't have the right mitigations for XSEs, which I will be [36:25.620 --> 36:31.360] talking in the, in the future slides. Um, and SAML has a lot of distal signatures, so I've [36:31.360 --> 36:36.020] seen SAML assertions with single distal signatures and multiple distal signatures. So [36:36.020 --> 36:40.460] missing signatures is an attack that, that it's more like a fuzzing attack on your SAML [36:40.460 --> 36:45.940] endpoint where you remove the distal signatures and see what your, uh, what your portal is, [36:45.940 --> 36:49.980] uh, how your portal is handling those kind of SAML responses or SAML messages. And [36:49.980 --> 36:54.000] signature wrapping attacks is where you kind of like either clone or move your distal [36:54.000 --> 36:59.040] signatures around so that to, to, to see if your SAML library or if you're, if you're going [36:59.040 --> 37:03.780] to do it manually, if you have like those code to kind of like catch those exceptions [37:03.780 --> 37:08.100] when, when like you clone signatures with your own public key certificate or you move [37:08.100 --> 37:13.460] signatures and assertions around. And one of the recent issues that we saw was about how we [37:13.460 --> 37:19.240] parse XML. Um, like under the word if you, let's say if you're using like a SAML library, [37:19.240 --> 37:24.680] like PySAML or PasswordSAML, uh, it uses like an XML tree to parse the entities, the [37:24.680 --> 37:29.560] values, the field values of our XML. And, and this is where like the canonicalization [37:29.560 --> 37:35.380] algorithm comes into play where you can introduce like a comment and the way the XML tree [37:35.380 --> 37:40.460] parses it could lead to authorization bypass. So as you see, as you can see, like the left [37:40.460 --> 37:45.560] side is where there's an account where it's a fake admin at example.com. But let's say if [37:45.560 --> 37:50.540] you can introduce a comment and if the XML tree parser breaks it down into like text and [37:50.540 --> 37:55.700] comments, then you can have like an account or like valid credentials for fake admin at [37:55.700 --> 38:01.120] example.com, but you can log in as admin at example.com. So this is where like you have to [38:01.120 --> 38:06.580] make sure the underlying XML tree parser makes, takes into account of like comments with [38:06.580 --> 38:11.360] like canonicalization algorithms. And now let's, let's talk about the mitigations that we [38:11.360 --> 38:17.720] have for, um, XML-based security issues. Definitely I've seen that we, uh, application [38:17.720 --> 38:21.660] developers use a lot of XML validation libraries, like as I already mentioned, PyXML, [38:21.660 --> 38:26.900] PassportXML. So using the right validation library, uh, which are, which can catch these [38:26.900 --> 38:31.480] exceptions that we spoke about or the security issues and which, which has been like patched [38:31.480 --> 38:35.900] for all the security issues is one of the mitigations that you can have to, uh, to come up [38:35.900 --> 38:41.260] with a good SAML, um, uh, implementation. And also disabling external entity is very [38:41.260 --> 38:46.740] important, uh, because when you have like a SAML endpoint, you don't have, I mean in most of [38:46.740 --> 38:51.760] the cases you don't need to like have external references, uh, because SAML is more like an [38:51.760 --> 38:56.460] encapsulated file which has everything to verify the authenticity of a particular, uh, [38:56.460 --> 39:01.820] particular, uh, identity provider. So you can disable the external entities to be false so [39:01.820 --> 39:07.960] now we are not vulnerable to excesses on our SAML endpoint. And the other thing is to [39:07.960 --> 39:11.980] prevent like a DDoS attack, like a billion laughs attack, you need to have some kind of a [39:11.980 --> 39:16.260] memory constraints, memory restrictions. That's where you can have like a, you can [39:16.400 --> 39:21.020] configure a security manager, uh, at your, in your endpoint that will either turn off or [39:21.020 --> 39:26.120] limit the entity expansion. So now you have some memory restrictions so that you hit, when [39:26.120 --> 39:29.940] you hit a particular memory computation power, then the, the SAML particular, the [39:29.940 --> 39:34.360] particular function is going to like break so that we don't have like a DDoS attack on our [39:34.360 --> 39:38.480] SAML endpoints. And it's configuring a security manager is very, is very important to [39:38.480 --> 39:43.720] prevent billion laughs attack. And also look at other alternatives. I think the industry is [39:43.720 --> 39:48.260] also moving towards open ID connect where it's trying to, it's trying to come up with more [39:48.260 --> 39:54.140] like a jot after your single sign on where it's less verbose, it's easy to, uh, interpret and [39:54.140 --> 39:58.700] correlate what the metadata of that particular token is rather than looking at a file which is [39:58.700 --> 40:04.600] around like 7 to 9 kilobytes. So look at alternatives for, um, for a single sign on. So [40:04.600 --> 40:09.620] now I, I think we have covered different authentication patterns and we just wanted to [40:10.040 --> 40:13.700] kind of brief on like the common, commonalities that we have seen across different [40:13.700 --> 40:18.960] authentication patterns, let it be JWT, OAuth, or SAML or Passwordless. So some of, these [40:18.960 --> 40:24.100] are some of the things that we would want to brief about which is, which are token metadata. [40:24.100 --> 40:28.340] So look at token metadata and token metadata can be used to provide very granular [40:29.020 --> 40:34.120] access controls and also like granular authorization for your, uh, portal. And the choice [40:34.120 --> 40:38.460] of algorithm is very important. Like based on the use case, if secret sharing is easier [40:38.460 --> 40:41.540] then you can like look into a symmetric encryption, if not then you can look at public [40:41.540 --> 40:45.440] encryption. So algorithmic choice is very important as well. And insufficient [40:45.440 --> 40:50.800] validation. So any kind of authentication pattern comes with, comes with multiple layers [40:50.800 --> 40:55.040] of defense where like there are multiple validations in place. So look into like [40:55.040 --> 41:00.740] combining validations, not just like rank or just one validation because that could like be [41:01.680 --> 41:05.160] programmed incorrectly where we could like lead to like bypass issues or author, [41:05.160 --> 41:09.160] authentication and authorization bypass issues. And missing context is also very [41:09.160 --> 41:13.620] important because we have seen that in JWTs and as well as in Passwordless. So you do [41:13.620 --> 41:18.380] need to understand the context of your application so that you can decide which [41:19.540 --> 41:24.440] authentication approach would be the best for your application. And also, um, [41:24.440 --> 41:28.360] understand which, like which kind of encryptions or which kind of algorithms you can use for [41:28.360 --> 41:33.140] your, for your applications. Um, and yeah, I mean like just to conclude, I think there are [41:33.140 --> 41:37.360] multiple ways to authenticate and we have not touched on like all the different [41:37.360 --> 41:42.700] authentication patterns but we, uh, did pick on a few and we wanted to talk about them, talk [41:42.700 --> 41:46.280] about the bad practices, talk about the mitigations which we, which we have done. And [41:46.280 --> 41:51.640] also we have seen that being application security engineers, uh, we also work very [41:51.640 --> 41:55.960] closely with developers, uh, educate them, empower them so that they can like [41:55.960 --> 42:02.880] securely, um, have like the most secure authentication, uh, in place. Um, so yeah, um, [42:02.880 --> 42:31.940] this was our talk and we are now open for any Q&A's. Uh, is, is, is the question about, uh, [42:31.940 --> 42:40.180] like digital signature bypass or authorization bypass? Uh, for only for .NET, uh, [42:40.800 --> 42:48.720] I think we, we have come, we have come across like, uh, very common use cases where there was a [42:48.720 --> 42:53.500] signature bypass that was reported by Duo Security where like most of the SAML [42:53.500 --> 42:58.500] libraries, whether it's Okta or OneLogin, where you can like include like a common and like do [42:58.600 --> 43:03.680] like a signature bypass. But I don't have any specifics for just for .NET. I, I can [43:03.680 --> 43:05.320] definitely, uh, look into that. [43:05.320 --> 43:11.100] Okay, so, uh, the presenter was Alvaro Nunes. Okay. The talk was SSO works. It was a [43:11.100 --> 43:31.610] brilliant issue. Cool, okay. I'll do that. Thank you. Yes. Uh, the token stealing in JWT. Okay, [43:31.610 --> 43:37.130] uh, the question was about how do you prevent token stealing? So I think, uh, uh, [43:37.130 --> 43:43.650] come. In JSON Web Tokens. In JSON Web Tokens. Okay. So, token could be stolen. I mean, [43:43.650 --> 43:47.050] sending over HTTPS is of course, uh, sending over TLS is a pretty good, uh, [43:47.050 --> 43:51.530] prevention as such. But even if tokens, uh, so I think that's where the other parts of [43:51.530 --> 43:57.690] the defense come in. Even if tokens are stolen, uh, you still like, uh, can have like [43:57.690 --> 44:01.830] some of the things in place where, oh, okay. The problem is with respect to like, uh, [44:01.830 --> 44:05.490] that's where I think what she spoke about came into picture, like avoid like leaking [44:05.490 --> 44:09.910] tokens through referers or like any of the other headers. So other compensation controls [44:09.910 --> 44:15.230] come into place as such, because we cannot prevent like, I mean, any kind of token, [44:15.230 --> 44:19.050] right? Even whether JWT or not. But one of the things you could do is also not have too [44:19.050 --> 44:24.230] much sensitive information inside your JSON key value pair, because anyone who sees, uh, [44:24.230 --> 44:27.310] gets a token can actually view all of the details. So it's mostly compensation [44:27.310 --> 44:31.390] controls around any kind of token and that applies to JWTs as well. [44:42.740 --> 44:45.180] Yeah. You can use... [44:45.720 --> 44:47.320] Using custom parameters? [44:50.260 --> 44:57.100] Yeah. I mean, I, we can definitely do that. Um, but since, I mean, as you're aware, uh, [44:57.100 --> 45:01.760] since the payload is base 64, base 64 encoded, like anybody can decode it, so we don't want to [45:01.760 --> 45:06.560] put anything that is very sensitive. So one of the things that I've seen is using the JIT. [45:06.800 --> 45:12.000] So what we have seen is like, let's say if the JIT, if this particular JIT and if that [45:12.000 --> 45:16.780] particular, if there are like a lot of requests with this particular JSON web token, but it [45:16.780 --> 45:21.480] has like mul- like mul- there are multiple times the signature was invalid, then we have [45:21.480 --> 45:25.540] some kind of like IP tracking system to kind of like detect those in places where this [45:25.540 --> 45:30.360] particular JWT with this particular JIT is kind of like fuzzing on the digital signature and we [45:30.360 --> 45:34.140] want to like identify those. And that's the thing where we kind of like have a pipeline of like [45:34.140 --> 45:38.980] identifying those and put it into a central system so that we, we would say that, okay, these [45:38.980 --> 45:43.340] are the bad JITs that are out there, so don't trust them. And like probably like work on like [45:43.340 --> 45:46.980] global lockout for that. But yeah, I mean, to answer your question, we can definitely put [45:46.980 --> 45:52.120] like a source IP, like how AWS does for its IAM roles. We can definitely do that, but we, [45:52.120 --> 45:57.200] it's just that we don't want to put a lot of data, like a lot of PII or sensitive data into, [45:57.200 --> 46:01.620] into like a JSON web tokens because we don't encrypt it, we just send it over TLS, so any [46:01.620 --> 46:05.540] service can base 64 decode it and like look at that. But yeah, that, I, I think we can [46:05.540 --> 46:09.740] definitely look into putting in like a source IP, doing some IP whitelisting as well. [46:21.600 --> 46:26.360] So if I understood correctly, you wanted recommendations on token binding for mobile [46:26.360 --> 46:36.620] apps. So, okay, he did bring it up. So I wanted to include it in the presentation, but good [46:36.620 --> 46:41.240] that you brought it anyway. So the way it happens is on mobiles, there is like two agents [46:41.240 --> 46:45.760] working on it. So if you follow the best practices and keep them separated, the code verifier [46:45.760 --> 46:52.040] and the token as they are meant to be, the event of compromises lessens. So I wouldn't, [46:52.040 --> 46:57.780] how do you store secrets right now? Like if you're using general OAuth for mobile devices, [46:57.780 --> 47:09.050] like where do you store them? Yeah, that is correct. Yeah, you could always reverse engineer [47:09.050 --> 47:15.130] and get all the secrets that are baked in. But the, but the security that Pixie brings [47:15.130 --> 47:20.090] in is that it's two agents kind of communicating and doing the traffic workflow. So even in [47:20.090 --> 47:25.310] the event of one compromise, the entire system doesn't get compromised. So I would say just [47:25.310 --> 47:30.690] storing both of them in separate apps or separate agents would still give you that security, [47:30.690 --> 47:35.690] but eventually all of them would get reversible. Unless you want to invest on another server [47:35.690 --> 47:39.950] where the mobile actually communicates with that. And then the secret is basically removed [47:39.950 --> 47:55.930] from the mobile device entirely. That would be an overkill. Yeah. The, the dynamic use [47:55.930 --> 48:01.730] case with OAuth is always a little bit iffy. So pre-registering always removes that attack [48:01.730 --> 48:06.710] vector in case if it is dynamic, then you could definitely do composition controls [48:06.710 --> 48:15.610] on the server end. Yeah. If you have other questions, you can definitely reach out to [48:15.610 --> 48:18.430] us, but we are out of time. So thank you for being a great audience.