WEBVTT

00:00.000 --> 00:00.580
All righty.

00:00.580 --> 00:09.440
Hi, everybody, and welcome to Chrome Alone, a discussion about transforming a browser into a C2 platform.

00:10.580 --> 00:15.920
So I'm Mike Weber, and I've been building offensive Chrome extensions since 2018.

00:15.920 --> 00:24.080
I gave a talk back at DerbyCon about this a couple of years ago, and the reason I'm still doing it is because it is so damn effective.

00:24.460 --> 00:39.340
I currently work at Praetorian Security where I make malicious extensions and other fun tools for our red team, and it's regularly still getting them from pretty much no access at all to just GGing our clients completely in a really quick amount of time.

00:39.340 --> 00:45.840
So I'm excited to get to share this stuff with you so you can also do this on your targets and really just have a good time with Chrome.

00:47.680 --> 00:50.800
Fun fact, there are a lot of Mike Webbers in security.

00:51.100 --> 00:54.300
The list on screen is all of those who I am not.

00:54.300 --> 00:58.160
If you need an easy reminder, I'm the Mike Webber that works for Praetorian Security.

00:58.160 --> 01:04.920
Sometimes we have a Roman motif going on, and in case it's not clear from the intro slide, I love the movie Home Alone.

01:06.980 --> 01:10.760
So small note here, this is a very compressed presentation.

01:10.880 --> 01:18.520
There are going to be times where I definitely just have a throwaway sentence that's like, and then you just implement a Socks proxy in JavaScript at the end.

01:18.680 --> 01:32.780
And in those moments, if you're like, I feel like I need more information, I would direct you to the GitHub repository, which should be live now, containing a full implementation of everything that I'm about to talk about that will run on Windows with Chrome.

01:33.580 --> 01:41.060
And when that does happen, I will also throw up a friendly reminder that drawing the owl is super easy and don't worry about it.

01:42.340 --> 01:45.480
So why are we targeting the browser in the first place to do this?

01:45.480 --> 01:51.000
Why don't we just use Cobalt Strike or Nighthawk or Meterpreter or whatever your favorite implant is.

01:51.060 --> 01:55.460
And the main reason for that is the browsers are everywhere.

01:55.460 --> 01:56.940
They're running on everything.

01:56.940 --> 02:03.760
So Chrome, Edge, Firefox, whatever, everybody's going to have to run these in their enterprise.

02:03.760 --> 02:11.340
So you don't have to worry that someone said, well, you can't run the browser, because that's the only way they have to access their internal resources.

02:11.340 --> 02:23.480
So if you have a centralized single sign-on service like, say, Office 365 or Google Workspace or Okta, then the main way you're going to be accessing this is through your browser.

02:23.480 --> 02:29.340
And that's why it's a really juicy target for us to infect so we can kind of just, like, go along for the ride.

02:30.200 --> 02:34.720
And specifically from the world of browsers, we're going to target Chromium.

02:34.720 --> 02:36.800
So that's Edge and Chrome specifically.

02:36.800 --> 02:43.520
And the reason we're going to do that is it's been around for a long time and there's more built-in features than anyone is even aware of.

02:43.520 --> 02:53.020
The thing is practically an operating system, and there's two features specifically that we're going to be taking advantage here as we build out our sort of, like, browser implant.

02:53.020 --> 02:59.840
One of them is browser extensions, and the other one is something you might be less familiar with, which is isolated web applications.

03:00.860 --> 03:03.680
Browser extensions I probably don't need to explain to you.

03:03.680 --> 03:10.080
Every time you install an ad blocker or something to review your grammar or run an LLM in the browser, you're installing a browser extension.

03:10.360 --> 03:21.620
And they have a lot more capabilities built into them than you're often using in the first place, which is why it's a super common way that malicious actors are going to run around and have fun inside your browser.

03:21.620 --> 03:31.980
So tale as old as time, people have been doing adware and click fraud or crypto mining or stealing all of your cookies and your bank account creds, the simpler stuff.

03:32.040 --> 03:37.520
And more recently, you can see people executing some pretty complicated attacks using the browser as their mechanism.

03:37.520 --> 03:44.220
So there's supply chain attacks where people use their extension or infect one extension and use that to infect more extensions and spread around.

03:44.460 --> 03:53.400
Or you'll find malware families like LLM C2, which after they get on your machine, they'll actually sideload an extension in order to steal creds and do some other fun stuff.

03:53.400 --> 03:55.380
And that's the approach that we're going to take.

03:56.660 --> 04:00.040
Pen testers know that this is a thing, so there's a million tools out there.

04:00.040 --> 04:01.300
I can't call them all out.

04:01.300 --> 04:14.920
I am going to explicitly call out a malicious extension called cursed Chrome, which is a really awesome way to turn someone's browser into a sort of HTTP proxy, and you can just steal all their cookies in their session and run around their network.

04:14.920 --> 04:18.080
It's great, and we're going to do that, plus a little more.

04:19.180 --> 04:26.020
Because it's such a common exploit vector, Google has tried to lock down the Chromium source code base.

04:26.140 --> 04:30.980
You might be familiar with, hey, you know, uBlock origin doesn't seem to work anymore.

04:31.200 --> 04:37.120
The reason for this is they've been trying to restrict the number of capabilities that are allowed within extensions these days.

04:37.120 --> 04:40.160
So, specifically, there's two capabilities that we're going to miss.

04:40.160 --> 04:43.760
One is you can't man in the middle browser traffic easily anymore with a permission.

04:43.780 --> 04:44.660
That's a bummer.

04:44.660 --> 04:46.460
That was great for capturing creds.

04:46.460 --> 04:54.300
And the other one is it's a little challenging to try to hide dynamic code execution in your extension without explicitly saying you're asking for it.

04:54.780 --> 05:07.660
And the reason that that comes up is the Chrome store review, so when you have an extension and you submit it to Google so they can actually share it with everybody else, they've changed that process so there's a lot more scrutiny of the actual extensions.

05:07.660 --> 05:11.280
You pretty much need to write an essay to explain why you're asking for every permission now.

05:11.280 --> 05:13.120
You used to just be able to submit to the store.

05:13.420 --> 05:14.600
Those days are gone.

05:15.080 --> 05:18.940
And finally, they do occasionally remove capabilities from the browser.

05:18.940 --> 05:22.300
So, I know I'm talking about how there's a million legacy features that we're going to use.

05:22.300 --> 05:23.340
They take them out sometimes.

05:23.340 --> 05:41.960
So, there was this really cool thing called Chrome apps that let you do stuff like host a web server in Chrome or, you know, make an SSH connection to something else, and it got deprecated in 2025, except, you know, what is dead may never die, and now they've gifted us this thing called isolated web applications.

05:42.220 --> 05:45.940
And you might be wondering, Mike, what on earth is an isolated web app?

05:45.940 --> 05:50.680
And I'm going to steal something from Google's presentation last year at ClickOn19.

05:51.420 --> 05:59.500
Pretty much when you need to create a new API in Chrome, they have a set of restrictions that you need to follow to make sure that it's safe to add.

05:59.560 --> 06:08.000
Specifically, it still needs to be safe to visit a web page, and you have to make sure that if you're asking for something on the machine, you ask the user for meaningful consent.

06:08.600 --> 06:16.860
And shockingly, or maybe not so shockingly, they get requests from people all the time that would like to violate these principles when they add an API into the browser.

06:17.180 --> 06:32.540
So, you know, very much in the spirit of yes, and, we have gotten isolated web apps, which is pretty much a part of the browser where they're going to add these APIs that they explicitly understand are dangerous and not what you expect from a web browsing experience.

06:32.640 --> 06:43.740
So, there's permissions, once again, now we can make direct socket connections on TCP or UDP, we can have socket servers, you can hit some web USB mechanisms that have been blocked for years.

06:44.060 --> 06:47.300
Specifically, this is the example they give when talking about it.

06:47.460 --> 07:02.200
There was a testing center that wanted to run Chrome in kiosk mode, but they also wanted to make sure that users weren't running like chat GPT in another monitor, so they wanted to have a permission that lets you just dump all of the screens without ever asking the user permission to do so,

07:02.200 --> 07:06.380
because they figure a cheater will just say, no, I'm not going to let you see if I'm running chat GPT.

07:06.540 --> 07:10.980
So, there's this extra suite of powerful permissions that's now built into the browser.

07:10.980 --> 07:12.500
It's in Chrome right now.

07:12.760 --> 07:20.720
And they recognize that this is dangerous, so there's extra protections to stop you from being able to run too crazy with this stuff.

07:20.720 --> 07:25.420
Specifically, all of the code needs to be explicitly written in advance and signed.

07:25.420 --> 07:30.880
There's a whole bundling mechanism, and that is tied to a cryptographic public key.

07:31.280 --> 07:37.940
Theoretically, they'll be able to use this to lock the keys down to specific vendors, but right now you can just self-sign and run these things in any browser.

07:38.660 --> 07:40.980
Additionally, there's a lot of isolation in place.

07:41.000 --> 07:50.680
Isolated web apps are not supposed to interact with the rest of the browser, so they shouldn't be able to see your cookies, they shouldn't be able to read anything from local storage or do any browsing, to be honest.

07:50.680 --> 07:55.060
And this is mainly enforced through a really strict content security policy.

07:55.060 --> 07:57.420
Everything needs to be in the bundle, and that's it.

07:57.640 --> 08:07.720
And they even acknowledge in the slide that, you know, well, you could just embed an entire JavaScript interpreter, but we're not going to have to do anything remotely that complicated to really have fun with this.

08:08.700 --> 08:17.760
So, for those of you who are content security policy heads, if you check the specification for isolated web apps, this is the actual content security policy.

08:17.760 --> 08:21.220
For those of you who can't just read content security policy, don't sweat it.

08:21.220 --> 08:30.760
Essentially what this is saying is you're not able to dynamically execute code from the internet unless you're doing it inside WebAssembly.

08:30.760 --> 08:37.120
And that's a really great loophole that we're going to drive a train through, but we'll come back to that one later.

08:37.260 --> 08:52.980
The final bit I have about Google's opinions on isolated web apps is in the presentation, these are all quotes taken verbatim as they discuss isolated web apps, and most of this is kind of meant in a sort of joking way, but I feel if you ever ask the question who's going to use this besides malware authors,

08:52.980 --> 08:57.560
you have to consider that some malware authors will actually use this capability.

08:59.220 --> 09:03.060
So, the way that we're going to talk about this is in the form of a case study.

09:03.060 --> 09:12.040
So, we're going to talk about a red teaming scenario that you might encounter where we want to go against a hardened target, and we're going to make some assumptions for them.

09:12.040 --> 09:17.860
So, we're going to say they're running Okta for single sign on and they've got it properly configured, we can't brute force passwords.

09:18.060 --> 09:27.560
We're going to say they have amazing secrets management and the secrets we need to hit our objective are inside Vault and nowhere else, so no red teaming will get you there.

09:27.660 --> 09:42.140
They use a hardware token for multi-factor authentication over web authentication, so you need someone to click a UB key to get to our goal, and we'll even give them the bone and say, minus one exception, their endpoint detection response is totally dialed in.

09:42.260 --> 09:57.680
So, to be specific about this user that we're going to target, they log into SSO once a day in Chrome, they never log into Vault, the creds we need to hit our goal are going to be inside Vault, and in order to access that repository with our final secrets,

09:57.680 --> 10:02.560
you're going to need to have MFA authentication with a UB key as well as SSO.

10:02.560 --> 10:06.980
And now, here's the part where I rig it for me, the presenter.

10:07.240 --> 10:13.840
We're going to say that we've successfully tricked this targeted user into running one PowerShell script on a Windows host.

10:13.840 --> 10:17.920
Just to be clear, the tool that's being presented now is a post-exploitation tool.

10:18.080 --> 10:24.560
Initial access is left as an exercise to the reader, though if you can get initial access from a PowerShell script, you're probably good.

10:24.760 --> 10:34.560
But outside of that script, assume EDR is fine-tuned, the SOC is great, and Chrome has all the network traffic whitelisted, so we'll have no problem doing anything out of Chrome.

10:36.420 --> 10:45.460
So I've got this great architecture diagram, which I'm sure you can all parse and read super easily on the screen, and there's really only two takeaways that I want you to have from this.

10:45.460 --> 10:54.460
One of them is that we're going to run an isolated web application inside one instance of Chrome, and then we're going to install a Chrome extension into a separate instance of Chrome.

10:54.460 --> 10:59.680
And then these are going to both talk back to our C2 server, which is running in the cloud.

11:00.260 --> 11:01.440
I've used Amazon here.

11:01.440 --> 11:03.080
You can use whatever cloud you want.

11:03.800 --> 11:27.860
But in general, I don't think this really describes the problem, and I've mentioned I'm a fan of Home Alone, so I think we're better off describing it from the view of turning the browser into a fun house of traps, and each trap that we've set is going to solve a specific part of our challenges to go from zero to getting the win that we need at the end of the assessment.

11:27.920 --> 11:30.860
So to be a little more concise, we have a plan.

11:30.860 --> 11:35.240
First we're going to need to sideload a Chrome extension and an isolated web app.

11:35.600 --> 11:41.240
Then we're going to use that to capture SSO credentials for Okta using the Chrome extension.

11:41.500 --> 11:48.980
We're then going to tunnel all of our web traffic from the user's position via a Socks proxy implemented with isolated web apps.

11:49.480 --> 12:01.940
Then we're going to do some shenanigans to trick the user into authenticating the vault with their web authentication token using extensions, and then finally, once more, back to the isolated web apps for RDP, and don't worry, this slide is coming back.

12:01.940 --> 12:03.760
I'll keep you updated as we're going.

12:04.620 --> 12:19.640
So first things first, we've got to sideload these extensions, and the way that Chrome extensions are loaded by the browser is essentially there's a JSON file on disk that just describes, hey, here's the permissions I need my extension to run, and here's where it's stored on disk.

12:19.640 --> 12:21.140
It's just a JSON file.

12:21.780 --> 12:27.140
Individual extensions request permissions, and they often request really dangerous permissions.

12:27.140 --> 12:27.880
It's super common.

12:27.880 --> 12:34.800
So like this example I have on the right, which is going to look very similar to our final extension, is actually Adobe Acrobat.

12:34.800 --> 12:36.440
Everybody requests dangerous extensions.

12:36.440 --> 12:37.880
It's just super common.

12:38.820 --> 12:44.240
And in order to stop people from just tweaking these things constantly, there is a little bit of protection in the browser.

12:44.320 --> 13:00.020
Specifically, there's a sort of like HMAC hash, which is calculated by the browser for each blob of JSON, and normally that would be very complicated to reverse engineer, but Chromium is open source, so you can just read the source code and reverse engineer it yourself and then sign your own stuff,

13:00.020 --> 13:01.640
and this has been happening for years.

13:01.640 --> 13:06.440
You can go as far back as 2016 and find Adware people taking advantage of this.

13:06.500 --> 13:13.380
More recently, pen testers such as Nicholas Murray and Gordon Long have written public POCs for being able to calculate these hashes.

13:13.480 --> 13:14.480
That's great.

13:14.640 --> 13:17.060
We're going to have one that's implemented in PowerShell.

13:17.980 --> 13:25.700
And the final bit about side-loading Chrome extensions I'm going to cover is there's developer permissions that you can ask for by going into the UI and flicking some buttons.

13:25.820 --> 13:26.940
These are really powerful.

13:26.940 --> 13:30.700
These let us do things like read the file URIs, which lets us build out a file browser.

13:30.900 --> 13:35.000
We're just obviously going to flip all of these things on because we're side-loading, so why not?

13:35.000 --> 13:45.600
And unfortunately, isolated web apps are a bit more new, so side-loading those isn't covered, so we have to talk through what do you do to even install these things?

13:45.820 --> 13:50.380
First of all, let's say that we have a signed web app bundle that has an egg in it.

13:50.380 --> 13:51.840
In this case, I'll say Google Keep.

13:51.840 --> 14:00.740
Then we turn on a bunch of flags and we get this super-duper polished internal web UI, which you click a button and then load a signed web app bundle for.

14:00.740 --> 14:09.160
So if you do all of that, and then you take a look, we'll just grep through the entire profile folder for where our egg shows up, and it shows up in two places.

14:09.160 --> 14:16.440
It shows up in the bundle that we just loaded, that makes sense, and it shows up in this thing, sync data level DB 003.log.

14:16.440 --> 14:21.120
You might think, well, .log might be a text file, and sadly, it's not.

14:21.500 --> 14:27.780
It's not even JSON, it's some sort of hybrid mess, but we did get a hint with this level DB bit.

14:27.780 --> 14:34.200
So, it's actually just one of the many open-source Google internal data formats.

14:34.320 --> 14:35.760
In this case, it's level DB.

14:35.760 --> 14:37.340
This is used within Chrome.

14:37.420 --> 14:45.140
And all you need to know about this is it's essentially a very nice key value storage system.

14:45.140 --> 14:46.880
So, the key is very simple.

14:46.880 --> 14:53.360
It's literally just like the string web apps DT and then an ID based off of our public key for our app.

14:53.360 --> 14:56.280
But this value over here is a lot more.

14:56.280 --> 15:00.440
And luckily, once again, it's open source, so we can just read the spec.

15:00.480 --> 15:13.000
And the first seven bytes are just some, uh, a CRC32 calculation based off of the content, the length, and, uh, a type which we're gonna be lazy for, and we're just gonna say full all the way through.

15:13.180 --> 15:28.320
And that's CRC32, it's actually CRC32C, I didn't realize there were many variations of CRC32, but, uh, once again, just go to the source code, you can pull their implementation, uh, I'm an idiot, so I decided to write this myself in PowerShell, it does work,

15:28.320 --> 15:31.620
it was painful, you can use my implementation, don't worry about this.

15:31.820 --> 15:39.080
And finally we have the remaining, you know, infinite more bytes as part of that value pair.

15:39.080 --> 15:41.880
And what this is, is a Google protobuf object.

15:41.880 --> 15:51.280
Uh, protobuf, for those who aren't familiar with it, is essentially just a serialization mechanism, so you predefine these proto definitions, and then everything gets written out to disk.

15:51.480 --> 16:00.940
So, a protobuf definition looks something like this, this is right from the source code, and essentially it's a type, a name, and an offset.

16:00.940 --> 16:16.180
So, you know, at position two on our protobuf object, that's a string, that's the name of our application, at position seven is the sources object, which is a different type, because of course you can nest these, a sources object is in fact a series of bools that say how is this web app installed,

16:16.180 --> 16:24.020
was it sideloaded, is it a core system component, you better believe when we sideload, we say it's super important in core, don't you dare uninstall it.

16:24.340 --> 16:42.520
And finally, we just need to go generate an app that describes, uh, the application we're sideloading, turn that into a protobuf object, calculate the CRC32C hash for it, add that into the level DB structure, turn on a couple of flags, because isolated web apps are not enabled by default in the browser,

16:42.520 --> 16:45.180
and lucky for us, that's in JSON, so that's actually really easy to do.

16:45.660 --> 17:01.400
And then we need to calculate the isolated web app ID, run the app from the command line, so there's literally like a dash app ID flag you can run Chrome with to open an app, uh, directly, and finally when you do that, as a precaution, they make you show an interface for web apps,

17:01.400 --> 17:04.280
there's no headless mode for running isolated web apps.

17:04.280 --> 17:17.260
So we're gonna steal a page from red teaming, and we're going to use hidden desktop, uh, mechanisms, where we essentially, when we launch that Chrome process, we give it a different desktop handle, and that just, the user just never sees it.

17:17.260 --> 17:18.620
You'll see what this looks like in the demo.

17:19.160 --> 17:35.960
And obviously, uh, I don't expect all of you to be able to take that information and sideload all of this, don't worry, this is implemented in the repository I posted earlier under the doorknob project, and uh, doorknob is just a series of PowerShell scripts that are gonna let you sideload extensions and isolated web apps,

17:35.960 --> 17:42.660
and they'll generate the loader for you, and it just works, it's a lot less painful than grabbing a superheated doorknob, you run the scripts and you're good to go.

17:43.540 --> 17:45.200
So that's the first part of the plan.

17:45.200 --> 17:48.620
Now we've got all of our stuff loaded into the browser, it's time to take advantage of it.

17:48.740 --> 17:51.680
So, first things first, we need those octa creds.

17:52.000 --> 17:58.740
And this is going to be the most straightforward Chrome extension in terms of malicious extensions that you're gonna have.

17:59.060 --> 18:11.280
Uh, we're going to have a malicious extension that asks for pretty much every permission we can, we're sideloading so no one's gonna tell us no, so we're gonna ask for background permissions to make sure this runs even if the user closes Chrome, we're gonna ask for the ability to read the clipboard,

18:11.280 --> 18:24.280
we're gonna ask for cookies permissions so we can steal all of the user sessions out of the browser, we're gonna ask for declarative net requests because we're going to actually use this to turn off certain, uh, internal protections in Chrome that let us do other silly things,

18:24.280 --> 18:29.440
which I'll cover in a bit, and, uh, of course, why not ask for history so we can tell where the user's been going.

18:29.860 --> 18:43.180
And this used to be enough to also steal credentials that were being submitted, uh, in any form, but unfortunately manifest v3 stopped us from so we need to rely on another mechanism in extensions, which is content scripts.

18:43.480 --> 18:57.740
So what we're going to do is we're going to inject JavaScript into every single tab that's running and then that JavaScript is going to, uh, intercept every mechanism we care about so we can add events to forms, for example, and submission, and then we steal all of the content.

18:58.340 --> 19:17.160
And essentially there's a lot of different barriers within Chrome to stop you from doing something like this, so we're just going to add our malicious JavaScript into every single part of Chrome we possibly can and we're going to build a sort of like microservices nightmare within Chrome that lets different parts of it talk to our C2,

19:17.160 --> 19:18.440
even when they shouldn't.

19:18.860 --> 19:31.300
And, um, if you might be thinking, well, won't people notice that you're running JavaScript in every single tab, in which case I would say you have a lot of faith in the user, but additionally, we're going to do this all with WebAssembly instead of JavaScript.

19:31.500 --> 19:36.040
And I don't know how many of you have tried to reverse engineer WebAssembly, but it's not fun.

19:36.120 --> 19:40.300
This is not easy to manage in any way or form from within the browser.

19:40.980 --> 19:55.620
Additionally, the way we're going to compile our JavaScript is we're going to do this through Golang, so the entire Go runtime is going to be built into this really cool file format that's super easy to parse, and I don't know how many of you used to reverse engineer Go malware,

19:55.620 --> 19:59.820
but until there was great tooling for it, it wasn't super great to reverse engineer.

20:00.120 --> 20:04.960
And lucky for us, the tooling for WebAssembly right now is not fantastic.

20:04.960 --> 20:08.060
Ghidra cannot show you hello world written in this.

20:08.060 --> 20:18.200
I mean, obviously with enough time you can figure out what's being sent, but any analyst that just sees this is probably not going to be able to pull out information very quickly to figure out what we're doing.

20:18.280 --> 20:23.140
And the way that WebAssembly permissions are asked for in the browser, it's really all or nothing.

20:23.140 --> 20:25.760
You either say you can run WebAssembly or you can't.

20:25.760 --> 20:26.040
That's it.

20:26.040 --> 20:37.200
There's no granularity to it, and even if you could turn it off, that permission we asked for earlier, we're going to use to disable content security policy processing for all websites we visit.

20:37.200 --> 20:39.680
So we're loading this in everything and no one can stop us.

20:39.940 --> 20:55.700
And if you're feeling like particularly malicious, you can actually use WebAssembly to invoke JavaScript code to load more WebAssembly, so you build this like nesting doll of WebAssembly that calls out to JavaScript to load more WebAssembly that calls out to JavaScript.

20:55.700 --> 20:56.640
You get the idea.

20:56.640 --> 20:59.160
You can really waste a lot of time with this.

20:59.720 --> 21:07.580
And as a result, like, this is essentially what it looks like when you write something in WebAssembly versus JavaScript.

21:07.580 --> 21:10.620
What you're actually seeing is the exact same code.

21:11.120 --> 21:17.860
So on the right, this is JavaScript to load WebAssembly, and this is the only thing that any analyst will be able to see in all of those tabs we're running.

21:17.860 --> 21:20.840
It's just there's a WebAssembly file, it's being run.

21:20.840 --> 21:27.320
And then you can throw a bunch of decoy code in there from whatever an LLM decides to shit out, but this is essentially the part that's important.

21:28.460 --> 21:40.240
In Go, I don't expect people to be able to read this and understand it immediately, but we're doing the same thing, and there's an interop object within WebAssembly that we can use to call back out to JavaScript and do the exact same things.

21:40.240 --> 21:51.340
It's a little more verbose, but ultimately, you can replicate probably 90 to 95% of what you can do in JavaScript within Go, and then you're off to the races.

21:51.540 --> 21:59.180
So as a result of this, uh, there's absolutely no way that you can expect a malware analyst to take a look at this.

21:59.180 --> 22:06.740
What will happen is they'll poke their head in, they'll see it's WebAssembly, and then sort of throw up their shoulders and shrug, and either it gets in or it doesn't.

22:06.740 --> 22:12.100
I can say that we've submitted malicious extensions into the Chrome store using this approach, and it's never been blocked.

22:12.100 --> 22:14.620
We've got plenty of extensions, more than we need.

22:14.620 --> 22:15.920
This is very effective.

22:16.440 --> 22:20.280
So, now we've got our extension, like what are we actually doing with it?

22:20.400 --> 22:23.840
And this is where, you know, JavaScript comes to the rescue.

22:23.920 --> 22:26.680
We just add event listeners to the submit function on forms.

22:26.680 --> 22:30.460
We can add it to a couple of places, like hitting the key or clicking a mouse button.

22:30.720 --> 22:34.920
We can even intercept or man-in-the-middle certain functions, like when you call web authentication.

22:34.920 --> 22:36.020
We'll cover that later.

22:37.080 --> 22:44.680
Uh, essentially, every site that you visit, we can identify the form, add our listener to it, and then JavaScript gets the ability to process all of its results.

22:44.680 --> 22:52.740
And obviously, just to be clear, the implant that you're able to get on GitHub does not pop up an alert window and highlight it in the big red box, it just sends it to the C2.

22:54.580 --> 23:02.640
And just like in the movie Home Alone, sometimes the most cleverly laid traps are not enough, and we need an old man with a shovel to come beat the shit out of someone.

23:02.640 --> 23:07.520
And that's where the shelling out capability, uh, within Chrome is really helpful for us.

23:07.520 --> 23:15.140
And this presentation's more about using Chrome, but for those of you who want to go a little farther, let's talk about our old man with a shovel, native messaging.

23:15.260 --> 23:24.620
And native messaging, in a nutshell, is pretty much just a way to tell Chrome, hey, when I invoke this JavaScript piece, I want you to run an executable on disk.

23:24.720 --> 23:35.800
And normally, you need to, like, install a registry key, and have a file on disk, and the registry key points to a JSON file, but because we're sideloading, all of this is handled.

23:35.800 --> 23:40.780
So once again, doorknob, or the sideloader piece, will just be able to install all of this for you.

23:40.780 --> 23:58.420
So you'll have a registry key, or on macOS it's a file on disk, that points to a JSON file, that JSON file is very short, it's pretty much just a name and a path to the executable you want to run, and then in your JavaScript code, you open a connection to your native messaging host,

23:58.420 --> 24:00.300
and it ends up looking something like this.

24:00.300 --> 24:05.240
Which is Chrome just straight up shelling out, and then running whatever binary you've told it to.

24:05.240 --> 24:18.980
So, I will say, this is not subtle, like, I wouldn't expect a SOC analyst to miss this, it's pretty blatant, but you still can't block it, because this is the only way that Chrome interacts with native messaging hosts.

24:18.980 --> 24:25.060
So if you use, say, one password, the way that it interacts with the one password on host is the same mechanism.

24:25.060 --> 24:26.660
So they can't block it.

24:27.440 --> 24:40.680
For red teamers who want to get fancy, what you probably would do is instead of embedding a binary to just interpret shell commands, what you'd want to do is have a whitelisted application that you have a DLL you can sideload, and in that sideloaded DLL,

24:40.680 --> 24:48.040
that's where you would run your code to, I don't know, run, maybe that's when you run your cobalt strike beacon, or whatever stage 2 implant you actually want to run.

24:48.920 --> 25:03.200
So this is all collected in Hot Wheels, which is a weaponized web assembly browser extension, and that will give you credential jacking, shelling out, session theft by stealing cookies, file read operations, and the ability to read arbitrary history.

25:03.200 --> 25:06.900
And this extension will run on both Edge and in Chrome.

25:06.900 --> 25:11.100
Obviously this is implementation via Chrome, but it works on both.

25:12.060 --> 25:13.820
So that's how we're getting creds.

25:13.820 --> 25:16.600
Now we need to figure out how we're going to tunnel our traffic.

25:17.340 --> 25:28.640
And normally I would say let's just use curse Chrome, that's exactly what it's for, but it only does HTTP, and we just spent 10 minutes talking about isolated web apps, so let's actually use the damn things.

25:28.760 --> 25:34.980
And the way that we're going to do this is through the direct sockets permission, which this is the main feature we're going to abuse.

25:34.980 --> 25:49.580
So if you go read the explainer for direct sockets, it tells us that the use case for using direct sockets is when you want to speak to an SSH server, or RDP into something, or touch virtual desktop infrastructure, all of the things that we would want to do in an offensive context as a red teamer.

25:49.580 --> 25:52.140
This is perfect, it's like our shopping list.

25:52.160 --> 26:03.360
So the first thing you might think, or what I tried to do was, oh great, I'll turn Chrome into a version of Responder that listens for NTLM hashes and we'll just start jacking creds and that'll be super cool.

26:03.540 --> 26:10.080
And then I realized that the isolated web app API implementations are a little more janky than that, and you have to read the spec carefully.

26:10.080 --> 26:20.320
So for example, when I try to listen on port 135, I find out that it has to be over port 3276, or 678.

26:20.320 --> 26:26.700
And I don't know why that is, but it doesn't really matter, because we can still make arbitrary connections outwards, and that's just as important.

26:27.680 --> 26:40.760
So once again, your first reaction might be, oh great, I'm gonna write like an SMB client, and an RDP client, an SSH client, but then it's like, uh, just slow down and write a SOCKS proxy, and then connect through that through all of your local hosts.

26:40.760 --> 26:45.060
It's a lot less implementation work, it's a lot less complicated, and it's much more straightforward.

26:45.480 --> 26:46.800
So that's what we're gonna do.

26:46.940 --> 26:54.300
We're going to write a SOCKS server, and then we just need to like overcome that, that isolation issue, where isolated web apps aren't supposed to talk with anyone else.

26:54.540 --> 27:01.220
But because we can make SOCKET servers, we just write a SOCKET server in JavaScript, and have our Chrome extension connect back to it.

27:01.220 --> 27:05.020
This is the, that building out of that microservices nightmare I was talking about earlier.

27:05.460 --> 27:09.880
So, by their powers combined, we're, we're just done.

27:09.880 --> 27:11.240
That's it, that's all you need to do.

27:11.440 --> 27:16.900
And uh, yeah, right, this is the part where this talk would be two hours if I didn't do this, I'm sorry.

27:17.020 --> 27:20.640
So, lucky for you, we've got the blowtorch capability.

27:20.640 --> 27:24.380
Uh, I've named it this because this is the most overkill part of the project, really.

27:24.480 --> 27:38.280
Uh, this gives us full SOCKS proxying out of the browser, so if we wanted to replicate what Cursed Chrome does, we would dump the cookies from the target browser, uh, using Hot Wheels, and then import that into our browser, which is locally on the attacker machine,

27:38.280 --> 27:43.580
and then we just pointed at our SOCKS proxy, and now we've replicated the same features you would have in Cursed Chrome.

27:43.860 --> 27:46.580
Except now we can RDP into things, and that's pretty cool.

27:47.160 --> 27:50.400
Which brings us to the final part of the plan.

27:50.400 --> 27:54.980
We also need to solve this tricky bit with web authentication and clicking buttons.

27:55.540 --> 28:10.340
And when I say this, what I'm talking about is, like, maybe you're more familiar with Fido or U2F or, you know, pass keys or whatever, but essentially there is a device or a piece of software on your machine that stores a key, and in order to sign a request,

28:10.340 --> 28:14.900
the user needs to interact with something, say like a little button that you press on the side of your machine.

28:14.920 --> 28:21.620
And there's even a few other security components to it, like you can only run it from, uh, the website that you request the web authentication request on.

28:21.620 --> 28:28.520
It's got the same origin protect, uh, policy protections, and, uh, even if they were different, then, uh, you know, the user would get an indication.

28:29.000 --> 28:39.580
So my first thought was, well, in 2018, someone gave a DEF CON talk about abusing web USB to do this, and isolated web apps have this really cool thing called unrestricted web USB.

28:39.780 --> 28:41.500
Why don't I just use that?

28:41.500 --> 28:44.700
And, um, unfortunately, I couldn't get it to work.

28:44.700 --> 28:50.960
I don't know if that's a side effect of it being new, or they knew, let's make it unrestricted except for the bad stuff.

28:50.960 --> 28:51.980
Could be a skill issue.

28:51.980 --> 28:53.000
I, I don't know.

28:53.000 --> 28:59.760
But the answer was, isolated web apps are cool, but we still got Chrome extensions, so let's try taking advantage of it through that.

28:59.920 --> 29:04.440
So the first thing that we want to do is break that same origin policy restriction.

29:04.500 --> 29:14.060
And we have JavaScript running in literally every tab, so what we can do is pick a tab and then open an iframe for the site we actually want to run.

29:14.060 --> 29:20.920
And then our injected content script can watch for some sort of, like, query token that triggers the web authentication request.

29:20.920 --> 29:22.160
So that ends up looking like this.

29:22.160 --> 29:28.300
You know, here we're on, like, demo.ubico.com, and now it's made a web authentication request to our key for octa.com.

29:28.360 --> 29:29.380
That's cool.

29:29.500 --> 29:32.680
But also, a user might notice this, and that's not great.

29:32.680 --> 29:36.340
I mean, I think plenty of users would miss this, to be honest, but, you know, let's be thorough.

29:37.060 --> 29:49.820
And to take advantage of this, uh, there's another question we need to answer, which is, if you trigger multiple web authentication requests in Chrome, and you do it in different tabs, what's the order that it's resolved?

29:50.520 --> 29:53.040
And here's where I was a little surprised.

29:53.040 --> 29:58.100
So say we've opened octa.com in one tab, and then we go to a new tab and open, you know, something different.

29:58.780 --> 30:05.500
And then when you, your YubiKey's flashing, you press the button, it actually resolves the first tab that you press, not the active tab.

30:05.500 --> 30:12.060
So from your perspective, you've just pressed your YubiKey and it didn't work, so you press it again, and now it works.

30:12.160 --> 30:16.080
But you don't realize that you've actually signed two requests instead of one.

30:16.900 --> 30:25.100
And this makes sense, you know, the YubiKey has no, uh, awareness of what's going on within Chrome, it just knows I got a request for octa, and then I got a request for Yubico.

30:25.100 --> 30:31.380
So, I, I don't really know exactly who would be the responsible party for fixing this, it's a reasonable way to do it.

30:32.220 --> 30:51.160
But what we're gonna do, it doesn't matter who needs to fix it, we're gonna abuse it, is we're going to hook that navigator dot credentials dot get function, so that whenever they normally would have to click their YubiKey, we're going to then find an inactive tab and trigger another web authentication request for our actual target,

30:51.160 --> 30:54.080
and then they'll click the button twice and trigger it.

30:54.080 --> 31:01.200
And the only indication they're gonna get in the UI component is a little dot on that icon there, which says there's a notification running on this tab.

31:01.240 --> 31:04.400
And if they've opened way too many tabs, they're not even gonna get that.

31:04.400 --> 31:09.020
So I think that it's reasonable to expect that this will probably work on just about any user.

31:10.380 --> 31:22.940
So, you know, the final attack chain, because these web authentication requests also expire, is you write a script that like logs in every five minutes and gets a challenge, you push that down to your infected browser, and then you just wait.

31:22.940 --> 31:26.100
We play this waiting game until they click the button and then we win.

31:26.600 --> 31:37.900
Alternatively, if you don't care about being sneaky, you could also be really obnoxious and just trigger it to open the request on every single tab the user's in until they click the button, that would also probably work.

31:37.900 --> 31:41.400
But, you know, ultimately we're looking to be sneaky and not too blatant.

31:42.500 --> 31:48.060
So, this is the paint bucket capability within uh, within the Chrome alone framework.

31:48.060 --> 31:53.000
And uh, the reason it's paint bucket is the first one might miss you, but the second one will definitely get you in the head.

31:53.420 --> 32:00.740
So, we can secretly coerce our target into answering whatever web authentication challenges we want and uh, and we're good.

32:00.740 --> 32:03.880
So the final thing we need to do is just, you know, RDP into the target.

32:03.880 --> 32:05.460
We've already talked about socks.

32:05.480 --> 32:07.300
Let's see what this actually looks like.

32:09.500 --> 32:13.000
So what we're looking at is a clean install.

32:13.000 --> 32:19.960
This is just a normal Chrome browser, nothing else fancy is going on and we're going to say we just coerced the user into running our script.

32:21.560 --> 32:24.920
So, they run our script and this is actually pretty quick how it happens.

32:24.920 --> 32:29.880
What's going to happen is it's going to very quickly close the browser and restart it.

32:29.880 --> 32:31.320
We've side loaded our extension.

32:31.320 --> 32:31.940
That's it.

32:31.940 --> 32:33.360
The user normally wouldn't see this as well.

32:33.360 --> 32:34.700
They might see Chrome flash.

32:34.960 --> 32:43.120
In the background, we've now launched a separate instance of Chrome that's running an isolated web application and we need to kill that and restart it a few times because Chrome.

32:43.360 --> 32:53.140
But uh, ultimately, in the background, there is now a second instance running on a separate desktop that's running our isolated web app that's handling all the socks proxying for us.

32:53.340 --> 33:00.520
So, the biggest giveaway for this is if you take a look at the command argument for it, you can see it's been hardcoded to run, you know, whatever our app ID is.

33:00.520 --> 33:01.260
But that's about it.

33:01.260 --> 33:02.220
That's all you see.

33:03.200 --> 33:09.240
So, now we're going to pop over to our C2 and there's a separate component within the repository called battle plan.

33:09.240 --> 33:20.820
This is just uh, like the, the Node.js server that we're going to push to AWS and a nice little uh, vibe coded uh, you know, web UI that's going to help us interact with it.

33:21.040 --> 33:26.060
So, obviously, the first thing we should do with all installed implants is pop calc.

33:26.060 --> 33:28.020
That's the way that you prove you've got shell access.

33:28.320 --> 33:30.180
So, we have an interactive shell.

33:30.180 --> 33:33.260
In this case, we're just going to run, you know, command dot exe with uh, calc.

33:33.380 --> 33:35.120
We can take a look at the user's machine.

33:35.220 --> 33:35.880
There we go.

33:35.880 --> 33:36.460
We've got calc.

33:36.460 --> 33:37.340
You could shell out.

33:37.340 --> 33:38.800
But that's not why we're here.

33:38.800 --> 33:39.900
This is really blatant.

33:39.900 --> 33:41.180
We're actually here for creds.

33:41.180 --> 33:42.460
So, what does that actually look like?

33:42.460 --> 33:44.160
So, say that they've gone to GitHub.

33:44.240 --> 33:45.920
They're typing their credentials in.

33:45.920 --> 33:46.600
They hit enter.

33:46.600 --> 33:48.160
Obviously, those creds don't exist.

33:48.260 --> 33:49.300
But it doesn't matter.

33:49.300 --> 33:50.480
We still capture the data.

33:50.480 --> 33:55.200
Every time that that's sent, it gets pushed back to our C2 and we capture it.

33:55.220 --> 33:57.240
So, now let's actually capture the creds we care about.

33:57.300 --> 33:58.700
This user is Harry.

33:58.960 --> 34:00.060
He's a cool guy.

34:00.060 --> 34:01.840
He's got a password he uses for everything.

34:02.000 --> 34:03.400
He's entering it in.

34:04.120 --> 34:05.580
And uh, let's see if we caught that.

34:05.580 --> 34:06.960
We don't worry about web authentication yet.

34:06.960 --> 34:08.240
That's coming soon.

34:08.980 --> 34:10.980
And uh , we can see it's wet bandits forever.

34:10.980 --> 34:12.260
Harry's a really cool guy.

34:12.260 --> 34:14.240
And now we've got his pa - his password.

34:14.300 --> 34:15.720
So, let's see if it works.

34:15.720 --> 34:20.560
We know that we've got, we've got this internal vault website that we normally can't access.

34:20.900 --> 34:24.000
So, we're going to force a socks proxy through his browser.

34:24.360 --> 34:27.880
And now, of course, we get internal DNS and all of the goodies that come with that.

34:28.060 --> 34:29.700
So, here's our vault instance.

34:29.700 --> 34:31.440
And let's try to log in as Harry.

34:32.080 --> 34:35.000
So, into Okta we go.

34:35.000 --> 34:36.900
You get to see how slow I type.

34:38.280 --> 34:40.800
How fast can I type wet bandits forever?

34:40.800 --> 34:41.860
Let's find out.

34:42.380 --> 34:44.320
Super fast.

34:49.140 --> 34:52.760
But also, once again, oh no, MFA.

34:52.760 --> 34:54.080
I guess it's game over.

34:54.340 --> 34:57.680
But it's not because we got a small Python script we've written.

34:57.680 --> 34:59.220
This is also in the demo repository.

34:59.220 --> 35:01.580
And what this is going to do is it's going to take those creds.

35:01.620 --> 35:02.780
It's going to hit Okta.

35:02.940 --> 35:04.660
And it's going to get that challenge.

35:04.660 --> 35:07.580
And we're going to push that challenge down to the user's browser.

35:08.040 --> 35:10.420
So, we're just waiting for a response right now.

35:10.420 --> 35:14.360
The user, meanwhile, goes to a totally different page and authenticates.

35:14.380 --> 35:17.820
And you might notice, in that background tab, we've got that notification.

35:18.360 --> 35:20.080
So, the user doesn't see it though.

35:20.080 --> 35:21.260
And they're clicking their Yubi key.

35:21.260 --> 35:24.860
I literally had to click the button like four times during this because it's so easy to misclick these things.

35:24.860 --> 35:27.600
So, no one thinks anything about clicking the button.

35:28.200 --> 35:34.080
But we've completed the entire login process and now we've got a client token to log into Vault.

35:34.080 --> 35:36.820
The user never visited Vault, but it doesn't matter.

35:36.820 --> 35:38.140
We've still got their challenge.

35:38.140 --> 35:40.120
And now we can just log directly into it.

35:40.200 --> 35:43.900
Uh, in Vault's case, there's a token, but obviously you would adapt this for whatever your target is.

35:44.320 --> 35:45.800
There's a shared key.

35:45.800 --> 35:47.760
Uh, there's this secret called SilverTuna.

35:47.760 --> 35:49.680
That's for all the Home Alone heads out there.

35:49.680 --> 35:52.240
I'm sure all five of you recognize it.

35:52.400 --> 35:57.160
Um, and then we've got the final credentials that we need to hit our objective.

35:57.480 --> 36:01.880
Uh, this is just a standard game of Active Directory, uh, login credential.

36:01.880 --> 36:10.820
We're going to force, uh, a Socks proxy to tunnel our RDP access along with all of those credentials to connect to the final target .

36:10.900 --> 36:14.880
So, here we're connecting, we're giving it the domain of Seven Kingdoms.

36:16.560 --> 36:19.360
And we're giving the super secret password a password.

36:19.980 --> 36:24.680
And then that's gonna get us, uh, an RDP connection into our domain controller.

36:24.680 --> 36:26.040
So, we're pretty much there.

36:26.260 --> 36:32.880
Uh, and just to demonstrate, this is going up to AWS and then tunneled through the browser's, uh, Socks proxy.

36:32.880 --> 36:34.200
But it's still very responsive.

36:34.200 --> 36:35.660
RDP's totally usable.

36:35.680 --> 36:37.140
SSH is totally usable.

36:37.140 --> 36:40.980
We can go onto the desktop and we can dump out the contents of our final flag.

36:40.980 --> 36:41.900
And boom.

36:41.900 --> 36:42.600
There we go.

36:42.600 --> 36:43.320
We've won.

36:43.320 --> 36:44.180
That's it.

36:45.520 --> 36:49.680
So, obviously

36:57.680 --> 36:59.340
this isn't a perfect technique.

36:59.340 --> 37:05.720
First of all, you need to be writing a script to automate, uh, that final pushing component for the, uh, the web authentication piece.

37:05.720 --> 37:09.380
But, uh, you know, hard things aren't free.

37:09.540 --> 37:14.600
It's also worth noting that Edge and Chrome are not perfectly identical implementations.

37:14.600 --> 37:21.000
So, for example, WebUSB within Edge, uh, the unrestricted permission, it doesn't exist.

37:21.380 --> 37:23.960
Obviously it doesn't really matter for us because we couldn't make it work.

37:23.960 --> 37:27.620
But I would expect those two browsers to sort of fork in the future.

37:27.620 --> 37:31.000
So, there might be some features that only Edge can handle versus Chrome.

37:32.000 --> 37:36.460
Uh, isolated web apps until very recently, they wouldn't even load in Edge.

37:36.460 --> 37:40.520
If you tried to load them, it just opened the window a hundred thousand times until it crashed your machine.

37:40.620 --> 37:44.600
But, uh, like two weeks ago I was just double checking and they work now.

37:44.600 --> 37:49.600
So, uh, look for Edge to become a valid infection vector in the near future for this repo as well.

37:50.520 --> 37:53.640
It is worth calling out that isolated web apps are constantly changing.

37:53.640 --> 37:57.200
They're still very new in the scheme of things for any product within Chrome.

37:57.200 --> 38:02.800
I would be unsurprised if suddenly it became a little more challenging to sideload isolated web apps in the future.

38:02.900 --> 38:05.880
Maybe they'll lock down those keys to only a couple of users.

38:06.240 --> 38:11.640
Uh, I would be surprised if they did that though because then I don't know how anyone would ever actually develop an isolated web app.

38:11.640 --> 38:14.520
So, they would have just created this functionality for no one to use.

38:14.660 --> 38:16.620
So, I don't really expect that's gonna be the case.

38:16.620 --> 38:23.480
The bigger thing I expect to watch for is them adding more dangerous APIs for us to run with and I'm very interested in that.

38:24.500 --> 38:29.200
The only other limitation right now is doorknobs implementation is Windows and Chrome only.

38:29.320 --> 38:32.900
So, if you go to that GitHub repo, you'll only find that implementation.

38:32.900 --> 38:34.720
But, you know, watch this space.

38:35.860 --> 38:41.040
If you're a defender and you're wondering how on earth would I stop this, I've got good news and bad news for you.

38:41.040 --> 38:45.060
The good news is Chrome extensions are very straightforward to block.

38:45.060 --> 38:47.520
There's a policy item that you can set.

38:47.520 --> 38:48.660
It's very easy to do.

38:48.660 --> 38:50.160
You can do this in Windows or Mac OS.

38:50.160 --> 38:55.260
You essentially just say, don't allow Chrome extensions to be installed if I haven't whitelisted them.

38:55.260 --> 38:57.000
That's done by two policies.

38:57.000 --> 38:59.940
Extension install block list and extension install allow list.

38:59.940 --> 39:04.180
And when our clients do this, we cannot install malicious extensions.

39:04.180 --> 39:07.020
You can't sideload them, you can't convince them to install it through the store.

39:07.020 --> 39:08.020
Very effective.

39:08.020 --> 39:10.080
So, you should absolutely do that.

39:10.320 --> 39:13.480
When it comes to isolated web apps though, it's too new.

39:13.480 --> 39:15.480
There is no policy for this yet.

39:15.480 --> 39:17.240
So, there's nothing that you can set.

39:17.240 --> 39:28.320
There's technically some policies you can set for specific permissions on like, if you're running Chrome OS, but most people here probably aren't doing that, so I don't think that's a sufficient fix.

39:28.320 --> 39:31.880
So, we're going to have to go to secondary indicators of compromise instead.

39:31.920 --> 39:41.340
So , you're going to watch for when applications that aren't Chrome start editing the secure preferences file, the preferences file, your local state object or your level DB files.

39:41.340 --> 39:43.740
Those are all things that no one should touch but Chrome.

39:45.020 --> 39:47.780
Ditto with any of the registry keys or files on disk.

39:47.860 --> 39:52.160
Is there anything to stop someone from injecting into Chrome and then doing exactly this?

39:52.380 --> 39:57.720
No, but we need every tool that we have in order to try to stop people from running with this.

39:58.860 --> 40:02.680
And with that in mind, thank you so much.

40:02.760 --> 40:08.260
If you would like to get access to this, I'll take claps, whatever, I've got five minutes, clap as long as you want.

40:15.110 --> 40:20.210
All the codes available online right now, unless something horrible has happened, theoretically that QR code is there.

40:20.290 --> 40:26.630
If you have any questions, or you have any examples of success stories using this tool, please hit me up.

40:26.630 --> 40:29.050
It motivates me to live.

40:29.050 --> 40:29.810
It is wonderful.

40:29.810 --> 40:31.970
I love watching people own stuff with this.

40:31.970 --> 40:36.650
So, hit me up, I'm Bouncy Hat on Twitter and Mastodon on the InfoSec Exchange Mastodon.

40:37.210 --> 40:39.430
Thank you so much and have a wonderful DEF CON.

