1 00:00:00,000 --> 00:00:06,660 Hello everyone, my name is Arseniy Ryotov, this is Fedor Sakharov, and today we'll be 2 00:00:06,660 --> 00:00:12,920 speaking about detected web attacks with recurrent neural networks. 3 00:00:13,910 --> 00:00:18,420 So before we start, a little bit about ourselves. 4 00:00:19,680 --> 00:00:23,860 I'm an application security researcher at Positive.com. 5 00:00:23,960 --> 00:00:29,480 Positive.com is an application security company, and Fedor is a software developer 6 00:00:29,480 --> 00:00:32,240 at SOM.com. 7 00:00:32,400 --> 00:00:36,060 SOM is a decentralized computing platform. 8 00:00:37,140 --> 00:00:42,360 So our presentation will be divided into three parts. 9 00:00:42,600 --> 00:00:48,680 We will start with the problem, the challenges of web attack detection. 10 00:00:49,080 --> 00:00:58,820 Then we will move to the actual solution, the anomaly detection for HTTP requests with 11 00:00:58,820 --> 00:00:59,340 attacks. 12 00:00:59,480 --> 00:01:01,000 Using deep learning. 13 00:01:01,240 --> 00:01:06,380 And then we will finish with our results, demo, and our plans. 14 00:01:07,700 --> 00:01:15,760 So the first part, I would like to speak about the problem. 15 00:01:16,540 --> 00:01:20,060 So we are solving the problem of web attack detection. 16 00:01:20,500 --> 00:01:23,380 So what are web attacks? 17 00:01:25,400 --> 00:01:29,240 The systems that aim at detection. 18 00:01:29,480 --> 00:01:32,700 And web attacks are called web application firewalls. 19 00:01:33,260 --> 00:01:43,000 These are the systems that protect websites and web applications against the attacks on 20 00:01:43,000 --> 00:01:51,260 the higher level of OSI L7 attacks. 21 00:01:51,740 --> 00:01:55,880 The first commercial was appeared about 20 years ago. 22 00:01:55,880 --> 00:02:00,260 And the most known open source one was security. 23 00:02:01,940 --> 00:02:09,920 Typically, WAFs operate as a reverse proxy, so we have some intermediate server that processes 24 00:02:09,920 --> 00:02:15,600 the traffic, web traffic, and then proxies it to the back end. 25 00:02:17,380 --> 00:02:24,600 And mostly, WAFs use pattern matching nowadays, still use it to detect web attacks. 26 00:02:26,520 --> 00:02:32,080 From WAF perspective, there are basically two types of web attacks. 27 00:02:32,560 --> 00:02:35,460 The first one is time series based. 28 00:02:35,740 --> 00:02:46,220 So that it means that the attacker tries to make different multiple requests to perform 29 00:02:46,220 --> 00:02:47,160 his attack. 30 00:02:47,460 --> 00:02:54,140 It may be a web scraping, root forcing for example, a login page, fingerprinting to detect 31 00:02:54,140 --> 00:02:54,580 the virtual network. 32 00:02:54,580 --> 00:02:59,200 version of your web server, or scanning, for example, for vulnerabilities. 33 00:03:00,120 --> 00:03:07,800 And the second one, the second type of attacks is based on a single request, a single pair 34 00:03:07,800 --> 00:03:10,540 of HTTP requests and HTTP response. 35 00:03:11,520 --> 00:03:15,500 These attacks can be detected on per-request basis. 36 00:03:16,000 --> 00:03:22,460 These are, for example, SQL injection, cross-site scripting, XML external antigen injections, 37 00:03:22,460 --> 00:03:32,880 and all other attacks that are basically some kind of injection into some HTTP parameter. 38 00:03:34,650 --> 00:03:40,420 And the focus of our research will be the second type of attack. 39 00:03:40,580 --> 00:03:50,880 So we do not analyze at present the sequences, but we analyze single requests and try to 40 00:03:50,880 --> 00:03:52,260 detect and analyze. 41 00:03:52,460 --> 00:04:00,400 So we do not analyze single requests to detect some patterns of web attack injections. 42 00:04:02,420 --> 00:04:08,920 Now I would like to compare classic pattern matching to machine learning approach. 43 00:04:10,040 --> 00:04:19,520 Pattern matching is effective to detect known attack vectors, and it can be easily maintainable. 44 00:04:19,680 --> 00:04:20,700 It's just a text file. 45 00:04:20,840 --> 00:04:22,380 You can open it in any. 46 00:04:22,460 --> 00:04:31,560 Text editor and add your additions, or you can delete anything, or you can maintain it 47 00:04:31,560 --> 00:04:34,560 via version control, such as Git. 48 00:04:35,640 --> 00:04:37,680 And it can be pretty fast. 49 00:04:38,920 --> 00:04:46,140 The results are always predictable, and rules and patterns can work out of the box. 50 00:04:46,280 --> 00:04:49,880 So you don't need to mostly... 51 00:04:52,460 --> 00:04:58,700 tune it for particular websites, so it can work for majority of websites. 52 00:04:58,960 --> 00:05:01,600 But, of course, false positives can happen. 53 00:05:02,880 --> 00:05:10,220 There are also some disadvantages of pattern matching, such that they are subject to attacks 54 00:05:10,220 --> 00:05:10,600 themselves. 55 00:05:11,020 --> 00:05:21,020 So if you write a pattern that is not well thought of, that contains some vulnerabilities, 56 00:05:22,020 --> 00:05:28,620 then it can be subject to such attacks like redraws, so you can perform denial of service 57 00:05:28,620 --> 00:05:31,260 on the pattern that is buggy. 58 00:05:32,680 --> 00:05:37,680 And patterns are typically easily bypassed by hackers. 59 00:05:37,900 --> 00:05:44,640 So if they have a valve that uses patterns to block, for example, SQL injections, it 60 00:05:44,980 --> 00:05:46,720 can be easily bypassed. 61 00:05:48,440 --> 00:05:50,940 And of course, it's not so effective. 62 00:05:51,000 --> 00:05:55,420 It can be effective at catching zero days, so unknown vectors that... 63 00:05:55,420 --> 00:06:01,580 So pattern matching cannot extrapolate to unknown vectors. 64 00:06:02,380 --> 00:06:09,860 And to write a pattern, to write some rule, you, of course, need to understand what you're 65 00:06:09,860 --> 00:06:10,600 protecting from. 66 00:06:10,880 --> 00:06:13,320 So you need extensive web security knowledge. 67 00:06:14,560 --> 00:06:17,680 And yeah, pattern matching causes lots of false positives. 68 00:06:21,000 --> 00:06:27,000 So let's see what benefits and disadvantages presents machine learning. 69 00:06:28,580 --> 00:06:33,780 The biggest advantage, of course, is that machine learning can extrapolate. 70 00:06:33,880 --> 00:06:36,420 It can detect previously unseen samples. 71 00:06:38,150 --> 00:06:41,360 And usually, it's not so easy to bypass. 72 00:06:43,400 --> 00:06:48,680 It's also pretty fast, if we are speaking about just the forward pass, not training. 73 00:06:51,000 --> 00:06:57,340 It doesn't require web security knowledge, especially if we speak about deep learning, 74 00:06:57,600 --> 00:07:02,860 when you don't need to extract features prior to training. 75 00:07:05,840 --> 00:07:11,980 And the disadvantages of machine learning is that it requires some time, of course, 76 00:07:12,140 --> 00:07:13,400 to be trained. 77 00:07:15,340 --> 00:07:18,480 The results are difficult to interpret. 78 00:07:18,780 --> 00:07:19,720 It just... 79 00:07:19,720 --> 00:07:29,820 A decision, zero or one, it just tells that there is something in this particular request 80 00:07:29,820 --> 00:07:37,860 that is uncommon, but I cannot tell you what is uncommon, what kind of vulnerability or 81 00:07:37,860 --> 00:07:40,080 a check is in this particular request. 82 00:07:41,330 --> 00:07:46,960 And you cannot predict the behavior of a trained model. 83 00:07:48,160 --> 00:07:49,560 If we compare... 84 00:07:49,560 --> 00:07:51,540 If we compare to rules and patterns. 85 00:07:52,580 --> 00:07:55,800 And models are not so easy to maintain. 86 00:07:56,060 --> 00:08:00,280 You cannot just open it in a text file and modify it. 87 00:08:00,420 --> 00:08:03,000 You always need to retrain it. 88 00:08:04,640 --> 00:08:07,160 So these were the problematics. 89 00:08:09,260 --> 00:08:12,880 Now I would like to state the goals of our research. 90 00:08:13,100 --> 00:08:14,200 There are three of them. 91 00:08:14,280 --> 00:08:18,580 The first one is that we would like to... 92 00:08:18,580 --> 00:08:19,540 The first one is that we would like to... 93 00:08:19,540 --> 00:08:25,840 Create a deep learning model that does not require feature extraction prior to training. 94 00:08:26,080 --> 00:08:33,800 The second one is that this model should solve the anomaly detection problem in HTTP requests. 95 00:08:35,180 --> 00:08:39,620 And finally, this model should yield interpretable results. 96 00:08:43,460 --> 00:08:48,200 What is an anomaly if we are speaking about HTTP requests? 97 00:08:48,360 --> 00:08:49,420 In fact... 98 00:08:49,420 --> 00:08:50,540 In fact, it can be anything. 99 00:08:50,900 --> 00:08:58,780 It can be just a request that has, for example, three headers, HTTP headers, instead of normal 100 00:08:58,780 --> 00:08:59,600 20. 101 00:09:00,000 --> 00:09:05,180 Or it can be a spam, or it can be even a zero-J attack. 102 00:09:06,920 --> 00:09:15,120 And the model should understand the intention of this HTTP request, whether it is malicious 103 00:09:15,580 --> 00:09:16,220 or not. 104 00:09:16,300 --> 00:09:18,580 Like in classic movie sentiment. 105 00:09:21,200 --> 00:09:30,520 And of course, malicious and benign classification greatly depends on the samples and the history 106 00:09:30,520 --> 00:09:31,800 of previous observations. 107 00:09:35,020 --> 00:09:46,320 There are three examples that I want to share with you, just to show how important to be 108 00:09:46,320 --> 00:09:47,340 able to... 109 00:09:47,920 --> 00:09:48,560 To... 110 00:09:48,560 --> 00:09:53,500 Take into account the context and the history of the previous observations. 111 00:09:55,400 --> 00:10:06,320 If you're a web security enthusiast, of course, you would notice here that this request has 112 00:10:06,320 --> 00:10:12,180 a string that resembles an SQL injection attempt. 113 00:10:12,640 --> 00:10:17,940 But without context, we cannot say that it is a real SQL injection. 114 00:10:17,940 --> 00:10:18,480 Or not. 115 00:10:20,260 --> 00:10:27,900 So, in fact, this request comes from a backtracking system known as JIRA. 116 00:10:28,080 --> 00:10:33,360 And they use the special query syntax called JQL. 117 00:10:33,900 --> 00:10:44,200 And a pattern matching approach would detect this request as an attack, because obviously, 118 00:10:44,400 --> 00:10:47,560 there are some keywords that... 119 00:10:48,640 --> 00:10:52,000 That are a sign of an SQL injection. 120 00:10:52,860 --> 00:10:56,820 But in fact, this request is benign. 121 00:10:56,960 --> 00:11:00,320 And it shouldn't be classified as an attack. 122 00:11:01,840 --> 00:11:03,120 Let's see this example. 123 00:11:04,280 --> 00:11:11,920 In this request, you can see a POST parameter that has some HTML markup. 124 00:11:13,500 --> 00:11:17,540 Just looking at this example, we cannot say that this request has some HTML markup. 125 00:11:17,540 --> 00:11:19,680 Because this request is actually an attack, again. 126 00:11:19,960 --> 00:11:29,420 But web security hackers would definitely try to inject there some, for example, script 127 00:11:29,420 --> 00:11:32,880 checks to see if there is an XSS vulnerability. 128 00:11:35,500 --> 00:11:43,860 Again, a pattern matching approach would definitely block this request, because there are some 129 00:11:43,860 --> 00:11:45,340 HTML checks. 130 00:11:46,340 --> 00:11:47,060 Okay. 131 00:11:47,060 --> 00:11:54,460 But in fact, this is a request that is also benign. 132 00:11:54,660 --> 00:11:59,000 And this markup is allowed for this particular website. 133 00:11:59,440 --> 00:12:09,400 And only knowing the previous states, previous observations with the module can tell that 134 00:12:09,400 --> 00:12:13,220 this HTTP request is actually benign. 135 00:12:14,640 --> 00:12:16,980 And the search example. 136 00:12:16,980 --> 00:12:26,360 This request is, as you can see in the host header, comes from a content management framework 137 00:12:26,360 --> 00:12:27,520 called Joomla. 138 00:12:27,960 --> 00:12:36,180 And looking at the task parameter, you can see that this is probably a typical user registration. 139 00:12:38,520 --> 00:12:45,960 But in fact, there is an additional parameter, as you can see, user groups. 140 00:12:46,100 --> 00:12:46,960 Which is API. 141 00:13:01,020 --> 00:13:13,620 Um, um, and the solution for that is to create, um, this, um, in anered, uh, in an, um, negative 142 00:13:13,960 --> 00:13:14,360 So it can, it can, uh, can, uh, in an array. 143 00:13:14,360 --> 00:13:14,720 Uh, what a nice way to, uh, to, uh, do that, uh, uh, to, uh, to, to, um, to, uh, to, to, 144 00:13:14,720 --> 00:13:16,940 But, um, then we need to, uh, make, you know, like, this, to, to, to, uh. 145 00:13:16,940 --> 00:13:27,080 would just let this request pass because it doesn't contain any injections, it just has an 146 00:13:27,460 --> 00:13:36,100 additional parameter with the value 7 so it typically would not be blocked. But a module that 147 00:13:36,100 --> 00:13:46,460 is properly trained and our module would detect this request as an attack. So this is the 148 00:13:46,940 --> 00:14:00,300 next part is actual solution, how our module works and how it was built. All right. Please 149 00:14:00,300 --> 00:14:08,160 raise your hands those of you who know what a neural network is. All right. Now those of you 150 00:14:08,160 --> 00:14:16,900 who know what is a convolutional neural network is. Right. And recurrent neural network. All 151 00:14:16,940 --> 00:14:30,220 right. Okay. LSTM. Good. So I guess I'll have to spend a little bit more time on this. We 152 00:14:30,220 --> 00:14:38,600 decided to build this machine learning algorithms just like a proof of concept inside our web 153 00:14:38,600 --> 00:14:46,920 application framework protection. So first of all we have a very simple application. We 154 00:14:46,940 --> 00:14:55,180 tried to build a classifier and well what we tried to do is we tried to collect some benign data 155 00:14:56,140 --> 00:15:06,760 and obviously we didn't have any malicious data for some example web application. So we had to 156 00:15:08,840 --> 00:15:16,860 generate some malicious examples. So it would look something like this. There would be a request 157 00:15:16,940 --> 00:15:24,760 which are labeled malicious and some of them would be labeled benign. So let's try to build a 158 00:15:24,760 --> 00:15:36,580 classifier. Well what is an HTTP protocol? It is a text based protocol and each line of it is an 159 00:15:36,580 --> 00:15:46,840 independent sentence. It consists of headers, URI which are not that long, some body information, 160 00:15:46,940 --> 00:15:55,520 some code. It may be somehow encoded like whatever and well it's text and it's sequential in nature 161 00:15:55,520 --> 00:16:01,640 and for example the values of the parameters they depend on the names of the parameters so it 162 00:16:01,640 --> 00:16:16,040 would be a weird thing to see an IP address in the connection header or something weird. So we decided to 163 00:16:17,980 --> 00:16:25,460 use recurrent neural networks for analyzing text data they deal pretty well with 164 00:16:28,640 --> 00:16:35,500 texts and it's a class of neural networks that can work with sequential data the data which is 165 00:16:35,500 --> 00:16:50,580 varies in its size and its sequences where like normal texts or music or movies or whatever first 166 00:16:50,580 --> 00:17:00,700 we tried to use simple recurrent neural networks and we built a classifier on top of it and tried 167 00:17:00,700 --> 00:17:05,360 to evaluate our results which were somewhat good 168 00:17:05,500 --> 00:17:13,200 but however there are known problems the results are not interpretable in classification you just 169 00:17:13,200 --> 00:17:22,300 get a label and you don't know why model considers something to be malicious or benign so your user 170 00:17:22,300 --> 00:17:28,540 which is probably not the security experts will have no way of understanding the decisions of 171 00:17:28,540 --> 00:17:35,400 your model also you have a need to construct the malicious data which is tricky because you can 172 00:17:35,400 --> 00:17:35,480 understand the decisions of your model also you have a need to construct the malicious data which is tricky because you can 173 00:17:35,480 --> 00:17:41,400 just like take your benign samples inject some known attack sequences to 174 00:17:41,400 --> 00:17:48,060 them and call that your malicious data set which is kind of weird because most 175 00:17:48,060 --> 00:17:53,340 likely real attacks to your web application will not look like the data 176 00:17:53,340 --> 00:18:00,420 set you generated and it also needs manual labeling for example you want to 177 00:18:00,420 --> 00:18:04,780 detect SQL injections XSS attacks benign data 178 00:18:05,840 --> 00:18:09,840 whatever else you want to detect so it becomes your class 179 00:18:09,840 --> 00:18:16,480 but you have to label it and well it has a certain problem 180 00:18:16,480 --> 00:18:21,300 if you encounter a new type of attack it's not clear which class it will 181 00:18:21,300 --> 00:18:21,800 belong to 182 00:18:24,660 --> 00:18:32,100 ok so what we tried to do is we tried to improve our classifier 183 00:18:33,100 --> 00:18:34,700 and the first thing 184 00:18:34,700 --> 00:18:44,640 we decided to add the attention layer. Attention mechanism is something that solves a lot of 185 00:18:44,640 --> 00:18:52,980 problems. Well, first of all, it aids the process of learning, and it also makes the results of 186 00:18:52,980 --> 00:19:02,680 your decision process interpretable. You can use it to highlight the parts of the data that 187 00:19:02,680 --> 00:19:09,120 your model considered the most important in its decisions, and not highlight something that 188 00:19:09,120 --> 00:19:15,520 it considered not important. But it still improves our situation, but it still doesn't solve 189 00:19:15,520 --> 00:19:25,760 the problems of the classification. But what if we tried to detect anomalies instead of trying 190 00:19:25,760 --> 00:19:32,420 to classify our data into SQL injections, XSS attacks, and so on and so forth? Well, the initial 191 00:19:32,420 --> 00:19:32,660 question is, what if we tried to classify our data into SQL injections, XSS attacks, and so on 192 00:19:32,680 --> 00:19:37,940 Well, the initial task of attack detection is more similar to it, and if you think about it, it's 193 00:19:37,940 --> 00:19:47,260 exactly what the human brain would do. Well, if you tried to detect some anomalous attack in your 194 00:19:47,260 --> 00:19:52,660 web application, you would probably first detect something weird about the request, and only then 195 00:19:52,660 --> 00:19:58,820 you would understand that it's an SQL attack, for example. Well, the advantage of that is that if 196 00:19:58,820 --> 00:20:02,660 we built a reasonable anomaly detection platform, we would be able to detect some anomalous attacks 197 00:20:02,660 --> 00:20:09,100 and we would no longer have to mutually label the data to generate our malicious samples, and 198 00:20:12,540 --> 00:20:13,640 that would do it. 199 00:20:13,940 --> 00:20:22,560 The link embedded, not well. Well, there's a class of recurrent neural networks that are used 200 00:20:22,560 --> 00:20:31,780 mostly for machine translation or for music generation or whatever. It is a so-called encoder 201 00:20:32,660 --> 00:20:45,020 decoder models, and they're basically two different recurrent networks with LSTM cells, which are 202 00:20:45,020 --> 00:20:54,960 connected with each other in the following fashion. The encoder processes the inputs, and it 203 00:20:54,960 --> 00:21:02,640 outputs some state which is a fixed-sized vector. Then it's fed into the decoder, and it's fed into 204 00:21:02,640 --> 00:21:10,320 the decoder, and also our sequence fed into it, and the decoder outputs some target. Well, for 205 00:21:10,320 --> 00:21:20,380 machine translation that's used, obviously, the sequences are sentences, say, in English, and the 206 00:21:20,380 --> 00:21:32,020 target sentence is the sentence in French, so the encoder and decoder will possibly translate your 207 00:21:32,640 --> 00:21:42,080 sequence to French in a nice fashion. It works in Google Translate and a lot of applications 208 00:21:42,080 --> 00:21:48,400 nowadays, but what if our target sequence would be the same as the input sequence? 209 00:21:57,980 --> 00:22:01,940 We could build a model where 210 00:22:01,940 --> 00:22:18,580 we feed the... So, yeah, so what about if we build a model where the targets are the same as the 211 00:22:18,580 --> 00:22:24,440 inputs, but not really the same, but the probabilities of the inputs, which during the 212 00:22:24,440 --> 00:22:31,820 learning phase would be one-hot vectors. For example, if we have our request, the first letter 213 00:22:31,940 --> 00:22:39,960 of it, G-E-T, we also feed it to the decoder, and the decoder outputs the possibilities of the 214 00:22:40,500 --> 00:22:47,620 letters. The first output is the possibility of the letter G, the second of the letter E, and so 215 00:22:47,620 --> 00:22:59,040 on and so forth. So what we're trying to do is to teach our encoder-decoder model to reconstruct the 216 00:22:59,040 --> 00:23:01,240 data with some possibilities. 217 00:23:06,080 --> 00:23:13,600 Now the outputs of the model are the probabilities of each letter in the sequence, and also we collect 218 00:23:13,600 --> 00:23:24,480 the whole loss of this reconstruction process, and if the model so-called failed to reconstruct 219 00:23:24,800 --> 00:23:29,760 our request, then we consider that this request is anomalous. 220 00:23:30,640 --> 00:23:31,060 And 221 00:23:33,420 --> 00:23:43,020 it turns out that the probabilities of the anomalous characters in the request, which would be 222 00:23:43,020 --> 00:23:45,220 considered anomalous, are quite low. 223 00:23:50,280 --> 00:23:59,420 So here's a bit about how actually the input data is processed. Well, earlier this day there was this 224 00:23:59,420 --> 00:24:00,520 great talk by... 225 00:24:01,940 --> 00:24:07,980 I don't know, a gentleman about the reverse engineering and recurrent neural networks. He explained a bit 226 00:24:07,980 --> 00:24:16,720 about embeddings. Well, we also use embeddings, but we don't use the word embeddings. We use letter 227 00:24:16,720 --> 00:24:27,180 embeddings and just use some vocabulary pre-created to... 228 00:24:27,180 --> 00:24:28,360 ... 229 00:24:32,720 --> 00:24:40,000 ...transfer our sequences to numeric data. And also, the batches... the data inside the batches 230 00:24:40,000 --> 00:24:46,760 is padded to the maximum length in the batch. It's... it improves the learning process, I don't know 231 00:24:46,760 --> 00:24:46,980 why. 232 00:24:49,420 --> 00:24:57,640 So in the end we built a model which detects anomalies which can be visualized in the following 233 00:24:57,640 --> 00:25:01,920 matter. Here we have an SQL injection, and after the SQL injection we have the modern project data, and in the 234 00:25:01,940 --> 00:25:05,620 And you see that the detection is a bit noisy, 235 00:25:05,780 --> 00:25:11,220 but the letters which are considered anomalous, 236 00:25:11,340 --> 00:25:12,760 they are highlighted with red. 237 00:25:13,220 --> 00:25:19,480 And it seems that apart from some small noise 238 00:25:19,480 --> 00:25:21,860 in the parts which aren't actually anomalous, 239 00:25:21,880 --> 00:25:24,220 like the first letters in the parameters 240 00:25:24,220 --> 00:25:29,340 and some unknown one-letter anomalies 241 00:25:29,340 --> 00:25:31,600 in the PHP session ID cookie, 242 00:25:33,000 --> 00:25:40,260 we have detected SQL injection quite well. 243 00:25:45,160 --> 00:25:49,340 Okay, now I think it's the time for our demo. 244 00:25:55,060 --> 00:25:59,400 Okay, here's a process which we actually presented to some... 245 00:26:04,720 --> 00:26:08,220 Well, first we generate some normal traffic 246 00:26:08,220 --> 00:26:10,300 to our test backend. 247 00:26:11,060 --> 00:26:13,660 Well, it's actually a verb suit, nothing special. 248 00:26:14,160 --> 00:26:22,480 Well, the parameters of the traffic will be set now. 249 00:26:25,260 --> 00:26:28,920 Yeah, we use verb intruder to generate some traffic 250 00:26:28,920 --> 00:26:31,920 to get trained, to get normal traffic. 251 00:26:35,140 --> 00:26:37,260 So we have sent some requests 252 00:26:37,260 --> 00:26:39,200 and assume that the model is ready. 253 00:26:39,340 --> 00:26:43,780 And now we will try to send some attacks 254 00:26:43,780 --> 00:26:46,020 to the target web application. 255 00:26:46,340 --> 00:26:51,140 It's a sample, it's a demo banking application 256 00:26:51,140 --> 00:26:54,440 that we have built for testing 257 00:26:54,440 --> 00:26:57,240 our different machine learning models. 258 00:26:58,120 --> 00:27:01,920 So firstly, we try to submit an escalator. 259 00:27:01,940 --> 00:27:04,920 So we have a transaction, and it was refused. 260 00:27:05,320 --> 00:27:08,680 Then we logged in as a regular user. 261 00:27:08,880 --> 00:27:12,500 Now we try to perform some payment. 262 00:27:13,810 --> 00:27:16,060 We do a money transaction. 263 00:27:17,030 --> 00:27:18,320 And in the comment field, 264 00:27:18,420 --> 00:27:23,400 you have seen a part of some access as a check, 265 00:27:23,910 --> 00:27:24,760 just a sample. 266 00:27:25,000 --> 00:27:30,000 And this is the interface of enterprise WAF. 267 00:27:30,510 --> 00:27:31,600 And you can see, 268 00:27:33,140 --> 00:27:41,340 how this anomalous requests are logged into some actual WAF. 269 00:27:44,540 --> 00:27:46,700 Now here's some interesting part. 270 00:27:46,780 --> 00:27:48,020 We are trying to do the, 271 00:27:48,720 --> 00:27:51,700 I don't know how it's called, the SQL split injection. 272 00:27:52,060 --> 00:27:54,320 It's, yeah, it's fragmented SQL injection. 273 00:27:54,520 --> 00:27:57,300 As you see, it's split into two parameters. 274 00:27:57,760 --> 00:28:01,380 As traditional pattern matching would typically just, 275 00:28:01,380 --> 00:28:04,500 just analyze each parameter one by one. 276 00:28:04,640 --> 00:28:07,420 So it would miss this attack 277 00:28:07,420 --> 00:28:11,100 because it doesn't see the whole payload. 278 00:28:11,900 --> 00:28:14,880 But machine learning approach on the contrary, 279 00:28:14,960 --> 00:28:19,400 would detect it as it analyzes the whole HTTP request 280 00:28:19,400 --> 00:28:23,100 instead of particular parameters inside it. 281 00:28:27,980 --> 00:28:31,220 And again, you can see the detection being logged. 282 00:28:31,360 --> 00:28:36,460 And so we're trying to get this to the web interface of our WAF. 283 00:28:37,700 --> 00:28:38,040 Yeah. 284 00:28:38,140 --> 00:28:39,820 And it's quite interesting because well, 285 00:28:39,920 --> 00:28:40,920 this problem with the, 286 00:28:41,380 --> 00:28:43,940 this kind of SQL injections, 287 00:28:44,100 --> 00:28:48,520 we addressed it separately and we even built a separate tool, 288 00:28:48,620 --> 00:28:55,840 which tried to detect some sophisticated SQL injections by like parsing SQL 289 00:28:55,840 --> 00:28:58,140 grammar and whatever. 290 00:28:58,300 --> 00:29:01,340 And it turned out that the generalization, 291 00:29:01,340 --> 00:29:05,920 the generalized neural network can also detect these kinds of sophisticated attacks, 292 00:29:06,200 --> 00:29:13,040 just as well as the tool that we built specifically for detecting these types of injections. 293 00:29:13,560 --> 00:29:14,040 All right. 294 00:29:14,400 --> 00:29:18,940 So it looks like we have created a deep learning model 295 00:29:18,940 --> 00:29:22,360 that does not require the prior feature extraction. 296 00:29:22,580 --> 00:29:27,080 It just can look at the data online, 297 00:29:27,220 --> 00:29:29,840 which is flowing to the web applications of your, 298 00:29:29,960 --> 00:29:31,040 for example, client, 299 00:29:31,040 --> 00:29:32,260 or your own web applications, 300 00:29:33,060 --> 00:29:35,320 and use it to learn the, 301 00:29:36,660 --> 00:29:39,660 how the normal requests to your apps look like. 302 00:29:42,320 --> 00:29:47,440 It detects the anomalies in the future traffic 303 00:29:47,440 --> 00:29:48,600 after the learning phase. 304 00:29:49,560 --> 00:29:53,600 And it, which I think like the most important result 305 00:29:53,600 --> 00:29:54,240 of our work, 306 00:29:54,320 --> 00:29:55,920 it yields interpretable results. 307 00:29:56,020 --> 00:30:00,260 So your clients or you yourself would know why, 308 00:30:01,040 --> 00:30:03,420 the model considers something anomalous or not. 309 00:30:04,700 --> 00:30:10,240 We have open sourced this work as a Jupiter notebook. 310 00:30:10,580 --> 00:30:14,540 You can see it on this GitHub link provided below. 311 00:30:15,420 --> 00:30:17,640 Please do run it. 312 00:30:17,840 --> 00:30:26,180 I think there's some data from the bank application. 313 00:30:26,180 --> 00:30:27,060 Yeah, from the bank application. 314 00:30:28,640 --> 00:30:29,420 Please run it. 315 00:30:29,420 --> 00:30:32,040 Please try to train the model. 316 00:30:32,140 --> 00:30:34,640 Please try to verify our results. 317 00:30:34,980 --> 00:30:36,360 That would be very helpful. 318 00:30:37,040 --> 00:30:40,720 And I hope some of you will come up with the new ideas 319 00:30:40,720 --> 00:30:41,640 how to improve it. 320 00:30:42,980 --> 00:30:46,020 There will be some weird things in the code 321 00:30:46,020 --> 00:30:47,500 which you will probably notice. 322 00:30:48,740 --> 00:30:52,600 Feel free to ping us whenever you want about them. 323 00:30:52,640 --> 00:30:54,460 Like for example, how the thresholds 324 00:30:54,460 --> 00:30:55,580 for anomalies are chosen. 325 00:30:56,960 --> 00:30:58,900 It's quite obvious in the code. 326 00:30:59,880 --> 00:31:04,020 But it looks like kind of magic now. 327 00:31:05,880 --> 00:31:07,380 And for the future work, 328 00:31:07,620 --> 00:31:10,200 well, there's a lot to be improved. 329 00:31:10,770 --> 00:31:13,440 First of all, we need to optimize the learning time 330 00:31:13,440 --> 00:31:19,240 because now it takes like five hours for the data set 331 00:31:19,240 --> 00:31:25,660 that we have open sourced on high-end GPUs. 332 00:31:26,540 --> 00:31:30,620 We also need, it would be a great idea 333 00:31:30,620 --> 00:31:33,500 to now build the classifier on top 334 00:31:33,500 --> 00:31:34,560 of the anomaly detection. 335 00:31:34,780 --> 00:31:37,460 So, if we have detected some anomalous sequence, 336 00:31:38,280 --> 00:31:42,160 it is a good point to try to classify it, 337 00:31:42,180 --> 00:31:46,680 whether it is an SQL injection or XSS now 338 00:31:46,680 --> 00:31:48,760 because we have stripped all of the normal data 339 00:31:48,760 --> 00:31:50,720 from our request. 340 00:31:51,520 --> 00:31:53,500 And improve the threshold calculation. 341 00:31:53,840 --> 00:31:55,640 Well, now the threshold is pretty much designated. 342 00:31:55,640 --> 00:31:59,680 is calculated in some sophisticated way, 343 00:31:59,840 --> 00:32:03,160 we have a hypothesis that we have a normal distribution 344 00:32:03,160 --> 00:32:06,640 and for our learning data set, 345 00:32:06,740 --> 00:32:09,420 we calculate the parameters of these distributions 346 00:32:09,420 --> 00:32:14,000 which we later use in the threshold calculation 347 00:32:14,000 --> 00:32:17,260 and this is used for anomaly detection. 348 00:32:17,660 --> 00:32:22,360 Well, cases like that have to be proven 349 00:32:22,360 --> 00:32:25,700 or whatever in a more scientific manner 350 00:32:25,700 --> 00:32:29,260 because it may look like an exponential distribution 351 00:32:29,260 --> 00:32:35,280 or to someone, so that has to be improved a lot. 352 00:32:38,760 --> 00:32:40,400 All right, thank you.