WEBVTT

00:00.000 --> 00:06.280
I'm going to get Maxim going here fairly quickly because he was asking me about the timer very quickly, which means he has a lot to cover.

00:06.500 --> 00:12.580
And it's a super important topic about supply chain attacks, because if the robots don't get us, this shit will.

00:13.380 --> 00:15.020
Have a wonderful time.

00:15.020 --> 00:15.820
Thank you.

00:16.120 --> 00:18.740
Let's give him a big round of applause and a big welcome.

00:19.220 --> 00:20.200
Thank you.

00:26.590 --> 00:37.170
Imagine one sunny morning, you read the news, a crypto war disrupts operations of hundreds of companies around the world and government networks of 25 countries.

00:37.170 --> 00:48.130
The war is spreading and the initial blast radius is estimated to be around 28,000 machines and now likely affecting much more computers around the planet.

00:48.150 --> 00:52.330
Security industries struggle to understand how did this happen?

00:52.330 --> 00:54.910
There is no one source of compromise.

00:55.110 --> 01:02.330
Eventually, a security researcher with support from cloud providers connect all the dots and find the source.

01:02.330 --> 01:10.030
All backdoor software were pulled from cloud buckets that were abandoned in the past and reclaimed by the threat actor.

01:10.030 --> 01:16.050
The risk many researchers have raised in the past materialized on the truly gigantic scale.

01:16.050 --> 01:23.610
The buckets are taken down by the cloud provider with estimates suggesting like about 5,000 buckets being affected.

01:25.030 --> 01:35.870
This is not a real incident, it was me who claimed 5,000 buckets and those are images of a fake news channel generated with LLM.

01:35.870 --> 01:45.590
But the risk is very real and today I want to invite you on a journey to dissect the anatomy of such an attack and talk about root cause remediation.

01:47.050 --> 01:53.730
My name is Max, I am security researcher and engineer at Big Tech, mostly doing Red Team in these days.

01:53.730 --> 01:55.970
I have a PhD in computer security.

01:55.970 --> 02:06.910
I presented at this stage twice in the past and I open sourced a couple of projects for fuzzing, for software analysis, and for GCP scanning.

02:07.830 --> 02:11.570
So the talk will be logically divided into five parts.

02:11.570 --> 02:17.850
We're going to try to understand the motivation of supply chain attack via S3 buckets.

02:17.890 --> 02:30.590
We will discuss how an attacker equipped with modern elements of big data analysis and LLMs can bring those attacks on a really giant scale.

02:30.590 --> 02:37.070
We're going to walk through nine case studies and then we're going to talk about root cause remediation here.

02:37.270 --> 02:42.730
Before we start I need to say that I'm presenting on my own behalf.

02:42.970 --> 02:47.470
This presentation does not reflect opinion of any of my past or current employers.

02:48.670 --> 02:53.330
So why do we want a supply chain attack in the first place?

02:53.350 --> 02:58.990
So if you've ever done Red Team on pen test, you know that perimeter penetration might be really hard.

02:58.990 --> 03:08.390
And then as an attacker you might notice, right, that attack costs grow as long as you want a higher efficiency.

03:08.530 --> 03:13.050
And you kind of want to invert this game, right, in your advantage.

03:13.170 --> 03:16.410
And in my opinion supply chain attack gives you that advantage.

03:16.410 --> 03:19.790
The attack surface usually grows with the size of the company.

03:20.370 --> 03:26.090
Depending on the software you can actually end up in privileged parts of network or even in prod, right.

03:26.090 --> 03:30.550
And the obvious disadvantage is precision, right.

03:30.550 --> 03:39.570
You have to target something that's used by your target or maybe you don't care or maybe you compromise something that's used by anyone.

03:39.570 --> 03:40.890
So there's benefit.

03:41.150 --> 03:43.990
How does it work in practice in case of cloud buckets?

03:43.990 --> 03:51.090
So let's say you have something that's running on a potential weakness machine and pull executable code from a cloud bucket.

03:51.090 --> 03:57.330
It can be an automated job or users just follow some instruction, let's say curl and pipe it in the bash.

03:57.730 --> 04:00.610
What's going to happen if bucket is deleted?

04:00.850 --> 04:07.010
Well, users will get 404 from AWS, but the bucket namespace is available.

04:07.010 --> 04:18.730
So someone with bad intent can claim the bucket, put malware into it, make it public and well, everyone who rely on that bucket will get infected, right.

04:19.650 --> 04:22.510
Same is actually applicable to malware.

04:22.710 --> 04:27.870
Imagine you have a host compromised with stage one that's pulling stage two from S3 bucket.

04:28.030 --> 04:35.810
Someone sends abuse report to cloud provider, the bucket is taken down and at some point recycled back to consumers.

04:35.810 --> 04:49.730
An attacker who is not affiliated with the original malware can claim this bucket and again, put malware into it, enable public access to it and well, infect all the victims of that malware.

04:49.730 --> 04:55.690
And in general, this risk is not something that's unknown to the industry, right.

04:55.830 --> 05:01.990
Real threat actors and security researchers have been abusing and show this risk in the past.

05:01.990 --> 05:15.410
For example, backdooring Python packages, targeting AWS S3 buckets, expired domains, popular NPM packages and even top level domains of a sovereign state, right.

05:15.410 --> 05:17.990
And it was also presented at this stage at DEF CON.

05:17.990 --> 05:26.430
People were hacking software and two years ago, Thomas Johansson presented the danger of expired TLD domain, well, to pwn internet.

05:26.430 --> 05:28.030
So there's a risk.

05:28.230 --> 05:32.350
And as for malware, this Watchtower research is quite cool.

05:32.690 --> 05:41.890
They showed that it's possible to hijack a lot of expired domains in web shells with backdoors, where backdoor phones back to those expired domains.

05:41.890 --> 05:43.750
So check it out, it's quite cool.

05:43.750 --> 05:52.530
And the closest work to this one is this another great Watchtower research where they claimed 150 buckets and also showed the risk, right.

05:52.610 --> 05:57.550
They published that when I was wrapping up the first bunch of my research here.

05:57.950 --> 06:03.490
But still, we have still a lot of remaining unknowns here, right?

06:03.490 --> 06:05.290
What is the real scale of the attack?

06:05.290 --> 06:08.210
What if we claim a lot of buckets, right?

06:08.310 --> 06:09.650
What would be impact?

06:09.650 --> 06:12.510
Can we actually simulate it and see how it works?

06:12.510 --> 06:21.310
Because, well, in theory, everything works, it was true in this research.

06:21.310 --> 06:25.210
I had a lot of buckets that I initially thought are exploitable, they were not.

06:25.390 --> 06:27.230
And, well, what about data?

06:27.950 --> 06:30.030
We will have a lot of data, right?

06:30.170 --> 06:33.330
You will see, and how do you navigate this data?

06:33.330 --> 06:34.950
What is the true cost of attack?

06:34.950 --> 06:37.650
And actually no one talked about root cause remediation here.

06:37.650 --> 06:39.630
We're going to close these gaps today.

06:40.330 --> 06:42.390
We also have to be very careful.

06:42.390 --> 06:44.390
There are certain rules of engagement here.

06:44.390 --> 06:47.430
First of all, buckets always has to stay private, right?

06:47.430 --> 06:49.330
We always return 403.

06:49.330 --> 06:51.410
We don't want to compromise actual people.

06:51.410 --> 06:55.390
If we want to test anything, we test it on a clone of the bucket.

06:55.390 --> 06:56.710
We respect user privacy.

06:56.710 --> 07:00.330
We don't attribute to individual IPs, individual organization.

07:00.330 --> 07:03.890
I want to show you the scale and the big picture here.

07:03.890 --> 07:08.590
And we also responsibly disclose the findings later about that.

07:08.690 --> 07:10.750
And our approach is quite simple.

07:10.750 --> 07:12.050
We search for buckets.

07:12.070 --> 07:13.990
We check if it's available.

07:13.990 --> 07:14.830
We claim it.

07:14.830 --> 07:16.870
We enable logs for five days.

07:16.890 --> 07:19.710
We triage logs to find sensitive stuff.

07:19.710 --> 07:21.650
We evaluate security impact.

07:21.750 --> 07:23.350
And, well, I guess profit.

07:23.890 --> 07:26.890
Let's move to the part where we search for the buckets.

07:27.070 --> 07:30.450
And the best place to store your code these days is GitHub, right?

07:30.450 --> 07:33.890
It's petabytes of data, millions of repositories.

07:33.890 --> 07:39.490
And unfortunately they don't kind of allow you to search through all the code, right?

07:39.490 --> 07:40.670
You cannot just query.

07:40.670 --> 07:45.290
What enabled this nice tool called source graph, search engine.

07:45.290 --> 07:49.330
It allows you to search GitHub just in seconds, right?

07:49.330 --> 07:56.430
And now all you need to do is to search for S3.Amazon.AWS.com or S3, right?

07:56.430 --> 07:57.590
And you get everything.

07:57.590 --> 08:01.970
And then you expect bucket names with this like ugly regular expression.

08:02.350 --> 08:03.310
And that's it.

08:03.350 --> 08:08.670
And you can say apply same for Maven and PyPy where you have millions of files.

08:09.230 --> 08:13.590
You need to list and fetch repos from repo one or PyPy.

08:13.870 --> 08:15.670
You like download package.

08:15.670 --> 08:16.970
You extract it in memory.

08:16.970 --> 08:18.610
You apply the three gaps.

08:18.610 --> 08:19.650
And, well, you have buckets.

08:19.650 --> 08:22.850
The only difference here that in case of GitHub it was seconds.

08:23.230 --> 08:30.570
In Maven and PyPy it was one and a half months running on like machine on my wife's computer.

08:30.570 --> 08:31.650
It was super noisy.

08:31.650 --> 08:32.550
A lot of CPUs.

08:32.550 --> 08:33.810
Eventually it lost power.

08:33.810 --> 08:34.930
So I gave up.

08:34.930 --> 08:37.170
Like, okay, I don't want to run it anymore.

08:37.930 --> 08:44.890
But eventually, like, I think I managed to crawl through like 45% of everything there.

08:45.050 --> 08:48.910
Anyway, for malware it's even more challenging, right?

08:49.270 --> 08:51.870
You cannot just get all malware.

08:51.870 --> 08:58.210
And I was pretending to be a lazy and, well, since lazy and poor hacker in this research.

08:58.210 --> 09:03.030
So it was impossible for me to get all the samples.

09:03.030 --> 09:06.370
And even if I would get them, there was still a problem, right?

09:06.370 --> 09:09.170
Malware is usually packed and obfuscated.

09:10.310 --> 09:16.070
You need to probably run it in sandbox and it opens another layer of problems, right?

09:16.070 --> 09:24.830
But then this nice resource called URL host, I found it and, yeah, it was relatively straightforward.

09:24.830 --> 09:30.850
They allow you to get all links to Amazon AWS, right?

09:30.850 --> 09:32.470
So it was perfect for me.

09:32.590 --> 09:33.030
Okay.

09:33.030 --> 09:35.550
I'm pretty sure you are interested in what I got.

09:35.790 --> 09:46.290
I registered 480 buckets, 255 received traffic, 4.5 million requests and 3.5 gigabyte of logs.

09:46.490 --> 09:48.490
This is a geography of requests, right?

09:48.490 --> 09:52.430
15,000 hosts, 129 countries.

09:52.490 --> 10:00.090
For malware I got like 188 buckets , 175 received traffic, 2 million requests, almost 4 gigabytes of logs.

10:00.090 --> 10:02.470
And this is a geography.

10:02.470 --> 10:12.210
So it's 20,000 hosts from 142 countries and they were mostly pulling executables and JavaScript, right?

10:12.410 --> 10:23.030
As for GitHub, there we got 4.5,000 buckets, 1.5 received traffic, almost 4 million requests and 19 gigabytes of logs.

10:23.030 --> 10:24.790
So it was quite a lot.

10:24.790 --> 10:26.610
And this is a geography.

10:26.610 --> 10:33.650
So it's 243,000 hosts, all countries except probably North Korea, right?

10:33.650 --> 10:37.810
But keep in mind that most of those requests are not sensitive.

10:37.810 --> 10:40.390
They might not be dangerous in the first place, right?

10:40.390 --> 10:43.730
So how do we find dangers out of this noise?

10:43.750 --> 10:45.250
And, well, let me show you.

10:45.250 --> 10:55.930
This is an example of a log query to AWS, a lot of fields, but what we really care about is bucket name, IP address, request type, object URL referrer and user agent, right?

10:56.150 --> 10:59.290
This data allow you to get the context around requests.

10:59.290 --> 11:04.270
But still, we had 26 gigabytes of logs and 11 million requests.

11:04.270 --> 11:05.610
So it's a lot, right?

11:05.610 --> 11:07.470
And I needed to navigate through it.

11:07.510 --> 11:16.910
But a lot of those requests are coming to pull non-sensitive stuff such as pictures, videos, some text files, like training data and so on.

11:16.910 --> 11:18.570
You can just remove it, right?

11:18.570 --> 11:27.310
We can also filter out like bots, scanners, you know, a lot of bots these days that try to scrape everything for LLM training.

11:27.530 --> 11:29.310
You can like remove it.

11:29.310 --> 11:31.710
You can also aggregate unique IP, right?

11:31.710 --> 11:33.710
Is someone pulling something in the loop?

11:33.710 --> 11:36.130
We counted this on one host, right?

11:36.170 --> 11:39.690
And still, I had a lot of requests.

11:40.190 --> 11:43.870
Probably three years ago, I would just give up or look through them manually.

11:43.870 --> 11:48.450
But these days, we have LLM agents that can help to do the classification for you.

11:48.450 --> 11:53.350
So I leveraged the custom LLM agents to classify requests.

11:53.530 --> 12:03.310
And I got like, I guess, time saving from like a month to a couple of days from like gigabytes of logs to a few megabytes with 500 sensitive buckets .

12:03.310 --> 12:07.290
Of course, I had like hallucinations and like when LLMs was simply wrong.

12:07.290 --> 12:09.210
But still, it kind of worked.

12:09.710 --> 12:12.830
If you're curious about LLM, this is architecture, right?

12:12.830 --> 12:16.190
You have three components working together.

12:16.550 --> 12:21.390
One element is a planner, aggregator, classifier.

12:21.390 --> 12:27.570
I give tools like internet search and GitHub search for the agent and I save answers to the database, right?

12:27.570 --> 12:29.430
And so this is like the prompt, right?

12:29.430 --> 12:39.370
You provide the bucket name, you provide actual requests, it like construct a plan, then in the aggregator with the tools, right?

12:39.370 --> 12:41.850
It actually query and all the content.

12:42.470 --> 12:46.550
And then with all this context, the classifier makes the final decision.

12:46.590 --> 12:48.210
This is how it looks in practice, right?

12:48.210 --> 12:49.450
That ugly little page, right?

12:49.450 --> 12:51.350
With a lot of context.

12:51.350 --> 13:09.490
And this is an example of LLM like telling me that, well, something is trying to pull minecraft-py from assets.minecraft.net, unpacking it and well, classification is executable because I know that on the website they ask users to execute it.

13:09.490 --> 13:12.030
So, yeah, a big time saver.

13:12.710 --> 13:15.450
All right, so let's talk about results.

13:15.890 --> 13:21.770
Before we show examples, those are the sensitive types that I came up with.

13:21.770 --> 13:33.130
So it's executables, ML models, archived executables, PyPy packages, I had dynamic web content, static sensitive files, configs and data write attempts.

13:33.130 --> 13:36.990
So let's start with examples on executables, right?

13:36.990 --> 13:46.070
So statistics were dominated by PyTorch and Microsoft executables and archives as executables.

13:46.490 --> 13:52.090
For SN, statistics, mostly ISPs, so like end users, right?

13:52.090 --> 13:58.050
I had requests from like universities, maybe students on campus, maybe administrative network, you never know.

13:58.050 --> 14:04.070
And I had a lot of like business entities, like small, medium business and a large stock trading company.

14:04.410 --> 14:19.470
A canonical example would be this large network equipment company who used to surf installation binary from three buckets, they changed the distribution policy, made an announcement and deleted the bucket.

14:19.470 --> 14:30.050
But unfortunately, the link was still used by a lot of clients not affiliated to the original tool owner, right?

14:30.050 --> 14:35.510
Like this one, like a partial script where they pull and execute a binary from the bucket.

14:35.510 --> 14:43.250
And in this case, it's 162 hosts who would execute our malicious code.

14:43.730 --> 14:45.950
And another example is Minecraft, right?

14:45.950 --> 15:06.810
It can be played on Raspberry Pi and you need to download the website with reference in the package that you need to download and unpack and execute from, again, an S3 bucket, an S3 bucket was abandoned, and well, again, this gives us a very straightforward to get code execution on a lot of hosts.

15:08.130 --> 15:14.830
I also had a lot of requests to pull Vagrants.box VMs, right, from abandoned S3 buckets.

15:15.630 --> 15:21.610
You can obviously put backdoor in VM, but escaping VM is not an easy job, right?

15:21.610 --> 15:23.930
And how about executing code on the host?

15:23.930 --> 15:25.310
And it's also possible.

15:25.310 --> 15:36.650
Because Vagrants allow you to put like system command in the config and any time user like download the box and edit, not like execute, even add, you can execute your code.

15:36.650 --> 15:40.890
So a very straightforward way to get code execution, right?

15:40.970 --> 15:43.810
Now, PyTorch models.

15:44.070 --> 15:49.570
A quarter of requests came to pull PyTorch models, right?

15:49.570 --> 15:57.850
And they allow arbitrary code execution because they support like PyTorch relies on pickle deserialization to load models, right?

15:57.930 --> 16:03.710
And well, it's pickle deserialization allow you arbitrary code execution by design, right?

16:03.710 --> 16:09.450
They put some controls in place, but not everyone rely on them, right?

16:09.450 --> 16:12.710
And let me show how it works in practice.

16:12.710 --> 16:14.730
Hopefully the demo will work.

16:14.730 --> 16:15.070
Okay.

16:15.070 --> 16:17.570
So we have this open source project, right?

16:17.570 --> 16:18.830
Super gradients.

16:18.830 --> 16:20.770
4,000 stars.

16:21.010 --> 16:28.490
They used to serve prebuilt models from like S3 buckets, right?

16:28.950 --> 16:31.410
And then they change it.

16:31.410 --> 16:34.410
But people who rely on the old ones still were vulnerable.

16:34.410 --> 16:38.210
And you can see like one example.

16:38.210 --> 16:42.410
We are going to use this one in this demonstration, so we go back.

16:42.990 --> 16:47.190
This is just a simple script on how to load this model, right?

16:48.110 --> 16:49.630
Or does it load it?

16:49.630 --> 16:58.030
And if we execute it, right, you will see 403 with the attempt to pull it from the bucket.

16:58.030 --> 17:00.510
So this is 403, right?

17:00.510 --> 17:07.150
If you scroll it up, you see the attempt to download it from the bucket.

17:07.210 --> 17:10.170
And this is the package, right?

17:10.170 --> 17:12.310
The old version to show in the demo.

17:12.310 --> 17:14.270
It's like two years ago, right?

17:14.270 --> 17:15.950
I need to apply patch.

17:15.950 --> 17:20.630
As you remember, we don't want to run it on like actual bucket.

17:20.630 --> 17:21.710
We want the clone.

17:21.710 --> 17:25.090
So this is the only way you can simulate it safely, right?

17:25.090 --> 17:27.370
So this is the change.

17:27.370 --> 17:31.490
Like just two places where this random string to the bucket name, right?

17:31.490 --> 17:32.850
And claim the bucket.

17:32.970 --> 17:36.450
And we can scroll down, and that's basically another one.

17:37.030 --> 17:42.310
So we patch it, and now we can go back.

17:43.030 --> 17:54.650
If you run it again, just to validate, right, you're going to see the attempt to pull the model from the copy of the bucket, right?

17:55.310 --> 17:55.930
Okay.

17:55.930 --> 18:00.550
So now let's poison the model, right?

18:00.550 --> 18:04.330
We're going to rely on this code snippet from Snook, right?

18:04.330 --> 18:07.670
It's a minimal implementation to inject code in PyTorch.

18:08.110 --> 18:09.810
Relatively straightforward.

18:10.330 --> 18:13.910
Just import the system calculator.

18:14.050 --> 18:15.510
So that's basically it.

18:15.510 --> 18:17.990
And we save it in the PTH file, right?

18:18.570 --> 18:19.070
All right.

18:19.070 --> 18:22.070
So let's close it.

18:22.350 --> 18:32.430
So we're going to poison this model, right, that I downloaded from their new place.

18:32.670 --> 18:33.030
Okay.

18:33.030 --> 18:34.850
So we have the model.

18:34.850 --> 18:42.390
Now we need to reconstruct the folder structure, the tool expect, right, the open source supergradients.

18:42.530 --> 18:45.250
And now we are ready to upload it to S3 bucket, right?

18:45.250 --> 18:48.650
So this is the name of the bucket, right?

18:48.650 --> 18:51.250
So we upload it.

18:51.250 --> 18:53.750
We need to upload folder, not file.

18:54.390 --> 18:54.970
All right.

18:54.970 --> 18:56.410
So we go back.

18:58.090 --> 18:59.390
We upload it.

18:59.390 --> 19:03.010
So the model is 34 megabytes, right?

19:03.450 --> 19:07.230
And all you need is just to enable access to it, right?

19:07.230 --> 19:09.630
Well, world access.

19:10.430 --> 19:10.990
Okay.

19:10.990 --> 19:12.310
So we upload it.

19:21.060 --> 19:25.840
And now we can pull the model, like just rerun the script, right?

19:25.840 --> 19:27.640
And we will get the calculator.

19:30.190 --> 19:31.870
So the model is loading.

19:31.870 --> 19:35.370
And we got this ugly full screen calculator.

19:35.370 --> 19:35.870
Okay.

19:35.870 --> 19:37.830
Now let's move to another example.

19:37.830 --> 19:43.510
I had even bigger open source project with 33,000 stars.

19:43.510 --> 19:45.710
Again, same problem there, right?

19:46.050 --> 19:49.810
People who rely on our bucket got compromised, right?

19:49.830 --> 19:59.030
And in this case, you can, again, poison PyTorch model and get code execution when people load their, like, their buckets, right?

19:59.330 --> 20:00.270
All right.

20:00.270 --> 20:03.050
So let's go to Maven and PyPy packages.

20:03.050 --> 20:07.930
Out of hundreds of buckets, I actually got only nine sensitive buckets, right?

20:07.930 --> 20:13.190
Still like 3.8 thousand IPs, JavaScript, and executables.

20:14.150 --> 20:16.290
I want to show you one example.

20:16.290 --> 20:19.710
It's not so pretty, I think.

20:20.230 --> 20:27.590
The old version is vulnerable because it tries to pull a pre-built binary from an S3 bucket, right?

20:27.590 --> 20:30.310
Now it returns 403.

20:30.310 --> 20:32.990
Well, 403 because we control it right now.

20:32.990 --> 20:45.270
And the plea is basically a wrapper around a native binary that will be installed on your machine from that S3 bucket, right?

20:45.270 --> 20:48.070
And we can just modify that library.

20:48.070 --> 20:56.170
We can add our code every time the library is loaded and, well, get code execution on the machine.

20:56.170 --> 20:58.310
And let me show how it works in practice, right?

20:58.310 --> 21:06.190
So, again, so if we execute this not so plea package, right?

21:06.190 --> 21:10.670
So an old version is probably like five years old.

21:10.670 --> 21:13.530
You see the attempt 403.

21:13.610 --> 21:13.970
Yep.

21:13.970 --> 21:20.250
So it's trying to pull that archive and extract it on the machine, right?

21:20.250 --> 21:21.790
So this is the name, basically.

21:21.790 --> 21:28.830
And I have a version of it slightly, like, newer just to make it easier to compile.

21:28.830 --> 21:30.930
But it's basically the same package, right?

21:30.930 --> 21:32.710
And vulnerable to the same problem.

21:32.710 --> 21:40.390
So let's change, again, the reference to the bucket to something without active clients.

21:40.390 --> 21:47.890
So we add just additional string, right?

21:47.930 --> 21:55.870
And now I already compiled the library and put it in the bucket to make it faster.

21:56.930 --> 22:01.810
All we need now is to basically execute the package, right?

22:01.810 --> 22:11.390
So if we execute it, so it tries to fetch a bunch of stuff.

22:11.570 --> 22:16.210
But at some point, it will fetch the prebuilt library and install it on the machine, right?

22:16.210 --> 22:19.970
So, okay, now at this point, the backdoor library is there.

22:19.970 --> 22:24.630
And if we execute the binary, we get arbitrary code execution.

22:25.010 --> 22:25.770
So, yeah.

22:25.850 --> 22:27.230
Pretty nice.

22:29.590 --> 22:30.670
Thank you.

22:32.750 --> 22:35.530
And the impact of this would be quite interesting.

22:35.530 --> 22:51.310
It would lead to installation of a backdoor library on five Fortune 500 companies, like, including three largest banks in the world, AV vendor, a global telecom company, and a huge retail company, right?

22:51.310 --> 22:55.030
And there's another example called kuva-dev.

22:55.030 --> 23:03.890
This one is interesting because it references an additional host repository for this package that I have never heard about.

23:03.890 --> 23:13.290
But in the log, I found, like, 288 hosts pulling thousands of packages from that repository.

23:13.290 --> 23:14.990
This is an example of logs.

23:14.990 --> 23:17.150
And this would be also quite dangerous.

23:17.150 --> 23:28.710
It would lead to, again, installation of backdoor packages on five government entities in Europe and South America, global investment fund, and two major, like, tech and telecom companies.

23:28.710 --> 23:34.990
And we have limited time, so I cannot go through all examples of sensitive request types.

23:34.990 --> 23:39.410
I just want to quickly mention that I had a lot of requests to PHP and JavaScript.

23:39.530 --> 23:43.650
I also had requests to static, like, sensitive files and webpages.

23:43.890 --> 23:48.770
And most of them, like, PDF docs and, well, Microsoft formats.

23:49.190 --> 23:53.490
You might be thinking, okay, Max, what's the problem with the static file format?

23:53.490 --> 23:59.890
Well, it's a good social engineering vector because you already have established trust with a potential victim, right?

23:59.890 --> 24:15.750
So they come and download something on the website, and you can, well, it wouldn't be super odd to ask them to run some command, let's say, in the PDF, like, a manual, or in case of this weird engineering calculator, ask them to enable macros, right?

24:15.750 --> 24:26.010
And in this particular case, it would be, like, three state-level agencies in, like, in Europe and in South America, and, like, integration design firms, right?

24:26.010 --> 24:28.130
So it's a relatively interesting vector.

24:28.730 --> 24:31.730
And what's funny, I had, like, data write attempts.

24:31.730 --> 24:36.470
So I created a bucket, and I see people trying to put logs in my buckets, right?

24:36.750 --> 24:39.170
Which is quite funny, in my opinion.

24:39.170 --> 24:40.510
But obviously, I didn't enable.

24:40.510 --> 24:46.910
I don't know what they wanted to put into my buckets because it might be sensitive, right?

24:47.130 --> 24:47.590
Okay.

24:47.590 --> 24:52.130
Let's go to the most, like, funny part, which is the malware.

24:52.630 --> 24:55.550
Let's start with some statistics.

24:56.090 --> 25:01.950
We can see the stats are dominated by two families, RK and Linker.

25:02.990 --> 25:07.650
Basically, they represent a huge chunk of all of the malware.

25:07.650 --> 25:13.770
But Linker is a malicious Chrome extension masquerading as a benign application in the web store.

25:13.770 --> 25:17.710
For example, a playlist on the screenshot on the slide.

25:17.910 --> 25:26.490
And when a victim visits some interesting websites, Linker pulled JavaScript from S3 and injected it into the victim's browser, right?

25:26.490 --> 25:28.810
And the main purpose is to show ads.

25:28.810 --> 25:31.430
It was active, like, three, four years ago.

25:31.590 --> 25:38.710
But since then, it was taken down from Chrome web store, and the author eventually abandoned it.

25:39.070 --> 25:42.650
But in the logs, you can still see a lot of requests for those buckets.

25:43.590 --> 25:44.950
Requests, name.

25:45.410 --> 25:47.830
What's important for us is refer, right?

25:47.830 --> 25:55.750
It actually tells us the context in which, like, website this JavaScript will be executed, right?

25:55.750 --> 25:59.010
And there is even public research on that sample.

25:59.010 --> 26:03.210
And the extension just pulled config from this FlashPlaylist.com, right?

26:03.210 --> 26:11.550
And the website should return this mixed panel variable with the link to the bucket and JavaScript, right?

26:11.650 --> 26:12.710
Name.

26:14.530 --> 26:27.370
And the code is obfuscated, but all it does is basically install it in the Chrome local storage, and then this variable is used to pull the script any time a user visits a web page, right?

26:27.370 --> 26:31.530
And, well, since we control S3 bucket, we can put any JavaScript we want.

26:31.650 --> 26:34.170
Let me show you how it works in practice.

26:34.170 --> 26:52.030
So, again, a clone of the S3 bucket with no active clients, malicious JavaScript, and this bucket, just to show you, well, some data can be exfiltrated from the JavaScript, and this is a malicious extension installed in the browser, right?

26:52.430 --> 26:57.050
Let's just visit some websites to show how it works.

26:57.050 --> 27:02.750
Gmail, Twitter, Instagram, Facebook, LinkedIn, right?

27:02.750 --> 27:09.810
And you can see, our JavaScript got executed on all of those websites, right?

27:10.510 --> 27:24.230
And you can take a look at logs, right, and see that there's actual attempt to pull the JavaScript from the bucket we control, right?

27:24.230 --> 27:30.570
And let me show that, well, it's possible to weaponize it in some context, right?

27:30.570 --> 27:38.090
So, for example, on TikTok, well, you can actually exfiltrate some data.

27:38.090 --> 27:42.150
Well, Amazon is allowed in CSP policy on TikTok, so it's quite easy, right?

27:42.150 --> 27:51.590
So, in the JavaScript, we take everything that's available to our JavaScript in the context and put it into the bucket, right?

27:51.590 --> 28:03.370
So, obviously, you cannot, like, steal HTTP-only cookies and probably not all the data, but still, I mean, this is a question on how to weaponize XSS on all of those resources for the attacker, right?

28:03.370 --> 28:06.570
You can see, like, cookies, you can see page data.

28:07.850 --> 28:09.970
I want to rant about this capture.

28:09.970 --> 28:11.410
It's just crazy.

28:11.410 --> 28:23.890
So, I wanted to show you a test account from Microsoft, and I tried to register an account, and, like, I spent a decent amount of time, probably the hardest challenge within the whole research, and it's crazy.

28:23.890 --> 28:25.090
This capture is crazy.

28:25.090 --> 28:25.890
I couldn't.

28:25.890 --> 28:27.290
So, no Microsoft demo for you.

28:27.290 --> 28:30.150
Like, I didn't know how to move the person to the right place.

28:31.190 --> 28:32.610
I don't know.

28:32.990 --> 28:34.610
Well, this is impact, right?

28:34.610 --> 28:41.250
So, thousands of users on, like, many, many websites, like Google, YouTube, and Facebook, and so on.

28:41.250 --> 28:43.570
But, obviously, there's nothing wrong with those websites.

28:43.570 --> 28:48.070
It's basically malicious Chrome extension that injects JavaScript.

28:48.070 --> 29:00.130
It has control over the browser, and I hope that, naturally, this extension will die, right, because of introduction of manifest v3, and the extension depends on manifest v2.

29:00.130 --> 29:01.150
We'll see.

29:01.270 --> 29:03.370
What about sensitive users?

29:03.410 --> 29:04.770
We have a lot of them.

29:04.770 --> 29:13.750
Again, a lot of people visiting, like, government websites in certain countries, and , actually, people from government networks visiting government websites.

29:13.750 --> 29:15.630
So, yeah, quite risky.

29:17.450 --> 29:18.130
RK.

29:18.130 --> 29:23.810
RK is malware pretending to be useful, like, executable.

29:23.810 --> 29:25.010
It tries to steal your data.

29:25.010 --> 29:27.010
It was active, like, four years ago.

29:27.470 --> 29:30.190
It was forked by other families.

29:30.670 --> 29:32.510
That's how it looks in the logs, right?

29:32.510 --> 29:37.410
A machine-generated bucket name, and the request to pull executable.

29:37.450 --> 29:43.070
And there are a bunch of old sandbox reports indicating, okay, that actually happened.

29:43.670 --> 30:00.210
The problem is replicating this malware is quite challenging, because you actually need to find the executable who would, like, pull from the bucket, and it was hard, because, first of all, anti-VM, anti-debugging, and, second, well, malware is not active anymore.

30:00.210 --> 30:05.850
Part of its infrastructure is dead, so you cannot reproduce it in any way.

30:05.850 --> 30:11.830
But for you, I found the sample after, like, a really long search, so RK Stealer.

30:11.910 --> 30:14.510
So we are in Windows VM.

30:14.510 --> 30:15.470
We have Wireshark.

30:15.470 --> 30:19.450
Installer is actually our malware, and we have FakeNetNG.

30:19.450 --> 30:21.490
I'll tell you why we need it.

30:21.510 --> 30:29.210
So let's start Wireshark just to see what's going on, like, on the wire, right?

30:31.250 --> 30:33.650
So then we run installer.

30:34.050 --> 30:35.350
We see some traffic, right?

30:35.350 --> 30:36.790
At this point, you are infected.

30:36.790 --> 30:39.910
Don't, this is fake.

30:40.530 --> 30:44.290
We can see the actual request, right?

30:44.290 --> 30:49.630
And it's HTTP, obviously, because, well, malware doesn't care about your security at all, right?

30:49.630 --> 30:53.330
So it tries to pull the executable over HTTP, right?

30:53.330 --> 30:55.150
This is the actual executable.

30:55.150 --> 31:03.070
And what you can do, actually, you can spin up FakeNetNG that will respond with executable to every request that malware makes, right?

31:03.070 --> 31:06.070
So it's like a fake server for malware.

31:06.210 --> 31:09.010
And in our case, we're going to serve it calculator.

31:09.010 --> 31:10.970
So now see what's going to happen.

31:10.970 --> 31:16.110
So we run malware, and we have our calculator, right?

31:16.390 --> 31:22.090
So now in FakeNetNG, you can see the actual request, right?

31:22.090 --> 31:29.690
It tries to probe whether the bucket is available and the executable is there, and then just download it over HTTP, right?

31:29.690 --> 31:32.510
And we, like, just give it calculator, right?

31:32.510 --> 31:34.250
And it executes it blindly.

31:34.430 --> 31:34.890
All right.

31:34.890 --> 31:37.130
So that was RK.

31:37.670 --> 31:41.030
Now let's move towards total impact.

31:41.030 --> 31:47.710
This is the overall map of the users that I verified would have been compromised from this attack, right?

31:47.710 --> 31:56.190
It's 28,000 users, 158 countries, 134 organizations, and 25 government networks, right?

31:56.190 --> 32:00.050
And you might be thinking, well, Max, we saw, like, bigger attacks, right?

32:00.050 --> 32:04.490
But I want to remind you it's just five days of monitoring logs, right?

32:04.990 --> 32:07.770
God knows what would happen if I would look for two months.

32:07.770 --> 32:08.950
Again, lazy hacker.

32:09.210 --> 32:12.330
Anyway, country statistics.

32:12.330 --> 32:16.570
US, Russia, China, Germany, and other European countries, right?

32:17.410 --> 32:20.490
$20 the cost of attack.

32:20.490 --> 32:27.250
You can likely do it in, like, zero budget that I spent on, like, log storage, right?

32:27.270 --> 32:29.370
And this is attacker profiles.

32:29.370 --> 32:44.790
As you can see from impact, that would be interesting from anyone, from hacktivist for fun to cyber crime for, well, cause financial damage, ransomware and stuff like that, to APT groups for sabotage and espionage purposes, right?

32:44.830 --> 32:47.950
And responsible disclosure is quite interesting here.

32:47.950 --> 32:52.070
As one person who helped me with this research pointed out, there's a paradox here.

32:52.070 --> 32:56.290
In order to find vulnerability, you have to fix vulnerability.

32:56.290 --> 33:01.350
Because once you claim the bucket, it's not any more vulnerability because the bucket is claimed, right?

33:01.350 --> 33:07.470
So, but still, I didn't want to sit on all of those buckets because, well, it's quite dangerous, right?

33:07.470 --> 33:20.810
So eventually I collaborated with AWS on a mediation campaign and they seemed to hold all the buckets that were identified as sensitive, right?

33:21.930 --> 33:27.150
Yeah, it was a positive collaboration with them.

33:27.190 --> 33:31.370
But I want to highlight that this is likely a tip of an iceberg here, right?

33:31.370 --> 33:36.170
A sizable tip, but what about other package repository?

33:36.370 --> 33:38.590
What about GitHub commit history?

33:38.590 --> 33:41.950
Because source graph doesn't allow you to search in the commit history.

33:41.950 --> 33:43.610
What about proprietary code?

33:43.610 --> 33:46.310
And what about other cloud providers, right?

33:46.310 --> 33:51.990
AWS is just one example because of its size, I picked it, but there are others.

33:52.310 --> 33:55.990
And S3 buckets is just one problem, right?

33:55.990 --> 34:05.590
There are other type of abundant resources that an attacker can exploit like domain IP and domains and other stuff.

34:05.590 --> 34:06.790
So, yeah.

34:07.050 --> 34:22.670
And if we ask any cloud provider, they would point out that it's basically customer's responsibility for, well, don't forget your code and references to dangling buckets, right?

34:22.670 --> 34:25.650
And unfortunately, I think they're right.

34:25.650 --> 34:28.650
We should not forget about the code, right?

34:28.650 --> 34:34.350
We should not forget about the references to the buckets that doesn't exist, that represent risk.

34:34.350 --> 34:50.070
And through the course of collaboration with AWS, they also wanted to share that it's also possible to rely on machine generated bucket names in certain cases or make them less predictable to reduce the risk here.

34:50.070 --> 34:57.950
And also, they rolled out recently a higher cap for amount of buckets you can have, so per account.

34:57.950 --> 35:01.730
So per account, you can now have like 10,000 buckets.

35:01.830 --> 35:03.190
And, well, it's a lot.

35:03.310 --> 35:09.690
You probably, like, it would probably incentivize people to, well, not delete buckets.

35:09.690 --> 35:10.950
Like, why do we need to delete it?

35:10.950 --> 35:12.630
Keep it, right?

35:12.630 --> 35:17.770
Yeah, so those are the references, if you want to look deeper into that.

35:18.590 --> 35:21.790
And, like, blaming engineers is nice, right?

35:21.790 --> 35:23.670
But it's not productive.

35:23.670 --> 35:25.110
I would say it's counterproductive.

35:25.110 --> 35:30.010
And I would believe, I believe that in general, as a security industry, we can do better, right?

35:30.010 --> 35:46.430
So if you work on, like, static source code analysis or you're a code storage provider or you're just within a security team within the organization, look for dangling buckets that reference to something that doesn't exist and, well, remove it.

35:46.850 --> 35:48.050
It's not that hard.

35:48.050 --> 35:52.950
And I wanted to release a tool to do it, but eventually I found a bunch of tools that already exist for that.

35:52.950 --> 35:57.550
So just use one of them and they're pretty decent and much better than I would write them.

35:57.610 --> 36:05.090
And the real root cause fix here would involve secure by default cloud, right?

36:05.090 --> 36:10.310
So it's either bucket namespace to be project scoped, right?

36:10.310 --> 36:14.130
So you have project name and bucket name, where project name is immutable.

36:14.130 --> 36:16.770
You cannot, like, delete and someone else reclaim it.

36:16.770 --> 36:21.490
Or even better, like, just make bucket names non-recyclable at all.

36:21.490 --> 36:24.530
So it's not possible to reclaim them, right?

36:25.430 --> 36:31.370
It's possible, probably there are some caveats with abuse potential, right?

36:31.370 --> 36:35.230
Or general people claiming all cool buckets.

36:35.550 --> 36:37.190
Maybe, maybe not.

36:37.510 --> 36:41.830
It requires some research on critical user journeys, right?

36:42.290 --> 36:47.630
And as for buckets used by malware, I think the best path forward is just keep them always private.

36:47.630 --> 36:55.350
There's even, like, this shadow server initiative that's in whole domains used by malware.

36:55.350 --> 37:01.310
So we can, well, cloud providers, I think, can apply the same strategy for buckets, right?

37:02.130 --> 37:02.910
All right.

37:02.910 --> 37:08.730
I hope I convinced you that abundant cloud buckets is a serious problem, right?

37:08.730 --> 37:11.710
You can run the attack with relatively low cost.

37:12.330 --> 37:20.050
And LLMs and elements of big data analysis can really bring this on, like, gigantic scale, right?

37:20.170 --> 37:23.830
And, well, help attack reduce the time and effort required here.

37:23.870 --> 37:38.050
I would like to thank Electronic Frontier Foundation for help here and a lot of amazing people who made this talk possible, as well as James Erickson and overall Amazon security for very positive collaboration.

37:38.650 --> 37:46.370
They wanted to share that they are always welcome to collaborate with security researchers to make, like, the cloud and their customers more secure.

37:47.630 --> 37:49.090
Those are the references.

37:49.450 --> 37:51.310
And, well, basically, that's it.

37:51.310 --> 37:52.230
Thank you.

37:52.230 --> 37:53.690
And I'll be near the stage.

