start	end	text
8450	12670	Hi, everyone. Thank you very much for attending to our talk.
12750	15950	We're going to present the new concept of shadow vulnerabilities
15950	22090	and how we apply that in order to attack the most famous projects in the world.
22090	29530	So, just before we begin, we're very happy to say that we are very proud to be part of this amazing community,
29530	32850	the DEF CON community and the AppSec community for itself.
32850	36470	And before we begin, just a really quick intro about ourselves.
36470	39930	I'm the co-founder and CTO of Oligo Security.
39930	45970	Like any other Israeli that you probably met, I'm ex-IDF technological unit.
45970	52150	And in the last eight years, I've been hacking and breaking software at Checkpoint Research.
52150	56910	And I'm super famous for being handsome, or at least I think.
57650	64610	And along with me is an awesome guy. He's one of our most talented researchers at Oligo Research Team.
64610	69210	He's, again, like any other Israeli, ex-IDF technological unit.
69210	72370	And he's been breaking and building software for all of his life.
72370	75650	And he's very famous for being the best scuba instructor.
75650	80710	He likes to deep dive into coral reefs and into complex bugs and code.
81170	84970	So, just as a really quick agenda, what we're going to talk about today
84970	89610	is the new concept of shadow vulnerabilities, what actually it means.
89610	97390	And then we're going to give an example of a shadow vulnerability that we discovered in the famous Snake.yml Java parser.
97610	106210	Then we're going to explain the process that we did in order to scale it and find vulnerable projects
106210	109410	that are vulnerable to this shadow vulnerability.
109610	114230	And in the end, like any good DEF CON talk, we're going to exploit some stuff and talk about the impact
114230	117990	and then sum it up with conclusion and key takeaways.
117990	126490	So, just as you might be familiar from this concept from other industries,
126490	133370	the shadow IT, that stands for the IT, the infrastructure that we don't monitor.
133370	136050	And hence, we don't really know what's going on there.
136050	140230	And hence, there's a bigger risk of the stuff that we aren't aware of them.
140230	148150	And you can see that this analogy goes in different world, the API world, the API that we don't monitor.
148150	153770	And hence, we don't know what's going on in there, the sensitive data, and of course, so on.
153770	160130	And that's why we dubbed this concept of shadow vulnerability for exactly the same analogy,
160130	162830	for risks that we aren't aware of them.
162830	166470	And hence, they're even bigger to deal with and more riskier.
166470	171210	And basically, shadow vulnerability stands for those type of vulnerabilities
171210	175530	that actually doesn't get a CVE assigned to the issue.
175530	177630	And why do these things happen?
177630	180830	It can happen for several different reasons.
180830	187690	Of course, the most obvious one is that it just takes a lot of time in order to classify
187690	191720	or there's a dispute between the maintainer and the reporter.
191720	199580	And it might take a lot of time or even result in a no-fix to get this issue a CVE.
199860	207360	Again, there are a lot of examples in libraries and projects that just by not following the best security practices,
207360	209970	you're actually opening a door for attacks.
210240	214580	And of course, in the end, the maintainers that are responsible for the project
214580	221000	are the ones that are deciding whether this issue is a real CVE or not.
221000	224660	And they are the ones that will flag it as a fix or not.
224660	229880	And of course, what we're going to show is that there are just libraries that are insecure by design.
229880	235400	Meaning that just by misusing this library, you're prone to a vulnerability.
235420	240300	And again, the fact that we don't have a CVE associated is what keeps us blind
240300	250980	because all of the other tools or other approaches that we know,
250980	253480	and how can we deal with it.
253660	256540	So now, I'm going to pass it on to Awesome Guy,
256540	264340	that will deep dive and explain about how we found this vulnerable code pattern inside Snake.yml
264340	266520	and Guy can take it from here.
267300	268760	Thank you, Guy.
271420	277920	Okay, so as Guy said, we're here to show you the new concept of shadow vulnerabilities.
277920	282660	And to do that, we will dive into a specific example of a shadow vulnerability that we have found
282660	285060	in a library called Snake.yml.
285340	290800	So Snake.yml is a famous open source library for parsing YAML files in Java.
290960	295440	It is ranked the number one YAML parser in the Maven repository
295440	301800	and it is itself a dependency for more than 4,000 other open source packages.
304890	307450	And just to recap, this is a YAML file.
307450	312310	It is pretty similar to a JSON file, but it is meant to be more readable to humans.
312310	315750	So if you are a human and you find this readable, so good for you.
317450	322410	So let's say you are a Java developer and you want to deserialize a YAML file.
322530	325730	I am a Java developer myself sometimes.
326350	328690	Not proud of it, but yes, I am.
329690	336470	So what most developers will do, they will just try to find the first code snippet on the internet that works.
336470	341190	So what they will do then, they will just find this snippet from the docs.
341190	343570	They will copy and paste it to their code.
343630	347190	They will try to run it and it works.
347370	353350	At this point, what most developers will do is they will just close the docs and continue with their job.
353570	358770	After all, there is no alert that you have done something bad.
360310	365490	But if one digs a bit further into documentation, he will see this.
365490	370870	Snake YAML allows you to construct a Java object of any type.
371210	373310	So what is any type?
373430	380830	Any type can be a string, an array, a hash map or a dictionary,
380830	385610	and it can even be a custom Java object like this person class here.
385610	394470	So trying to parse this payload will result in calling the constructor method for the person class.
395270	397430	But wait, any type?
397450	401450	Something like this should really make your hacker Spidey sense tingle.
402110	404870	Can it even be a URL class loader?
405050	413770	So just to recap, a URL class loader is a Java class that allows you to load the Java classes from remote servers.
413770	417710	And basically it loads them into memory and it can also execute them.
418590	421830	So apparently yes, this also works.
421910	426910	I'm sorry for the lame emojis from Windows. They used to be better.
427430	429950	But yes, this actually works.
429950	439090	If you will try to parse this YAML using Snake YAML, it will result in code execution from a remote server.
439090	441750	As you can see here, the attacker control server.
442730	454530	And I guess you wouldn't expect that just by parsing a YAML file you will result in code execution which can lead to complete takeover of the running host.
455530	459850	So we were not the only ones who thought this was unexpected.
459950	465110	This issue was reported a long time ago to the Snake YAML maintainers.
465930	471590	And as a reply, the maintainers said that, well, he doesn't see that as a problem.
471590	474010	This is the intended behavior.
474490	478770	Users who want to be safe can just use SafeConstructor.
479990	483350	So let's pause for a second and explain what SafeConstructor is.
483630	494010	So Snake YAML allows you to provide custom constructor types to configure the way that you control the YAML parsing.
494010	504260	So for example, the SafeConstructor will only allow you to parse Java primitive types such as a bool, string, int, and so on.
504550	510450	And if it sees an unfamiliar type, it will just throw an exception and crash.
512070	519390	There is also the constructor type which will do exactly the same thing as the SafeConstructor.
519390	529210	But instead of throwing an exception when it sees an unknown type, it will just try to parse it and to create any Java object that it can find in the class loader.
530890	543570	And it's important to note that a part of the issue here is that the unsafe constructor, not the default constructor, is the default type for Snake YAML.
543570	551350	So if you will just try to initialize a new YAML parser, you will automatically receive the constructor type.
551430	557330	You need to opt-in if you want to use the SafeConstructor.
558350	569710	And in order to make things even worse, constructor type inherits SafeConstructor, giving developers a false sense of safety when they're using the constructor type.
569710	583830	I think this is the really root issue here, because developers who are using the unsafe constructor get a false sense of safety that they are using the SafeConstructor just because it inherits the SafeConstructor.
583830	588430	But it actually overrides the safe behavior of the SafeConstructor.
590470	592410	So is this a vulnerability?
592690	596830	Well, you might as well say, yeah, this is not a vulnerability.
596830	600570	It's up to the users to know how to use Snake YAML.
600570	607890	The users need to read all the docs, and that's exactly the maintainer's point.
609190	618890	But what we say is that this vulnerability is a source for so many other vulnerabilities that we have found that you might as well call this a vulnerability instead.
618890	630910	It's important to note that the reason that we issue CVEs for open source libraries is to tell the users who are using these libraries that they have potential security issues.
630910	635790	You need to notify the users that something that they are using can be dangerous.
636650	651590	But because this did not get any CVE, we call this shadow vulnerability, since users who are using Snake YAML will not know that they are using a possible vulnerable function.
653830	665290	But anyway, all of this doesn't matter, since, as the maintainer says, 100% of the applications who use Snake YAML don't use it to parse untrusted input.
666310	668630	We decided to test this claim.
669750	674410	To do that, we introduced a concept we call reverse fuzzing.
675110	683090	Traditional fuzzing involves taking one target and shooting as many inputs at it, seeing when it breaks.
683090	695210	Reverse fuzzing is the process when you take one vulnerable input and throw it at as many targets as you can, trying to find the one that breaks.
696790	705030	The simplest way to start searching for targets in this process is to just search for the code pattern in GitHub.
706110	709830	So we did do that, and we ended up with many results.
710370	715030	And there were too many for us to just go through each and every one.
715550	719070	So we had to lower the amount of false positives.
719110	724710	We wanted to filter the targets by amount of stars to find only the prime targets.
724710	729170	But sadly, the GitHub code search does not let you do that.
729170	738070	So we had to write our own scripts to do this, and we had to run them for a couple of hours because of the rate limiting that the API has.
738770	744250	But we did end up with a much lower number of results.
744650	754470	But still, out of all these results, we still had a few false positives, because some of the projects that use Snake YAML only use it to create YAML files and not to parse them.
754470	758070	And also some of them are using the safe constructor.
759330	763050	To eliminate the noise here, we just used CodeQL.
763050	772850	For those of you who are not familiar, CodeQL is a powerful code querying tool that can help you find patterns exactly such as this.
775270	780030	We ended up filtering the results, and we found a few prime targets.
780030	782670	I will focus on a few of them now.
782670	787510	One project that we found vulnerable was Apache Cassandra.
789750	799170	Apache Cassandra uses the Cassandra YAML file to configure the server.
799730	808470	Using the vulnerability that we have found, we've discovered that if a malicious attacker can control the contents of this configuration file,
808470	811250	he can actually execute code on the running machine.
814290	821750	Since this is a configuration file, we wanted to test if we can find an interesting attack vector for this.
822970	829030	Usually attackers don't get the access to just edit configuration files on the servers.
829230	836450	But during our research, we did find that on the default container image for Cassandra and the default installation,
836450	846470	the Cassandra YAML file will usually have write permissions from any user on the running host.
846470	855310	So this can be leveraged to gain local privilege escalation on the machine running Apache Cassandra.
855310	866510	In addition to this, during our research, we have found another vulnerability in Apache Cassandra that did allow us to modify files on the Cassandra server.
866510	876350	And then we just chained these two vulnerabilities together to obtain persistent RCE capabilities on Apache Cassandra.
877210	890230	Another research that we started doing was also to search for more targets that are using Cassandra as a service, such as Amazon that is providing Cassandra as a service.
890550	897590	Most of them really did sanitize the inputs, but the attack vector can still be valid for more services.
899390	908010	So we did try to report this vulnerability to the Apache team that maintained Cassandra.
908010	915510	And they were super responsive and they immediately said that they do see the issue and they will issue a fix.
916450	922890	But they did say that they don't consider this a vulnerability because of the attack vector,
922890	933930	which actually created another set of vulnerability because there is an issue, but it is not being notified to the users that it exists.
935130	945370	And sadly, after deploying the fix, we see that they fell into the same pitfall that we mentioned earlier.
945370	958510	They thought because the constructor inherits a safe constructor, they thought that just by using the constructor they are safe because it inherits a safe constructor.
958610	963270	But as we mentioned earlier, it overrides the safe behavior of the safe constructor.
964430	970550	This is still left unfixed since it broke some tests and stuff.
971550	972750	Yeah.
975090	986890	So while we did found a local privilege escalation, and local privilege escalation is really cool, what we really wanted to find is remote code execution, which is way cooler.
987530	993530	And to do that, we had to expand our research to find even more targets.
995230	1008610	We did had some issues with the old method since not all the targets are open source, so searching GitHub limited the amount of results that we can get.
1008950	1018410	And in addition to that, running CodeQL is pretty difficult in scale because you need to have the CodeQL database for each and every project.
1019710	1026570	And as the maintainer already said, most of the projects do use Snake.YAML only for configurations.
1026910	1040410	And we wanted to find a method how we can filter out those projects who use Snake.YAML only for configuration and find the ones who are using Snake.YAML to parse YAML files during their actual runtime.
1042690	1048790	To do that, we decided to move from searching GitHub to searching for images in Docker Hub.
1048970	1065570	We wanted to trace them in a runtime, and we wanted to plot the amount of calls that they do to parsing YAML files in order to find the ones who are not only using it in the beginning.
1065570	1078730	Because what we understand is that when you use it for configuration, you usually only use it once when you start a container, and then you don't have to parse any YAML file.
1080570	1085150	So there are a couple of ways of doing that. We wanted to do that in scale.
1085150	1097190	And luckily, this is exactly what we at Oligo do. We use eBPF technology to observe the runtime behaviors of open source libraries down to the function level, and we do do that at scale.
1097190	1106250	So using the data that we had, we were able to plot these graphs on many popular projects.
1106810	1113630	So this is an example for a project that was using Snake.YAML actually for configuration only.
1113630	1121850	So you can see that over time, you only see one peak at the beginning, and then there are no more usages.
1123550	1130690	And contrary to this, this is a project that actually used it to parse YAML files on the fly.
1131150	1134970	So these were actually interesting targets.
1135830	1144630	So using this method, we were able to find more targets. Some of them are still under responsible disclosure, so we can't explain the bugs we found there.
1144890	1151570	But one of the targets that we did find, and we can show you here since it already got fixed, is Confluence.
1151570	1163230	So just in short, Confluence is using another open source library which is called Liquibase that had this HTTP client code,
1163230	1170670	which was communicating with an API that was able to communicate and get YAML back from the API.
1171850	1178050	So you can see here that it is not using the safe constructor, it is using the default and unsafe constructor.
1179430	1193150	So you can see here that once you issue a GET request, the output from the connection is being moved straight into the loaded function.
1194510	1205670	So this issue was fixed in Confluence server on the latest version, but it was not fixed as a security update, it was just pushed as a regular update.
1208050	1216550	And there were many more projects that we found vulnerable to this. This vulnerability was kind of like a goldmine for us.
1216550	1220930	Everywhere we looked, we found flawed usages of this library.
1222930	1230370	And to continue and sum up and give the conclusions, I will give the talk back to Gal.
1230750	1234050	Thank you, Guy, for being that awesome.
1234050	1236830	Okay, cool. So let's sum it up.
1236830	1244810	We actually were able to prove that vulnerability is not a vulnerability, but we were able to hack one of the most famous projects in the world.
1244810	1253450	We started with an LPE, then we did a post-auth RCE, and actually we did find a no-auth RCE,
1253450	1261690	meaning that we have a huge list of IPs that are using this vulnerable code pattern that we can now take down.
1261690	1267790	This is still under responsible disclosure, but please stay tuned as we're going to publish it as soon as we can.
1268530	1271030	But now, let's see what happened.
1271070	1279290	While we did our research, actually Google stepped in, and in one of the most famous tools, OSS Fuzz,
1279290	1285410	which continuously fuzzes the most famous open source projects in the world for security vulnerabilities,
1285410	1289690	and Snake YAML is one of them, they did see that this issue occurs.
1289690	1291910	So they opened an issue.
1292150	1298730	And of course, we already know our maintainer that just changed the status to won't fix.
1299250	1306930	But then Google said, look, this is an RCE. We can actually run code. This is very severe.
1306930	1311750	We don't agree with you. There was a dispute, and Google said, look, we are Google.
1311750	1316090	We are a CNA. We're not going to ask you. We're going to issue a CVE.
1316630	1321310	So in a return to that, the maintainer said, good, if you're Google and you can issue a CVE,
1321310	1325410	you can come up with a fix to this problem. I'm not going to do it.
1325410	1332330	And this is how we ended up getting Snake YAML 2.0, which actually introduced breaking changes.
1332330	1341070	It actually breaks the concept of deserializing structs and only lets you deserialize the primitive types.
1341070	1347230	And by that, we still think that the world will remain vulnerable because all of the other applications
1347230	1356270	that are leveraging Snake YAML for much more complex and extended usages besides the default types
1356270	1358890	will have to use the vulnerable part.
1359790	1364410	And now when you actually get to the official documentation of Snake YAML,
1364410	1370630	you can see right away the maintainer added, if you are here because of a CVE, it's probably a false positive.
1370630	1376470	And again, as Guy mentioned, we usually trust the documentation that we read,
1376470	1379650	and this is exactly the root cause of those shared vulnerabilities.
1379850	1386510	Because without knowing all of that, I would just get into the documentation and see that there's a false positive
1386510	1388870	or say, okay, there isn't a risk.
1389150	1393890	And of course, other projects saw this and followed.
1393890	1399270	And for example, Apache Cassandra, we did see they tried to fix it but couldn't fix it.
1399270	1403430	After the CVE applied, they just suppressed it and ignored it.
1403430	1407510	Why? Because it would break in the builds of people and people ignored it.
1407510	1412590	And again, they followed the maintainer's suggestion and just suppressed the vulnerability.
1412650	1414210	So it's still out there.
1414750	1419030	So this actually raises an interesting ethical question.
1419030	1421670	Who owns the responsibility?
1421670	1429130	Is it the library maintainer that has been thankfully giving the world an amazing open source that let us build amazing tools,
1429130	1435090	but now he needs to change the way that his code works just for others to use it safely?
1435150	1437470	Or is it the project maintainer?
1437470	1439630	They have thousands of open sources.
1439630	1443330	They have to be responsible for each and every one's security?
1443330	1451550	Or is it just the innocent users that just want to code and use a DB or use an open source
1451550	1458810	and don't know or think about the consequences or the problems they inherit when they use it?
1458810	1466710	Or just the fact that they now have to be a Java security expert in order to just use a YAML parser?
1468410	1472370	And as you can see, this is just the tip of the iceberg.
1472370	1476510	This example of Snake YAML is just one example of a shadow vulnerability.
1476550	1479090	But there are many more out there.
1479090	1485190	You can see the same documentation that are repeating itself from each and every example,
1485190	1486950	whether it's like Lodash or Jackson.
1486950	1491330	And you can see how the maintainers on one hand say, OK, this is not a problem.
1491330	1498210	But on the other hand, you should be aware and be following the guidelines in order to use it safely.
1498210	1507430	And we do see those stuff coming over and over in different use cases and different libraries that everyone is using.
1507770	1509970	And there are many more out there.
1509970	1512050	And that's why we urge you guys.
1512050	1515330	We're going to publish a list of all of the shadow vulnerabilities,
1515330	1520550	but we urge you to also participate and add more and more examples
1520550	1527270	because we think that it should be a security effort of all of the community in order to fix it.
1527270	1531610	And again, like any good DEF CON talk, we have to exploit something.
1531610	1535390	So I'm going to pass it on to Awesome Guy,
1535390	1542110	that will show you an exploitation on Apache Cassandra with this shadow vulnerability.
1544830	1550830	So we don't trust the demo gods, so we had a video.
1551510	1556570	So you can see on the lower terminal, this is the Apache Cassandra server.
1556570	1559250	On the top one, it's the attacker.
1561370	1566170	We have used two vulnerabilities that were chained together.
1566430	1570470	And once we reset the server, we can see that the malicious payload is being loaded.
1571070	1572790	And we will get a connection.
1573410	1576250	And we're now running as the Cassandra user.
1580550	1582270	Great, so...
1582270	1584330	You can applaud now.
1592800	1597000	Great. Thank you, Guy, again, for being so awesome.
1598040	1602980	So now, let's conclude what we have been seeing up until now.
1603120	1606740	Open source, just like Guy, is awesome.
1607040	1612800	And this is what enables us to build amazing applications and do it.
1612800	1616580	And on the contrary, because it's everywhere,
1616580	1620300	that's why it's very important to secure those open source packages.
1620300	1624880	And I think people even talk about Lock4Shell, or Spring4Shell, or everything with Shell,
1624880	1629380	just keep recurring and showing us how important it is.
1629380	1634660	And that's why we think, by showing here the concept of shadow vulnerabilities,
1634660	1641460	that the industry has to realize that fixing by a CVE cannot be the only focus.
1641460	1645140	There are other problems out there, and that's why shadow vulnerabilities
1645140	1650940	and these libraries that have this type of being insecure by design,
1650940	1652440	it's just, again, the tip of the iceberg.
1652440	1656520	And that's why this shadow concept should be called out.
1656520	1660420	Because you saw that even if we have a fix, or even if we have a CVE,
1660640	1664060	a lot of the time it doesn't really solve the real issue.
1664060	1668260	And that's why we don't think it's someone's responsibility.
1668260	1670940	We think it's everyone's responsibility,
1670940	1675240	because we are all using, knowingly or unknowingly,
1675240	1679420	in these applications that are built upon this amazing open source project,
1679420	1682940	and that's why we think it should be a community effort.
1682940	1686340	And that's why we need your help in order to do it.
1686420	1690300	So, again, thank you very much for attending this talk.
1690300	1694560	Please stay tuned as we're going to publish more and more examples of shadow vulnerabilities,
1694560	1699780	and we're going to publish the new project that we hacked.
1699780	1704020	And, of course, if you have any questions, you can reach out via LinkedIn,
1704020	1707320	or Twitter, or X, or whatever.
1707320	1709880	Elon will decide to call it tomorrow morning.
1709960	1713480	We will be there and be happy to answer any questions that you guys have.
1713480	1714480	Thank you.
1720860	1722280	Any questions?
1725080	1727020	Where do I like to dive?
1727560	1730420	I'm from Israel, so I mainly dive in Eilat.
1730480	1733160	But I've been all over the world,
1733160	1737160	like wherever I get to and there's water, so I try to dive there.
1737660	1739600	And to memory corruptions.
1742100	1745020	Did Cassandra fix the other bug that you found?
1745360	1748100	Yeah, we found several bugs in Cassandra.
1748100	1752420	One of them was fixed and issued a CVE by itself, you can see.
1752420	1756540	It was a command injection, so it actually lets you run code,
1756540	1761220	but we used it in this research in order to create an arbitrary file primitive
1761220	1766220	in order to actually exploit the shadow vulnerability of Snake.YAML.
1766220	1769380	But the shadow vulnerability of Snake.YAML is still unfixed.
1770900	1771660	Yes.
1775300	1779040	It's a good question. You can find our blog in the Oligo official website.
1779040	1782020	We're going to publish everything, like the research and how we did it.
1782020	1786480	We're going to publish some tools and the way we did and scaled the research.
1786480	1789840	And of course, we're going to publish more and more examples of shadow vulnerabilities,
1789840	1791540	so you can see it over there.
1792380	1793160	Yes.
1803300	1806380	Yeah, so that is a good question.
1806380	1809600	How do you find more shadow vulnerabilities in more libraries?
1809860	1817080	So what we wanted to do to do that is just focus on libraries that are actually doing dangerous stuff.
1817080	1821180	This serialization is something that is known to be really dangerous.
1822360	1827460	We didn't come up with a smart way to do this at scale,
1828080	1832760	but it's basically focusing on the libraries that you know that can be dangerous
1832760	1837900	and trying to find these patterns of documentation that says,
1837900	1841840	it's your responsibility to do that and that in order to be secure.
1843120	1844760	Here comes the payload.
1846200	1847140	What, what?
1847580	1852140	The payload? What payload we used?
1852240	1854940	It was on the previous slide.
1855240	1860060	It's basically the URL class loader that will initiate a connection to our controlled server
1860520	1865060	that will serve the malicious jar that will be executed.
1866000	1867800	This one, yeah.
1870640	1872120	More questions?
1872900	1873700	Yeah.
1881500	1886920	So yes, if we are planning to release an open source tool to find this.
1886980	1891240	So currently not. It is based on the data that we have collected.
1891600	1897720	But we can suggest that there is another way to search for this kind of
1897720	1900520	issues using a dynamic instrumentation.
1900620	1905060	Like you can do the same thing with Frida, just in a lesser scale.
1906480	1907140	Yeah.
1909060	1910240	You only have what?
1913700	1915480	Yeah, yeah.
1918510	1921590	Cool. Thank you very much guys. Thank you for attending.
1921590	1927110	It was a pleasure to be here and again, hit us up and we'd love to answer anything.
1927110	1927950	Thank you very much.
