WEBVTT

00:00.000 --> 00:01.080
Hello, all.

00:01.680 --> 00:04.920
And welcome to day four at DEF CON.

00:10.650 --> 00:12.770
Thank you for joining to our talk.

00:12.870 --> 00:15.210
We're going to talk about PASKEYS.

00:15.570 --> 00:20.190
As you can see, it's PASKEYS spawn turning the web button against itself.

00:21.030 --> 00:22.930
So, a little bit about ourselves.

00:22.930 --> 00:24.170
So, I'm Shaurya.

00:24.170 --> 00:27.970
I work as a principal software engineer at SquareX.

00:28.010 --> 00:30.290
This is my second year at DEF CON.

00:30.290 --> 00:33.170
And second main stage talk.

00:33.170 --> 00:34.670
So, happy to be back here.

00:34.730 --> 00:36.570
Uh, yeah.

00:37.950 --> 00:39.050
Hello, everyone.

00:39.050 --> 00:39.990
I'm Johnny.

00:39.990 --> 00:42.710
I'm a front-end engineer at SquareX and researcher.

00:42.710 --> 00:44.510
And this is my first time at DEF CON.

00:44.510 --> 00:47.410
So, really excited to see all of you here.

00:51.820 --> 00:52.780
Hi, everyone.

00:52.780 --> 00:53.720
My name is Daniel.

00:53.740 --> 00:56.840
I work as a senior front-end engineer at SquareX.

00:56.880 --> 00:58.840
This is also my first DEF CON.

00:58.840 --> 01:00.340
So, really happy to be here.

01:04.520 --> 01:05.280
Okay.

01:05.280 --> 01:10.940
So, we are part of a browser security company.

01:10.940 --> 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.

01:18.100 --> 01:21.020
We have a dedicated team that works towards all of this.

01:21.020 --> 01:24.480
This is just a couple of research that we have done with our team before.

01:24.480 --> 01:26.260
Which has been published before.

01:26.280 --> 01:31.260
Like, the second one was also, like, at the DEF CON main stage last year.

01:32.720 --> 01:38.060
So, I think it's important to talk about passkeys.

01:38.060 --> 01:43.820
Because we all know that all the companies are now pushing passkeys, right?

01:43.900 --> 01:46.620
It was all just password protection back then.

01:46.620 --> 01:49.040
But not everyone is just talking about passkeys.

01:49.100 --> 01:55.880
If you look at, you know, the latest news articles, we can see, like, all the major companies are pushing passkeys.

01:56.020 --> 02:03.420
And within a few years, it's gonna be the main medium of accessing applications across the web.

02:03.420 --> 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.

02:12.060 --> 02:17.320
And that's actually gonna happen, as you can see, because of the companies pushing it as well.

02:17.480 --> 02:20.940
So, the first question that comes in is that why?

02:20.940 --> 02:23.260
Why are they pushing passkeys?

02:23.260 --> 02:28.800
So, I mean, it's, of course, like, better, I would say, in some aspects, right?

02:28.800 --> 02:33.120
So, it uses a public cryptography, which comes with its own benefits.

02:33.300 --> 02:37.740
The first one is protection against phishing up to a good level.

02:38.000 --> 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.

02:47.000 --> 02:54.120
By default, your passkey will not appear on the second origin, because the passkeys are bound to the origin.

02:54.220 --> 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?

03:05.080 --> 03:11.200
So, since it is bound by the origin, it helps us with some protection against phishing, which is pretty good.

03:11.560 --> 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.

03:21.040 --> 03:27.060
So, you know, people cannot just go ahead and guess your private key easily, compared to a password.

03:27.140 --> 03:30.120
So, the guessability factor is also very less.

03:30.520 --> 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.

03:38.260 --> 03:41.160
Because the private keys are not with the server.

03:41.580 --> 03:42.480
So, that's good, right?

03:42.480 --> 03:45.840
So, all these three things make them definitely better.

03:45.840 --> 03:48.220
And that's why companies are pushing this.

03:49.420 --> 03:52.640
Now, there are a couple of terms we're gonna talk about.

03:52.640 --> 03:55.160
I'm sure some of you might be aware about them.

03:55.160 --> 03:58.640
But just to, like , you know, clarify at a very basic level.

03:58.680 --> 04:01.780
So, we're gonna use terms like passkeys and WebAuthn.

04:01.780 --> 04:08.820
So , the implementation of passkeys itself relies on a set of standards, which are called FIDO2.

04:08.820 --> 04:16.100
And then WebAuthn is one of its specifications that enables the support of passkey on browsers.

04:16.280 --> 04:22.440
So, in this talk, we're gonna focus about this WebAuthn flow, which is the flow that happens via the browser.

04:22.440 --> 04:25.720
And that's where most people are using passkeys these days.

04:25.960 --> 04:35.640
Now, the browser, in this case, acts like a mediator between, you know, your authenticator and wherever, like, use your passkeys.

04:36.260 --> 04:41.880
So, as you can see, people are saying that passwords are dead.

04:41.880 --> 04:45.160
But the question is, is the replacement ready?

04:45.180 --> 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.

04:54.060 --> 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.

05:02.440 --> 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.

05:09.500 --> 05:16.940
Because before we start adopting, it's important to understand how adversaries can go and use it against people.

05:17.040 --> 05:17.520
Right ?

05:18.020 --> 05:18.740
So, yeah.

05:18.740 --> 05:25.980
So, as you can see, this set of APIs, the WebAuthn, it's like a magic box for most websites.

05:26.060 --> 05:30.700
So, they get, like, a couple of APIs that they have to call, and that's where the magic is.

05:30.700 --> 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.

05:36.620 --> 05:41.860
Now, we'll show how people can exploit the trust boundary in the browser itself.

05:41.900 --> 05:46.160
But before that, I think it's important to understand how the flow works.

05:46.160 --> 05:50.340
So, I'll ask Daniel to walk us through with how the WebAuthn flow works.

05:53.060 --> 05:53.740
Cool.

05:53.740 --> 05:54.500
Thank you.

05:54.620 --> 05:57.580
So, I'm gonna go through the WebAuthn 101.

05:57.620 --> 06:00.320
And there are a couple of flows that we are concerned about.

06:00.320 --> 06:04.020
Firstly, the registration flow, and secondly, the authentication flow.

06:04.020 --> 06:07.860
So, both of these flows actually have a couple of, have a few involved parties.

06:08.000 --> 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.

06:19.220 --> 06:21.840
So, let's go through the registration flow.

06:22.260 --> 06:27.120
Normally starts out with a user clicking on something like create a passkey on a website.

06:27.260 --> 06:33.240
The server then gets this request and responds with a challenge and additional information for the creation of the public key.

06:33.440 --> 06:38.400
The browser then gets this response and calls navigator.credentials.create.

06:38.400 --> 06:41.760
So, this triggers the authenticator to generate a new key pair.

06:41.780 --> 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.

06:50.420 --> 06:58.020
So, some of these fields include things like credential ID and attestation information, like public key, counter.

06:58.020 --> 07:04.300
So, the counter is useful for preventing replay attacks because the counter is incremented every time the key is used.

07:04.420 --> 07:09.200
And then flex, which has information about whether the user is present or verified, and things like that.

07:09.300 --> 07:15.180
So, this information is then returned to the navigator.credentials.create call, which then formulates a response.

07:15.900 --> 07:17.260
And some of the fields are included here.

07:17.260 --> 07:18.860
So, this is not exhaustive.

07:18.860 --> 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.

07:28.840 --> 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.

07:36.180 --> 07:38.060
So, that's the registration flow.

07:38.260 --> 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.

07:46.440 --> 07:50.240
The server gets that request, and then responds with a challenge, and then the information.

07:51.540 --> 07:55.720
And then the browser gets this response and calls navigator.credentials.get.

07:55.720 --> 07:59.580
So, previously it was .create, but this time around it's .get for authentication.

07:59.760 --> 08:04.160
And it triggers the authenticator to retrieve and use existing credentials.

08:04.760 --> 08:08.240
So, the authenticator then prompts for biometrics of PIN again.

08:08.960 --> 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.

08:16.460 --> 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.

08:26.580 --> 08:34.080
Some slight differences are things like the signature being a higher level field within the response over there.

08:34.080 --> 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.

08:43.040 --> 08:48.740
Then this information is returned to the server, which verifies it and handles logging the user.

08:49.800 --> 08:58.240
So, Authenticator Attestation Global Unique Identifier, also known as AAGUID, is basically a way to identify the type of authenticator.

08:59.040 --> 09:05.940
So, there's a UUID mapping between well-known authenticators and this value.

09:05.940 --> 09:10.980
So, the server can use this AAGUID to identify what type of authenticator is being used on the client side.

09:11.440 --> 09:15.300
And this is public information, so you can actually search it up for those mappings.

09:16.320 --> 09:20.200
Cool, and now I'll pass the time over to Johnny to take us through security properties.

09:23.530 --> 09:24.310
All right, hey guys.

09:24.310 --> 09:26.590
I'll be going over the attack itself.

09:26.930 --> 09:30.910
So, we're just going to review the security properties of WebAuthn really quick.

09:31.030 --> 09:38.030
It's designed to be cryptographically strong, so it uses public key cryptography.

09:38.490 --> 09:40.050
Cryptography, sorry.

09:40.050 --> 09:41.590
I'm a little nervous.

09:41.830 --> 09:43.670
Private keys are stored securely.

09:43.670 --> 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.

09:52.850 --> 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.

10:02.550 --> 10:11.870
And if your device gets stolen, for example, user verification basically verifies that you can't silently reuse a passkey.

10:11.870 --> 10:15.930
You're going to have to have someone's fingerprint or their face for face ID.

10:16.630 --> 10:19.610
Attestation is something that is kind of used.

10:19.610 --> 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.

10:27.630 --> 10:37.550
And that basically allows corporations to authenticate the device, basically verify that the device is from that internal system.

10:38.850 --> 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.

10:47.110 --> 10:52.750
So, traditionally, right, we have passwords, and we have a shared secret.

10:52.750 --> 10:54.430
The user has the password.

10:54.430 --> 10:57.310
They have to remember it or store it in a password manager.

10:57.550 --> 11:00.310
And the relying party also has to store it.

11:00.310 --> 11:05.530
And we kind of trust the relying party to hash it and store it securely in some type of database.

11:06.290 --> 11:11.410
With passkey authentication, the relying party only stores a public key.

11:11.490 --> 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.

11:19.330 --> 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.

11:29.290 --> 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.

11:39.370 --> 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.

11:50.410 --> 11:55.190
Basically developers will trust the browser to enforce certain things.

11:55.190 --> 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.

12:05.990 --> 12:13.070
And the server validates the cryptographic result but it has, it basically doesn't care how that result came to be.

12:13.070 --> 12:16.130
So, if you have a valid result, it doesn't matter.

12:16.250 --> 12:18.130
The server will accept it.

12:19.130 --> 12:21.750
So, this leads us into the actual exploit.

12:22.330 --> 12:24.770
What if your browser is lying to you?

12:25.250 --> 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.

12:33.590 --> 12:35.750
There are two things that make our demo work.

12:35.750 --> 12:38.270
One is we need an injection pathway.

12:38.790 --> 12:41.450
Basically we need a way to inject code into the browser.

12:41.590 --> 12:46.210
And two, we need code that can basically play the role of an authenticator.

12:48.670 --> 12:52.110
Like I said before, the browser acts as kind of a middle man.

12:52.110 --> 12:56.270
So, you can consider this like a man in the middle or man in the browser attack.

12:57.790 --> 13:00.710
In our demo, we use a malicious browser extension.

13:00.970 --> 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.

13:09.890 --> 13:14.750
And we overwrite the create and get functions that Daniel explained earlier.

13:15.750 --> 13:20.290
And this extension, of course, is just a convenient way for us to proxy the credentials API.

13:20.290 --> 13:23.490
But there are other injection methods as you all know.

13:23.610 --> 13:27.790
You can use cross site scripting or it could be a compromised third party script.

13:30.300 --> 13:33.160
So, I'll briefly walk through the attack flow.

13:33.500 --> 13:40.600
Essentially what happens is, you know, the user creates a pass key, hits the server, server provides options.

13:40.720 --> 13:47.740
And then instead of calling the get function from the credentials web API, it calls our injected code.

13:47.840 --> 13:49.840
So, it's calling our get function here.

13:49.900 --> 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.

14:08.270 --> 14:11.670
So, with authentication, it's kind of similar.

14:11.670 --> 14:13.310
You know, it hits the server.

14:13.530 --> 14:15.110
It calls the get function.

14:15.510 --> 14:21.550
And from here, we actually take, we pull the private key that we stored earlier and the relevant information.

14:21.550 --> 14:25.950
And then we forge a challenge back to the relying party.

14:31.600 --> 14:32.120
Cool.

14:32.120 --> 14:34.960
I'm going to hand it over to Sharya and he's going to show you the actual demo.

14:37.280 --> 14:38.000
Okay.

14:38.080 --> 14:42.920
So, as you can see, what we are trying to do is just proxy the APIs.

14:43.080 --> 14:47.540
And like he mentioned, you can do it via XSS or you can do it via an extension.

14:47.720 --> 14:49.900
So, in this example, we're going to use an extension.

14:49.900 --> 14:52.840
But the same thing applies to any kind of client-side scripting.

14:52.980 --> 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.

15:01.100 --> 15:04.460
So, I'm just going to show this to you, how it looks like.

15:07.940 --> 15:08.720
Okay.

15:08.720 --> 15:13.700
So, as you can see here, right now, the extension that we have made is disabled, right?

15:13.700 --> 15:17.120
So, it's not enabled in the extension page.

15:17.380 --> 15:21.460
Now, what we're going to do is that we're going to go to this website called WebAuthn.io.

15:21.460 --> 15:25.680
It's one of those websites where you can go about and test how passkey flow is working.

15:25.680 --> 15:26.620
Good for developers.

15:26.620 --> 15:28.180
They can try out how the flow is.

15:28.560 --> 15:31.560
As you can see, we're going to go ahead and click on register.

15:31.960 --> 15:34.200
And this is how typically the flow looks like.

15:34.200 --> 15:40.120
So, the browser is going to ask you for some sort of a verification to store the passkey on your machine.

15:40.400 --> 15:41.740
So, we're going to give that.

15:42.200 --> 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.

15:49.340 --> 15:52.060
So, this is how a normal flow looks like.

15:52.460 --> 15:55.320
Now, as you can see here, this is how it shows.

15:55.320 --> 15:58.720
So, it shows, like, what is the password manager used.

15:58.860 --> 16:05.360
And as we earlier showed, this is just identified based on a UUID, which is, like, tied to a given authenticator.

16:05.360 --> 16:11.440
So, if the response they're receiving has that UUID, they figure out, oh, it's Google Password Manager.

16:11.660 --> 16:13.740
Similarly, one password has its own.

16:13.740 --> 16:15.220
iCloud has its own.

16:15.220 --> 16:17.200
Everyone has its own unique identifier.

16:17.200 --> 16:20.700
And that's how, like, websites figure out which authenticator you're really using.

16:21.500 --> 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.

16:31.600 --> 16:35.060
So, as you can see here, the extension is enabled right now.

16:35.120 --> 16:39.820
And we're going to select a AGUID as, let's say, one password.

16:40.320 --> 16:42.200
Now, we're going to go ahead, click on register.

16:42.200 --> 16:45.800
You can see that there was no biometric that came in.

16:45.800 --> 16:51.000
So, the whole response of the function itself was done by the extension itself.

16:51.460 --> 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.

17:00.120 --> 17:03.420
Now, once the registration is done, we're going to click on authenticate.

17:03.420 --> 17:06.020
And you can see, like, the authentication was successfully done.

17:06.020 --> 17:07.940
And it shows up as one password.

17:08.560 --> 17:13.200
So, this is, like, one basic example that you can see on any random website.

17:13.340 --> 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.

17:21.260 --> 17:23.820
So, let's see what happens when you do it on Gmail.

17:23.840 --> 17:25.620
Apparently, it works there as well.

17:25.860 --> 17:27.300
So, how it looks like.

17:27.300 --> 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.

17:36.360 --> 17:37.880
So, how the flow looks like.

17:37.880 --> 17:38.800
So, you go here.

17:39.080 --> 17:41.640
Let's say this is a normal Gmail account.

17:41.640 --> 17:43.180
You're going to search for passkeys.

17:43.300 --> 17:45.680
You go ahead and create a new passkey.

17:45.680 --> 17:49.900
It's going to open your iCloud or whatever you're using on your machine.

17:50.120 --> 17:53.080
The passkey gets created and you can see it appears here.

17:53.360 --> 17:59.320
Now, when the user logs out, they can log back in using that same passkey.

17:59.340 --> 18:01.420
That's how the usual flow works like.

18:01.420 --> 18:04.540
It doesn't ask you for any kind of password or anything.

18:04.540 --> 18:05.060
Right?

18:05.400 --> 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.

18:11.480 --> 18:13.620
So, as you can see, the extension is on now.

18:13.620 --> 18:17.800
We're going to head back and we're going to re-register a new passkey.

18:18.500 --> 18:21.020
So, if you see here, it's selected as iCloud.

18:21.020 --> 18:22.940
We're going to open passkeys.

18:23.940 --> 18:29.440
And we're going to go ahead and delete the previous one and create a new one as an example.

18:30.940 --> 18:35.880
So, as you can see, this time the passkey was created right away.

18:35.960 --> 18:41.000
There was no biometric that happened because it never really reached that place.

18:41.580 --> 18:45.700
And as you can see, it's still showing up as iCloud on the bottom.

18:45.820 --> 18:53.280
So, since the AGUID was that, Gmail still thinks that this passkey was registered using an iCloud account.

18:53.360 --> 18:54.960
And that's how basic this was.

18:54.960 --> 18:59.460
Like, you know, just passing a different UID makes it think that this is the password manager you're using.

19:00.620 --> 19:04.720
Now, how does it look when you log out and try to log back in?

19:05.100 --> 19:08.820
So, you can see, like, you go back ahead, you're going to put it back again.

19:08.820 --> 19:12.000
When you click on continue, it's going to pass and you're back here.

19:12.340 --> 19:13.680
So, the passkey works.

19:14.100 --> 19:16.920
Now, this can actually be taken further ahead.

19:16.920 --> 19:21.220
So, apparently, once you log in using your passkey, you can go ahead and change your password as well.

19:21.220 --> 19:25.260
So, you get the full account if you want, if you're using that same passkey.

19:25.600 --> 19:30.340
That just shows, like, you know, having this as a primary medium can go against you as well.

19:32.180 --> 19:39.700
Now, coming back to, you know, the next part, what was the most suspicious part in this flow?

19:39.700 --> 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?

19:46.940 --> 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.

19:54.180 --> 19:57.060
So, for that also, we figured out how we can do that.

19:57.060 --> 20:03.440
We can still show a biometric to the user, but ultimately, the response is still going to come through the extension.

20:03.780 --> 20:06.640
So, that is what we're going to call the silent mode.

20:06.700 --> 20:09.500
So, in silent mode, it works silently.

20:09.500 --> 20:13.040
Like, you know, you will not know anything is wrong and it's going to work the same way.

20:13.180 --> 20:14.500
Now, how does it work?

20:14.500 --> 20:15.800
So, it's pretty simple.

20:15.800 --> 20:20.980
We're going to still invoke the original function, but we will not return a response to the website.

20:21.220 --> 20:23.500
So, basically, the flow is happening twice.

20:23.500 --> 20:28.520
One is being done by the extension and the other one is being done by the actual iCloud.

20:28.860 --> 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.

20:36.660 --> 20:39.960
The real passkey is with the extension, probably synced in a server.

20:40.660 --> 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.

20:48.140 --> 20:49.660
So, how does it look like?

20:49.820 --> 20:51.220
Pretty same.

20:52.760 --> 20:55.860
So, this is how this one looks like.

21:00.070 --> 21:02.830
So, we're going to go ahead and enable the extension.

21:02.830 --> 21:09.410
But this time, instead of going ahead with the normal mode, we're going to switch on the silent mode.

21:10.110 --> 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.

21:20.110 --> 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.

21:25.030 --> 21:29.490
So, they will never know something went wrong, but this passkey was never actually used for registration.

21:30.350 --> 21:32.310
And the same flow, it will work back again.

21:32.310 --> 21:34.650
So, there also, we're going to call the original function.

21:35.130 --> 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.

21:41.650 --> 21:44.890
So, this is just to make it less suspicious for the user.

21:46.530 --> 21:47.450
Okay.

21:47.490 --> 21:53.850
Now, I think after this, you know, the question that comes in, what if I'm already registered?

21:53.850 --> 21:54.490
Right?

21:54.630 --> 21:59.650
So, as you can see in this flow, we were doing the registration, and then we were doing the authentication.

21:59.750 --> 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.

22:07.550 --> 22:11.570
So, how are we going to force the user to re-register again?

22:11.830 --> 22:14.690
So, for that, actually, there are multiple ways you can do that.

22:14.690 --> 22:18.290
The first one is by failing the login intentionally.

22:18.430 --> 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.

22:24.470 --> 22:26.950
So, we will just throw an error on the website.

22:26.950 --> 22:30.790
So, instead of returning the original function response, we will throw an error.

22:30.850 --> 22:36.010
So, the website will feel that either the passkey is not registered or it's somehow not working.

22:36.410 --> 22:40.510
Which will lead the user to fall back to other methods like password.

22:40.630 --> 22:43.250
So, they will go ahead and use a password-based method.

22:43.250 --> 22:46.350
And since it's an extension, it can easily pick up the password.

22:46.350 --> 22:48.410
So, your password is compromised after that.

22:49.050 --> 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.

22:55.510 --> 22:58.910
But that's, again, going to be a problem because you have the extension there.

22:58.910 --> 23:03.750
So, your new registration will now get stored through the extension, not the original one.

23:04.110 --> 23:09.150
The other way you can also do it is by playing a little bit with social engineering.

23:09.190 --> 23:13.810
Like, on that page, you can show a banner that says, like, you know, hey, your passkey seems expired.

23:13.810 --> 23:15.150
Go ahead and create a new one.

23:15.150 --> 23:16.750
And people can fall for that.

23:17.030 --> 23:17.530
So, yeah.

23:17.530 --> 23:20.850
So, you have, like, a way to fail the original call.

23:20.850 --> 23:24.430
Or you can go ahead and trigger the password-based flow.

23:24.430 --> 23:27.250
Or the third one is just go ahead and show some phishing banners.

23:27.250 --> 23:34.570
In all of these cases, user will end up either using the password method or going ahead with the passkey.

23:34.570 --> 23:36.370
So, how does that look like?

23:38.170 --> 23:41.190
So, we're going to do the same attack.

23:41.190 --> 23:46.830
But now we're going to turn on not just the silent mode, but also the force reset mode.

23:47.590 --> 23:51.110
So, as you can see here, right now, we're going to register a normal passkey.

23:51.110 --> 23:53.550
This is a passkey without the extension.

23:53.810 --> 23:55.270
So, this is a legit one.

23:55.510 --> 23:59.430
Now, what we're going to do is we're going to go ahead and enable the extension.

24:00.570 --> 24:06.110
And then once we have enabled this, we will go ahead and use both the options this time.

24:06.110 --> 24:11.690
So, we're going to use not just the normal silent mode, but we'll also use the force reset mode.

24:11.830 --> 24:15.450
Which basically takes care that if you're already registered, I'm going to fail it.

24:15.790 --> 24:17.110
So, you log out.

24:17.250 --> 24:23.050
After that, when you're trying to sign back in, it says that the passkey exists.

24:23.050 --> 24:25.690
But as you can see, it says, like, we weren't able to log in.

24:25.690 --> 24:28.650
Because the API itself was failed by the extension.

24:29.650 --> 24:34.830
So, the user will end up either creating a password, using, like, a password-based flow.

24:34.830 --> 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.

24:45.370 --> 24:48.090
And, again, the same flow will work as we showed earlier.

24:48.650 --> 24:52.930
So, this is just to answer the question, like, you know, what happens if registration was not before done?

24:53.930 --> 24:54.730
Okay.

24:56.830 --> 25:00.730
Now, I think we have done everything with the same machine.

25:00.730 --> 25:04.210
But I think what's important is to share it across devices.

25:04.210 --> 25:06.550
Because that's where the magic is, right?

25:07.110 --> 25:12.870
Right now, we were just storing what you were seeing there on the local storage, as an example.

25:12.870 --> 25:18.510
But now what we're going to do is we will just replace the local storage to a simple API.

25:18.590 --> 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.

25:26.330 --> 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.

25:41.330 --> 25:45.670
Which just shows how dangerous this whole flow can go in.

25:47.590 --> 25:49.710
I'll show you how it looks like.

25:49.750 --> 25:53.590
So, in this case, we're going to go ahead and do a registration.

25:53.590 --> 25:59.870
So, you can see here, this is how we have just exposed a local server here.

26:00.110 --> 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.

26:07.430 --> 26:10.730
We're going to go back and register a new passkey.

26:12.050 --> 26:14.790
So, you can see that this extension is on.

26:14.790 --> 26:19.170
And for this example, they're going to use the silent mode with 1Password.

26:19.710 --> 26:22.830
So, you go ahead and you're going to create a new passkey.

26:24.770 --> 26:27.830
Since the silent mode is on, it's going to show you everything.

26:28.130 --> 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.

26:35.510 --> 26:37.650
Now, we'll head back to a different machine.

26:37.650 --> 26:40.270
Now, this machine is the attacker machine.

26:40.530 --> 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.

26:47.570 --> 26:51.330
So, it already has one passkey synced on the other machine.

26:51.930 --> 26:55.690
Now, we're going to go back, turn off the silent mode, because we don't need silent mode here.

26:56.250 --> 26:59.970
The user is going to go back, type in the same email address.

27:02.130 --> 27:08.370
And after that, it will automatically detect that the passkey was there, and you can see the user is logged in.

27:09.290 --> 27:15.670
So, by sharing what we were doing on the very first page, you can actually do it across devices as well.

27:15.770 --> 27:17.370
And it works quite smoothly.

27:18.590 --> 27:24.230
Now, I think the biggest question that comes in, how should I fix it?

27:24.230 --> 27:24.510
Right?

27:24.510 --> 27:25.830
That's really important.

27:25.990 --> 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.

27:33.090 --> 27:37.490
So, it's really important to have your CSP policies right on the pages.

27:37.750 --> 27:40.570
Of course, there's a limitation to what all you can do.

27:40.950 --> 27:43.230
But it's really important to have the CSPs right.

27:43.230 --> 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.

27:49.650 --> 27:55.530
Second is that you also need to make sure that you're doing all the verifications nicely.

27:55.530 --> 27:58.470
Like, it just should not be like a simple A-G-Y-D check.

27:58.470 --> 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.

28:05.890 --> 28:13.050
Now, it's also important to monitor and alert in case an unusual passkey usage is happening.

28:13.170 --> 28:15.990
Similar to how companies do it with passwords.

28:16.110 --> 28:20.030
So, let's say, you know, you're trying to log in using password on one page.

28:20.030 --> 28:24.650
And let's say you go to an entirely different network or device, you try to log in using that password.

28:25.450 --> 28:30.590
Ideally, if you're seeing a suspicious login, it should fall back to some additional methods.

28:30.730 --> 28:34.270
Like, you know, you should ask for some more data to really verify that's the user.

28:34.270 --> 28:41.750
But at least in what we were experimenting, we saw that whenever we were using passkeys, it was somehow more trusted.

28:41.790 --> 28:49.050
And most applications were not really doing those additional checks that you would typically expect from a password-based flow.

28:49.710 --> 28:55.550
Lastly, you know, it's really important to also log the client in some way.

28:55.550 --> 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.

29:03.810 --> 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.

29:15.670 --> 29:19.230
You should go ahead and put this code on your DevTools.

29:19.230 --> 29:23.290
And that's how people also end up doing a self-access attack.

29:23.490 --> 29:25.850
So, those kinds of things are also coming these days.

29:25.850 --> 29:31.770
It's really important to lock down on the client side as well.

29:32.690 --> 29:36.030
Now, for the website, what can a website do?

29:36.030 --> 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.

29:42.450 --> 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.

29:51.190 --> 29:54.010
So, that's something people really need to take it seriously.

29:54.170 --> 29:57.130
And they should work on making sure that is not happening.

29:57.250 --> 29:59.150
Some of the ways of doing this is mentioned here.

29:59.150 --> 30:00.810
So, of course, you can do CSP.

30:00.810 --> 30:02.330
You can also use trusted type.

30:02.330 --> 30:03.870
Trusted type is really good as well.

30:03.870 --> 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.

30:11.990 --> 30:13.250
And it really helps.

30:13.250 --> 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.

30:19.910 --> 30:25.590
And for that, Gmail was giving us a lot of issues because they had good CSP policies there.

30:25.710 --> 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.

30:32.550 --> 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.

30:44.070 --> 30:48.370
For users and admins, I think it's important to harden your browsers.

30:48.550 --> 30:51.690
Specifically, I would say for enterprises in some way.

30:52.370 --> 30:55.910
Many times people don't even know what extensions are being used.

30:55.910 --> 31:01.990
And even as a consumer, it's really important to know, like, what extensions I really have on my machine.

31:02.070 --> 31:04.310
And how many of them do I really use?

31:05.550 --> 31:09.950
If someone is into development, you know, you can just create your own extension.

31:09.950 --> 31:10.790
It's pretty simple.

31:10.790 --> 31:12.570
Just have a couple of lines.

31:12.570 --> 31:14.110
Use the management permission.

31:14.110 --> 31:17.750
And you can see, like, what are extensions you have installed on your machine?

31:17.750 --> 31:19.430
What was the installation method?

31:19.430 --> 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.

31:25.670 --> 31:32.530
The funny part is that the extension that we made for this demo, it only asks for host permission.

31:32.550 --> 31:35.710
Which is pretty common in every extension out there.

31:35.710 --> 31:38.550
It does not require any additional permission.

31:38.550 --> 31:39.890
Just the host permissions.

31:40.070 --> 31:46.850
So, host permission is literally found in almost every, I would say, extension out there.

31:46.930 --> 31:50.470
Like, if you have your password managers, they need to fill in the password on the pages.

31:50.470 --> 31:51.990
So, they need to have host permission.

31:52.110 --> 31:57.230
If you're using Grammarly, you're checking your grammar, you need to have host permission for that page.

31:57.310 --> 32:01.430
And it's such a common permission that most people don't even look at that.

32:01.430 --> 32:05.750
They just install the extension and it says it has access to modify your web page.

32:05.750 --> 32:06.590
They say, yes.

32:06.590 --> 32:07.690
And it installs.

32:07.850 --> 32:12.450
So, you have to be careful about if you really need that extension on your machine and only allow that.

32:12.510 --> 32:15.810
As a website, of course, you need to stop down.

32:16.230 --> 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.

32:25.390 --> 32:27.730
Not like anything which is outside.

32:27.910 --> 32:32.850
And lastly, you can also use any sort of browser security solutions or a browser security extension as well.

32:33.050 --> 32:39.170
So, I think it's really important to understand that browser is the new OS.

32:39.170 --> 32:45.350
Because almost, like, you know, more than 90% of the work that you do nowadays is on the browser.

32:45.770 --> 32:51.350
I could argue that some developers might use some IDs outside or maybe terminal outside.

32:51.350 --> 32:56.490
But if you exclude them, for most other departments, it's 99% of the work happening by the browser.

32:56.590 --> 32:59.470
They might just use Outlook or Slack outside, but that's it.

32:59.790 --> 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.

33:09.410 --> 33:14.690
And you need to have the right set of controls that we earlier used to have for local applications.

33:14.690 --> 33:16.510
Similarly, for the extensions as well.

33:17.230 --> 33:17.930
So, yeah.

33:18.050 --> 33:21.370
This is what we can do as users and admins.

33:21.830 --> 33:23.750
So, that's it for the presentation.

33:23.750 --> 33:25.390
I hope you all liked it.

33:26.050 --> 33:28.010
We covered a couple of demos here.

33:28.010 --> 33:31.650
If you have any questions, feel free to reach out to us.

33:31.650 --> 33:33.150
We are here right behind the stage.

33:33.150 --> 33:35.510
We'll be able to help you out with any questions that you have.

33:35.570 --> 33:36.650
Thank you so much.

