start	end	text
5970	11510	Alright everyone, thank you so much for coming out to this talk. It's called Secrets and Shadows,
11510	17230	Leveraging Big Data for Vulnerability Discovery at Scale. I'm so excited to be here for another year
17230	23730	at another DEF CON, and I really do have something in store for you today. Let's get right into it.
26700	32420	So, just a disclaimer, everything we're going to talk about today was done completely independent of
32420	39880	my employer, outside of work, with my own money, my own resources. If you want to talk about this work
39880	44560	outside of this presentation, just please refer to me as an independent security researcher.
44560	48020	It helps me be able to do work just like this.
51330	58130	So, my name is Bill Demerkappa, and I'm a security researcher with a diverse background in low-level
58130	61650	software security, and also cloud security.
65610	73090	I'm interested in defense and offense. I love solving hard security problems, and while I did start with a
73090	79570	software security background, I feel like the impact we can have with cloud security is much wider.
79570	84890	For example, you could have the most complex software vulnerability in the world, but at the end of the day,
85030	92010	a simple missing ID check in a cloud environment can lead to a much broader impact.
92010	98510	And that's what really got me interested in the cloud. It's the ability to have an impact without the same
98510	103230	technical complexity that comes with exploiting low-level vulnerabilities.
105270	111350	So, in this talk, we're going to discuss vulnerability discovery at scale.
111350	116570	And what I mean by that is, we're going to take a look at how we traditionally approach vulnerability discovery
116570	122950	with two common bug classes, dangling cloud resources and leaked secrets.
122950	129890	The goal is to identify the limitations of our historical approach and shift our perspective through some
129890	136700	practical examples. So, some background.
138500	144740	Now, from a high level, everyone knows what cloud computing is. It's basically a way where you can create
144740	151040	infrastructure, like servers, websites, and more, without needing to actually purchase your own physical
151040	157980	server rack. The cool part is, this can save you a lot of money. If you're just creating your own blog,
157980	163480	you really don't need that many resources at all. Why not borrow someone else's?
163480	169620	And that's really the fundamental principle of cloud computing. All you're doing is borrowing from someone
169620	179900	else's pool of shared resources. So, cloud environments are managed over the Internet.
179900	186820	But how do we actually secure this access? Well, for AWS, the way it works is that you can use something
186820	193800	called an access key. An access key can be short-lived or a long-term token that specifies credentials
193800	199640	for your account and allows you to manage your AWS resources, depending on the role and permissions
199640	205280	assigned to you. Can we please increase the microphone sound?
205900	213000	And for other platforms, it's similar. For example, for Google Cloud, the types of authentication include
213000	221060	service accounts, you can use CLI credentials, and in general, tokens are how we're able to operate with
221060	227600	these cloud environments. Unfortunately, tokens also present a pretty severe risk.
229380	235860	So, cloud provider tokens are dangerous because, by default, little restriction, there's little restriction
235860	244080	on who can use those tokens. For example, by default, if you create a root access key in AWS, anyone from
244080	251180	any IP can use that access key to manage your cloud environment. Now, obviously, the impact of a leaked
251180	257940	cloud credential will really depend on the context. For example, a lot of websites hard-code a Google Maps
257940	265400	API key, and in reality, despite the fact that it can lead to billing overcharges and abuse, the impact is
265400	274380	still fairly limited. But with a root AWS key, the dangers are much more problematic. For example, if you
274380	281300	stored your database in AWS, or you store your computing in AWS, an attacker could use your credentials
281300	290400	to not only access customer data, but to interfere with your production workflows. Now, when we talk
290400	297660	about how everything in the cloud is shared and borrowed, what I mean by that is, by nature, by its nature,
297660	304840	the cloud model introduces risk from this sharing model. So, for example, when you create a virtual machine,
304840	310800	what's really happening is you're borrowing time on a physical server that your cloud provider has bought.
311100	318400	And on this physical resource, you get assigned a network IP, for example. And the reason this is dangerous
318400	325780	is because once you're done with a resource, if you still have dangling DNS records pointing at that resource,
325780	333400	suddenly that exposes an opportunity for an attacker to take advantage of. So, from a high level, I view
333400	340060	cloud resources in two categories. Primitive resources and shared resources. So, a primitive resource is
340060	346400	something like a virtual machine where you get assigned a dedicated IP address. That IP address is not used by any
346400	352780	other customer but you. Whereas with a shared resource, what's really going on is it's a serverless application
353320	359500	that serves multiple customers. For example, if you have a serverless function that you can call on your
359500	366280	cloud provider, that URL you use to connect to that serverless function probably corresponds to an IP that
366280	373400	serves a lot of other customers. The reason this distinction is important is because it impacts what type of
373400	379040	dangling DNS records you need to worry about. So, for primitive resources where you have that unique IP
379040	385340	address, that includes pretty much every type of DNS record that could be dangling, like an A record, a C name
385340	391320	record, a name server, and et cetera. But whereas if it's a shared resource where the endpoint is shared
391320	398280	across customers, that's gonna be limited to C names, name server, MX, those types of records. And the
398280	404100	distinction there is that when the endpoint is shared, suddenly you don't have to worry about the A record
404100	411520	pointing at an IP address you no longer control. So, what can an attacker do with that domain control?
411660	416860	Well, from a high level it can enable phishing, malware distribution, scams, et cetera. It can lead to
416860	423240	cross-site scripting. Uh, and there's going to be context specific impact, like you can bypass the
423240	428200	trusted host names check in a software update installer, that's something I've seen pretty common.
428200	436040	You can abuse the brand trust and reputation in order to spread misinformation. Now, I included a
436040	443760	quote below from APNIC on an article talking about this potential abuse. So, from a high level, they
443760	450600	found that when it came to dangling DNS record abuse, um, in general, 75% of the hijacked dangling
450600	457560	resources were being used to, for black hat se- search engine optimization and really promoting bad
457560	468600	websites you don't want anyone going to. So, to be clear, past approaches for these types of bugs
468600	476060	already exist. Where, with dangling cloud resources, you know, we've seen that attackers can go
476060	481780	ahead and enumerate cloud IP pools and capture these resources that are dangling. But, with
481780	488700	leaked secrets, what we've seen is that a lot of work really relies on a limited scope. So, what I
488700	494880	mean by that is, everything that happens with leaked secrets is always about a specific target.
494880	503380	Like a specific folder, a specific repository, or a specific directory. And the problem with this is,
503380	509820	to start with dangling resources, some past work includes, you can buy DNS data and then enumerate
509820	516820	your cloud provider's IP pool in order to find what's dangling. So, if I go ahead and create a
516820	521740	resource over and over again in a cloud environment, I'll be assigned IP addresses that are
521740	528360	not assigned to any other customer. And if one of these IP addresses matches a DNS record that I've
528360	534740	found in DNS data that threat intelligence providers sell, well, that's one way you can capture a
534740	542260	dangling DNS record. And other attempts also include going after a specific target. So, instead
542260	546840	of using DNS data you buy from threat intelligence providers, you'll instead go ahead and
546840	551440	enumerate that provider pool, but this time compare against sub-domains you've enumerated for
551440	559480	that specific provider. So, to give you some examples, there's been a lot of work in this area.
559480	565720	Bishop Fox originally came out in 2015 with an article where they used this passive DNS data, or at
565720	573000	least a variant of it, in order to enumerate an AWS cloud IP pool and then capture AWS IPs that
573000	577500	corresponded to a specific domain they were interested in. So, in that case they used
577500	586320	bing.com to find those dangling DNS records. Some other work includes flying a false flag from
586320	590840	Black Hat, it's a talk, where they used passive DNS data from these threat intelligence
590840	598300	providers to determine whether IPs they captured were dangling. So, this project was again
598300	604160	focused on creating these backends for C2 malware platforms. They wanted to take control of
604160	610860	legitimate domains so that they could abuse those domains for a false level of trust. And one
610860	615700	interesting note about this project is that they noted that after releasing it, it would appear
615700	622280	that AWS and GCP now assign IPs from a limited pool for your account. We'll touch on this more
622280	627500	later, but this is what we're going to be focusing on when it comes to dangling DNS resources. The
627500	632220	topic is well traversed, but what's not well traversed are the modern deterrents against it and
632220	638540	how we can bypass them. And finally, there's still a lot of work where attackers simply
638540	645660	enumerate your domain subdomains and then find IPs that match them. Now when it comes to
645660	650800	leaked secrets, the story's a bit different. It's not as well traversed as dangling DNS
650800	657060	records at all. So for example, there's tools that you can use to search a Git repository for
657060	664000	these secret patterns. And even GitHub has a system where they'll scan every content, every
664000	670140	piece of code uploaded to their platform for these secret patterns. But the limitation with
670140	676240	this work is that it's really a, it's very small scope. I mean, think about how much code is
676240	680360	really going to end up on GitHub. You know, most enterprises aren't going to put their
680360	687880	closed source applications on GitHub where this scanning would occur in the first place. Now
688400	693200	going on to defender approaches to mitigate these vulnerabilities, well, they've been pretty
693200	698800	limited as well. Oftentimes these are treated as customer vulnerabilities, which technically
698800	704220	is correct. If you think about it from a high level, if you leak a secret or leave a DNS record
704220	710140	dangling, that is your responsibility. But what I think that is often missed is the provider's
710140	716380	responsibility and how they encourage these insecure defaults. So for example, tokens are
716380	722180	really, really easy to use. Have you ever thought about how easy it is to use a token in your
722180	728380	code? And that's how it can get leaked in the first place. Now Fortune 500 companies might have
728380	733680	those standard secure development lifecycle practices where they can avoid this. But in
733680	738620	reality, a lot of small to medium sized businesses might not understand this nuance or be able to
738620	746100	apply it uniform across their organization. Now, this is something we're going to talk about
746100	751480	later, but I want you to keep it in mind. Remember, even though it's a cloud customer
751480	757500	vulnerability, there's incentives that lead to them being created in the first place. So let's
757500	763460	talk about the traditional security mindset. Traditional bugs discovery is often centered
763460	767540	around a specific target. You know, if I'm looking for vulnerabilities, I might go reverse
767540	773260	engineering an application. And with dangling domains, one of the earliest approaches was going
773260	778460	first, enumerating the subdomains of my target, and then enumerating the cloud provider IP
778460	784400	pools in order to identify dangling resources. Now for secrets, again, we start with a specific
784400	791020	target, whether that be a single repository or a single platform like GitHub. And what I really
791020	795200	started to think about as I looked into this further and further was whether there's an
795200	800680	opportunity for some vulnerabilities to be approached differently. For example, were we
800680	807260	really facing tunnel vision here? Why do we need to start with a specific target? It's almost as
807260	811920	if, you know, there is a lack of focus in the industry against finding bugs at scale, and
811920	816820	rather finding bugs in individual areas. And that's what I really wanted to focus on with this
816820	823720	research is, can we find these vulnerabilities at scale? So to expand on this with dangling
823720	827860	resources, the traditional mindset might include, start with a target and then capture
827860	833300	vulnerable assets. But as we've seen with past work, it can often be a lot larger than that,
833300	837700	too. For example, the security at scale approach to dangling domains would be to capture
837700	843520	dangling assets first, and then check if there's any DNS records still pointing at them using
843520	850080	passive DNS replication data. Now here's where it gets interesting. For leaked secrets, there's
850080	855860	no such equivalent. You know, we have approaches to scan limited scopes for these secret
855860	862240	patterns, but when it comes to that security at scale mindset, it still goes around a very
862240	869340	limited target. You know, we start with a repository, a folder, a file, instead of starting with a
869340	878720	diverse data source that allows us to look for these secrets in a broad manner. So this is what
878720	882860	I really want you to take away from this talk from a high level, is that there's an untapped
882860	887960	potential to use unconventional data sources to find these vulnerabilities. We're about to go
887960	892240	through some examples, but what I really want you to think about is not just, you know, here's
892240	897140	how Bill applied it to dangling domains and leaked secrets, but rather how you can apply it to
897140	901640	other types of vulnerability classes as well. This is not just about these two vulnerability
901640	906460	classes. These two vulnerability classes are examples that you can apply to your own work.
908240	913560	So let's talk about how we would actually implement this in practice. From a high level, we
913560	918900	start with the vulnerability, not the target. So and then we work backwards by using creative
918900	924920	data sources. Remember, for dangling resources, we already have a playbook. You can, you know
925160	930120	a dang, a DNS record is dangling if it points at an IP address that the customer no longer
930120	935260	controls. How do you know if an IP is no longer controlled by a customer? Well, we can
935260	940480	enumerate the cloud IP pool and determine every IP that we get in our attacker account is
940480	945760	likely something that no other customer controls because that IP is assigned to us. But how do
945760	950320	we know if it's dangling? Well again, that passive DNS replication data. And if you're not
950320	954800	familiar with this, how it works is that threat intelligence providers from DNS, will work
954800	961720	with DNS providers to sell this aggregate DNS traffic data. For example, you can give these
961720	966920	threat intel providers an IP address and they'll give you every single DNS record that points at
966920	975420	it. Now again, we can capture assets first with DNS records instead of starting with a target.
975420	980720	What we'll do is we'll go through a cloud provider pool and we'll go and enumerate every IP
980720	985800	address that we're able to get and look for DNS records that point at it. What we're going to do
985800	991020	in the next section is apply this generic technique we've seen in past work against modern
991020	997640	deterrence. But what about secret scanning? So this is the interesting one. This is one that we
997640	1003840	still have a lot of research to do in. We have passive DNS replication data for dangling
1003840	1009740	resources. But what about leaked secrets? From a high level, the ideal data source needs to be
1009740	1017240	diverse, needs to be sufficient in volume, and it needs to include a diverse set of websites,
1017240	1022280	executables, you know, not just open source applications, but we need to include closed source
1022280	1028380	applications too. And we need to make sure that this is done in a feasible way. For example, even
1028380	1033720	if we have a large data set of these files, we need to make sure we can scan it in a
1033720	1041900	practical manner. So where can we find this large collection of apps and scripts? So what about
1041900	1049300	virus scanning platforms? This is where it's going to get really interesting. So what we've seen
1049300	1055540	with past work is a lot of people focusing on these platforms with limited diversity. You know,
1055540	1060000	we look at GitHub, it's really going to only be open source repositories that are being scanned
1060000	1065600	and automatically revoking keys. You know, we look at these tools, they all focus on scanning
1065600	1072220	individual targets, like folders, specific repos, etc. But what we're missing is that diverse data
1072220	1077280	source. And that's what I really focused on in this research. What I found was that virus scanning
1077280	1082740	platforms were actually a really interesting target. Because think about it, think about all
1082740	1087700	the stuff that people upload to virus scanning platforms. You know, think about all the websites
1087700	1091800	that are automatically scanned, all the applications, all the mobile apps that are
1091800	1099400	included in this virus total data source, and as well as other platforms. Now, with these scanning
1099400	1104880	platforms, it'd be infeasible to go ahead and, you know, download what, a billion, nine billion
1104880	1110100	files, and each scan each of them individually. But we don't need to do that, because we can use
1110100	1116720	the tools that they already provide us. Nearly every virus scanning platform lets you search for
1116720	1121800	specific patterns, specific strings, like they're literally spoon feeding us the perfect data
1121800	1126780	source here. And traditionally, what we've used this data source for is to find malware, you
1126780	1132020	know, find malicious use, etc. But what's really interesting about them is that, what if we use
1132020	1137200	secret patterns instead of malicious patterns? What if instead of looking for malware, we look
1137200	1143300	for secrets instead? And with virus total, this is retro hunt, but seriously, if you look at
1143300	1148000	nearly every other virus scanning platform, what you'll find is that they have a similar
1148000	1158250	future, um, at least if you have an account. So, let's apply this in practice. So with secret
1158250	1163350	split scanning, the plan is from a high level. We want to make sure that we look for secret
1163350	1168730	patterns, and what that really means is, think about your AWS access key. I don't know if
1168730	1173830	you've noticed, but it'll often start with A-K-I-A. And what we can do is we can create these
1173830	1180250	regex strings for identifying these secrets, and we can look for them using the same tools we
1180250	1185850	have available for malware hunting. So, most virus platforms allow you to search by a Yara
1185850	1192050	rule. And so what we can do is we can create a Yara rule for these secret patterns, and then we
1192050	1197810	can search samples uploaded to the platform for whether these patterns exist in them. Now,
1197810	1202690	one thing interesting that I did in this research was also focused on validating these secrets.
1202690	1207050	So, I've looked at a lot of past work into leaked secrets, and what I've found is, there's a lot
1207050	1212270	of theoretical research that discusses things like, oh, we looked for these secret patterns,
1212270	1216810	and, you know, we found these unique keys, but you read into it a little deeper, and they didn't
1216810	1220850	even check if those keys are legitimate. And that's something that didn't really make sense to
1220850	1225870	me. There's going to be thousands and thousands and tens of thousands of keys that match a
1225870	1232030	specific pattern, but are not active in practice. And so what we did was that I used a platform
1232030	1236530	to actually validate these keys, at least with basic metadata, and validate that they're
1236530	1243530	legitimate for our use case. Now, some patterns are going to be really noisy, but if the provider
1243530	1247490	doesn't make it easy to identify their secrets, you're going to find that you're going to have
1247490	1254030	to scan thousands and thousands of secret patterns and thousands of thousands of files. So, how
1254030	1258510	do we deal with this large volume? Well, what I did to do it on my budget, remember, I'm doing
1258510	1265270	this everything out of pocket, was leverage serverless computing. So, I needed a capacity of
1265270	1270710	having several physical server racks, but I don't have money to buy several physical server
1270710	1276550	racks. Instead, I can rent them using the cloud, and what that really means is I made a
1276550	1283030	serverless function in order to scan these files, and I also made a serverless function to
1283030	1287710	validate the keys that were found. And this way, I don't actually have to pay that much,
1287710	1293130	because I only pay for what I use. In practice, my costs were actually fairly reasonable for an
1293130	1299110	individual. Now, for dangling resources, again, the methodology from a high level was to
1299110	1304330	reallocate resources over and over and over again, and then it was to cross check them with
1304330	1310230	passive DNS replication data. Remember, this isn't necessarily new, but what's interesting
1310230	1316210	about them is that we're going to be talking about bypassing modern deterrents. And what I
1316210	1320230	mean by that is a lot of cloud providers have implemented these mitigations to make it
1320230	1327370	harder to do this dangling DNS record enumeration, and we're going to bypass them. So,
1327370	1333150	from a high level, one thing I want to call out is that earlier note. Remember, it would
1333150	1341710	appear that AWS began serving Elastic IPs from a small, specific pool similar to GCP. This
1341710	1346290	severely limits the diversity of addresses received. And so, let me tell you what this
1346290	1352190	really means in practice. So, what's going on here is that AWS and GCP have a mitigation
1352190	1358850	where when you are asked to assign me an IP address, whether that be an Elastic IP or in
1358850	1364530	GCP case, nearly every resource that you can go ahead and allocate that needs an IP, these
1364530	1371290	cloud providers will only give you a specific set of IPs assigned to a shared pool that's
1371290	1376410	limited to your account and maybe a few others. And for AWS, this is going to be largely
1376410	1382770	Elastic IP sharing. So, that means whenever you ask for a dedicated Elastic IP, you'll
1382770	1387190	notice if you free an Elastic IP and allocate another one, you're going to be assigned the
1387190	1391310	same one over and over again. Or in general. It's really hard to actually enumerate that
1391310	1398110	pool using Elastic IPs alone. Now, with AWS, they also introduced a mitigation, I don't
1398110	1403070	know if intentionally to go against dangling DNS enumeration, but they did introduce a
1403070	1408990	mitigation in 2024 where every IP address you received was actually had an increased
1409590	1415630	surcharge. So, now every IP you got allocated cost you extra money. And this deters attacks
1415630	1420430	by making it more expensive to enumerate their public IP pools and capture these dangling
1420430	1427070	DNS records. Now for Google Cloud, it's interesting. They actually had quite a lot more than I
1427070	1433470	expected. So, for project levels, so every account can have about 15, 10 to 15 projects
1433470	1438330	assigned to them by default. You can request an increase, but you need justification. Now,
1438330	1444270	IPs are again assigned from a small pool just like AWS. You only have 8 IPs you can use
1444270	1450150	by default in per region and globally. And with these accounts, you also had something
1450150	1455530	called a billing account restriction. So, with Google Cloud, every credit card can be
1455530	1459650	created into a billing account. Now, you can create a few billing accounts based off of
1459650	1463970	one credit card, but if you try to create more than a few, you'll automatically hit their
1463970	1469010	suspension and you'll have to go justify why are you creating a 50th, you know, credit
1469010	1474430	card account or billing account with one credit card. And so, all these deterrents really
1474430	1479230	make it difficult for attackers to enumerate these dangling domains. In fact, with Google
1479230	1484550	Cloud, while managed DNS enumeration was always a thing and has been for the past few years,
1484550	1489670	attackers haven't been able to enumerate Google Cloud's public IP pools for quite some
1489670	1497190	time, at least none researched that I could find online. So, with those AWS mitigations,
1497190	1501110	they're actually pretty simple to bypass. Instead of allocating elastic IPs, we can
1501110	1507150	just restart EC2 instances with ephemeral IPs and we can perform the enumeration by
1507150	1513750	just restarting, restarting, restarting. And my IP address that my EC2 instance is assigned
1513750	1519490	will generally rotate a lot faster through unique IPs than if you tried with elastic
1519490	1526290	IPs. In fact, um, I actually was able to enumerate nearly 2.4 million unique IP addresses in
1526430	1533530	a span of 6 months by using this methodology. Now, with Google Cloud, again, they had a
1533530	1539170	harder set of mitigations, but they, those mitigations were deterrents. So, how it worked
1539170	1544530	was that I used a backend bucket with a load balancer in order to assign IP addresses to
1544530	1549490	my resources. But this still didn't let me get past these cloud resource restrictions.
1549490	1555310	How do we do that? Well, once we have this primitive for enumerating cloud IPs, we can
1555310	1560810	talk about those limitations. But for high level information, we used forwarding rules
1560810	1567550	instead of virtual machines in order to enumerate these IPs. So, with Google Cloud,
1567550	1573070	remember all those restrictions? Well, we can actually bypass all of them fairly cheaply. So,
1573070	1577270	number one, with a billing account, one interesting thing I found was that you can assign
1577270	1581990	billing accounts across Google accounts. This was a useful primitive where if I could create a
1581990	1586490	billing account in one account, I can actually assign it across several accounts. And the
1586490	1591770	reason this is interesting is, well, what about those quotas? Well, with account quotas,
1591770	1595590	remember you can only create a certain amount of projects. Now, again, you can request an
1595590	1599650	increase in this limit, but you don't want to have to do this justification. I felt that it
1599650	1603250	would be inappropriate to assume that an attacker would be able to get this quota increase.
1603390	1607450	What I found was, though, you can create a Google Workspace environment. So, what that
1607450	1612610	means is I can create a fakebusiness.com, I can create Google Workspace environment for it,
1612610	1619470	and I can create practically as many Google accounts as I want for about $6 per account per
1619470	1625410	month. And this way, each of those accounts gets a dedicated quota limit and allows you to
1625410	1630990	bypass these quota limits by creating, for example, 10 accounts. Now that's $60, but now
1630990	1636650	your quota has been 10-timed. And finally, to bypass billing account restrictions, remember
1636650	1641210	those credit card restrictions, billing accounts can only be associated with a certain number
1641210	1647110	of projects. Well, we can instead then use virtual credit cards. And I use privacy.com.
1647110	1651950	That's not a recommendation, it's just one of the easiest that worked for me. And what really
1651950	1658170	this means is, it's not like they're bypassing KYC practices, they verified my identity, but it
1658170	1662630	still allows me to create as many credit card numbers as I want and be able to create as many
1662630	1666650	billing accounts as I want to be able to bypass every single restriction we discussed with
1666650	1672030	Google Cloud. And so this is what I really want to mention from a high level, is Google Cloud
1672030	1678670	implemented all these deterrents to try to make sure you can't enumerate their dangling IPs, but
1678670	1683810	in practice, these deterrents weren't addressing the root cause, which was the fact that the
1683810	1693060	dangling IPs still existed in the first place. So let's talk about a little bit of the
1693060	1701260	discovery process and what I was able to find with these techniques. So with dangling
1701260	1707240	resources, I was able to enumerate over 2 million IP addresses for Google Cloud and AWS. These
1707240	1712780	are unique IP addresses and they're mostly primitive resources. So these IPs were created
1712780	1720860	by, remember, restarting an EC2 instance or creating forwarding rules over and over again. As
1720860	1725280	far as I'm aware, this is one of the first methodologies to successfully bypass every single
1725280	1730600	Google Cloud deterrent that is intended to stop this type of attack in the first place. I
1730600	1737280	captured over 60,000 unique fully qualified domain names. And this reflects past research
1737280	1743060	into this area where researchers found that these FQDNs, there are a lot of different A
1743060	1748940	records that pointed at IPs that were no longer being controlled. Now out of these 60,000
1748940	1755040	FQDNs, there are about 54,000 unique second level domains. And what that really means is that
1755040	1760320	once you take away the subdomain, let's say A.B.com, we're just focusing on the unique
1760320	1768620	number of Apex or second level domains. Well, that was over 54,000. And finally, one of-
1768620	1773560	over 5,000 of the domains that I was able to capture included- were included in the
1773560	1779520	Tranco top 1 million list. So Tranco is a listing of every domain that they're aware of
1779520	1785440	within a certain ranking and it allows you to compare what- it's supposed to be an objective
1785440	1791340	metric for a ranking of a domain based on DNS data. Now, there are a lot of Fortune 500
1791340	1797160	companies impacted and what I found really interesting was that with AWS, we had a roughly
1797160	1806800	25- a rate of 25 dangling domains per 1,000 IPs. But with Google Cloud, it was nearly 36. And
1806800	1812820	so what I suspect this discrepancy is as a result of is that Google Cloud hasn't been able
1812820	1820340	to be enumerated for quite a few years. Now, this talk isn't going to focus on the actual
1820340	1825720	impact against customers because I promised DEF CON review board I wouldn't get stuck on it.
1825720	1829540	But you can see that I was able to compromise some of the world's largest organizations
1830100	1837180	including the Western District Court of Texas, um, the New York Times, uh, the California-
1837180	1843940	State Government of California, and Dior. And, um, yeah, it was a pretty fun time. There was a
1843940	1849280	lot more examples here. Again, this isn't intended to cover it. That's, uh, on a separate blog
1849280	1854980	post as well. I really go into detail about the impact. And for a secret scanning, again, what
1854980	1861200	was really interesting was that I scanned over 5 million unique files for- from various
1861200	1865920	platforms, not just VirusTotal, that was just one of them. Um, and I discovered over 15,000
1865920	1872860	validated secrets. And out of these secrets, they included over 2,500 unique, again, validated,
1872860	1877780	these aren't just, you know, may match a pattern, these are validated, to over 2,500 validated
1877780	1885360	secrets, over 2,400 unique AWS keys, over 2,200 GitHub personal access tokens and fine-grain
1885360	1893640	tokens, over 600 Google's cloud service accounts, over 460 Stripe accounts, and the rest are
1893640	1898120	largely from miscellaneous providers added up together that I didn't feel the need to include
1898120	1914130	in this slide. And, and again, there will be a blog to recap this, but from a high level, it's
1914130	1918210	some of the largest organizations in the world were impacted. You know, just a fun example a
1918210	1926090	few months ago was Slack, Stanford's entire Slack workspace, um, Samsung's workspace for
1926090	1932350	Bixby. I was able to get a bot token for this Samsung Bixby tenant and, which allowed me to
1932350	1937490	read messages from nearly every channel, every single channel that the bot had access to
1937490	1941810	because of a default scope that was quite broad. You know, some other interesting things
1941810	1946970	included the Supreme Court of Nebraska, that was a fun one, where they uploaded a password
1946970	1952650	list to VirusTotal with like 300 credentials from different, like, I don't know, different
1952650	1957710	AWS providers, different cloud providers, their security solutions, et cetera. That was a
1957710	1963090	really fun one. Um, you know, there are database backups with a lot of these AWS keys that had
1963090	1967810	broad access to S3 buckets. Anyways, you'll be able to read a lot more about this this
1967810	1974210	following week. So by leveraging a security at scale mindset, we can help protect thousands
1974210	1980050	of organizations far beyond a limited scope. Remember, instead of starting with a specific
1980050	1986090	target, by starting with a diverse dataset, we were able to have a much wider impact than any
1986090	1991830	of past work into leaked secrets. You can read more about some of this impact in an, in an
1991830	1997510	article that should be released right now, uh, by Matt Burgess from Wired. And I'll be
1997510	2002530	releasing a detailed technical blog later this week once I figure out whether a certain cloud
2002530	2009730	provider can actually revoke some of these keys or not. So, bringing it all together.
2012530	2017010	Hardcoding, hardcoding secrets is the path of least resistance. So remember, these are
2017010	2024750	customer vulnerabilities, but what enables them is these bad incentives. Think about it, think
2024750	2029910	about how easy it is to go ahead and generate an AWS access key or generate a Google Cloud
2029910	2035170	service account and then put that into your executable directly. You know, the libraries for
2035170	2042070	these different providers allow this direct interface in the first place. Now, the reason
2042070	2046090	this is really important is because a lot of developers are going to follow the path of least
2046090	2052950	resistance. Especially from smaller to mid-cap businesses. And with dangling DNS records, the
2052950	2059930	same problem exists. It's the path of least resistance. I created an AWS EC2 instance, I
2059930	2065630	put my DNS record pointing at that AWS EC2 instance, and the path of least resistance is
2065630	2071290	leaving that DNS record even if I deallocate it. And what I think we need to really focus on
2071290	2077070	is making sure that the path of least resistance is the secure path. And what this really
2077070	2083630	means is with dangling resources, I think we need to have better ownership of cloud resources
2083630	2089450	and DNS records. Better association. So for example, some cloud providers have tried to
2089990	2096590	associate their DNS services with their EC2 resources as one example. Um, and the problem
2096590	2100610	with this is a lot of different customers are going to use different DNS providers, different
2100610	2106650	cloud providers. What we really need is an industry wide solution of tracking DNS records and
2106650	2116080	tracking cloud resources and putting them together. Now, for hard coded secrets, what I
2116080	2121220	really think we need to focus on is making sure that it's hard to include secrets in your
2121220	2127380	code. So don't have short access tokens that your library just blindly accepts from a
2127380	2152390	string. But instead, for- alright, thank you for that. That was a nice wake up call. Um,
2153590	2158310	alright. Uh, anyways, so yeah, with these hard coded secrets, what I really think we need to
2158310	2164470	do is make sure to limit the secrets so that they can only be inserted from an environment or
2164470	2169130	from a file on disk. And make it hard to hard code these secrets inside of an executable in
2169130	2173290	the first place. Now again, you can have exceptions, you know, you can have it so a
2173290	2177570	customer can opt out from the secure default. But we need to make sure that the secret
2178390	2186670	default is secure. So what about remediating these vulnerabilities? Well, remember, for
2186670	2191870	dangling records at a high level, it's going to be hard to contact every single host of every
2191870	2197230	60,000 dangling domain that I was able to discover. What we really need is a way to tie
2197230	2202010	ownership to DNS records. And we need to do this across the industry because of that
2202010	2210390	multi-cloud approach. Now for secrets, this is where it gets really interesting. So I went
2210390	2214470	ahead and asked a bunch of organizations that I found secrets for, including GitHub,
2214470	2219290	including AWS, including OpenAI, whether I could report secrets to them and they could
2219290	2224310	revoke them automatically. Now GitHub has that program for scanning secrets on their
2224310	2229570	platform already. Remember, if you actually go ahead and post a, for example, OpenAI access
2229570	2235770	key on a public repository, that access key will be revoked within a few minutes. And what I
2235770	2240630	was curious was, hey GitHub, can I please use this mechanism you already have? Well,
2240630	2247010	unfortunately they said no. And in fact, several providers said no, like AWS, despite the
2247010	2252730	fact that they already had given this mechanism to GitHub and despite the fact that an
2252730	2258730	attacker could access the mechanism by posting a public git or public commit. Now one
2258730	2263730	exception to this was OpenAI, who immediately responded with an endpoint for reporting
2263730	2269290	these keys and allowed me to automatically revoke the keys that I discovered in the wild.
2269590	2274990	But what do we do about everyone else? So the problem with these secret keys is that the
2274990	2281050	impact is far, far, far greater than dangling DNS records. In fact, we just saw some of the
2281050	2285610	world's largest organizations and there were several more impacted. I didn't feel
2285610	2289970	comfortable releasing this work without at least some stopgap until these cloud providers
2289970	2296470	could take the secure default. So what I actually did was I developed a mechanism that
2296470	2303650	used GitHub's mechanism anyway for revoking these secrets, because they said no, but I
2303650	2309330	don't care. But yeah, so what I did was I have this system now where whenever new
2309330	2315290	secrets are discovered, I'll go ahead and create a gist. And the way I create this gist is
2315290	2321590	by automating the entire GitHub login process and then just using a UI endpoint for
2321590	2326770	creating a public gist. And this way it'll actually trigger the GitHub secret scanning
2326770	2337420	mechanism that they could have given me direct access to anyway. So yeah, anyways. Now
2337420	2341920	what's really cool about this is that every, almost every secret that you saw listed in the
2341920	2346080	previous section, a lot of them are going to be revoked. There's an exception to that
2346080	2351880	though. One of the largest providers which did have leaked secrets was AWS. Now AWS takes
2351880	2357700	an interesting approach. When you post your AWS access key on a public GitHub commit or
2357700	2364480	post, what they do is that they'll create a support case for you and restrict write access
2364480	2369860	using that key. I found that kind of interesting. So what's really happening is AWS is
2369860	2376200	aware of these secret keys, but they're choosing not to revoke them for some reason. Yeah,
2376200	2382340	that's an interesting one. So effectively if you find a leaked AWS access key on GitHub, you
2382340	2388340	can still use that key to read S3 buckets, read RDS database data, to read download files
2388340	2394400	from S3. You know, I remember I looked at a AWS key last weekend for a casino that was
2394990	2402460	alleged to deal with over $1 billion of bets a month. And I was like, okay, wait a minute,
2402460	2407520	was this reported? We should get this revoked. But in reality what happened was AWS created
2407520	2413700	this support case. The customer never saw it because the support email was sent to their
2413700	2418180	generic billing account. You know, a lot of people, a lot of enterprises set up an AWS
2418180	2423060	account and use a generic billing email that no one really looks at. And so the support case
2423060	2428020	was ignored and this key is still active today. You know, it's disappointing because I don't
2428020	2431720	know what more I can do for my shoes. You know, I've created a mechanism that can help
2431720	2436460	automatically revoke most of these keys, but what do we do about keys that the provider
2436460	2441720	doesn't take action on? And so this is where I really think providers need to switch up is,
2441720	2447540	number one, if someone's secret key, you have both components, is on the internet and you
2447540	2452700	know about it, you need to revoke that immediately. I mean, it's crazy to me to think
2452700	2456600	that even on GitHub, if you post your AWS access key, that's not going to be automatically
2456600	2461480	revoked. Every other provider I looked at does automatically revoke. Google Cloud revokes,
2461480	2467240	Slack revokes, OpenAI revokes. The largest cloud provider by market share does not revoke.
2470340	2476040	Now, if you're interested in starting this sort of research yourself, what I'd focus on is
2476040	2480480	breaking down the traditional methods of finding vulnerabilities. So with dangling domains,
2480480	2487460	that was checking if the DNS record is actually pointing at a uncaptured IP address. And with
2487460	2494000	secrets, it was trying to find those secret patterns in a diverse data source. So in this
2494000	2499640	case, we used virus scanning platforms, but you can use a similar methodology against a
2499640	2504900	lot, a larger set of vulnerability classes. And what you really want to do is correlate
2504900	2511880	those steps with these large data sets, regardless of their intended usage. Thank you so much
2511880	2525820	for coming out to this talk. What a fun time. We do have a few minutes for questions. Oh, we
2525820	2531860	apparently don't have microphones. All right, yeah. If you have questions, feel free to come
2531860	2536680	up and we can have a chat over on stage. Thank you so much for coming out to this talk. What a
2536680	2540400	fun time. And yeah, I look forward to working with these providers to address these
2540400	2541280	vulnerabilities.
