WEBVTT

00:05.970 --> 00:09.690
Alright everyone, thank you so much for coming out to this talk.

00:09.690 --> 00:15.050
It's called Secrets and Shadows, Leveraging Big Data for Vulnerability Discovery at Scale.

00:15.050 --> 00:21.810
I'm so excited to be here for another year at another DEF CON, and I really do have something in store for you today.

00:21.970 --> 00:23.730
Let's get right into it.

00:26.700 --> 00:37.700
So, just a disclaimer, everything we're going to talk about today was done completely independent of my employer, outside of work, with my own money, my own resources.

00:38.100 --> 00:44.560
If you want to talk about this work outside of this presentation, just please refer to me as an independent security researcher.

00:44.560 --> 00:48.020
It helps me be able to do work just like this.

00:51.330 --> 01:01.650
So, my name is Bill Demerkappa, and I'm a security researcher with a diverse background in low-level software security, and also cloud security.

01:05.610 --> 01:07.950
I'm interested in defense and offense.

01:07.950 --> 01:19.350
I love solving hard security problems, and while I did start with a software security background, I feel like the impact we can have with cloud security is much wider.

01:19.350 --> 01:32.010
For example, you could have the most complex software vulnerability in the world, but at the end of the day, a simple missing ID check in a cloud environment can lead to a much broader impact.

01:32.010 --> 01:34.550
And that's what really got me interested in the cloud.

01:34.550 --> 01:43.230
It's the ability to have an impact without the same technical complexity that comes with exploiting low-level vulnerabilities.

01:45.270 --> 01:51.350
So, in this talk, we're going to discuss vulnerability discovery at scale.

01:51.350 --> 02:02.950
And what I mean by that is, we're going to take a look at how we traditionally approach vulnerability discovery with two common bug classes, dangling cloud resources and leaked secrets.

02:02.950 --> 02:11.810
The goal is to identify the limitations of our historical approach and shift our perspective through some practical examples.

02:14.900 --> 02:16.700
So, some background.

02:18.500 --> 02:22.080
Now, from a high level, everyone knows what cloud computing is.

02:22.500 --> 02:32.320
It's basically a way where you can create infrastructure, like servers, websites, and more, without needing to actually purchase your own physical server rack.

02:32.940 --> 02:36.240
The cool part is, this can save you a lot of money.

02:36.240 --> 02:41.300
If you're just creating your own blog, you really don't need that many resources at all.

02:41.380 --> 02:43.480
Why not borrow someone else's?

02:43.480 --> 02:47.240
And that's really the fundamental principle of cloud computing.

02:47.260 --> 02:52.260
All you're doing is borrowing from someone else's pool of shared resources.

02:56.820 --> 02:59.900
So, cloud environments are managed over the Internet.

02:59.900 --> 03:02.540
But how do we actually secure this access?

03:02.960 --> 03:08.600
Well, for AWS, the way it works is that you can use something called an access key.

03:08.660 --> 03:21.340
An access key can be short-lived or a long-term token that specifies credentials for your account and allows you to manage your AWS resources, depending on the role and permissions assigned to you.

03:21.980 --> 03:25.280
Can we please increase the microphone sound?

03:25.900 --> 03:28.900
And for other platforms, it's similar.

03:28.900 --> 03:42.960
For example, for Google Cloud, the types of authentication include service accounts, you can use CLI credentials, and in general, tokens are how we're able to operate with these cloud environments.

03:43.640 --> 03:47.600
Unfortunately, tokens also present a pretty severe risk.

03:49.380 --> 03:58.200
So, cloud provider tokens are dangerous because, by default, little restriction, there's little restriction on who can use those tokens.

03:58.420 --> 04:08.480
For example, by default, if you create a root access key in AWS, anyone from any IP can use that access key to manage your cloud environment.

04:08.860 --> 04:14.620
Now, obviously, the impact of a leaked cloud credential will really depend on the context.

04:14.740 --> 04:27.000
For example, a lot of websites hard-code a Google Maps API key, and in reality, despite the fact that it can lead to billing overcharges and abuse, the impact is still fairly limited.

04:27.500 --> 04:32.640
But with a root AWS key, the dangers are much more problematic.

04:32.900 --> 04:47.380
For example, if you stored your database in AWS, or you store your computing in AWS, an attacker could use your credentials to not only access customer data, but to interfere with your production workflows.

04:49.260 --> 05:01.800
Now, when we talk about how everything in the cloud is shared and borrowed, what I mean by that is, by nature, by its nature, the cloud model introduces risk from this sharing model.

05:02.180 --> 05:10.800
So, for example, when you create a virtual machine, what's really happening is you're borrowing time on a physical server that your cloud provider has bought.

05:11.100 --> 05:16.740
And on this physical resource, you get assigned a network IP, for example.

05:16.960 --> 05:31.360
And the reason this is dangerous is because once you're done with a resource, if you still have dangling DNS records pointing at that resource, suddenly that exposes an opportunity for an attacker to take advantage of.

05:31.440 --> 05:35.680
So, from a high level, I view cloud resources in two categories.

05:35.700 --> 05:38.320
Primitive resources and shared resources.

05:38.600 --> 05:44.360
So, a primitive resource is something like a virtual machine where you get assigned a dedicated IP address.

05:44.500 --> 05:48.160
That IP address is not used by any other customer but you.

05:48.300 --> 05:55.620
Whereas with a shared resource, what's really going on is it's a serverless application that serves multiple customers.

05:55.740 --> 06:08.240
For example, if you have a serverless function that you can call on your cloud provider, that URL you use to connect to that serverless function probably corresponds to an IP that serves a lot of other customers.

06:08.260 --> 06:15.740
The reason this distinction is important is because it impacts what type of dangling DNS records you need to worry about.

06:15.760 --> 06:27.680
So, for primitive resources where you have that unique IP address, that includes pretty much every type of DNS record that could be dangling, like an A record, a C name record, a name server, and et cetera.

06:27.780 --> 06:37.660
But whereas if it's a shared resource where the endpoint is shared across customers, that's gonna be limited to C names, name server, MX, those types of records.

06:37.800 --> 06:47.580
And the distinction there is that when the endpoint is shared, suddenly you don't have to worry about the A record pointing at an IP address you no longer control.

06:48.240 --> 06:51.520
So, what can an attacker do with that domain control?

06:51.660 --> 06:56.320
Well, from a high level it can enable phishing, malware distribution, scams, et cetera.

06:56.320 --> 06:58.340
It can lead to cross-site scripting.

06:58.340 --> 07:08.200
Uh, and there's going to be context specific impact, like you can bypass the trusted host names check in a software update installer, that's something I've seen pretty common.

07:08.200 --> 07:14.100
You can abuse the brand trust and reputation in order to spread misinformation.

07:14.500 --> 07:21.180
Now, I included a quote below from APNIC on an article talking about this potential abuse.

07:21.500 --> 07:40.160
So, from a high level, they found that when it came to dangling DNS record abuse, um, in general, 75% of the hijacked dangling resources were being used to, for black hat se- search engine optimization and really promoting bad websites you don't want anyone going to.

07:43.500 --> 07:50.180
So, to be clear, past approaches for these types of bugs already exist.

07:50.280 --> 08:00.960
Where, with dangling cloud resources, you know, we've seen that attackers can go ahead and enumerate cloud IP pools and capture these resources that are dangling.

08:00.960 --> 08:07.520
But, with leaked secrets, what we've seen is that a lot of work really relies on a limited scope.

08:07.760 --> 08:14.880
So, what I mean by that is, everything that happens with leaked secrets is always about a specific target.

08:14.880 --> 08:20.280
Like a specific folder, a specific repository, or a specific directory.

08:21.020 --> 08:34.180
And the problem with this is, to start with dangling resources, some past work includes, you can buy DNS data and then enumerate your cloud provider's IP pool in order to find what's dangling.

08:34.180 --> 08:43.580
So, if I go ahead and create a resource over and over again in a cloud environment, I'll be assigned IP addresses that are not assigned to any other customer.

08:43.680 --> 08:57.040
And if one of these IP addresses matches a DNS record that I've found in DNS data that threat intelligence providers sell, well, that's one way you can capture a dangling DNS record.

08:57.620 --> 09:01.820
And other attempts also include going after a specific target.

09:01.820 --> 09:13.060
So, instead of using DNS data you buy from threat intelligence providers, you'll instead go ahead and enumerate that provider pool, but this time compare against sub-domains you've enumerated for that specific provider.

09:15.380 --> 09:19.480
So, to give you some examples, there's been a lot of work in this area.

09:19.480 --> 09:36.280
Bishop Fox originally came out in 2015 with an article where they used this passive DNS data, or at least a variant of it, in order to enumerate an AWS cloud IP pool and then capture AWS IPs that corresponded to a specific domain they were interested in.

09:36.360 --> 09:40.720
So, in that case they used bing.com to find those dangling DNS records.

09:41.780 --> 09:54.840
Some other work includes flying a false flag from Black Hat, it's a talk, where they used passive DNS data from these threat intelligence providers to determine whether IPs they captured were dangling.

09:56.160 --> 10:02.720
So, this project was again focused on creating these backends for C2 malware platforms.

10:02.720 --> 10:09.160
They wanted to take control of legitimate domains so that they could abuse those domains for a false level of trust.

10:09.920 --> 10:21.260
And one interesting note about this project is that they noted that after releasing it, it would appear that AWS and GCP now assign IPs from a limited pool for your account.

10:21.260 --> 10:27.020
We'll touch on this more later, but this is what we're going to be focusing on when it comes to dangling DNS resources.

10:27.120 --> 10:33.840
The topic is well traversed, but what's not well traversed are the modern deterrents against it and how we can bypass them.

10:34.780 --> 10:43.180
And finally, there's still a lot of work where attackers simply enumerate your domain subdomains and then find IPs that match them.

10:44.620 --> 10:48.320
Now when it comes to leaked secrets, the story's a bit different.

10:48.340 --> 10:52.160
It's not as well traversed as dangling DNS records at all.

10:52.360 --> 10:58.760
So for example, there's tools that you can use to search a Git repository for these secret patterns.

10:58.900 --> 11:08.580
And even GitHub has a system where they'll scan every content, every piece of code uploaded to their platform for these secret patterns.

11:08.660 --> 11:14.540
But the limitation with this work is that it's really a, it's very small scope.

11:14.540 --> 11:17.840
I mean, think about how much code is really going to end up on GitHub.

11:17.840 --> 11:25.680
You know, most enterprises aren't going to put their closed source applications on GitHub where this scanning would occur in the first place.

11:27.360 --> 11:34.500
Now going on to defender approaches to mitigate these vulnerabilities, well, they've been pretty limited as well.

11:34.640 --> 11:39.960
Oftentimes these are treated as customer vulnerabilities, which technically is correct.

11:39.960 --> 11:47.040
If you think about it from a high level, if you leak a secret or leave a DNS record dangling, that is your responsibility.

11:47.080 --> 11:54.440
But what I think that is often missed is the provider's responsibility and how they encourage these insecure defaults.

11:54.520 --> 11:58.540
So for example, tokens are really, really easy to use.

11:58.740 --> 12:03.080
Have you ever thought about how easy it is to use a token in your code?

12:03.160 --> 12:06.020
And that's how it can get leaked in the first place.

12:06.400 --> 12:12.820
Now Fortune 500 companies might have those standard secure development lifecycle practices where they can avoid this.

12:12.820 --> 12:21.380
But in reality, a lot of small to medium sized businesses might not understand this nuance or be able to apply it uniform across their organization.

12:23.800 --> 12:28.320
Now, this is something we're going to talk about later, but I want you to keep it in mind.

12:28.540 --> 12:36.280
Remember, even though it's a cloud customer vulnerability, there's incentives that lead to them being created in the first place.

12:36.700 --> 12:39.900
So let's talk about the traditional security mindset.

12:40.740 --> 12:45.280
Traditional bugs discovery is often centered around a specific target.

12:45.280 --> 12:49.140
You know, if I'm looking for vulnerabilities, I might go reverse engineering an application.

12:49.340 --> 13:01.840
And with dangling domains, one of the earliest approaches was going first, enumerating the subdomains of my target, and then enumerating the cloud provider IP pools in order to identify dangling resources.

13:02.020 --> 13:09.620
Now for secrets, again, we start with a specific target, whether that be a single repository or a single platform like GitHub.

13:10.220 --> 13:18.500
And what I really started to think about as I looked into this further and further was whether there's an opportunity for some vulnerabilities to be approached differently.

13:18.740 --> 13:22.660
For example, were we really facing tunnel vision here?

13:22.660 --> 13:25.900
Why do we need to start with a specific target?

13:26.320 --> 13:34.760
It's almost as if, you know, there is a lack of focus in the industry against finding bugs at scale, and rather finding bugs in individual areas.

13:34.760 --> 13:40.860
And that's what I really wanted to focus on with this research is, can we find these vulnerabilities at scale?

13:41.600 --> 13:49.220
So to expand on this with dangling resources, the traditional mindset might include, start with a target and then capture vulnerable assets.

13:49.220 --> 13:53.960
But as we've seen with past work, it can often be a lot larger than that, too.

13:53.960 --> 14:05.920
For example, the security at scale approach to dangling domains would be to capture dangling assets first, and then check if there's any DNS records still pointing at them using passive DNS replication data.

14:06.080 --> 14:08.680
Now here's where it gets interesting.

14:08.680 --> 14:11.440
For leaked secrets, there's no such equivalent.

14:12.000 --> 14:23.780
You know, we have approaches to scan limited scopes for these secret patterns, but when it comes to that security at scale mindset, it still goes around a very limited target.

14:23.780 --> 14:33.260
You know, we start with a repository, a folder, a file, instead of starting with a diverse data source that allows us to look for these secrets in a broad manner.

14:37.380 --> 14:46.680
So this is what I really want you to take away from this talk from a high level, is that there's an untapped potential to use unconventional data sources to find these vulnerabilities.

14:46.980 --> 14:59.580
We're about to go through some examples, but what I really want you to think about is not just, you know, here's how Bill applied it to dangling domains and leaked secrets, but rather how you can apply it to other types of vulnerability classes as well.

14:59.600 --> 15:02.480
This is not just about these two vulnerability classes.

15:02.480 --> 15:06.460
These two vulnerability classes are examples that you can apply to your own work.

15:08.240 --> 15:11.840
So let's talk about how we would actually implement this in practice.

15:12.200 --> 15:16.220
From a high level, we start with the vulnerability, not the target.

15:16.500 --> 15:19.980
So and then we work backwards by using creative data sources.

15:20.320 --> 15:23.860
Remember, for dangling resources, we already have a playbook.

15:23.860 --> 15:31.000
You can, you know a dang, a DNS record is dangling if it points at an IP address that the customer no longer controls.

15:31.080 --> 15:34.760
How do you know if an IP is no longer controlled by a customer?

15:34.760 --> 15:45.020
Well, we can enumerate the cloud IP pool and determine every IP that we get in our attacker account is likely something that no other customer controls because that IP is assigned to us.

15:45.020 --> 15:46.880
But how do we know if it's dangling?

15:46.880 --> 15:49.680
Well again, that passive DNS replication data.

15:49.680 --> 15:59.960
And if you're not familiar with this, how it works is that threat intelligence providers from DNS, will work with DNS providers to sell this aggregate DNS traffic data.

15:59.960 --> 16:07.620
For example, you can give these threat intel providers an IP address and they'll give you every single DNS record that points at it.

16:09.500 --> 16:15.420
Now again, we can capture assets first with DNS records instead of starting with a target.

16:15.420 --> 16:24.680
What we'll do is we'll go through a cloud provider pool and we'll go and enumerate every IP address that we're able to get and look for DNS records that point at it.

16:24.760 --> 16:32.180
What we're going to do in the next section is apply this generic technique we've seen in past work against modern deterrence.

16:33.660 --> 16:35.500
But what about secret scanning?

16:35.500 --> 16:36.600
So this is the interesting one.

16:36.600 --> 16:40.600
This is one that we still have a lot of research to do in.

16:40.680 --> 16:44.820
We have passive DNS replication data for dangling resources.

16:45.180 --> 16:46.660
But what about leaked secrets?

16:46.920 --> 17:03.720
From a high level, the ideal data source needs to be diverse, needs to be sufficient in volume, and it needs to include a diverse set of websites, executables, you know, not just open source applications, but we need to include closed source applications too.

17:04.160 --> 17:07.400
And we need to make sure that this is done in a feasible way.

17:07.400 --> 17:15.040
For example, even if we have a large data set of these files, we need to make sure we can scan it in a practical manner.

17:15.680 --> 17:19.240
So where can we find this large collection of apps and scripts?

17:20.080 --> 17:23.840
So what about virus scanning platforms?

17:24.900 --> 17:27.440
This is where it's going to get really interesting.

17:27.500 --> 17:34.820
So what we've seen with past work is a lot of people focusing on these platforms with limited diversity.

17:35.360 --> 17:42.420
You know, we look at GitHub, it's really going to only be open source repositories that are being scanned and automatically revoking keys.

17:42.560 --> 17:49.760
You know, we look at these tools, they all focus on scanning individual targets, like folders, specific repos, etc.

17:49.940 --> 17:52.660
But what we're missing is that diverse data source.

17:52.660 --> 17:55.400
And that's what I really focused on in this research.

17:55.420 --> 18:00.680
What I found was that virus scanning platforms were actually a really interesting target.

18:00.680 --> 18:05.860
Because think about it, think about all the stuff that people upload to virus scanning platforms.

18:06.160 --> 18:16.900
You know, think about all the websites that are automatically scanned, all the applications, all the mobile apps that are included in this virus total data source, and as well as other platforms.

18:17.780 --> 18:27.840
Now, with these scanning platforms, it'd be infeasible to go ahead and, you know, download what, a billion, nine billion files, and each scan each of them individually.

18:27.840 --> 18:32.340
But we don't need to do that, because we can use the tools that they already provide us.

18:32.360 --> 18:42.720
Nearly every virus scanning platform lets you search for specific patterns, specific strings, like they're literally spoon feeding us the perfect data source here.

18:42.720 --> 18:48.580
And traditionally, what we've used this data source for is to find malware, you know, find malicious use, etc.

18:48.580 --> 18:55.240
But what's really interesting about them is that, what if we use secret patterns instead of malicious patterns?

18:55.240 --> 18:58.740
What if instead of looking for malware, we look for secrets instead?

18:59.860 --> 19:11.100
And with virus total, this is retro hunt, but seriously, if you look at nearly every other virus scanning platform, what you'll find is that they have a similar future, um, at least if you have an account.

19:12.200 --> 19:14.440
So, let's apply this in practice.

19:17.290 --> 19:20.730
So with secret split scanning, the plan is from a high level.

19:20.730 --> 19:28.310
We want to make sure that we look for secret patterns, and what that really means is, think about your AWS access key.

19:28.310 --> 19:32.170
I don't know if you've noticed, but it'll often start with A-K-I-A.

19:32.170 --> 19:42.550
And what we can do is we can create these regex strings for identifying these secrets, and we can look for them using the same tools we have available for malware hunting.

19:42.710 --> 19:46.710
So, most virus platforms allow you to search by a Yara rule.

19:46.730 --> 19:57.310
And so what we can do is we can create a Yara rule for these secret patterns, and then we can search samples uploaded to the platform for whether these patterns exist in them.

19:57.450 --> 20:02.690
Now, one thing interesting that I did in this research was also focused on validating these secrets.

20:02.690 --> 20:16.450
So, I've looked at a lot of past work into leaked secrets, and what I've found is, there's a lot of theoretical research that discusses things like, oh, we looked for these secret patterns, and, you know, we found these unique keys, but you read into it a little deeper,

20:16.450 --> 20:18.850
and they didn't even check if those keys are legitimate.

20:19.070 --> 20:21.370
And that's something that didn't really make sense to me.

20:21.370 --> 20:28.750
There's going to be thousands and thousands and tens of thousands of keys that match a specific pattern, but are not active in practice.

20:28.930 --> 20:39.070
And so what we did was that I used a platform to actually validate these keys, at least with basic metadata, and validate that they're legitimate for our use case.

20:39.270 --> 20:52.950
Now, some patterns are going to be really noisy, but if the provider doesn't make it easy to identify their secrets, you're going to find that you're going to have to scan thousands and thousands of secret patterns and thousands of thousands of files.

20:53.110 --> 20:55.850
So, how do we deal with this large volume?

20:55.870 --> 21:02.290
Well, what I did to do it on my budget, remember, I'm doing this everything out of pocket, was leverage serverless computing.

21:02.370 --> 21:11.530
So, I needed a capacity of having several physical server racks, but I don't have money to buy several physical server racks.

21:11.530 --> 21:24.490
Instead, I can rent them using the cloud, and what that really means is I made a serverless function in order to scan these files, and I also made a serverless function to validate the keys that were found.

21:24.690 --> 21:29.830
And this way, I don't actually have to pay that much, because I only pay for what I use.

21:29.830 --> 21:34.090
In practice, my costs were actually fairly reasonable for an individual.

21:35.230 --> 21:46.750
Now, for dangling resources, again, the methodology from a high level was to reallocate resources over and over and over again, and then it was to cross check them with passive DNS replication data.

21:46.850 --> 21:55.810
Remember, this isn't necessarily new, but what's interesting about them is that we're going to be talking about bypassing modern deterrents.

21:55.810 --> 22:05.550
And what I mean by that is a lot of cloud providers have implemented these mitigations to make it harder to do this dangling DNS record enumeration, and we're going to bypass them.

22:06.910 --> 22:11.690
So, from a high level, one thing I want to call out is that earlier note.

22:11.690 --> 22:20.950
Remember, it would appear that AWS began serving Elastic IPs from a small, specific pool similar to GCP.

22:21.110 --> 22:24.870
This severely limits the diversity of addresses received.

22:25.010 --> 22:27.810
And so, let me tell you what this really means in practice.

22:28.110 --> 22:53.750
So, what's going on here is that AWS and GCP have a mitigation where when you are asked to assign me an IP address, whether that be an Elastic IP or in GCP case, nearly every resource that you can go ahead and allocate that needs an IP, these cloud providers will only give you a specific set of IPs assigned to a shared pool that's limited to your account and maybe a few others.

22:54.410 --> 22:58.670
And for AWS, this is going to be largely Elastic IP sharing.

22:58.730 --> 23:08.450
So, that means whenever you ask for a dedicated Elastic IP, you'll notice if you free an Elastic IP and allocate another one, you're going to be assigned the same one over and over again.

23:08.450 --> 23:09.610
Or in general.

23:09.610 --> 23:13.390
It's really hard to actually enumerate that pool using Elastic IPs alone.

23:14.370 --> 23:29.890
Now, with AWS, they also introduced a mitigation, I don't know if intentionally to go against dangling DNS enumeration, but they did introduce a mitigation in 2024 where every IP address you received was actually had an increased surcharge .

23:29.890 --> 23:33.350
So, now every IP you got allocated cost you extra money.

23:33.350 --> 23:41.030
And this deters attacks by making it more expensive to enumerate their public IP pools and capture these dangling DNS records .

23:42.950 --> 23:45.530
Now for Google Cloud, it's interesting.

23:45.530 --> 23:48.070
They actually had quite a lot more than I expected.

23:48.130 --> 23:55.310
So, for project levels, so every account can have about 15, 10 to 15 projects assigned to them by default.

23:55.310 --> 23:57.810
You can request an increase, but you need justification.

23:58.170 --> 24:01.890
Now, IPs are again assigned from a small pool just like AWS.

24:02.210 --> 24:07.030
You only have 8 IPs you can use by default in per region and globally.

24:07.670 --> 24:12.230
And with these accounts, you also had something called a billing account restriction.

24:12.330 --> 24:17.330
So, with Google Cloud, every credit card can be created into a billing account.

24:17.330 --> 24:31.790
Now, you can create a few billing accounts based off of one credit card, but if you try to create more than a few, you'll automatically hit their suspension and you'll have to go justify why are you creating a 50th, you know, credit card account or billing account with one credit card.

24:32.030 --> 24:38.170
And so, all these deterrents really make it difficult for attackers to enumerate these dangling domains.

24:38.250 --> 24:53.070
In fact, with Google Cloud, while managed DNS enumeration was always a thing and has been for the past few years, attackers haven't been able to enumerate Google Cloud's public IP pools for quite some time, at least none researched that I could find online.

24:54.810 --> 24:58.950
So, with those AWS mitigations, they're actually pretty simple to bypass.

24:59.070 --> 25:09.590
Instead of allocating elastic IPs, we can just restart EC2 instances with ephemeral IPs and we can perform the enumeration by just restarting, restarting, restarting.

25:09.590 --> 25:20.630
And my IP address that my EC2 instance is assigned will generally rotate a lot faster through unique IPs than if you tried with elastic IPs.

25:20.630 --> 25:29.670
In fact, um, I actually was able to enumerate nearly 2.4 million unique IP addresses in a span of 6 months by using this methodology.

25:29.870 --> 25:37.830
Now, with Google Cloud, again, they had a harder set of mitigations, but they, those mitigations were deterrents.

25:37.970 --> 25:45.490
So, how it worked was that I used a backend bucket with a load balancer in order to assign IP addresses to my resources.

25:45.490 --> 25:49.490
But this still didn't let me get past these cloud resource restrictions.

25:49.490 --> 25:50.850
How do we do that?

25:50.950 --> 25:57.030
Well, once we have this primitive for enumerating cloud IPs, we can talk about those limitations.

25:57.030 --> 26:04.650
But for high level information, we used forwarding rules instead of virtual machines in order to enumerate these IPs.

26:05.870 --> 26:09.130
So, with Google Cloud, remember all those restrictions?

26:09.130 --> 26:12.190
Well, we can actually bypass all of them fairly cheaply.

26:12.830 --> 26:19.430
So, number one, with a billing account, one interesting thing I found was that you can assign billing accounts across Google accounts.

26:19.610 --> 26:25.930
This was a useful primitive where if I could create a billing account in one account, I can actually assign it across several accounts.

26:25.930 --> 26:29.550
And the reason this is interesting is, well, what about those quotas?

26:29.870 --> 26:34.010
Well, with account quotas, remember you can only create a certain amount of projects.

26:34.010 --> 26:39.010
Now, again, you can request an increase in this limit, but you don't want to have to do this justification.

26:39.050 --> 26:43.250
I felt that it would be inappropriate to assume that an attacker would be able to get this quota increase.

26:43.390 --> 26:46.910
What I found was, though, you can create a Google Workspace environment.

26:46.910 --> 27:00.230
So, what that means is I can create a fakebusiness.com, I can create Google Workspace environment for it, and I can create practically as many Google accounts as I want for about $6 per account per month.

27:00.230 --> 27:09.310
And this way, each of those accounts gets a dedicated quota limit and allows you to bypass these quota limits by creating, for example, 10 accounts.

27:09.310 --> 27:13.710
Now that's $60, but now your quota has been 10-timed.

27:13.710 --> 27:22.330
And finally, to bypass billing account restrictions, remember those credit card restrictions, billing accounts can only be associated with a certain number of projects.

27:22.330 --> 27:25.490
Well, we can instead then use virtual credit cards.

27:25.490 --> 27:27.110
And I use privacy.com.

27:27.110 --> 27:30.930
That's not a recommendation, it's just one of the easiest that worked for me.

27:30.990 --> 27:47.690
And what really this means is, it's not like they're bypassing KYC practices, they verified my identity, but it still allows me to create as many credit card numbers as I want and be able to create as many billing accounts as I want to be able to bypass every single restriction we discussed with Google Cloud.

27:48.050 --> 28:06.790
And so this is what I really want to mention from a high level, is Google Cloud implemented all these deterrents to try to make sure you can't enumerate their dangling IPs, but in practice, these deterrents weren't addressing the root cause, which was the fact that the dangling IPs still existed in the first place.

28:10.980 --> 28:18.380
So let's talk about a little bit of the discovery process and what I was able to find with these techniques.

28:19.640 --> 28:26.960
So with dangling resources, I was able to enumerate over 2 million IP addresses for Google Cloud and AWS.

28:27.020 --> 28:31.520
These are unique IP addresses and they're mostly primitive resources.

28:31.600 --> 28:40.100
So these IPs were created by, remember, restarting an EC2 instance or creating forwarding rules over and over again.

28:40.260 --> 28:50.160
As far as I'm aware, this is one of the first methodologies to successfully bypass every single Google Cloud deterrent that is intended to stop this type of attack in the first place.

28:50.320 --> 28:55.480
I captured over 60,000 unique fully qualified domain names.

28:55.740 --> 29:06.880
And this reflects past research into this area where researchers found that these FQDNs, there are a lot of different A records that pointed at IPs that were no longer being controlled.

29:07.380 --> 29:13.840
Now out of these 60,000 FQDNs, there are about 54,000 unique second level domains.

29:13.840 --> 29:23.420
And what that really means is that once you take away the subdomain, let's say A.B.com, we're just focusing on the unique number of Apex or second level domains.

29:23.500 --> 29:26.080
Well, that was over 54,000.

29:26.560 --> 29:35.520
And finally, one of- over 5,000 of the domains that I was able to capture included- were included in the Tranco top 1 million list.

29:35.520 --> 29:49.120
So Tranco is a listing of every domain that they're aware of within a certain ranking and it allows you to compare what- it's supposed to be an objective metric for a ranking of a domain based on DNS data.

29:49.260 --> 30:02.600
Now, there are a lot of Fortune 500 companies impacted and what I found really interesting was that with AWS, we had a roughly 25- a rate of 25 dangling domains per 1,000 IPs.

30:02.600 --> 30:06.400
But with Google Cloud, it was nearly 36.

30:06.500 --> 30:15.700
And so what I suspect this discrepancy is as a result of is that Google Cloud hasn't been able to be enumerated for quite a few years.

30:17.620 --> 30:25.720
Now, this talk isn't going to focus on the actual impact against customers because I promised DEF CON review board I wouldn't get stuck on it.

30:25.720 --> 30:40.780
But you can see that I was able to compromise some of the world's largest organizations including the Western District Court of Texas, um, the New York Times, uh, the California- State Government of California, and Dior.

30:41.020 --> 30:43.460
And, um, yeah, it was a pretty fun time.

30:43.460 --> 30:44.920
There was a lot more examples here.

30:44.920 --> 30:47.240
Again, this isn't intended to cover it.

30:47.240 --> 30:49.700
That's, uh, on a separate blog post as well.

30:49.700 --> 30:51.740
I really go into detail about the impact.

30:52.220 --> 31:03.400
And for a secret scanning, again, what was really interesting was that I scanned over 5 million unique files for- from various platforms , not just VirusTotal, that was just one of them.

31:03.400 --> 31:07.460
Um, and I discovered over 15,000 validated secrets.

31:07.460 --> 31:26.480
And out of these secrets, they included over 2,500 unique, again, validated, these aren't just, you know, may match a pattern, these are validated, to over 2,500 validated secrets, over 2,400 unique AWS keys, over 2,200 GitHub personal access tokens and fine-grain tokens,

31:26.480 --> 31:39.260
over 600 Google's cloud service accounts, over 460 Stripe accounts, and the rest are largely from miscellaneous providers added up together that I didn't feel the need to include in this slide.

31:40.560 --> 31:40.700
And,

31:47.830 --> 31:56.930
and again, there will be a blog to recap this, but from a high level, it's some of the largest organizations in the world were impacted.

31:56.950 --> 32:06.610
You know, just a fun example a few months ago was Slack, Stanford's entire Slack workspace, um, Samsung's workspace for Bixby.

32:06.610 --> 32:20.370
I was able to get a bot token for this Samsung Bixby tenant and, which allowed me to read messages from nearly every channel, every single channel that the bot had access to because of a default scope that was quite broad.

32:20.370 --> 32:35.190
You know, some other interesting things included the Supreme Court of Nebraska, that was a fun one, where they uploaded a password list to VirusTotal with like 300 credentials from different, like, I don't know, different AWS providers, different cloud providers,

32:35.190 --> 32:37.230
their security solutions, et cetera.

32:37.230 --> 32:38.750
That was a really fun one.

32:38.870 --> 32:44.690
Um, you know, there are database backups with a lot of these AWS keys that had broad access to S3 buckets.

32:44.730 --> 32:48.630
Anyways, you'll be able to read a lot more about this this following week.

32:49.210 --> 32:57.330
So by leveraging a security at scale mindset, we can help protect thousands of organizations far beyond a limited scope.

32:57.710 --> 33:08.610
Remember, instead of starting with a specific target, by starting with a diverse dataset, we were able to have a much wider impact than any of past work into leaked secrets.

33:08.890 --> 33:16.790
You can read more about some of this impact in an, in an article that should be released right now, uh, by Matt Burgess from Wired.

33:16.790 --> 33:25.690
And I'll be releasing a detailed technical blog later this week once I figure out whether a certain cloud provider can actually revoke some of these keys or not.

33:27.250 --> 33:29.730
So, bringing it all together.

33:32.530 --> 33:36.130
Hardcoding, hardcoding secrets is the path of least resistance.

33:36.130 --> 33:43.530
So remember, these are customer vulnerabilities, but what enables them is these bad incentives.

33:43.990 --> 33:53.850
Think about it, think about how easy it is to go ahead and generate an AWS access key or generate a Google Cloud service account and then put that into your executable directly.

33:53.850 --> 34:00.270
You know, the libraries for these different providers allow this direct interface in the first place.

34:01.130 --> 34:07.110
Now, the reason this is really important is because a lot of developers are going to follow the path of least resistance.

34:07.570 --> 34:10.630
Especially from smaller to mid-cap businesses.

34:11.190 --> 34:14.630
And with dangling DNS records, the same problem exists.

34:14.730 --> 34:16.870
It's the path of least resistance.

34:16.970 --> 34:28.850
I created an AWS EC2 instance, I put my DNS record pointing at that AWS EC2 instance, and the path of least resistance is leaving that DNS record even if I deallocate it.

34:29.250 --> 34:35.950
And what I think we need to really focus on is making sure that the path of least resistance is the secure path.

34:36.070 --> 34:44.930
And what this really means is with dangling resources, I think we need to have better ownership of cloud resources and DNS records.

34:44.930 --> 34:46.570
Better association.

34:46.790 --> 34:55.510
So for example, some cloud providers have tried to associate their DNS services with their EC2 resources as one example.

34:55.670 --> 35:01.770
Um, and the problem with this is a lot of different customers are going to use different DNS providers, different cloud providers.

35:01.770 --> 35:09.890
What we really need is an industry wide solution of tracking DNS records and tracking cloud resources and putting them together.

35:12.580 --> 35:22.120
Now, for hard coded secrets, what I really think we need to focus on is making sure that it's hard to include secrets in your code.

35:22.120 --> 35:27.980
So don't have short access tokens that your library just blindly accepts from a string .

35:30.530 --> 35:32.670
But instead, for-

35:47.290 --> 35:50.010
alright, thank you for that.

35:50.010 --> 35:51.830
That was a nice wake up call.

35:51.990 --> 35:54.430
Um, alright.

35:54.430 --> 36:05.750
Uh, anyways, so yeah, with these hard coded secrets, what I really think we need to do is make sure to limit the secrets so that they can only be inserted from an environment or from a file on disk.

36:05.750 --> 36:10.110
And make it hard to hard code these secrets inside of an executable in the first place.

36:10.110 --> 36:15.470
Now again, you can have exceptions, you know, you can have it so a customer can opt out from the secure default.

36:15.710 --> 36:19.990
But we need to make sure that the secret default is secure.

36:21.670 --> 36:25.070
So what about remediating these vulnerabilities?

36:25.550 --> 36:35.410
Well, remember, for dangling records at a high level, it's going to be hard to contact every single host of every 60,000 dangling domain that I was able to discover.

36:35.430 --> 36:39.310
What we really need is a way to tie ownership to DNS records.

36:39.310 --> 36:43.710
And we need to do this across the industry because of that multi-cloud approach.

36:45.370 --> 36:49.590
Now for secrets, this is where it gets really interesting.

36:49.590 --> 37:00.910
So I went ahead and asked a bunch of organizations that I found secrets for, including GitHub, including AWS, including OpenAI, whether I could report secrets to them and they could revoke them automatically.

37:00.950 --> 37:05.710
Now GitHub has that program for scanning secrets on their platform already.

37:05.710 --> 37:14.910
Remember, if you actually go ahead and post a, for example, OpenAI access key on a public repository, that access key will be revoked within a few minutes.

37:15.430 --> 37:20.150
And what I was curious was, hey GitHub, can I please use this mechanism you already have?

37:20.150 --> 37:22.370
Well, unfortunately they said no.

37:22.670 --> 37:38.070
And in fact, several providers said no, like AWS, despite the fact that they already had given this mechanism to GitHub and despite the fact that an attacker could access the mechanism by posting a public git or public commit.

37:38.130 --> 37:49.290
Now one exception to this was OpenAI, who immediately responded with an endpoint for reporting these keys and allowed me to automatically revoke the keys that I discovered in the wild.

37:49.590 --> 37:51.790
But what do we do about everyone else?

37:52.230 --> 37:59.490
So the problem with these secret keys is that the impact is far, far, far greater than dangling DNS records.

37:59.490 --> 38:04.810
In fact, we just saw some of the world's largest organizations and there were several more impacted.

38:04.950 --> 38:12.150
I didn't feel comfortable releasing this work without at least some stopgap until these cloud providers could take the secure default.

38:12.630 --> 38:24.730
So what I actually did was I developed a mechanism that used GitHub's mechanism anyway for revoking these secrets, because they said no, but I don't care.

38:25.410 --> 38:33.510
But yeah, so what I did was I have this system now where whenever new secrets are discovered, I'll go ahead and create a gist.

38:33.510 --> 38:43.210
And the way I create this gist is by automating the entire GitHub login process and then just using a UI endpoint for creating a public gist.

38:43.210 --> 38:50.010
And this way it'll actually trigger the GitHub secret scanning mechanism that they could have given me direct access to anyway.

38:50.010 --> 38:51.690
So yeah, anyways.

38:56.900 --> 39:04.740
Now what's really cool about this is that every, almost every secret that you saw listed in the previous section, a lot of them are going to be revoked.

39:04.880 --> 39:06.860
There's an exception to that though.

39:06.860 --> 39:10.560
One of the largest providers which did have leaked secrets was AWS.

39:10.580 --> 39:13.400
Now AWS takes an interesting approach.

39:13.400 --> 39:26.000
When you post your AWS access key on a public GitHub commit or post, what they do is that they'll create a support case for you and restrict write access using that key.

39:26.000 --> 39:27.160
I found that kind of interesting.

39:27.160 --> 39:34.860
So what's really happening is AWS is aware of these secret keys, but they're choosing not to revoke them for some reason.

39:35.320 --> 39:37.340
Yeah, that's an interesting one.

39:37.340 --> 39:49.260
So effectively if you find a leaked AWS access key on GitHub, you can still use that key to read S3 buckets, read RDS database data, to read download files from S3.

39:49.260 --> 40:00.580
You know, I remember I looked at a AWS key last weekend for a casino that was alleged to deal with over $1 billion of bets a month.

40:00.620 --> 40:03.260
And I was like, okay, wait a minute, was this reported?

40:03.260 --> 40:04.720
We should get this revoked.

40:04.720 --> 40:09.160
But in reality what happened was AWS created this support case.

40:09.160 --> 40:15.320
The customer never saw it because the support email was sent to their generic billing account.

40:15.320 --> 40:22.040
You know, a lot of people, a lot of enterprises set up an AWS account and use a generic billing email that no one really looks at.

40:22.040 --> 40:25.860
And so the support case was ignored and this key is still active today.

40:25.880 --> 40:30.060
You know, it's disappointing because I don't know what more I can do for my shoes.

40:30.060 --> 40:38.040
You know, I've created a mechanism that can help automatically revoke most of these keys, but what do we do about keys that the provider doesn't take action on?

40:38.220 --> 40:50.640
And so this is where I really think providers need to switch up is, number one, if someone's secret key, you have both components, is on the internet and you know about it, you need to revoke that immediately.

40:51.180 --> 40:57.280
I mean, it's crazy to me to think that even on GitHub, if you post your AWS access key, that's not going to be automatically revoked.

40:57.280 --> 41:00.240
Every other provider I looked at does automatically revoke.

41:00.240 --> 41:03.880
Google Cloud revokes, Slack revokes, OpenAI revokes.

41:03.900 --> 41:07.240
The largest cloud provider by market share does not revoke.

41:10.340 --> 41:19.320
Now, if you're interested in starting this sort of research yourself, what I'd focus on is breaking down the traditional methods of finding vulnerabilities.

41:19.320 --> 41:26.300
So with dangling domains, that was checking if the DNS record is actually pointing at a uncaptured IP address.

41:26.560 --> 41:32.940
And with secrets, it was trying to find those secret patterns in a diverse data source.

41:32.940 --> 41:42.680
So in this case, we used virus scanning platforms, but you can use a similar methodology against a lot , a larger set of vulnerability classes.

41:43.180 --> 41:49.680
And what you really want to do is correlate those steps with these large data sets, regardless of their intended usage.

41:51.020 --> 41:53.220
Thank you so much for coming out to this talk.

41:53.380 --> 41:54.700
What a fun time.

42:00.780 --> 42:03.060
We do have a few minutes for questions.

42:05.220 --> 42:07.380
Oh, we apparently don't have microphones.

42:08.260 --> 42:10.560
All right, yeah.

42:10.560 --> 42:14.460
If you have questions, feel free to come up and we can have a chat over on stage.

42:14.460 --> 42:16.420
Thank you so much for coming out to this talk.

42:16.420 --> 42:17.420
What a fun time.

42:17.420 --> 42:21.280
And yeah, I look forward to working with these providers to address these vulnerabilities.

