1 00:00:00,000 --> 00:00:03,720 Okay, thank you everybody for coming or staying. 2 00:00:04,640 --> 00:00:08,720 So this talk is going to be about NoSQL, No Injections. 3 00:00:09,460 --> 00:00:13,740 My name is Wayne Huang. I am co-founder and CTO to Amorize Technologies. 4 00:00:15,460 --> 00:00:19,460 And my colleague, Kuang Ding, was a founding member. 5 00:00:19,760 --> 00:00:26,040 He was the first person to our Amorize Special Force team more than four years ago. 6 00:00:26,420 --> 00:00:29,320 This research was mostly done by Kuang. 7 00:00:30,000 --> 00:00:34,740 While I will be the presenter because I speak better English. 8 00:00:34,960 --> 00:00:39,800 Most of Amorize are based out of Taipei, and we're all from Taiwan. 9 00:00:41,220 --> 00:00:51,500 So this research started when we were crawling so much of the web to identify malware, 10 00:00:51,640 --> 00:00:59,600 and we had to ourselves implement a NoSQL solution and basically just retire. 11 00:01:00,000 --> 00:01:02,760 And together we come up with our own relational database solution. 12 00:01:04,820 --> 00:01:08,360 Amorize has two teams. The first on is a static analysis. 13 00:01:08,920 --> 00:01:14,420 So we write parsers and compilers, and we check for vulnerabilities inside codes. 14 00:01:14,560 --> 00:01:16,580 Actually this is more related to that team. 15 00:01:16,800 --> 00:01:23,020 But this research actually started from the other team crawling the web in search for malware. 16 00:01:23,220 --> 00:01:29,060 Because the data was getting much too big for traditional relational databases to handle. 17 00:01:29,060 --> 00:01:33,480 So that team, the Hackler team, started to do this research, 18 00:01:34,200 --> 00:01:38,460 but then this research would then actually benefit the CodeSecure team 19 00:01:38,460 --> 00:01:42,980 because as we see more and more NoSQL code, 20 00:01:43,400 --> 00:01:46,860 we need to know how to scan for vulnerabilities inside that code. 21 00:01:47,040 --> 00:01:50,120 And this is how the talk came about. 22 00:01:50,800 --> 00:01:53,240 So the slides are on SlideShare now, 23 00:01:53,760 --> 00:01:55,540 and if you go to my Twitter, 24 00:01:55,540 --> 00:01:59,780 you would get the link to the three of our talks this year at DEF CON. 25 00:02:00,300 --> 00:02:02,140 The next talk is going to be tomorrow. 26 00:02:02,840 --> 00:02:09,000 It's about how we automatically cluster the malware that we find using OBOX. 27 00:02:11,040 --> 00:02:14,400 So today we're going to be talking about what is NoSQL, 28 00:02:15,460 --> 00:02:16,920 types of NoSQL, 29 00:02:17,690 --> 00:02:19,020 who uses NoSQL, 30 00:02:19,630 --> 00:02:21,420 and so where the threats are. 31 00:02:22,220 --> 00:02:24,260 Note the NoSQL architecture. 32 00:02:24,260 --> 00:02:27,640 Security issues surrounding NoSQL 33 00:02:27,640 --> 00:02:29,880 and different families of NoSQL, 34 00:02:30,600 --> 00:02:32,680 and prevention and detection, 35 00:02:32,960 --> 00:02:37,780 and how NoSQL is affecting the current security technologies. 36 00:02:39,200 --> 00:02:40,500 So what is NoSQL? 37 00:02:41,820 --> 00:02:43,680 NoSQL technologies do not... 38 00:02:43,680 --> 00:02:45,860 Some common misconceptions. 39 00:02:46,520 --> 00:02:49,420 NoSQL technologies do not support SQL. 40 00:02:50,380 --> 00:02:52,460 The fact is, a lot of them do. 41 00:02:53,240 --> 00:02:54,240 NoSQL is a technology that is used to support SQL. 42 00:02:54,240 --> 00:02:56,040 NoSQL technologies are not vulnerable 43 00:02:56,040 --> 00:02:57,940 to threats such as SQL injection 44 00:02:57,940 --> 00:02:59,440 because there's NoSQL. 45 00:03:02,200 --> 00:03:05,980 One of the most commonly accepted definitions would be 46 00:03:05,980 --> 00:03:09,140 NoSQL is not only a SQL, 47 00:03:11,440 --> 00:03:15,960 and the storage itself is a non-relational DBMS, 48 00:03:16,980 --> 00:03:19,080 which can be semi-structured 49 00:03:19,080 --> 00:03:21,160 and schema-less, 50 00:03:21,220 --> 00:03:23,440 or sometimes, perhaps, 51 00:03:23,640 --> 00:03:24,220 even schema-less, 52 00:03:24,240 --> 00:03:24,680 or even schema-free, 53 00:03:25,580 --> 00:03:26,880 for example, 54 00:03:27,560 --> 00:03:29,780 in a key-value data store. 55 00:03:32,060 --> 00:03:33,880 So types of NoSQL, 56 00:03:34,240 --> 00:03:36,900 there are a lot of families to NoSQL. 57 00:03:37,480 --> 00:03:40,760 Key-value-based databases, 58 00:03:41,280 --> 00:03:42,360 column-based databases, 59 00:03:42,740 --> 00:03:43,700 document-based databases, 60 00:03:44,340 --> 00:03:45,420 graph-based databases, 61 00:03:45,980 --> 00:03:47,660 object-based databases, 62 00:03:48,060 --> 00:03:48,680 et cetera. 63 00:03:51,400 --> 00:03:54,220 So what's challenging for security users 64 00:03:54,220 --> 00:03:56,780 and security researchers today is 65 00:03:56,780 --> 00:04:01,700 NoSQL is resembled by its diversity. 66 00:04:01,940 --> 00:04:03,100 There are a lot of families, 67 00:04:03,320 --> 00:04:06,520 and then within the same family of NoSQL, 68 00:04:07,740 --> 00:04:10,080 implementations differ widely. 69 00:04:11,720 --> 00:04:15,960 And that presents a very big challenge as we see it. 70 00:04:17,140 --> 00:04:18,280 So why NoSQL? 71 00:04:18,540 --> 00:04:22,340 Why do people need to use the NoSQL technology? 72 00:04:22,340 --> 00:04:25,140 Well, mostly for two very important reasons. 73 00:04:25,320 --> 00:04:27,160 Performance and scalability. 74 00:04:29,040 --> 00:04:30,420 So who would use NoSQL, 75 00:04:30,700 --> 00:04:31,980 and so what's the impact? 76 00:04:33,640 --> 00:04:36,520 Cloud computing users or providers, 77 00:04:36,900 --> 00:04:38,180 or SaaS vendors, 78 00:04:39,640 --> 00:04:41,420 social network services providers, 79 00:04:42,180 --> 00:04:42,980 portal websites, 80 00:04:44,380 --> 00:04:49,340 and basically people that needs to process 81 00:04:49,800 --> 00:04:51,020 large amounts of data. 82 00:04:51,020 --> 00:04:54,660 And typically, they would use a mixture of databases 83 00:04:54,660 --> 00:04:58,740 which include both SQL databases and NoSQL databases. 84 00:04:59,240 --> 00:05:00,800 And that is, for example, 85 00:05:00,880 --> 00:05:04,680 what our current implementation is as well. 86 00:05:06,400 --> 00:05:08,640 So what's changed from the past, 87 00:05:08,700 --> 00:05:10,260 from SQL to NoSQL? 88 00:05:12,940 --> 00:05:15,820 So here's a typical NoSQL architecture. 89 00:05:16,620 --> 00:05:19,280 We have the web application and web services 90 00:05:19,280 --> 00:05:21,060 in the front. 91 00:05:21,630 --> 00:05:23,900 And in the center is the client library, 92 00:05:24,990 --> 00:05:28,580 which the web application and web services interact with. 93 00:05:29,240 --> 00:05:33,020 And then below is the NoSQL data storage. 94 00:05:35,160 --> 00:05:37,880 And the client library is gonna be the focus 95 00:05:37,880 --> 00:05:40,260 for security researchers as well as the attackers, 96 00:05:40,480 --> 00:05:44,300 because that's where the web application and web services 97 00:05:44,300 --> 00:05:46,660 are interfacing with the data storage. 98 00:05:49,740 --> 00:05:54,540 So the client library implementation, right now, 99 00:05:54,620 --> 00:06:00,400 has no standards such as ODBC, JDBC, ADO, PDO, et cetera. 100 00:06:02,080 --> 00:06:05,440 So these questions would strongly affect 101 00:06:05,440 --> 00:06:11,320 the security standing and aspects of these client libraries. 102 00:06:11,620 --> 00:06:12,920 How is it implemented? 103 00:06:13,630 --> 00:06:15,480 What interfaces does it support? 104 00:06:15,620 --> 00:06:17,560 Does it support a query interface? 105 00:06:19,280 --> 00:06:25,440 And here you see a CouchDB, oh, sorry, 106 00:06:25,680 --> 00:06:32,200 a CouchDB implementation of its SQL interface. 107 00:06:34,140 --> 00:06:35,640 Oh, I'm sorry, CouchQL. 108 00:06:37,100 --> 00:06:40,780 And as you can see, it looks very much like SQL. 109 00:06:40,840 --> 00:06:43,560 And in fact, it is a subset of SQL. 110 00:06:44,480 --> 00:06:49,140 While CouchDB itself is a NoSQL, 111 00:06:49,260 --> 00:06:49,600 it's also a NoSQL database. 112 00:06:54,820 --> 00:07:00,080 And so here, this, how this client library is implemented 113 00:07:00,740 --> 00:07:04,880 will affect what types of vulnerabilities would exist 114 00:07:04,880 --> 00:07:06,540 in this particular implementation. 115 00:07:07,940 --> 00:07:10,280 And so let's make room and let's look for, 116 00:07:10,460 --> 00:07:15,380 let's look at the old vectors versus the new vectors. 117 00:07:16,480 --> 00:07:19,240 So in the old days, there was only one horizontal vector. 118 00:07:19,260 --> 00:07:22,180 The SQL, right? 119 00:07:22,880 --> 00:07:27,720 And so, within that horizon, you would have, 120 00:07:27,780 --> 00:07:31,880 we would have ODBC, JDBC, ADO, PDO, what have you, 121 00:07:32,020 --> 00:07:34,520 for us and for, or for the attackers 122 00:07:34,520 --> 00:07:35,840 to do their SQL injections. 123 00:07:38,080 --> 00:07:41,240 Now, we have key value based databases 124 00:07:41,240 --> 00:07:44,120 and they may implement two versions, 125 00:07:44,160 --> 00:07:46,920 at least two versions of their client libraries, 126 00:07:47,220 --> 00:07:49,240 the Qo-like and the non-Qo-like. 127 00:07:49,240 --> 00:07:56,360 QO like. And these two different versions would have a lot of different implementations. 128 00:07:57,700 --> 00:08:03,360 And the same thing would be happening to column-based NoSQL databases. And the same 129 00:08:03,360 --> 00:08:10,180 thing happens to document-based NoSQL databases. So let's make room. Same thing happens to graph-based 130 00:08:10,180 --> 00:08:17,440 NoSQL databases. And the same thing happens to object-based NoSQL databases. So this is 131 00:08:17,440 --> 00:08:25,680 the landscape as we see it today. So as a vendor that developed static analysis tools 132 00:08:25,680 --> 00:08:34,160 to scan for security vulnerabilities, before we, for example, for database manipulation, 133 00:08:35,220 --> 00:08:42,820 for command injection, we had to scan for only a few categories. And SQL injection was 134 00:08:42,820 --> 00:08:46,360 among these categories. But now, if we want to support 135 00:08:47,440 --> 00:08:54,120 if we want to scan for NoSQL vulnerabilities, we end up with a landscape that looks like that 136 00:08:54,120 --> 00:09:05,620 down there. So perhaps it was a blessing that in the past, the notion of RDBMS matured, 137 00:09:06,400 --> 00:09:15,960 the notion of SQL matured, and SQL implementation standards matured as well, ODBC, JDBC, et cetera. 138 00:09:17,440 --> 00:09:22,460 And therefore, as new websites came out, as new frameworks came out, as new languages came out, 139 00:09:23,360 --> 00:09:29,300 everyone basically followed existing standards, ODBC, JDBC, ADO, PDO, et cetera, right? 140 00:09:29,420 --> 00:09:35,040 And so they weren't creating their own ways to access the database. Basically, even when new 141 00:09:36,080 --> 00:09:41,460 languages came out sometimes, they followed the SQL standard and implement some SQL-like interface 142 00:09:41,460 --> 00:09:46,440 or adopt ODBC or JDBC. But today, 143 00:09:47,440 --> 00:09:53,160 new implementations for yet another programming language's support to use yet another family of 144 00:09:53,160 --> 00:10:03,600 NoSQL is invented as needed. And that creates that picture there. And this is basically the 145 00:10:03,600 --> 00:10:12,860 threat that we see today. We see very, very few research on this topic. Apparently, the open 146 00:10:12,860 --> 00:10:17,420 source scanners, as well as the commercial scanners right now, they're not going to be able to do that. 147 00:10:17,440 --> 00:10:26,420 Now, haven't put a lot of effort into studying threats that exist here. However, more and more and more 148 00:10:26,420 --> 00:10:35,400 websites are starting to use NoSQL technologies. So we've covered the general topics. Now, let's 149 00:10:35,400 --> 00:10:47,000 look at the specific examples of vulnerabilities. So we'll be looking at some examples of NoSQL 150 00:10:47,000 --> 00:10:47,420 vulnerabilities. So we'll be looking at some examples of NoSQL vulnerabilities. And we'll be 151 00:10:47,440 --> 00:10:52,140 looking at some example of vulnerabilities, including connection pollution, JSON injection, view injection, 152 00:10:52,560 --> 00:11:01,060 key brute forcing, and key brute forcing. Sorry. Connection pollution using CouchDB as example. 153 00:11:01,640 --> 00:11:17,040 And CouchDB, the entire CouchDB interface is implemented in RESTful, which allows for cross-database or cross-pull 154 00:11:17,040 --> 00:11:25,900 access through restful and all of couch DB's global and database handlers are 155 00:11:25,900 --> 00:11:36,480 also implemented in restful so the this creates some attack vectors that are 156 00:11:36,480 --> 00:11:49,480 easier than before for example if we can manipulate the connector here if we can 157 00:11:49,480 --> 00:11:54,220 somehow manipulate the connector here then without further manipulation just 158 00:11:54,220 --> 00:12:03,320 by manipulating the connector itself we can restart a couch DB database and 159 00:12:03,900 --> 00:12:05,300 here is the list of 160 00:12:05,810 --> 00:12:06,260 all 161 00:12:06,260 --> 00:12:14,460 some of CouchDB's handlers that would allow us to execute a lot 162 00:12:14,460 --> 00:12:19,880 of commands if we're able to manipulate the connector. 163 00:12:23,970 --> 00:12:30,460 And, for example, the configuration itself is also in 164 00:12:30,460 --> 00:12:31,900 a RESTful interface. 165 00:12:31,900 --> 00:12:35,740 So, by manipulating the connector, we can also directly 166 00:12:35,740 --> 00:12:41,880 see the configuration of the database, which actually took a 167 00:12:41,880 --> 00:12:43,700 lot more steps in SQL injection. 168 00:12:47,660 --> 00:12:51,840 And here, and a lot of people, a lot of people, a lot of people 169 00:12:51,840 --> 00:12:57,860 thought that, okay, so you can still manipulate data flow, or 170 00:12:57,860 --> 00:13:01,880 you can still manipulate SQL commands. 171 00:13:01,900 --> 00:13:09,180 In a NoSQL implementation, however, real SQLs are very 172 00:13:09,180 --> 00:13:09,660 powerful. 173 00:13:10,340 --> 00:13:13,500 MySQL database is a very powerful set of SQL commands, 174 00:13:13,660 --> 00:13:18,280 which allowed you to execute system commands, for example. 175 00:13:19,060 --> 00:13:23,340 And then, so even if your NoSQL, even if my NoSQL implementation 176 00:13:23,340 --> 00:13:27,060 implements a SQL-like interface, well, most likely, 177 00:13:27,180 --> 00:13:30,300 there won't, you won't be able to execute database commands. 178 00:13:30,360 --> 00:13:31,880 You can, maybe you can, you can, you can, you can, you can, you 179 00:13:31,900 --> 00:13:36,080 know, manipulate, manipulate my database a bit, but you can't 180 00:13:36,080 --> 00:13:37,040 execute system commands. 181 00:13:37,220 --> 00:13:40,860 Well, that, that might not be true, because in this example 182 00:13:41,640 --> 00:13:43,820 that you see here, this is again CouchDB. 183 00:13:44,640 --> 00:13:50,000 If I am able to manipulate the configuration through the 184 00:13:50,000 --> 00:13:56,040 RESTful interface, then I can change the, the, the Javascript 185 00:13:56,040 --> 00:14:01,540 interpreter of CouchDB, and as you see here, we've changed it to 186 00:14:01,540 --> 00:14:01,880 JSF. 187 00:14:01,900 --> 00:14:07,500 as 2.exe which can be a file that we put on to the system or 188 00:14:07,500 --> 00:14:14,220 an arbitrary system command or system executable. So executing 189 00:14:14,220 --> 00:14:22,060 database, executing arbitrary commands through manipulation of 190 00:14:22,390 --> 00:14:31,260 the client interface is possible as well. And then what makes it 191 00:14:31,260 --> 00:14:37,940 harder, even when an injection vector exists, cross DB, cross 192 00:14:37,940 --> 00:14:42,980 databases is difficult. Cross databases was very easy with SQL 193 00:14:42,980 --> 00:14:49,040 injection because the SQL commands supported naming of databases so 194 00:14:49,040 --> 00:14:55,560 you can jump databases once you can manipulate SQL command. But it 195 00:14:55,560 --> 00:15:00,980 is absolutely not true in most SQL, in most NoSQL implementations. 196 00:15:01,260 --> 00:15:06,500 So traditionally what happens in a traditional SQL is you get 197 00:15:06,500 --> 00:15:11,260 connected, you do SQL injection and then you jump from one DB or 198 00:15:11,260 --> 00:15:15,860 one table to another. This is difficult to do in NoSQL 199 00:15:15,860 --> 00:15:26,300 implementation. So what you need to do is you need to find ways to 200 00:15:26,300 --> 00:15:31,200 inject variables, to inject something into the connection for you to 201 00:15:31,260 --> 00:15:38,640 do that. So basically once the connector is established, you're 202 00:15:38,640 --> 00:15:48,040 limited to that context in most NoSQL implementations. So document 203 00:15:48,040 --> 00:15:54,460 based issues, JSON injection as an example, also using CouchDB. And 204 00:15:54,460 --> 00:16:01,240 this is about data manipulation. So a lot of times it's really hard to 205 00:16:01,260 --> 00:16:05,380 do. And so I recommend that we do not implement our own JSON parser or 206 00:16:05,380 --> 00:16:09,080 handler, but sometimes you just have to. For example when you're handling 207 00:16:09,080 --> 00:16:17,180 very, very large JSON replies and existing ones are just too slow. But 208 00:16:17,180 --> 00:16:21,100 the key here is try, don't repeat yourself, leverage existing JSON 209 00:16:21,100 --> 00:16:29,980 implementation. Because if you really want to implement one, then there is 210 00:16:29,980 --> 00:16:31,240 risk because the trouble is with the stuff you're doing with JSON, you can't 211 00:16:31,240 --> 00:16:38,620 JavaMaker is a string type, and if we don't handle JSON well, there will be JSON injection. 212 00:16:39,000 --> 00:16:45,400 And when JSON injection happens in CouchDB, that is directly manipulating the data stored 213 00:16:45,400 --> 00:16:46,080 in the database. 214 00:16:47,840 --> 00:16:55,600 So the countermeasure is try to use collection types, such as hash and map, instead of manipulating 215 00:16:55,600 --> 00:16:56,860 the bare strings themselves. 216 00:16:56,860 --> 00:17:05,720 And when handling tented strings, at least we must remember to escape JSON and not escape 217 00:17:05,720 --> 00:17:06,060 JSON. 218 00:17:08,880 --> 00:17:10,360 Now view injection. 219 00:17:10,620 --> 00:17:12,340 I was using CouchDB. 220 00:17:12,520 --> 00:17:15,360 View injection allows for application manipulation. 221 00:17:16,700 --> 00:17:22,280 So CouchDB is scriptable, using SpiderMonkey as the scripting engine. 222 00:17:23,140 --> 00:17:26,280 So these JavaScripts are called views. 223 00:17:26,380 --> 00:17:26,840 In CouchDB, they're called views. 224 00:17:26,840 --> 00:17:33,480 In CouchDB, redefined views, and so there's redefined views and temporary views. 225 00:17:34,320 --> 00:17:38,820 And views are basically to do map reduce using JavaScript. 226 00:17:40,280 --> 00:17:48,440 And they allow for, and they're used to retrieve arbitrary data, modify return values to manipulate 227 00:17:48,440 --> 00:17:49,280 control flow. 228 00:17:51,480 --> 00:17:52,560 Oh, yeah. 229 00:17:52,640 --> 00:17:55,840 So if we can inject JavaScript. 230 00:17:58,900 --> 00:18:07,300 Into CouchDB as views, what we can do is we can then use that JavaScript data, use that 231 00:18:07,300 --> 00:18:13,020 JavaScript execution to retrieve arbitrary data, modify return values to manipulate 232 00:18:13,560 --> 00:18:16,980 control flow, and a lot of other things. 233 00:18:17,500 --> 00:18:22,300 So this is what we call view injection. 234 00:18:22,440 --> 00:18:25,320 It's basically when you inject JavaScript into CouchDB. 235 00:18:29,620 --> 00:18:33,720 And so as you can see, here is a typical example. 236 00:18:37,060 --> 00:18:44,860 So right here, as you can see, the view, the view is here, and the map is actually JavaScript, 237 00:18:44,900 --> 00:18:47,460 and it's executing it with SpiderMonkey. 238 00:18:47,580 --> 00:18:52,560 So if we can inject into this field, then we can just, we can basically do application 239 00:18:52,560 --> 00:18:53,120 manipulation. 240 00:18:53,920 --> 00:18:54,440 Okay. 241 00:18:56,300 --> 00:18:56,820 All right. 242 00:19:01,580 --> 00:19:08,260 So all these were injection issues in a NoSQL application, right? 243 00:19:08,320 --> 00:19:13,220 So NoSQL equals NoSQL injections, not necessarily, not necessarily. 244 00:19:15,020 --> 00:19:16,520 Key value-based problems. 245 00:19:17,520 --> 00:19:21,640 In a key value-based database, we can at least do key brute forcing. 246 00:19:22,600 --> 00:19:26,100 Key value-based databases are schema-free. 247 00:19:26,100 --> 00:19:27,900 So we don't have to get schema. 248 00:19:29,000 --> 00:19:38,920 So but then in a key value database, when we're doing key brute forcing, the key now 249 00:19:38,920 --> 00:19:40,460 is how to speed up the attacks. 250 00:19:41,660 --> 00:19:45,300 It really depends on the implementation of the client library and architecture. 251 00:19:45,540 --> 00:19:52,500 The challenge is can we make sense, context-sensitive attacks, meaning that we send a key and we 252 00:19:52,500 --> 00:19:53,980 do some static analysis. 253 00:19:54,200 --> 00:19:56,080 And according to the calculation, we can do some static analysis. 254 00:19:56,080 --> 00:20:01,380 The time in the calculation or the response differences, we can say, we can speed up 255 00:20:01,380 --> 00:20:06,640 this process and say, okay, this key, we can make quick judgment and say, this key 256 00:20:06,640 --> 00:20:08,900 doesn't exist in the key value data store. 257 00:20:10,440 --> 00:20:14,680 And that's how it usually looks like. 258 00:20:16,420 --> 00:20:19,120 And so we call this key brute forcing. 259 00:20:19,180 --> 00:20:22,520 Note that we're not manipulating the data flow at all. 260 00:20:22,960 --> 00:20:23,500 Okay. 261 00:20:23,520 --> 00:20:23,980 For example. 262 00:20:23,980 --> 00:20:34,400 For a video streaming website, for example, YouTube, there's typically a key associated 263 00:20:34,400 --> 00:20:43,720 with every video that gets eventually fed into the NoSQL database to retrieve that piece 264 00:20:43,720 --> 00:20:44,140 of video. 265 00:20:44,380 --> 00:20:52,940 So you don't need to manipulate anything for it to execute NoSQL dot get key, but you can 266 00:20:52,940 --> 00:20:54,620 very easily brute force the key. 267 00:21:00,260 --> 00:21:06,480 So prevention, it really depends on how data is modeled because there's no schema. 268 00:21:06,760 --> 00:21:17,920 So if, for example, we're storing all personal records in a single key data database, then 269 00:21:18,640 --> 00:21:22,320 once that is brute forced. 270 00:21:22,360 --> 00:21:22,920 Okay. 271 00:21:22,920 --> 00:21:25,380 They can get everything out, right? 272 00:21:25,500 --> 00:21:31,360 So it really depends on how your application logic is segmenting the data, how your application 273 00:21:31,700 --> 00:21:33,020 is modeling the data. 274 00:21:33,320 --> 00:21:34,840 Again, there's no schema. 275 00:21:34,900 --> 00:21:39,060 So data modeling is done by the application itself. 276 00:21:40,500 --> 00:21:46,700 And the key size, key space, and also unpredictable key generation algorithm. 277 00:21:47,140 --> 00:21:49,040 And also it can be challenge based. 278 00:21:49,140 --> 00:21:51,780 For example, asking for CAPTCHAs. 279 00:21:51,880 --> 00:21:52,400 Okay. 280 00:21:53,780 --> 00:22:01,140 And the impact on security technologies when these NoSQL implementations are adopted by 281 00:22:01,140 --> 00:22:01,620 websites. 282 00:22:03,380 --> 00:22:09,160 How NoSQL technologies would impact web application scanners. 283 00:22:11,160 --> 00:22:18,040 For traditional scanning, how to handle unknown error messages, meaning that for traditional 284 00:22:18,390 --> 00:22:19,680 black box scanners. 285 00:22:20,180 --> 00:22:21,080 Okay. 286 00:22:21,080 --> 00:22:21,260 Okay. 287 00:22:21,260 --> 00:22:29,680 Because most of them rely on knowing existing error messages of SQL databases and there 288 00:22:29,680 --> 00:22:35,200 aren't that many SQL databases, and so there aren't that many formats to database error 289 00:22:35,200 --> 00:22:35,600 messages. 290 00:22:36,000 --> 00:22:48,640 But here, as we saw, there's going to be a big wave of new formats to new error messages 291 00:22:48,640 --> 00:22:49,400 coming out. 292 00:22:49,540 --> 00:22:50,060 Okay. 293 00:22:50,060 --> 00:22:56,760 how would a web application scanner support all these new error messages? 294 00:22:57,940 --> 00:23:01,320 And then if we don't recognize the error messages, how to do blind injections? 295 00:23:02,460 --> 00:23:07,100 If a query language exists, how to perform logic-based blind injections? 296 00:23:08,420 --> 00:23:14,780 And then can we do time-based differential attacks based on static analysis as mentioned previously? 297 00:23:21,300 --> 00:23:24,700 And then finally, different types of attack payloads. 298 00:23:24,700 --> 00:23:32,960 Right now, well-known scanners, for example, commercial ones, Web Impact, Watchfire, Acunetix, Senzic, 299 00:23:33,160 --> 00:23:45,560 they all have a good database of attack payloads to execute against a website in order to find, for example, injection flaws. 300 00:23:46,480 --> 00:23:49,240 But how about for NoSQL implementations? 301 00:23:50,940 --> 00:23:55,660 So, first of all, the different languages, both in terms of data and programming. 302 00:23:56,540 --> 00:24:04,960 For example, for data manipulation, and by that we're referring to JSON injections, 303 00:24:06,340 --> 00:24:09,540 what is the language to be used? It's JSON. 304 00:24:09,760 --> 00:24:17,460 So, do we have a JSON-based pattern database for our injection purpose? 305 00:24:18,380 --> 00:24:20,040 And for programming languages, what is the language to be used? 306 00:24:20,040 --> 00:24:22,240 So, if we're doing language manipulation, for example, on CouchDB, 307 00:24:23,720 --> 00:24:26,320 then we're doing basically view injections. 308 00:24:26,560 --> 00:24:27,520 We're injecting JavaScript. 309 00:24:28,820 --> 00:24:39,420 Do we have that type of payload database for us to test out view injections inside a NoSQL web application? 310 00:24:42,500 --> 00:24:50,020 And then second one is the fact, the impact of a schema-less injection. 311 00:24:50,860 --> 00:24:58,000 Basically, because it's schema-less, the attack surface is redefined. 312 00:24:59,240 --> 00:25:04,880 Why? Because data is modeled not by SQL, but by the application itself. 313 00:25:06,160 --> 00:25:14,700 And therefore, the attack vectors are very, very sensitive to the entry points. 314 00:25:15,060 --> 00:25:16,140 Before it was not. 315 00:25:16,220 --> 00:25:18,580 Before it was, it doesn't matter which URL. 316 00:25:20,040 --> 00:25:24,240 It really didn't matter in which URL we're finding a SQL injection. 317 00:25:24,580 --> 00:25:29,380 When we find a SQL injection, that's a SQL injection, and we can jump tables, 318 00:25:29,480 --> 00:25:32,340 we can jump databases, we can execute system commands. 319 00:25:32,620 --> 00:25:37,860 But here, because everything, as we saw previously, is bound to the connector, 320 00:25:39,660 --> 00:25:47,360 the type of things that we can do, once we can manipulate the flow, the data, or the application itself, 321 00:25:47,580 --> 00:25:49,960 really depends on which URL. 322 00:25:50,040 --> 00:25:51,560 We're finding it in. 323 00:25:51,760 --> 00:25:56,560 And so, as the web developer, or the application developer, 324 00:25:56,920 --> 00:26:02,420 if they segment out and model out their NoSQL implementation well, 325 00:26:03,500 --> 00:26:05,880 their code would be a lot more secure. 326 00:26:06,340 --> 00:26:13,840 Because a lot of the entry points are not very useful, even if they're attacked. 327 00:26:15,180 --> 00:26:18,460 But then, how would a web application scanner test for this? 328 00:26:21,460 --> 00:26:24,820 And then, there are different attack concepts that can be played. 329 00:26:24,980 --> 00:26:26,500 For example, key brute forcing. 330 00:26:26,960 --> 00:26:33,260 Brute forcing the key, which is a very valid type of attack against, especially, 331 00:26:33,580 --> 00:26:36,420 just particularly NoSQL implementations. 332 00:26:36,540 --> 00:26:41,380 But are there any web application scanners implementing this type of checks? 333 00:26:45,220 --> 00:26:50,020 And then, so selecting the payload requires understanding of the data. 334 00:26:50,020 --> 00:26:51,640 Understanding of the underlying database. 335 00:26:53,400 --> 00:26:58,820 So, how to blindly identify URLs involving NoSQL. 336 00:26:59,100 --> 00:26:59,520 Right? 337 00:26:59,600 --> 00:27:04,560 So, now when you're a web scanner, when you're a pen tester, you go onto a website, you see a URL. 338 00:27:04,780 --> 00:27:06,720 How do you know what's behind this URL? 339 00:27:06,980 --> 00:27:10,300 Are there SQL databases, or are there NoSQL databases? 340 00:27:10,780 --> 00:27:16,420 And if there are NoSQL databases, what set of payload are you going to fire against that URL? 341 00:27:16,720 --> 00:27:19,180 Are you going to fire JSON manipulation? 342 00:27:19,180 --> 00:27:21,350 Or JavaScript injection? 343 00:27:23,060 --> 00:27:29,440 Or are you going to fire traditional SQL injection attack? 344 00:27:30,820 --> 00:27:32,960 Well, there are ways to find this out. 345 00:27:34,840 --> 00:27:40,640 Usually, NoSQL implementations of the SQL interface will be a subset of the SQL 9295. 346 00:27:41,040 --> 00:27:48,020 And, however, features that will impact parallelization typically will be removed. 347 00:27:48,020 --> 00:27:49,380 For example, UNION. 348 00:27:49,480 --> 00:27:59,880 So, when you start to see that you can manipulate the SQL command, but some of these commands are absent, 349 00:28:00,160 --> 00:28:07,520 especially, for example, commands like UNION, you know then it's probably an underlying, underneath is probably a NoSQL. 350 00:28:10,300 --> 00:28:15,120 NoSQL impacts on static analysis, or source code analysis. 351 00:28:16,140 --> 00:28:18,000 Source code analysis checks back. 352 00:28:18,000 --> 00:28:20,140 It's by data flow, so there's less of a problem. 353 00:28:20,360 --> 00:28:30,760 But diversity is a big problem, because you have to support so many, you have to recognize so many implementations of NoSQL databases. 354 00:28:31,740 --> 00:28:35,460 And so, right now, there are a lot of unsupported client libraries. 355 00:28:36,860 --> 00:28:40,740 But, in general, it's a lot easier than web application scanners. 356 00:28:43,760 --> 00:28:44,300 Sorry. 357 00:28:45,660 --> 00:28:48,120 NoSQL versus web application firewalls. 358 00:28:48,500 --> 00:28:51,460 Key brute forcing is not an injection attack. 359 00:28:52,540 --> 00:28:57,060 And it can be blocked by accessing thresholds. 360 00:28:57,060 --> 00:28:59,180 By access thresholds, for example. 361 00:28:59,460 --> 00:29:06,440 And so, web application firewalls has a good potential at blocking a lot of these attacks. 362 00:29:08,280 --> 00:29:10,980 A lot of these new attack vectors. 363 00:29:12,500 --> 00:29:14,280 Versus web application firewalls. 364 00:29:14,280 --> 00:29:19,840 So, web application scanners and static analysis tools, which are having a hard time finding these. 365 00:29:19,940 --> 00:29:24,660 Because web application firewalls are transparent, basically. 366 00:29:24,960 --> 00:29:26,280 To the back end. 367 00:29:29,260 --> 00:29:34,100 Or, web application WAFs can also help do URL integrity checks. 368 00:29:35,200 --> 00:29:39,800 For example, it can add some kind of HMAC to the key. 369 00:29:40,900 --> 00:29:41,940 HMAC to the key. 370 00:29:43,660 --> 00:29:48,320 Definition of attack payloads is going to be a challenge. 371 00:29:48,660 --> 00:29:52,220 So, what is a data or JSON injection? 372 00:29:52,520 --> 00:29:54,780 And what is a view or JavaScript injection? 373 00:29:54,980 --> 00:29:59,580 Right now, WAFs are very good at recognizing, okay, this is a SQL injection. 374 00:29:59,820 --> 00:30:00,680 So, I'm going to block it. 375 00:30:00,780 --> 00:30:02,520 This is probably a cross-site scripting. 376 00:30:02,560 --> 00:30:03,600 So, I'm going to block it. 377 00:30:03,700 --> 00:30:10,940 But, how will it develop patterns to detect attacks? 378 00:30:10,940 --> 00:30:13,880 Attacks against NoSQL databases. 379 00:30:14,040 --> 00:30:15,680 What are the patterns to these attacks? 380 00:30:16,800 --> 00:30:18,220 That's going to be the challenge. 381 00:30:19,160 --> 00:30:20,300 So, conclusion. 382 00:30:20,980 --> 00:30:25,060 Threat analysis must be conducted under a NoSQL mindset. 383 00:30:25,780 --> 00:30:29,620 Because a NoSQL implementation is so different from a SQL. 384 00:30:29,840 --> 00:30:32,280 The threat landscape is really, really different. 385 00:30:33,540 --> 00:30:40,360 Modeling of data is done by the application logic and not the SQL statement or database schema. 386 00:30:40,360 --> 00:30:44,340 And so, the threat is very sensitive to the entry point. 387 00:30:46,460 --> 00:30:51,520 So, where you're finding the vulnerability becomes critical. 388 00:30:52,600 --> 00:30:55,080 And not just, okay, I found a SQL injection. 389 00:30:55,300 --> 00:30:56,920 Great, I can do this and I can do that. 390 00:30:58,100 --> 00:30:59,860 Threat types are different. 391 00:30:59,980 --> 00:31:04,260 For example, new attack vectors would come out. 392 00:31:05,240 --> 00:31:07,000 And it impacts. 393 00:31:07,500 --> 00:31:09,960 And so, all of these would impact. 394 00:31:10,360 --> 00:31:12,080 Existing security technologies. 395 00:31:14,660 --> 00:31:16,720 And we'd love to hear your comments. 396 00:31:17,080 --> 00:31:22,260 Because we're considering implementing static and black box scanners as tools. 397 00:31:23,000 --> 00:31:25,060 Just for NoSQL technologies. 398 00:31:25,520 --> 00:31:31,780 But right now, because there's so many of them, we're also ourselves still in the research phase. 399 00:31:32,220 --> 00:31:34,340 So, if you'd like to join us. 400 00:31:34,420 --> 00:31:38,940 If you'd like to develop open source tools with us. 401 00:31:38,940 --> 00:31:40,780 We'd be very, very happy. 402 00:31:41,460 --> 00:31:44,820 So, please send us your comments. 403 00:31:46,800 --> 00:31:48,940 And we thank you for attending the talk. 404 00:31:49,100 --> 00:31:49,640 Thank you. 405 00:31:49,880 --> 00:31:51,520 Thank you.