1 00:00:00,000 --> 00:00:01,080 Hello, all. 2 00:00:01,680 --> 00:00:04,920 And welcome to day four at DEF CON. 3 00:00:10,650 --> 00:00:12,770 Thank you for joining to our talk. 4 00:00:12,870 --> 00:00:15,210 We're going to talk about PASKEYS. 5 00:00:15,570 --> 00:00:20,190 As you can see, it's PASKEYS spawn turning the web button against itself. 6 00:00:21,030 --> 00:00:22,930 So, a little bit about ourselves. 7 00:00:22,930 --> 00:00:24,170 So, I'm Shaurya. 8 00:00:24,170 --> 00:00:27,970 I work as a principal software engineer at SquareX. 9 00:00:28,010 --> 00:00:30,290 This is my second year at DEF CON. 10 00:00:30,290 --> 00:00:33,170 And second main stage talk. 11 00:00:33,170 --> 00:00:34,670 So, happy to be back here. 12 00:00:34,730 --> 00:00:36,570 Uh, yeah. 13 00:00:37,950 --> 00:00:39,050 Hello, everyone. 14 00:00:39,050 --> 00:00:39,990 I'm Johnny. 15 00:00:39,990 --> 00:00:42,710 I'm a front-end engineer at SquareX and researcher. 16 00:00:42,710 --> 00:00:44,510 And this is my first time at DEF CON. 17 00:00:44,510 --> 00:00:47,410 So, really excited to see all of you here. 18 00:00:51,820 --> 00:00:52,780 Hi, everyone. 19 00:00:52,780 --> 00:00:53,720 My name is Daniel. 20 00:00:53,740 --> 00:00:56,840 I work as a senior front-end engineer at SquareX. 21 00:00:56,880 --> 00:00:58,840 This is also my first DEF CON. 22 00:00:58,840 --> 00:01:00,340 So, really happy to be here. 23 00:01:04,520 --> 00:01:05,280 Okay. 24 00:01:05,280 --> 00:01:10,940 So, we are part of a browser security company. 25 00:01:10,940 --> 00:01:17,660 And as part of our work, we have to deal a lot with figuring out web threads and what could happen by the browser. 26 00:01:18,100 --> 00:01:21,020 We have a dedicated team that works towards all of this. 27 00:01:21,020 --> 00:01:24,480 This is just a couple of research that we have done with our team before. 28 00:01:24,480 --> 00:01:26,260 Which has been published before. 29 00:01:26,280 --> 00:01:31,260 Like, the second one was also, like, at the DEF CON main stage last year. 30 00:01:32,720 --> 00:01:38,060 So, I think it's important to talk about passkeys. 31 00:01:38,060 --> 00:01:43,820 Because we all know that all the companies are now pushing passkeys, right? 32 00:01:43,900 --> 00:01:46,620 It was all just password protection back then. 33 00:01:46,620 --> 00:01:49,040 But not everyone is just talking about passkeys. 34 00:01:49,100 --> 00:01:55,880 If you look at, you know, the latest news articles, we can see, like, all the major companies are pushing passkeys. 35 00:01:56,020 --> 00:02:03,420 And within a few years, it's gonna be the main medium of accessing applications across the web. 36 00:02:03,420 --> 00:02:12,060 So, if you have any consumer app, or if you have any, you know, SaaS application, you will see people using passkeys more often than passwords. 37 00:02:12,060 --> 00:02:17,320 And that's actually gonna happen, as you can see, because of the companies pushing it as well. 38 00:02:17,480 --> 00:02:20,940 So, the first question that comes in is that why? 39 00:02:20,940 --> 00:02:23,260 Why are they pushing passkeys? 40 00:02:23,260 --> 00:02:28,800 So, I mean, it's, of course, like, better, I would say, in some aspects, right? 41 00:02:28,800 --> 00:02:33,120 So, it uses a public cryptography, which comes with its own benefits. 42 00:02:33,300 --> 00:02:37,740 The first one is protection against phishing up to a good level. 43 00:02:38,000 --> 00:02:46,760 So, what I mean with this is that, you know, let's say you open a website, xyz.com, and then you open abc.com. 44 00:02:47,000 --> 00:02:54,120 By default, your passkey will not appear on the second origin, because the passkeys are bound to the origin. 45 00:02:54,220 --> 00:03:05,080 Unlike your usual phishing cases, where you can redirect a user to a random page, and by themselves, they can go ahead and enter the password on that page, right? 46 00:03:05,080 --> 00:03:11,200 So, since it is bound by the origin, it helps us with some protection against phishing, which is pretty good. 47 00:03:11,560 --> 00:03:21,040 Second is, it's not guessable, because you need to have a private key with you on the device, or, you know, your authenticator, but only the public key is there. 48 00:03:21,040 --> 00:03:27,060 So, you know, people cannot just go ahead and guess your private key easily, compared to a password. 49 00:03:27,140 --> 00:03:30,120 So, the guessability factor is also very less. 50 00:03:30,520 --> 00:03:38,260 Lastly, if in all, a data breach happens, what's going to get exposed is just the public keys, not the private keys. 51 00:03:38,260 --> 00:03:41,160 Because the private keys are not with the server. 52 00:03:41,580 --> 00:03:42,480 So, that's good, right? 53 00:03:42,480 --> 00:03:45,840 So, all these three things make them definitely better. 54 00:03:45,840 --> 00:03:48,220 And that's why companies are pushing this. 55 00:03:49,420 --> 00:03:52,640 Now, there are a couple of terms we're gonna talk about. 56 00:03:52,640 --> 00:03:55,160 I'm sure some of you might be aware about them. 57 00:03:55,160 --> 00:03:58,640 But just to, like , you know, clarify at a very basic level. 58 00:03:58,680 --> 00:04:01,780 So, we're gonna use terms like passkeys and WebAuthn. 59 00:04:01,780 --> 00:04:08,820 So , the implementation of passkeys itself relies on a set of standards, which are called FIDO2. 60 00:04:08,820 --> 00:04:16,100 And then WebAuthn is one of its specifications that enables the support of passkey on browsers. 61 00:04:16,280 --> 00:04:22,440 So, in this talk, we're gonna focus about this WebAuthn flow, which is the flow that happens via the browser. 62 00:04:22,440 --> 00:04:25,720 And that's where most people are using passkeys these days. 63 00:04:25,960 --> 00:04:35,640 Now, the browser, in this case, acts like a mediator between, you know, your authenticator and wherever, like, use your passkeys. 64 00:04:36,260 --> 00:04:41,880 So, as you can see, people are saying that passwords are dead. 65 00:04:41,880 --> 00:04:45,160 But the question is, is the replacement ready? 66 00:04:45,180 --> 00:04:53,980 To answer that, I think it's important to understand that passkeys can be misunderstood as well, if you just focus on those three points. 67 00:04:54,060 --> 00:05:02,440 Unlike passwords, they haven't been exposed to, you know, decades of research going through all the different ways things can go about. 68 00:05:02,440 --> 00:05:09,300 So, I think it's the right time we start focusing on the same kind of research that goes for the passwords for passkeys as well. 69 00:05:09,500 --> 00:05:16,940 Because before we start adopting, it's important to understand how adversaries can go and use it against people. 70 00:05:17,040 --> 00:05:17,520 Right ? 71 00:05:18,020 --> 00:05:18,740 So, yeah. 72 00:05:18,740 --> 00:05:25,980 So, as you can see, this set of APIs, the WebAuthn, it's like a magic box for most websites. 73 00:05:26,060 --> 00:05:30,700 So, they get, like, a couple of APIs that they have to call, and that's where the magic is. 74 00:05:30,700 --> 00:05:36,540 So, you get, like, an API to do something, then you get another API to do something, and that's where the black box is. 75 00:05:36,620 --> 00:05:41,860 Now, we'll show how people can exploit the trust boundary in the browser itself. 76 00:05:41,900 --> 00:05:46,160 But before that, I think it's important to understand how the flow works. 77 00:05:46,160 --> 00:05:50,340 So, I'll ask Daniel to walk us through with how the WebAuthn flow works. 78 00:05:53,060 --> 00:05:53,740 Cool. 79 00:05:53,740 --> 00:05:54,500 Thank you. 80 00:05:54,620 --> 00:05:57,580 So, I'm gonna go through the WebAuthn 101. 81 00:05:57,620 --> 00:06:00,320 And there are a couple of flows that we are concerned about. 82 00:06:00,320 --> 00:06:04,020 Firstly, the registration flow, and secondly, the authentication flow. 83 00:06:04,020 --> 00:06:07,860 So, both of these flows actually have a couple of, have a few involved parties. 84 00:06:08,000 --> 00:06:18,560 There's the user, the authenticator, the client, which is usually the browser, and the relying party, which is usually the server, that relies on the authenticator to authenticate the users. 85 00:06:19,220 --> 00:06:21,840 So, let's go through the registration flow. 86 00:06:22,260 --> 00:06:27,120 Normally starts out with a user clicking on something like create a passkey on a website. 87 00:06:27,260 --> 00:06:33,240 The server then gets this request and responds with a challenge and additional information for the creation of the public key. 88 00:06:33,440 --> 00:06:38,400 The browser then gets this response and calls navigator.credentials.create. 89 00:06:38,400 --> 00:06:41,760 So, this triggers the authenticator to generate a new key pair. 90 00:06:41,780 --> 00:06:50,420 So, the authenticator then prompts for the biometrics or pin, generates the key pair, stores the private key, and then returns a few fields. 91 00:06:50,420 --> 00:06:58,020 So, some of these fields include things like credential ID and attestation information, like public key, counter. 92 00:06:58,020 --> 00:07:04,300 So, the counter is useful for preventing replay attacks because the counter is incremented every time the key is used. 93 00:07:04,420 --> 00:07:09,200 And then flex, which has information about whether the user is present or verified, and things like that. 94 00:07:09,300 --> 00:07:15,180 So, this information is then returned to the navigator.credentials.create call, which then formulates a response. 95 00:07:15,900 --> 00:07:17,260 And some of the fields are included here. 96 00:07:17,260 --> 00:07:18,860 So, this is not exhaustive. 97 00:07:18,860 --> 00:07:27,840 So, you have things like ID, you know, raw ID, and then response, attestation object, which has the format, auth data, and then the attestation statement. 98 00:07:28,840 --> 00:07:36,040 So, all of this is returned to the server, which then verifies this registration data, and it stores the public key and all the other data. 99 00:07:36,180 --> 00:07:38,060 So, that's the registration flow. 100 00:07:38,260 --> 00:07:46,160 And for the authentication flow, it's also fairly similar in that it starts by the user clicking on signing with a passkey on the website. 101 00:07:46,440 --> 00:07:50,240 The server gets that request, and then responds with a challenge, and then the information. 102 00:07:51,540 --> 00:07:55,720 And then the browser gets this response and calls navigator.credentials.get. 103 00:07:55,720 --> 00:07:59,580 So, previously it was .create, but this time around it's .get for authentication. 104 00:07:59,760 --> 00:08:04,160 And it triggers the authenticator to retrieve and use existing credentials. 105 00:08:04,760 --> 00:08:08,240 So, the authenticator then prompts for biometrics of PIN again. 106 00:08:08,960 --> 00:08:15,400 It retrieves a private key, increments the counter, like I mentioned earlier, and it creates the authenticated data, and then it signs it. 107 00:08:16,460 --> 00:08:26,360 So, this information is returned back to the .get call, and then it formulates again the response, which is fairly similar as well to the .create response. 108 00:08:26,580 --> 00:08:34,080 Some slight differences are things like the signature being a higher level field within the response over there. 109 00:08:34,080 --> 00:08:41,300 Because previously in the .create flow, the signature was within the attestation statement, but this time around it's a field on its own within the response. 110 00:08:43,040 --> 00:08:48,740 Then this information is returned to the server, which verifies it and handles logging the user. 111 00:08:49,800 --> 00:08:58,240 So, Authenticator Attestation Global Unique Identifier, also known as AAGUID, is basically a way to identify the type of authenticator. 112 00:08:59,040 --> 00:09:05,940 So, there's a UUID mapping between well-known authenticators and this value. 113 00:09:05,940 --> 00:09:10,980 So, the server can use this AAGUID to identify what type of authenticator is being used on the client side. 114 00:09:11,440 --> 00:09:15,300 And this is public information, so you can actually search it up for those mappings. 115 00:09:16,320 --> 00:09:20,200 Cool, and now I'll pass the time over to Johnny to take us through security properties. 116 00:09:23,530 --> 00:09:24,310 All right, hey guys. 117 00:09:24,310 --> 00:09:26,590 I'll be going over the attack itself. 118 00:09:26,930 --> 00:09:30,910 So, we're just going to review the security properties of WebAuthn really quick. 119 00:09:31,030 --> 00:09:38,030 It's designed to be cryptographically strong, so it uses public key cryptography. 120 00:09:38,490 --> 00:09:40,050 Cryptography, sorry. 121 00:09:40,050 --> 00:09:41,590 I'm a little nervous. 122 00:09:41,830 --> 00:09:43,670 Private keys are stored securely. 123 00:09:43,670 --> 00:09:52,710 So, in Apple devices, they use something called the secure enclave, which is a separate security subsystem, and it has a completely different processing unit. 124 00:09:52,850 --> 00:10:02,550 Credentials are bound to web origins, so if a potential victim clicks on a phishing link, there's not going to be a corresponding credential for that origin. 125 00:10:02,550 --> 00:10:11,870 And if your device gets stolen, for example, user verification basically verifies that you can't silently reuse a passkey. 126 00:10:11,870 --> 00:10:15,930 You're going to have to have someone's fingerprint or their face for face ID. 127 00:10:16,630 --> 00:10:19,610 Attestation is something that is kind of used. 128 00:10:19,610 --> 00:10:27,630 It's more generally used in corporate scenarios for internal devices, but for consumer scenarios, it's really not used that much. 129 00:10:27,630 --> 00:10:37,550 And that basically allows corporations to authenticate the device, basically verify that the device is from that internal system. 130 00:10:38,850 --> 00:10:46,850 So, let's discuss kind of how the model of trust was with password authentication and how it kind of changes with passkeys. 131 00:10:47,110 --> 00:10:52,750 So, traditionally, right, we have passwords, and we have a shared secret. 132 00:10:52,750 --> 00:10:54,430 The user has the password. 133 00:10:54,430 --> 00:10:57,310 They have to remember it or store it in a password manager. 134 00:10:57,550 --> 00:11:00,310 And the relying party also has to store it. 135 00:11:00,310 --> 00:11:05,530 And we kind of trust the relying party to hash it and store it securely in some type of database. 136 00:11:06,290 --> 00:11:11,410 With passkey authentication, the relying party only stores a public key. 137 00:11:11,490 --> 00:11:19,070 So, that's pretty much useless for the relying party if they want to use it in a different website or in any other context. 138 00:11:19,330 --> 00:11:29,290 So, if you think about it, trust is actually shifted away from the user and the relying party and it's shifted towards the user's device. 139 00:11:29,290 --> 00:11:37,510 Because essentially the device stores the private key and the device is the one that verifies the user with touch ID or with face ID. 140 00:11:39,370 --> 00:11:49,230 So, what I'm getting at with all of this is that the browser has kind of become the trust anchor and it's become much more of an attractive attack vector for us. 141 00:11:50,410 --> 00:11:55,190 Basically developers will trust the browser to enforce certain things. 142 00:11:55,190 --> 00:12:05,850 The authenticator never has context about the application logic and it basically acts as a middle man between the authenticator and the server. 143 00:12:05,990 --> 00:12:13,070 And the server validates the cryptographic result but it has, it basically doesn't care how that result came to be. 144 00:12:13,070 --> 00:12:16,130 So, if you have a valid result, it doesn't matter. 145 00:12:16,250 --> 00:12:18,130 The server will accept it. 146 00:12:19,130 --> 00:12:21,750 So, this leads us into the actual exploit. 147 00:12:22,330 --> 00:12:24,770 What if your browser is lying to you? 148 00:12:25,250 --> 00:12:32,870 So, today we are going to show you how you can inject code into the browser and basically steal and replay pass keys on any device. 149 00:12:33,590 --> 00:12:35,750 There are two things that make our demo work. 150 00:12:35,750 --> 00:12:38,270 One is we need an injection pathway. 151 00:12:38,790 --> 00:12:41,450 Basically we need a way to inject code into the browser. 152 00:12:41,590 --> 00:12:46,210 And two, we need code that can basically play the role of an authenticator. 153 00:12:48,670 --> 00:12:52,110 Like I said before, the browser acts as kind of a middle man. 154 00:12:52,110 --> 00:12:56,270 So, you can consider this like a man in the middle or man in the browser attack. 155 00:12:57,790 --> 00:13:00,710 In our demo, we use a malicious browser extension. 156 00:13:00,970 --> 00:13:09,470 And what our extension does is it essentially hooks into the credentials API, which is a web API that interfaces with the authenticator. 157 00:13:09,890 --> 00:13:14,750 And we overwrite the create and get functions that Daniel explained earlier. 158 00:13:15,750 --> 00:13:20,290 And this extension, of course, is just a convenient way for us to proxy the credentials API. 159 00:13:20,290 --> 00:13:23,490 But there are other injection methods as you all know. 160 00:13:23,610 --> 00:13:27,790 You can use cross site scripting or it could be a compromised third party script. 161 00:13:30,300 --> 00:13:33,160 So, I'll briefly walk through the attack flow. 162 00:13:33,500 --> 00:13:40,600 Essentially what happens is, you know, the user creates a pass key, hits the server, server provides options. 163 00:13:40,720 --> 00:13:47,740 And then instead of calling the get function from the credentials web API, it calls our injected code. 164 00:13:47,840 --> 00:13:49,840 So, it's calling our get function here. 165 00:13:49,900 --> 00:14:05,580 And essentially what we do is we generate a key pair, we create the attestation, and basically we store the private information that we use later to authenticate, forge authentication responses. 166 00:14:08,270 --> 00:14:11,670 So, with authentication, it's kind of similar. 167 00:14:11,670 --> 00:14:13,310 You know, it hits the server. 168 00:14:13,530 --> 00:14:15,110 It calls the get function. 169 00:14:15,510 --> 00:14:21,550 And from here, we actually take, we pull the private key that we stored earlier and the relevant information. 170 00:14:21,550 --> 00:14:25,950 And then we forge a challenge back to the relying party. 171 00:14:31,600 --> 00:14:32,120 Cool. 172 00:14:32,120 --> 00:14:34,960 I'm going to hand it over to Sharya and he's going to show you the actual demo. 173 00:14:37,280 --> 00:14:38,000 Okay. 174 00:14:38,080 --> 00:14:42,920 So, as you can see, what we are trying to do is just proxy the APIs. 175 00:14:43,080 --> 00:14:47,540 And like he mentioned, you can do it via XSS or you can do it via an extension. 176 00:14:47,720 --> 00:14:49,900 So, in this example, we're going to use an extension. 177 00:14:49,900 --> 00:14:52,840 But the same thing applies to any kind of client-side scripting. 178 00:14:52,980 --> 00:15:00,820 So, I think for the first demo, we're going to use a website, which is like a common website where developers go and test out the passkey flow. 179 00:15:01,100 --> 00:15:04,460 So, I'm just going to show this to you, how it looks like. 180 00:15:07,940 --> 00:15:08,720 Okay. 181 00:15:08,720 --> 00:15:13,700 So, as you can see here, right now, the extension that we have made is disabled, right? 182 00:15:13,700 --> 00:15:17,120 So, it's not enabled in the extension page. 183 00:15:17,380 --> 00:15:21,460 Now, what we're going to do is that we're going to go to this website called WebAuthn.io. 184 00:15:21,460 --> 00:15:25,680 It's one of those websites where you can go about and test how passkey flow is working. 185 00:15:25,680 --> 00:15:26,620 Good for developers. 186 00:15:26,620 --> 00:15:28,180 They can try out how the flow is. 187 00:15:28,560 --> 00:15:31,560 As you can see, we're going to go ahead and click on register. 188 00:15:31,960 --> 00:15:34,200 And this is how typically the flow looks like. 189 00:15:34,200 --> 00:15:40,120 So, the browser is going to ask you for some sort of a verification to store the passkey on your machine. 190 00:15:40,400 --> 00:15:41,740 So, we're going to give that. 191 00:15:42,200 --> 00:15:49,080 After this is done, the passkey will now be stored in your password manager, and you can use the same passkey to log in back. 192 00:15:49,340 --> 00:15:52,060 So, this is how a normal flow looks like. 193 00:15:52,460 --> 00:15:55,320 Now, as you can see here, this is how it shows. 194 00:15:55,320 --> 00:15:58,720 So, it shows, like, what is the password manager used. 195 00:15:58,860 --> 00:16:05,360 And as we earlier showed, this is just identified based on a UUID, which is, like, tied to a given authenticator. 196 00:16:05,360 --> 00:16:11,440 So, if the response they're receiving has that UUID, they figure out, oh, it's Google Password Manager. 197 00:16:11,660 --> 00:16:13,740 Similarly, one password has its own. 198 00:16:13,740 --> 00:16:15,220 iCloud has its own. 199 00:16:15,220 --> 00:16:17,200 Everyone has its own unique identifier. 200 00:16:17,200 --> 00:16:20,700 And that's how, like, websites figure out which authenticator you're really using. 201 00:16:21,500 --> 00:16:30,980 Now, what we're going to do is, like, we're going to do the same flow back again, but with our extension on, which is going to go ahead and proxy everything. 202 00:16:31,600 --> 00:16:35,060 So, as you can see here, the extension is enabled right now. 203 00:16:35,120 --> 00:16:39,820 And we're going to select a AGUID as, let's say, one password. 204 00:16:40,320 --> 00:16:42,200 Now, we're going to go ahead, click on register. 205 00:16:42,200 --> 00:16:45,800 You can see that there was no biometric that came in. 206 00:16:45,800 --> 00:16:51,000 So, the whole response of the function itself was done by the extension itself. 207 00:16:51,460 --> 00:16:59,540 So, before it even reached your authenticator, it was able to intercept it and respond it back just by doing a simple JavaScript proxying. 208 00:17:00,120 --> 00:17:03,420 Now, once the registration is done, we're going to click on authenticate. 209 00:17:03,420 --> 00:17:06,020 And you can see, like, the authentication was successfully done. 210 00:17:06,020 --> 00:17:07,940 And it shows up as one password. 211 00:17:08,560 --> 00:17:13,200 So, this is, like, one basic example that you can see on any random website. 212 00:17:13,340 --> 00:17:21,260 Now, what we're going to do is that we're going to do the same thing, but let's say on a major website. 213 00:17:21,260 --> 00:17:23,820 So, let's see what happens when you do it on Gmail. 214 00:17:23,840 --> 00:17:25,620 Apparently, it works there as well. 215 00:17:25,860 --> 00:17:27,300 So, how it looks like. 216 00:17:27,300 --> 00:17:35,960 So, if you see here, typically you have this page called Google account page where you can go and add your new passkeys. 217 00:17:36,360 --> 00:17:37,880 So, how the flow looks like. 218 00:17:37,880 --> 00:17:38,800 So, you go here. 219 00:17:39,080 --> 00:17:41,640 Let's say this is a normal Gmail account. 220 00:17:41,640 --> 00:17:43,180 You're going to search for passkeys. 221 00:17:43,300 --> 00:17:45,680 You go ahead and create a new passkey. 222 00:17:45,680 --> 00:17:49,900 It's going to open your iCloud or whatever you're using on your machine. 223 00:17:50,120 --> 00:17:53,080 The passkey gets created and you can see it appears here. 224 00:17:53,360 --> 00:17:59,320 Now, when the user logs out, they can log back in using that same passkey. 225 00:17:59,340 --> 00:18:01,420 That's how the usual flow works like. 226 00:18:01,420 --> 00:18:04,540 It doesn't ask you for any kind of password or anything. 227 00:18:04,540 --> 00:18:05,060 Right? 228 00:18:05,400 --> 00:18:10,800 Now, what we're going to do is we're going to do the same thing now, but with our extension on. 229 00:18:11,480 --> 00:18:13,620 So, as you can see, the extension is on now. 230 00:18:13,620 --> 00:18:17,800 We're going to head back and we're going to re-register a new passkey. 231 00:18:18,500 --> 00:18:21,020 So, if you see here, it's selected as iCloud. 232 00:18:21,020 --> 00:18:22,940 We're going to open passkeys. 233 00:18:23,940 --> 00:18:29,440 And we're going to go ahead and delete the previous one and create a new one as an example. 234 00:18:30,940 --> 00:18:35,880 So, as you can see, this time the passkey was created right away. 235 00:18:35,960 --> 00:18:41,000 There was no biometric that happened because it never really reached that place. 236 00:18:41,580 --> 00:18:45,700 And as you can see, it's still showing up as iCloud on the bottom. 237 00:18:45,820 --> 00:18:53,280 So, since the AGUID was that, Gmail still thinks that this passkey was registered using an iCloud account. 238 00:18:53,360 --> 00:18:54,960 And that's how basic this was. 239 00:18:54,960 --> 00:18:59,460 Like, you know, just passing a different UID makes it think that this is the password manager you're using. 240 00:19:00,620 --> 00:19:04,720 Now, how does it look when you log out and try to log back in? 241 00:19:05,100 --> 00:19:08,820 So, you can see, like, you go back ahead, you're going to put it back again. 242 00:19:08,820 --> 00:19:12,000 When you click on continue, it's going to pass and you're back here. 243 00:19:12,340 --> 00:19:13,680 So, the passkey works. 244 00:19:14,100 --> 00:19:16,920 Now, this can actually be taken further ahead. 245 00:19:16,920 --> 00:19:21,220 So, apparently, once you log in using your passkey, you can go ahead and change your password as well. 246 00:19:21,220 --> 00:19:25,260 So, you get the full account if you want, if you're using that same passkey. 247 00:19:25,600 --> 00:19:30,340 That just shows, like, you know, having this as a primary medium can go against you as well. 248 00:19:32,180 --> 00:19:39,700 Now, coming back to, you know, the next part, what was the most suspicious part in this flow? 249 00:19:39,700 --> 00:19:46,940 I think as a user, the first suspicious part was that I didn't see any, you know, biometric or a face ID coming in, right? 250 00:19:46,940 --> 00:19:53,620 So, that could be one thing that could look back to a user and a user can see, like, you know, hey, there is something that looks suspicious. 251 00:19:54,180 --> 00:19:57,060 So, for that also, we figured out how we can do that. 252 00:19:57,060 --> 00:20:03,440 We can still show a biometric to the user, but ultimately, the response is still going to come through the extension. 253 00:20:03,780 --> 00:20:06,640 So, that is what we're going to call the silent mode. 254 00:20:06,700 --> 00:20:09,500 So, in silent mode, it works silently. 255 00:20:09,500 --> 00:20:13,040 Like, you know, you will not know anything is wrong and it's going to work the same way. 256 00:20:13,180 --> 00:20:14,500 Now, how does it work? 257 00:20:14,500 --> 00:20:15,800 So, it's pretty simple. 258 00:20:15,800 --> 00:20:20,980 We're going to still invoke the original function, but we will not return a response to the website. 259 00:20:21,220 --> 00:20:23,500 So, basically, the flow is happening twice. 260 00:20:23,500 --> 00:20:28,520 One is being done by the extension and the other one is being done by the actual iCloud. 261 00:20:28,860 --> 00:20:36,660 So, because of that, if the user even opens their iCloud keychain, they will still see that the website has a passkey there, but that's the wrong one. 262 00:20:36,660 --> 00:20:39,960 The real passkey is with the extension, probably synced in a server. 263 00:20:40,660 --> 00:20:47,960 So, that just shows, you know, that you can actually play it in a bad way and you can have the user think that they're actually using the same flow. 264 00:20:48,140 --> 00:20:49,660 So, how does it look like? 265 00:20:49,820 --> 00:20:51,220 Pretty same. 266 00:20:52,760 --> 00:20:55,860 So, this is how this one looks like. 267 00:21:00,070 --> 00:21:02,830 So, we're going to go ahead and enable the extension. 268 00:21:02,830 --> 00:21:09,410 But this time, instead of going ahead with the normal mode, we're going to switch on the silent mode. 269 00:21:10,110 --> 00:21:20,110 After doing this, when we go ahead and create a new passkey, like I said, we're still going to go ahead and call the original function, but we will just not return its response. 270 00:21:20,110 --> 00:21:25,030 So, the user still sees the touch ID, they're going to do it, and it's going to get registered as an iCloud. 271 00:21:25,030 --> 00:21:29,490 So, they will never know something went wrong, but this passkey was never actually used for registration. 272 00:21:30,350 --> 00:21:32,310 And the same flow, it will work back again. 273 00:21:32,310 --> 00:21:34,650 So, there also, we're going to call the original function. 274 00:21:35,130 --> 00:21:40,630 So, users still think that, you know, you're going to use a touch ID, but the real response that it gets is from the extension. 275 00:21:41,650 --> 00:21:44,890 So, this is just to make it less suspicious for the user. 276 00:21:46,530 --> 00:21:47,450 Okay. 277 00:21:47,490 --> 00:21:53,850 Now, I think after this, you know, the question that comes in, what if I'm already registered? 278 00:21:53,850 --> 00:21:54,490 Right? 279 00:21:54,630 --> 00:21:59,650 So, as you can see in this flow, we were doing the registration, and then we were doing the authentication. 280 00:21:59,750 --> 00:22:07,450 So, this attack sort of assumes that you're going to do registration when the extension or that proxy code was present. 281 00:22:07,550 --> 00:22:11,570 So, how are we going to force the user to re-register again? 282 00:22:11,830 --> 00:22:14,690 So, for that, actually, there are multiple ways you can do that. 283 00:22:14,690 --> 00:22:18,290 The first one is by failing the login intentionally. 284 00:22:18,430 --> 00:22:24,330 So, what we can do is that as an extension, we see that we don't have a passkey for this website. 285 00:22:24,470 --> 00:22:26,950 So, we will just throw an error on the website. 286 00:22:26,950 --> 00:22:30,790 So, instead of returning the original function response, we will throw an error. 287 00:22:30,850 --> 00:22:36,010 So, the website will feel that either the passkey is not registered or it's somehow not working. 288 00:22:36,410 --> 00:22:40,510 Which will lead the user to fall back to other methods like password. 289 00:22:40,630 --> 00:22:43,250 So, they will go ahead and use a password-based method. 290 00:22:43,250 --> 00:22:46,350 And since it's an extension, it can easily pick up the password. 291 00:22:46,350 --> 00:22:48,410 So, your password is compromised after that. 292 00:22:49,050 --> 00:22:55,350 The other way a user could react is that they can go ahead and register a new passkey because they like the flow, probably. 293 00:22:55,510 --> 00:22:58,910 But that's, again, going to be a problem because you have the extension there. 294 00:22:58,910 --> 00:23:03,750 So, your new registration will now get stored through the extension, not the original one. 295 00:23:04,110 --> 00:23:09,150 The other way you can also do it is by playing a little bit with social engineering. 296 00:23:09,190 --> 00:23:13,810 Like, on that page, you can show a banner that says, like, you know, hey, your passkey seems expired. 297 00:23:13,810 --> 00:23:15,150 Go ahead and create a new one. 298 00:23:15,150 --> 00:23:16,750 And people can fall for that. 299 00:23:17,030 --> 00:23:17,530 So, yeah. 300 00:23:17,530 --> 00:23:20,850 So, you have, like, a way to fail the original call. 301 00:23:20,850 --> 00:23:24,430 Or you can go ahead and trigger the password-based flow. 302 00:23:24,430 --> 00:23:27,250 Or the third one is just go ahead and show some phishing banners. 303 00:23:27,250 --> 00:23:34,570 In all of these cases, user will end up either using the password method or going ahead with the passkey. 304 00:23:34,570 --> 00:23:36,370 So, how does that look like? 305 00:23:38,170 --> 00:23:41,190 So, we're going to do the same attack. 306 00:23:41,190 --> 00:23:46,830 But now we're going to turn on not just the silent mode, but also the force reset mode. 307 00:23:47,590 --> 00:23:51,110 So, as you can see here, right now, we're going to register a normal passkey. 308 00:23:51,110 --> 00:23:53,550 This is a passkey without the extension. 309 00:23:53,810 --> 00:23:55,270 So, this is a legit one. 310 00:23:55,510 --> 00:23:59,430 Now, what we're going to do is we're going to go ahead and enable the extension. 311 00:24:00,570 --> 00:24:06,110 And then once we have enabled this, we will go ahead and use both the options this time. 312 00:24:06,110 --> 00:24:11,690 So, we're going to use not just the normal silent mode, but we'll also use the force reset mode. 313 00:24:11,830 --> 00:24:15,450 Which basically takes care that if you're already registered, I'm going to fail it. 314 00:24:15,790 --> 00:24:17,110 So, you log out. 315 00:24:17,250 --> 00:24:23,050 After that, when you're trying to sign back in, it says that the passkey exists. 316 00:24:23,050 --> 00:24:25,690 But as you can see, it says, like, we weren't able to log in. 317 00:24:25,690 --> 00:24:28,650 Because the API itself was failed by the extension. 318 00:24:29,650 --> 00:24:34,830 So, the user will end up either creating a password, using, like, a password-based flow. 319 00:24:34,830 --> 00:24:44,590 And after that, when they go ahead and, you know, create a new passkey, if they want to stick with the same flow, they will end up creating a passkey, which is, again, being proxy. 320 00:24:45,370 --> 00:24:48,090 And, again, the same flow will work as we showed earlier. 321 00:24:48,650 --> 00:24:52,930 So, this is just to answer the question, like, you know, what happens if registration was not before done? 322 00:24:53,930 --> 00:24:54,730 Okay. 323 00:24:56,830 --> 00:25:00,730 Now, I think we have done everything with the same machine. 324 00:25:00,730 --> 00:25:04,210 But I think what's important is to share it across devices. 325 00:25:04,210 --> 00:25:06,550 Because that's where the magic is, right? 326 00:25:07,110 --> 00:25:12,870 Right now, we were just storing what you were seeing there on the local storage, as an example. 327 00:25:12,870 --> 00:25:18,510 But now what we're going to do is we will just replace the local storage to a simple API. 328 00:25:18,590 --> 00:25:25,990 So, we can have a simple API endpoint, and whatever data that we were storing on the local storage, we can send it across to that. 329 00:25:26,330 --> 00:25:41,050 And on another device, which is the attacker's device, they can go ahead, install the same extension, and since those things are shared across through that API, they're going to get that passkey, and they can log in on the behalf of the user. 330 00:25:41,330 --> 00:25:45,670 Which just shows how dangerous this whole flow can go in. 331 00:25:47,590 --> 00:25:49,710 I'll show you how it looks like. 332 00:25:49,750 --> 00:25:53,590 So, in this case, we're going to go ahead and do a registration. 333 00:25:53,590 --> 00:25:59,870 So, you can see here, this is how we have just exposed a local server here. 334 00:26:00,110 --> 00:26:07,290 And after running this local server, it's just going to replace your normal local storage calls with calls which are specific to an API. 335 00:26:07,430 --> 00:26:10,730 We're going to go back and register a new passkey. 336 00:26:12,050 --> 00:26:14,790 So, you can see that this extension is on. 337 00:26:14,790 --> 00:26:19,170 And for this example, they're going to use the silent mode with 1Password. 338 00:26:19,710 --> 00:26:22,830 So, you go ahead and you're going to create a new passkey. 339 00:26:24,770 --> 00:26:27,830 Since the silent mode is on, it's going to show you everything. 340 00:26:28,130 --> 00:26:34,370 After this is done, you can see that the passkey is now created with the name of 1Password, just because we selected that on the top. 341 00:26:35,510 --> 00:26:37,650 Now, we'll head back to a different machine. 342 00:26:37,650 --> 00:26:40,270 Now, this machine is the attacker machine. 343 00:26:40,530 --> 00:26:47,570 So, you're going to go here, load the same extension back in, and you can see that on the top, the number says one. 344 00:26:47,570 --> 00:26:51,330 So, it already has one passkey synced on the other machine. 345 00:26:51,930 --> 00:26:55,690 Now, we're going to go back, turn off the silent mode, because we don't need silent mode here. 346 00:26:56,250 --> 00:26:59,970 The user is going to go back, type in the same email address. 347 00:27:02,130 --> 00:27:08,370 And after that, it will automatically detect that the passkey was there, and you can see the user is logged in. 348 00:27:09,290 --> 00:27:15,670 So, by sharing what we were doing on the very first page, you can actually do it across devices as well. 349 00:27:15,770 --> 00:27:17,370 And it works quite smoothly. 350 00:27:18,590 --> 00:27:24,230 Now, I think the biggest question that comes in, how should I fix it? 351 00:27:24,230 --> 00:27:24,510 Right? 352 00:27:24,510 --> 00:27:25,830 That's really important. 353 00:27:25,990 --> 00:27:33,070 So, I think, as you can see, most of the stuff that we were trying to do was by doing injections on the page. 354 00:27:33,090 --> 00:27:37,490 So, it's really important to have your CSP policies right on the pages. 355 00:27:37,750 --> 00:27:40,570 Of course, there's a limitation to what all you can do. 356 00:27:40,950 --> 00:27:43,230 But it's really important to have the CSPs right. 357 00:27:43,230 --> 00:27:49,530 Because if you don't have it right, you know, some basic flows can go through and you can have this injection there. 358 00:27:49,650 --> 00:27:55,530 Second is that you also need to make sure that you're doing all the verifications nicely. 359 00:27:55,530 --> 00:27:58,470 Like, it just should not be like a simple A-G-Y-D check. 360 00:27:58,470 --> 00:28:05,490 It should also do a lot of other checks, like the certificate and other things similar to how it happens with, let's say, a hardware-bound device. 361 00:28:05,890 --> 00:28:13,050 Now, it's also important to monitor and alert in case an unusual passkey usage is happening. 362 00:28:13,170 --> 00:28:15,990 Similar to how companies do it with passwords. 363 00:28:16,110 --> 00:28:20,030 So, let's say, you know, you're trying to log in using password on one page. 364 00:28:20,030 --> 00:28:24,650 And let's say you go to an entirely different network or device, you try to log in using that password. 365 00:28:25,450 --> 00:28:30,590 Ideally, if you're seeing a suspicious login, it should fall back to some additional methods. 366 00:28:30,730 --> 00:28:34,270 Like, you know, you should ask for some more data to really verify that's the user. 367 00:28:34,270 --> 00:28:41,750 But at least in what we were experimenting, we saw that whenever we were using passkeys, it was somehow more trusted. 368 00:28:41,790 --> 00:28:49,050 And most applications were not really doing those additional checks that you would typically expect from a password-based flow. 369 00:28:49,710 --> 00:28:55,550 Lastly, you know, it's really important to also log the client in some way. 370 00:28:55,550 --> 00:29:03,410 So, you should also go ahead and enforce things to make sure that people couldn't fiddle too much if it is allowed to. 371 00:29:03,810 --> 00:29:15,670 There have been cases where people are also doing self-access, where, you know, people would give, like, a banner or a page saying that, you know, hey, we cannot verify your capture. 372 00:29:15,670 --> 00:29:19,230 You should go ahead and put this code on your DevTools. 373 00:29:19,230 --> 00:29:23,290 And that's how people also end up doing a self-access attack. 374 00:29:23,490 --> 00:29:25,850 So, those kinds of things are also coming these days. 375 00:29:25,850 --> 00:29:31,770 It's really important to lock down on the client side as well. 376 00:29:32,690 --> 00:29:36,030 Now, for the website, what can a website do? 377 00:29:36,030 --> 00:29:42,450 So, I think it's really important to go back to, you know, 101 and see how you can really stop XSS. 378 00:29:42,450 --> 00:29:51,190 Because, I mean, it's something we have been talking about for years, but it still happens, you always find new bugs getting reported that are of XSS. 379 00:29:51,190 --> 00:29:54,010 So, that's something people really need to take it seriously. 380 00:29:54,170 --> 00:29:57,130 And they should work on making sure that is not happening. 381 00:29:57,250 --> 00:29:59,150 Some of the ways of doing this is mentioned here. 382 00:29:59,150 --> 00:30:00,810 So, of course, you can do CSP. 383 00:30:00,810 --> 00:30:02,330 You can also use trusted type. 384 00:30:02,330 --> 00:30:03,870 Trusted type is really good as well. 385 00:30:03,870 --> 00:30:11,990 But you can actually enforce that whenever you're trying to insert something or using something like, you know, create HTML, it's going to purify it and then use it there. 386 00:30:11,990 --> 00:30:13,250 And it really helps. 387 00:30:13,250 --> 00:30:19,850 I remember when we were trying this whole, you know, POC, we were trying to use a library to generate a block. 388 00:30:19,910 --> 00:30:25,590 And for that, Gmail was giving us a lot of issues because they had good CSP policies there. 389 00:30:25,710 --> 00:30:32,550 But by making a bit of changes, making sure that we are following the trusted flow, we were able to bypass that and have the whole thing running in. 390 00:30:32,550 --> 00:30:42,730 So, you can make it difficult for people to do this by having the right set of CSP policies and having trusted type on the pages which are really required to have those checks on. 391 00:30:44,070 --> 00:30:48,370 For users and admins, I think it's important to harden your browsers. 392 00:30:48,550 --> 00:30:51,690 Specifically, I would say for enterprises in some way. 393 00:30:52,370 --> 00:30:55,910 Many times people don't even know what extensions are being used. 394 00:30:55,910 --> 00:31:01,990 And even as a consumer, it's really important to know, like, what extensions I really have on my machine. 395 00:31:02,070 --> 00:31:04,310 And how many of them do I really use? 396 00:31:05,550 --> 00:31:09,950 If someone is into development, you know, you can just create your own extension. 397 00:31:09,950 --> 00:31:10,790 It's pretty simple. 398 00:31:10,790 --> 00:31:12,570 Just have a couple of lines. 399 00:31:12,570 --> 00:31:14,110 Use the management permission. 400 00:31:14,110 --> 00:31:17,750 And you can see, like, what are extensions you have installed on your machine? 401 00:31:17,750 --> 00:31:19,430 What was the installation method? 402 00:31:19,430 --> 00:31:25,670 So, it's a good check you can do by yourself to make sure that you don't have anything that could possibly cause this. 403 00:31:25,670 --> 00:31:32,530 The funny part is that the extension that we made for this demo, it only asks for host permission. 404 00:31:32,550 --> 00:31:35,710 Which is pretty common in every extension out there. 405 00:31:35,710 --> 00:31:38,550 It does not require any additional permission. 406 00:31:38,550 --> 00:31:39,890 Just the host permissions. 407 00:31:40,070 --> 00:31:46,850 So, host permission is literally found in almost every, I would say, extension out there. 408 00:31:46,930 --> 00:31:50,470 Like, if you have your password managers, they need to fill in the password on the pages. 409 00:31:50,470 --> 00:31:51,990 So, they need to have host permission. 410 00:31:52,110 --> 00:31:57,230 If you're using Grammarly, you're checking your grammar, you need to have host permission for that page. 411 00:31:57,310 --> 00:32:01,430 And it's such a common permission that most people don't even look at that. 412 00:32:01,430 --> 00:32:05,750 They just install the extension and it says it has access to modify your web page. 413 00:32:05,750 --> 00:32:06,590 They say, yes. 414 00:32:06,590 --> 00:32:07,690 And it installs. 415 00:32:07,850 --> 00:32:12,450 So, you have to be careful about if you really need that extension on your machine and only allow that. 416 00:32:12,510 --> 00:32:15,810 As a website, of course, you need to stop down. 417 00:32:16,230 --> 00:32:25,390 Similarly, if someone is from an enterprise background, they can also use enterprise policies on the browsers to make sure that only the approved extensions are out there. 418 00:32:25,390 --> 00:32:27,730 Not like anything which is outside. 419 00:32:27,910 --> 00:32:32,850 And lastly, you can also use any sort of browser security solutions or a browser security extension as well. 420 00:32:33,050 --> 00:32:39,170 So, I think it's really important to understand that browser is the new OS. 421 00:32:39,170 --> 00:32:45,350 Because almost, like, you know, more than 90% of the work that you do nowadays is on the browser. 422 00:32:45,770 --> 00:32:51,350 I could argue that some developers might use some IDs outside or maybe terminal outside. 423 00:32:51,350 --> 00:32:56,490 But if you exclude them, for most other departments, it's 99% of the work happening by the browser. 424 00:32:56,590 --> 00:32:59,470 They might just use Outlook or Slack outside, but that's it. 425 00:32:59,790 --> 00:33:09,250 So, it's really important to understand that the notion of the endpoint itself has transferred from the real device or your OS to the browser. 426 00:33:09,410 --> 00:33:14,690 And you need to have the right set of controls that we earlier used to have for local applications. 427 00:33:14,690 --> 00:33:16,510 Similarly, for the extensions as well. 428 00:33:17,230 --> 00:33:17,930 So, yeah. 429 00:33:18,050 --> 00:33:21,370 This is what we can do as users and admins. 430 00:33:21,830 --> 00:33:23,750 So, that's it for the presentation. 431 00:33:23,750 --> 00:33:25,390 I hope you all liked it. 432 00:33:26,050 --> 00:33:28,010 We covered a couple of demos here. 433 00:33:28,010 --> 00:33:31,650 If you have any questions, feel free to reach out to us. 434 00:33:31,650 --> 00:33:33,150 We are here right behind the stage. 435 00:33:33,150 --> 00:33:35,510 We'll be able to help you out with any questions that you have. 436 00:33:35,570 --> 00:33:36,650 Thank you so much.