WEBVTT

00:00.000 --> 00:01.880
We'll go ahead and get started.

00:01.880 --> 00:08.500
We'll have Zhengyu Liu and Jingyue Yu present on the Domino Effect.

00:09.380 --> 00:11.520
Let's clap it up for them.

00:22.230 --> 00:23.830
Hello, everyone.

00:29.280 --> 00:31.240
Should we get started?

00:31.680 --> 00:33.200
Okay.

00:33.280 --> 00:35.000
So, hello, everyone.

00:35.000 --> 00:43.160
Welcome to our talk, the Domino Effect automated detection and exploitation of cloud vulnerability at scale.

00:43.160 --> 00:51.240
So, I'm Zhengyu Liu, and this is my collaborator, Jingyue Yu, and this is our joint work with Tao Li, Zifeng Kang, and my advisor, Yingzhi Cao.

00:51.960 --> 00:57.860
And we're both PhD students from Johns Hopkins University, focused on web security and software security.

00:57.860 --> 01:07.380
And we spend our most of time studying vulnerabilities, building security testing tools, and thinking about how to make the modern world a better place.

01:08.600 --> 01:13.300
And today, we're excited to share our research on dump clobbering.

01:13.300 --> 01:22.140
So, I will first start a very quick overview of what dump clobbering is, and then explain the challenges of detecting those vulnerabilities at scale.

01:22.140 --> 01:26.100
And introduce our automated analysis framework, HAWQ.

01:26.100 --> 01:41.700
And after that, Zhengyu will take over to present our large-scale zero-day hunting results and show how we turn those HTML injection into the end-to-end exploits with dump clobbering gadgets we find.

01:43.260 --> 01:45.020
So, let's begin.

01:45.940 --> 01:52.700
So, dump clobbering originates from an old but still standard browser feature defined in the HTML specification.

01:52.740 --> 01:58.500
And it allows you to perform named lookups on window or document objects to access elements on a page.

01:58.500 --> 02:04.360
Well, this feature provides a convenient way to reference dump elements by their ID or name.

02:04.680 --> 02:14.780
It often opens the door to the dump clobbering attack in the scenario where those elements are attacker-controlled, and it's more than the developer's intention to use them at all.

02:15.220 --> 02:28.220
By crafting a name collision between the dump element's ID or name attributes and a property accessed via the window or document, the attacker could pollute the JavaScript value and change the application logic.

02:29.400 --> 02:40.920
So, and especially modern web applications often accept a wide range of user inputs, including like script-less raw HTML to support things like rich text formatting or like embed media.

02:41.380 --> 02:54.000
For a more concrete example, to give an illustration for people not very familiar with this, is that at first the attacker needs to inject a link or element to the page.

02:54.380 --> 03:01.020
And then the page contains JavaScript that probably reads from like window.remote to load additional scripts.

03:01.020 --> 03:06.760
And if it's undefined, it fallbacks to use like a city and URL and load script from there.

03:07.340 --> 03:14.740
However, with the attacker inject link whose ID equals to the remote, the lookup is no longer undefined.

03:14.740 --> 03:17.900
And instead, it refers to the injected A-link.

03:18.100 --> 03:20.420
And this is what we call a clobber.

03:21.200 --> 03:26.400
And later, like when the dump element is concatenated with the string, type cohesion occurs.

03:26.400 --> 03:36.240
And for those link elements, this converts them from a dump element to their ref value and producing a URL controlled by the attacker.

03:36.760 --> 03:43.480
And finally, the URL flows to the script.source and loading malicious code from attacker's domain.

03:44.940 --> 03:55.100
Since dump clobbering was first introduced by Grace Hess in 2013, a lot of work has been working towards understanding various clobbering techniques.

03:55.100 --> 04:06.240
And as a core, the key question is, which HTML markups can clobber which JavaScript targets and probably enter which browser implementations?

04:06.380 --> 04:14.600
Because the clobbering behaviors is defined in the HTML specification, but the browser implementation varies slightly.

04:15.840 --> 04:29.340
And building on years of the findings and also the updates from the browser, the recent paper from Oakland 2003 called Clobbering Time is the first to systematically answer this question.

04:29.340 --> 04:40.960
It uncovered over 30,000 clobbering-capable HTML markups across five distinct techniques, making a real significant forward in this field.

04:41.880 --> 04:48.200
However, identifying those clobbering behaviors is just the initial payload landing step of the attack.

04:48.420 --> 04:53.480
And for the full exploitation, we still need the gadgets and the exploits.

04:53.540 --> 05:05.920
So the following question is, can we automatically detect those gadgets and generate working exploits so that we can really test them at scale and better understand its landscape in our modern web?

05:05.920 --> 05:08.820
And this is where our work comes in.

05:09.320 --> 05:12.180
So to do that, there are two main challenges.

05:12.260 --> 05:21.240
The first one is that real-world JavaScript, especially after minified or bundled, is full of dynamic behaviors, like aliasing or directed property lookups.

05:21.240 --> 05:24.980
And it's very unfriendly to our static analysis tools.

05:24.980 --> 05:34.300
And those features make it extremely hard to track how data flows through an application, and in turn makes the gadgets a very hard problem.

05:34.700 --> 05:36.860
The second challenge is exploit generation.

05:37.280 --> 05:42.120
In DOM clobbering, the payload is no longer a string, which is usually the case.

05:42.120 --> 05:43.620
But it's a DOM element.

05:43.620 --> 05:52.480
And that element needs to be compatible with the JavaScript operations in the gadgets and carry the attacker-controlled values to the sensitive syncs.

05:52.480 --> 06:01.400
And if the element itself is malformed or is not incompatible with the gadgets, it may break the code or just fail to propagate the payload.

06:02.580 --> 06:11.620
Okay, now let's take a look at a motivating example and show how those challenges failed our existing approaches.

06:11.880 --> 06:19.260
This is a zero-day cross-site scripting caused by DOM clobbering found by Hawk in my favorite Red Hat platform, HackMD.

06:19.520 --> 06:28.920
The HTML injection was possible because the developer allowed the name attributes on the tag and exposing its application to the DOM clobbering.

06:29.560 --> 06:38.840
To escalate the HTML injection to cross-site scripting, Hawk found vulnerable gadgets from the Google client API library used in the page.

06:38.840 --> 06:46.820
And the Google client library is used by a website that tries to integrate the Google service, like Google Drive, Google Maps, or YouTube.

06:46.820 --> 07:00.140
And once the library is loaded on the page, it will precise the developer-defined configurations in the page and callbacks in and by searching the corresponding script tag that contains the configuration URL.

07:00.140 --> 07:11.740
And then we'll use a new function, which you can dynamically generate a function, like a generated JavaScript code, by parsing those configuration objects and execute its code.

07:12.600 --> 07:19.160
But here's the problem, that the source it uses, document.script, is vulnerable to DOM clobbering.

07:19.160 --> 07:29.580
So the attacker can inject a clobbered DOM element that is not a script, like an f-frame with a crafted name equals to the script, to hijack the configuration object.

07:29.820 --> 07:44.760
And combining the HTML injection and the DOM clobbering gadgets in the page, the attacker could achieve cross-scripting by sharing a malicious HackMD node and probably perform any unsorted actions on behalf of the user.

07:45.560 --> 07:52.740
And do you know, like, both the HTML injection and DOM clobbering gadgets have been fixed by the HackMD and the Google, respectively.

07:53.840 --> 07:56.520
And let's talk about the private work.

07:56.660 --> 08:02.080
Like, this thing is a static NS2 that tries to detect this by looking at the source code.

08:02.080 --> 08:08.580
But it fails to detect it because of the dynamic behavior and condition logic embedded in the gadget code.

08:09.220 --> 08:17.620
Secondly, exploiting the gadgets requires HTML that satisfy both the data flow and control flow constraints along the chain.

08:17.620 --> 08:24.040
The data flow constraints ensure that payloads can flow from one attacker-controlled variables to another.

08:24.040 --> 08:31.660
While the control flow constraints ensures that the program state, like, SQ the gadget's logic.

08:31.660 --> 08:35.780
So we don't, like, SQ it earlier.

08:35.920 --> 08:41.200
For example, involves a subscript operation of the value.

08:41.200 --> 08:46.040
So this means our objects must behave like a collection , such as collections.

08:46.420 --> 08:53.380
If it's just a single element, the access on it will throw a runtime error and the gadget will just fail to execute.

08:54.400 --> 09:03.520
And the thing fails to generate a working exploit because it only considers the initial pattern, but ignores all the constraints in the gadget code.

09:03.520 --> 09:10.240
And as a result, it produces payloads like image name equals to script that will never reach the sink.

09:10.600 --> 09:19.620
Another popular client-side testing, too, failed to detect it because it relies on a canary-based testing.

09:19.620 --> 09:29.640
While this approach works very well for stream-based exploits by checking whether partial attacker-controlled values reach the sink, it does not apply to dump clobbering.

09:30.520 --> 09:38.080
Because dump clobbering requires a near-correct HTML element and considering all the constraints from the gadgets.

09:38.080 --> 09:42.320
And it randomly generates HTML that will just never reach the sink.

09:42.500 --> 09:49.260
Or even worse, it will just break the website's functionality and skip executing many real gadgets.

09:50.220 --> 09:50.820
Okay.

09:51.320 --> 09:54.600
Now let's see how we solve the problem with HAWQ.

09:55.500 --> 09:58.300
HAWQ operates in three stages.

09:58.300 --> 10:10.800
So our key insight here is that instead of directly injecting HTML marks from the start, we first perform the tint tracking on website-defined values from those potential clobberable source to the sink.

10:10.800 --> 10:19.120
And this phase is non-intrusive and helps us identify a wide range of potential gadgets without needing to guess the payload.

10:19.220 --> 10:26.700
And next, based on the tint trace, we extract the data flow and control flow constraint and use them to generate the corresponding exploit markups.

10:26.760 --> 10:38.960
Finally, we insert those crafted markups to the page and replay the execution and check whether the payloads reach the sink, confirming whether the gadget is really exploitable or not.

10:42.090 --> 10:47.710
Specifically, in the first stage, HAWQ performs dynamic tint analysis on website-defined values.

10:47.710 --> 10:49.950
We categorize the source into two tabs.

10:49.950 --> 10:56.970
First, the lookups on document can be directly shadowed by the attacker-injected values, like documented links, documented strings.

10:57.010 --> 11:02.530
And in this case, we can directly tint the original values and observe how they propagate in the program.

11:02.670 --> 11:10.630
And second, there are lookups on, like, window objects where the attacker clobber value is only used if the original value is undefined.

11:10.630 --> 11:17.630
And this typically appears in, like, those fallback expressions, like tannery operators or, like, logic or checks.

11:17.630 --> 11:26.930
And in such case, HAWQ will track those fallback values instead and identify opportunities where the attacker-controlled value might take effect.

11:27.310 --> 11:36.850
And HAWQ will only inject its own value, like random value, when there is no website-defined value is present as a fallback.

11:37.690 --> 11:45.130
The sink used in our tint tracking are typical, like, client-side sinks, like in VAL, SETs, Temout, and others.

11:45.770 --> 11:48.910
The tinted value in the page are managed in two ways.

11:48.910 --> 11:58.510
For objects with properties, we just insert another, like, specific field, a non-enumerable property, so that it doesn't interfere with the normal behavior.

11:58.890 --> 12:09.110
For those primitive values, which are very hard to be tinted, we wrap them with a special object that holds both a concrete value and its tint metadata.

12:09.110 --> 12:12.770
So, this allows us to track even undefined values.

12:13.690 --> 12:22.070
Our tint engine supports propagation across JavaScript operations, JavaScript built-ins, and browser-native APIs, and so on.

12:22.550 --> 12:31.750
And the tint propagation rules are implemented in a very extensible way, like adding support of new APIs is as simple as defining a single handler function.

12:32.890 --> 12:37.590
And we implement the tint analysis using a code-rewriting approach based on geology.

12:37.590 --> 12:50.970
Instead of instrumenting the browser itself, it gives us a very flexible feature and allows us to track all types of JavaScript values and supports cross-browser analysis without relying on the browser internals.

12:51.630 --> 12:58.350
The output of the first stage would be the tint trace represents in a tint dependency graph.

12:58.430 --> 13:04.630
And the backbone are the operations, and there are concrete values and also the attacker-controlled tinted values.

13:05.350 --> 13:21.530
Next, the challenge would be, once we have this tint dependency graph, how do we generate the HTML markups that can leverage those operations observed in the graph and carry the attacker-controlled strain all the way to the sinks?

13:21.670 --> 13:35.050
And in the second stage, in this stage, we will introduce the concept of a symbolic DOM, which allows us to formally define the constraints that DOM elements must satisfy at each step along the path.

13:35.050 --> 13:44.150
And then we implement a simple DOM constraint solver that uses those representations to automatically generate the compatible and exploit-ready HTML markups.

13:45.810 --> 13:52.430
So, the first step, to model... so, we need to understand what a successful exploit would look like.

13:52.430 --> 14:00.270
So, to model a valid exploit, we treat the HTML payload as flowing through four key stages in the tint dependence graph.

14:00.270 --> 14:06.290
The initial clobbering, where the attacker's DOM elements first inject to the JavaScript program.

14:06.290 --> 14:13.870
The advanced clobbering, where some parts of the first injected DOM elements get loaded to the program.

14:14.470 --> 14:22.090
And the third stage is DOM to strain, where the strain payload loads from the attacker-controlled DOM elements to the page.

14:22.090 --> 14:30.110
And the final stage is strain to strain, where the strain is precise, or transformed and finally flows to the sink.

14:31.030 --> 14:41.310
In the first stage, the DOM elements should contain ID or name attributes correspond to the name, the lookup keys, which is quite straightforward.

14:41.850 --> 14:46.450
On the second stage, the attacker-controlled elements must be further loaded.

14:46.450 --> 14:54.210
And this stage is only necessary when there are additional JavaScript operations before the strain payloads can be loaded.

14:54.210 --> 15:02.730
And since we cannot skip any JavaScript operations in the graph, so we need to use this advanced clobbering techniques to fulfill them.

15:02.730 --> 15:17.750
And the problem would become, if the base object is an attacker-controlled DOM element, how do we format in a way to make the results of the operation could also be attacker-controlled DOM elements and without raising any error?

15:17.790 --> 15:20.110
And there are a few strategies that can be taken.

15:20.110 --> 15:27.830
The first way is HTML injection, that you can inject multiple DOM elements with the same name attributes, and it will look like an array.

15:28.170 --> 15:40.870
The second way is to use the well-known nested window proxy, parent, child, or input form those relationships to clobber lookups, like whose property is a general string.

15:40.970 --> 15:50.130
And the third way targets a certain DOM-specific properties, like previous symboling, and by arranging the DOM elements to match the expected structure.

15:51.690 --> 16:07.070
And later on, when the attacker... there are several rounds of advanced clobbering, and later on the attacker needs to load its string from the controlled DOM elements to the program, because the final payloads shown in the thing should be in a type of string.

16:07.110 --> 16:09.530
And there are three main ways to achieve this.

16:09.530 --> 16:14.830
The first is the well-known techniques through type cohesion during binary operation, like add.

16:15.010 --> 16:18.390
And this applies to the a and area elements.

16:18.390 --> 16:23.210
We are accessing those elements and triggers the use of its ref value as a string.

16:23.650 --> 16:34.590
The catch here is the ref value must be a valid URL, and browser will often auto-fix it with the protocol, like HTTPS, or whatever is used in the current page.

16:34.590 --> 16:43.390
And to bypass this, attacker will need to inject a base tag before the clobbered element, controlling how those relative URLs are resolved.

16:44.190 --> 16:50.490
Another two-stage operations can be leveraged are function calls and get-fued, which is less documented.

16:50.770 --> 16:59.230
For the function calls, some JavaScript built-ins and browser APIs would automatically coerce its argument or property values to a string.

16:59.530 --> 17:08.770
So in that case, if the attacker control value is passed to those and or accessed in this way, the browser would perform the cohesion just like those during the binary operations.

17:09.450 --> 17:13.090
The third way is to exploit the attribute name collision.

17:13.090 --> 17:18.950
Like if a property name matched to a legitimate reflected DOM attribute, it can be abused.

17:18.950 --> 17:33.990
For example, if the application erased the value property from the element, then the attacker could inject an input tag with a payload saved in its value attribute, because it's a valid attribute name.

17:34.630 --> 17:41.650
And our paper includes a comprehensive list of those attributes and APIs that can be used in this stage.

17:42.530 --> 17:48.870
And finally, there would be a result of a string-related transformation and finally flows to the sink.

17:49.970 --> 17:54.850
Okay, so we know what a legitimate DOM element should look like.

17:54.850 --> 18:02.850
To describe those in a formal way so that we can solve them, we need this symbolic DOM syntax.

18:03.730 --> 18:10.450
So it's basically a constraint syntax to describe a set of DOM elements with the same list of features.

18:10.590 --> 18:15.070
And it comes with four primitives, int, boolean, string, node, and collection.

18:15.350 --> 18:20.750
And each node represents a DOM element which can have a tag name and several attributes.

18:20.850 --> 18:24.110
And a node can have siblings and children.

18:24.110 --> 18:29.570
And a valid symbolic DOM that can be concrete to the HTML must have one root node.

18:30.330 --> 18:42.090
And then with each operation type and also the stage we just mentioned, we could generate the constraints on the inputs or outputs elements using the operations.

18:42.090 --> 18:50.230
For example, to achieve document to DOM through the document.p operation, the DOM elements can be described on the page.

18:50.690 --> 18:55.990
Whereas the is root has tag name and has attribute constraints.

18:56.070 --> 19:01.390
And when p equals to the script, so we can concrete to a very simple HTML element.

19:01.990 --> 19:10.510
And with those model constraints, we can traverse all the operations nodes and attach those constraints to the attacker-controlled nodes.

19:10.510 --> 19:22.570
And each attacker-controlled node in the graph should have two conjunctive sets of constraints as they serve as the return value of this operation and arguments of the subsequent operations.

19:23.430 --> 19:26.550
And finally, we need to merge and solve those constraints.

19:26.630 --> 19:33.710
And the key insight here is that the way it starts from small and then connects those and finally concrete to the HTML.

19:33.890 --> 19:34.610
So what does it mean?

19:34.610 --> 19:43.650
It means that first of all, we focus on the local constraints like a C1 and expand it into a disjunctive norm form or DNF form.

19:43.650 --> 19:51.970
And in this form, each local constraint can represent a valid possible DOM trace that satisfies those constraints.

19:52.070 --> 19:58.970
And next, we will merge the formulas across different DNFs if they point to the same tinted nodes.

19:58.970 --> 20:07.270
And during this process, conflicts may rest and we just need to get rid of them and only save the valid combinations.

20:07.290 --> 20:18.130
And you can think of the second stage as attaching different DOM trace at their shared nodes and discard any combination that doesn't fit together.

20:18.410 --> 20:25.850
And in the last step, we will just concrete the formulas to the HTML marks as exploits.

20:27.650 --> 20:39.250
And finally, in the last step, we would just inject our generated payload and replay the web page and see whether our canary value from the exploit could really flow to the sink.

20:40.030 --> 20:45.690
And next, I'm going to hand over to my collaborator and she will show the results.

20:47.270 --> 20:48.390
Hi.

20:49.770 --> 20:50.610
All right.

20:50.610 --> 20:53.150
So let's get to the real exciting part.

20:53.150 --> 21:08.890
Now I'm going to show some real world examples we found with our toolhawk as well as some so those include some DOM clobbering gadgets in the wild in web applications and libraries and also end-to-end exploitations.

21:09.170 --> 21:19.250
So first, we apply our toolhawk to tranquil top 5,000 websites and found 497 zero-day exploitable gadgets.

21:19.250 --> 21:40.610
So there are our cases includes more than web bundlers like webpack, RS pack, white, polyfuse, and some core functional libraries like prism, page find, mess jacks, version 2 and version 3, and also some third-party services including plausible analytics,

21:40.610 --> 21:47.010
Google client, API library, and also web application framers like Astro.

21:47.010 --> 21:48.710
Our data set is public.

21:48.710 --> 21:52.890
You can access the whole data set through this QR code if you are interested.

21:54.690 --> 21:58.550
So the first case I want to show you is the webpack.

21:58.550 --> 22:08.830
So according to an investigation, there are an average of 1.27 webpack bundles per site among the tranquil top 100K websites.

22:08.830 --> 22:17.310
So this vulnerability we found by Hawk can lead to cross-site scripting on websites that uses webpack as the bundler.

22:17.470 --> 22:22.650
So in case you are not familiar, so the pipeline of using webpack is like this.

22:22.650 --> 22:36.090
First you have to feed the website source code to the webpack to generate the production code, which includes a compressed website code and also the webpack runtime code, which is a webpack library code.

22:36.090 --> 22:41.670
And in that webpack runtime code is where we found the dump clobbering gadgets.

22:41.670 --> 22:51.550
So with that dump clobbering gadget, if that website contains an HTML injection, this gadget can cause cross-site scripting.

22:52.730 --> 22:55.810
So let's jump into the code gadget.

22:56.490 --> 23:10.010
So webpack requires the developer to set the public house to be auto or you can either leave it to be empty in hope that the webpack will help you load some external scripts.

23:10.010 --> 23:14.950
But actually it is doing more harm than you think it is doing good.

23:15.470 --> 23:24.850
So if we pay attention to the code itself, in the first box we marked up, so the document or current script can actually be clobbered.

23:24.850 --> 23:31.050
And then in the box 2, the script URL is loaded as the document.script.sauce.

23:31.050 --> 23:47.270
So in this case, if we construct our payload like this with the source equals to HTTPS attacker.control.server, that script URL will be an attacker control URL.

23:47.270 --> 23:58.990
And then later, finally, this script URL is used as the webpack required.p, which will be later load that script from that attacker control domain.

23:58.990 --> 24:03.170
So that will cause arbitrary script loading from the attacker server.

24:06.260 --> 24:09.600
So the second case I want to show is the Astro.

24:09.600 --> 24:17.000
It is a widely adopted client server web framework to help you construct a web application from scratch.

24:18.280 --> 24:28.400
So in this code, we can also find some clobbering gadget where the clobberable element is here, the document.scripts.

24:28.400 --> 24:30.860
But this case is a little bit special.

24:30.860 --> 24:38.260
So if we pay attention how the document.script is used, we can see it is accessed through array.from.

24:38.260 --> 24:46.020
So the code is treating the document.scripts as an array, not just one single HTML element.

24:46.020 --> 24:54.600
So in this case, we have to construct the payload as an HTML collection instead of just single one HTML element.

24:56.040 --> 25:05.060
So and then if we jump into the for loop to see how do we reach the final sync, we can see two conditional checks before we reach the sync.

25:05.060 --> 25:13.680
So the first condition check checks whether the script.dataset.astro.exec is equal to an empty string.

25:13.680 --> 25:23.120
And the second condition checks check the type which is an attribution which is the type attribution of the HTML element we got before.

25:23.380 --> 25:31.320
So to bypass those two condition checks with our payload, the first script.dataset is undefined.

25:31.320 --> 25:36.780
So the first condition will return false which causes the code to continue execution.

25:36.800 --> 25:43.780
And then when we reach the second condition, the type again in our payload, the type attribution does not exist.

25:43.780 --> 25:47.740
So the second condition will also return false.

25:47.960 --> 25:58.980
That will finally lead us to the final sync where the new script is loaded from new script is created as a new element with a script type.

25:58.980 --> 26:04.220
And it's innerHTML is copied from the payloads in innerHTML.

26:04.220 --> 26:12.620
So finally we can achieve arbitrary code execution if we construct our payload as this HTML collection.

26:13.360 --> 26:16.700
So in our case, the innerHTML will be alert 1.

26:17.560 --> 26:20.200
That caused the process drifting.

26:20.200 --> 26:25.160
And then the final case study I want to show you is the UM editor.

26:25.160 --> 26:28.780
It's an editor previously maintained by Baidu.

26:28.780 --> 26:33.580
So in this code, it's a little bit straightforward.

26:33.580 --> 26:48.940
So if we see ‑‑ we can see the clobberable element is the window.UM editor underscore home underscore URL which in our case will be the HTTP attacker.control.com.

26:48.940 --> 26:55.180
And then later that variable URL is used to be assigned to a global variable.

26:55.180 --> 26:58.240
UM editor underscore config.

26:58.240 --> 27:08.420
And then later that variable is concatenated with some constant strings to construct the final URL that will be ‑‑ that the code will be loading the script from.

27:08.420 --> 27:13.780
It is also causing the scripts being loaded from the attacker's domain.

27:16.330 --> 27:21.310
So finally I want to talk about the end‑to‑end exploitation.

27:21.310 --> 27:27.390
So to understand the end‑to‑end exploitation, we first need to achieve HTML injection.

27:27.390 --> 27:35.070
So as mentioned before, the web application they accept and process all sorts of user inputs.

27:35.070 --> 27:37.590
But how does it become unsafe?

27:37.590 --> 27:40.650
So we have some basic findings.

27:40.650 --> 27:48.830
So first, some sanitizers from these websites, they do not strip the ID or name attribution by default.

27:48.850 --> 27:59.590
And the web applications, they are not aware of this vulnerability and they rely on those ID or name attributes for intended logic.

27:59.590 --> 28:10.390
So due to these reasons, the ID or name attribute, they sometimes slip through the white lists as they don't seem harmful at all.

28:11.730 --> 28:22.490
So based on how these web applications process the user inputs, we categorize the input factors of HTML injection into two types.

28:22.490 --> 28:26.590
The first is by user typing and the application rendering.

28:26.590 --> 28:33.650
The second is by the user copy and paste HTML elements into the page directly.

28:34.010 --> 28:37.010
So the first case is easy to understand.

28:37.010 --> 28:51.330
The attacker might input some raw HTML strings such as the image tag with source equals to X and on error equals to alert 1 into some user controllable fields.

28:51.330 --> 28:58.930
And then those strings are later parsed and rendered by the web application without proper sanitization.

29:00.290 --> 29:08.570
So the second input factor is to insert through copy and paste HTML elements into the page directly.

29:08.570 --> 29:11.250
This is based on several factors.

29:11.250 --> 29:19.530
The first is that the elements whose content editable attributes is enabled, they can accept HTML elements directly.

29:19.530 --> 29:27.170
And second is that the clipboard data can have text or HTML MIME type, not just plain text.

29:27.170 --> 29:35.350
And also the browser clipboard APIs, they will sanitize cross-site scripts but they do not sanitize ID or name attributes.

29:35.350 --> 29:40.610
As mentioned before, they don't look harmful at all at most of the cases.

29:41.450 --> 29:52.670
So based on these factors, what if the website just saved these HTML elements input from the user or attacker without proper sanitization?

29:52.670 --> 29:55.690
That will cause the stored HTML injection.

29:56.770 --> 30:00.130
I will show you with one real world example we found.

30:00.130 --> 30:05.330
So this is the Canvas LMS discussion at JHU in our school.

30:05.330 --> 30:15.890
So in the discussion board, in the input box, if you just directly input some raw HTML text into the input box, they will be sanitized.

30:15.890 --> 30:26.450
But if you directly copy and paste HTML elements into the input box, the website will actually accept those elements and render those elements in the website.

30:26.450 --> 30:28.850
That will cause the HTML injection.

30:29.030 --> 30:34.030
This is usually caused by the web application developers.

30:34.030 --> 30:43.370
They are mostly cautious about user inputs by typing but sometimes they are just careless about the contents from the clipboard.

30:43.370 --> 30:47.130
That's why it's causing HTML injection in this case.

30:48.070 --> 30:56.550
So we also manually hunted for HTML injection in the world in real world applications.

30:56.550 --> 31:11.390
So we manually discovered 187 HTML injection vulnerabilities in various web applications including wiki, web mail, forum, editors, RSS, social media, chat bot, and so on.

31:11.390 --> 31:18.530
So and we also summarized 12 editors and client-side libraries that are vulnerable to HTML injection.

31:18.530 --> 31:21.830
They can also be accessed in our public data set.

31:23.310 --> 31:40.030
And then in terms of end to end exploitation, with all the DOM clobbering gadgets we found by HAWQ and also the HTML injection vulnerabilities we found manually, we can achieve 12 end to end exploitation with our with those gadgets and HTML injection.

31:40.030 --> 31:47.990
So in those includes 11 of them leading to cross-site scripting and one of these two CSRF.

31:47.990 --> 31:55.810
And the affected applications include the Jupyter lab or notebook and also Canvas LMS.

31:57.510 --> 32:02.370
So let's dive into the Jupyter lab or Jupyter notebook for details.

32:02.370 --> 32:17.950
The first summary, so we found HTML injection in Jupyter lab, Jupyter notebook, web page, and also we found DOM clobbering gadget with HAWQ in both version 2 and version 3.

32:18.030 --> 32:23.670
The message library is used by the Jupyter lab to render mathematical formulas.

32:23.670 --> 32:28.250
And though combining those two together we can achieve end to end exploitation.

32:30.050 --> 32:49.070
So in terms of the HTML injection, we found that in the markdown preview page of Jupyter lab, if we insert some, if we just type in raw HTML tags for example image or whatever HTML elements, it will be accepted and rendered in the web page.

32:50.550 --> 32:56.510
And we also reported this end to end vulnerability to the developer of Jupyter lab.

32:56.510 --> 33:08.590
And they also confirmed that it is not trivial to mitigate this vulnerability because the ID and name attributes they are assumed to work by a large number of widget libraries.

33:08.590 --> 33:14.750
So a very easy example is that for example there is a markdown file with two hash tags hello.

33:14.750 --> 33:21.710
This tag will be rendered as an H2 element with the ID equals to hello.

33:21.710 --> 33:31.090
And the ID hello will later or somewhere be used as the fragment identifier in the URL to locate that element in the page.

33:33.840 --> 33:45.820
So if we take a look at the MathJax library, it is a library used while used to render mathematical formulas and it is used by the Jupyter lab.

33:46.600 --> 33:54.240
So with our toolhawk we found dump clobbering gadgets in both MathJax version 2 and version 3.

33:54.240 --> 34:01.360
And just days before they released version 4 and they promised to fix this vulnerability but we haven't checked yet.

34:01.360 --> 34:03.760
Just say good luck.

34:04.560 --> 34:05.220
Okay.

34:05.220 --> 34:13.520
So if we take a look at the MathJax version 2 we will find the window dot MathJax here is clobberable element.

34:13.520 --> 34:22.420
And then later that variable is combined is concatenated with some constant strings to construct a file URL.

34:22.420 --> 34:25.660
And here a type coercion happens.

34:25.840 --> 34:39.740
And finally that file URL is used to load is used to the script source which is to load the attacker control the scripts.

34:40.160 --> 34:43.620
That will cause cross-site scripting.

34:43.620 --> 34:58.380
And but if we take a look at the version 3 just at the first glance there is no more clobberable window dot MathJax and there is no more loading of additional dependency scripts by default.

34:58.520 --> 35:11.760
But by leveraging hawk we found that MathJax version 3 they supports using the require macro which allows you to load extension scripts.

35:12.240 --> 35:20.140
So we further found that in version 3 of MathJax there is a clobberable element called document dot current script.

35:20.140 --> 35:30.380
And then later that document dot current script is document dot current script SRC attribution is get.

35:30.380 --> 35:40.320
And with some regular expression replacement operation the string from that payload is retrieved.

35:40.320 --> 35:52.100
And then finally that T variable is assigned to the R dot SRC which is which is the SRC attribute of one script element in a page.

35:52.100 --> 35:56.820
That is also causing loading scripts from the attacker's domain.

36:00.480 --> 36:02.400
So okay.

36:03.440 --> 36:09.780
So till now we have both dump clobbering gadgets from MathJax both version 2 and version 3.

36:10.020 --> 36:27.020
And also with our research on dump clobbering we reported those problems and Firefox is also supporting considering patching the dump clobbering by disabling the shadowing on document lookups.

36:27.660 --> 36:32.980
And they are they are referring to the zero day gadgets found by our tool hawk.

36:32.980 --> 36:34.740
That's good news.

36:34.840 --> 36:45.700
So to summary we design and implement hawk a dynamic analysis tool for automatically detecting and exploiting dump clobbering gadgets.

36:45.700 --> 37:03.220
So and we also conduct a large scale study over the trunk top 5,000 websites and identify 497 exploitable gadgets revealing the widespread presence of dump clobbering vulnerabilities in popular client side libraries.

37:03.220 --> 37:14.360
And also we demonstrate 12 end to end exploitations by combining the discover gadgets with real world HTML injections validating their practical impact.

37:14.360 --> 37:19.980
So our tool the source code, the data set and the paper are all open source.

37:19.980 --> 37:22.960
Feel free to access them if you are interested.

37:23.100 --> 37:29.040
And also both of us, Zhang Yu and Jianjia, we are open to internship or full time jobs.

37:29.040 --> 37:33.660
So if you have any opportunities please feel free to reach out to us.

37:33.660 --> 37:34.260
Thank you.

