1 00:00:00,000 --> 00:00:05,000 So, hello, everybody. Thank you for coming this evening to this talk about connection 2 00:00:05,000 --> 00:00:12,420 string attacks. First of all, thank you. I know it's Saturday, it's late, everybody wants 3 00:00:12,420 --> 00:00:17,800 to be in another place having beers and so on. And for us, it's very good to have you 4 00:00:17,800 --> 00:00:24,140 here. So thank you very much. First of all, let me introduce ourselves. He is Jose Palazón, 5 00:00:24,140 --> 00:00:33,780 Palaco. He's working on Yahoo as a software architect. And I'm Chema Alonso. I'm a Microsoft 6 00:00:33,780 --> 00:00:40,040 MVP in enterprise security, but I'm not working on Microsoft. I'm working in a security company 7 00:00:40,040 --> 00:00:46,240 in Spain called I64. The talk for today is about connection string injection attacks. 8 00:00:46,540 --> 00:00:52,260 But before that, I would like to make a quick introduction about our country, about Spain, 9 00:00:52,520 --> 00:00:54,120 because maybe you don't know it. 10 00:00:54,120 --> 00:00:55,380 I know you don't know it, but you love Spain. 11 00:00:58,380 --> 00:00:59,460 Viva España. 12 00:00:59,580 --> 00:01:05,980 Viva España. Well, this year we won the World Cup, so we are very proud of this. 13 00:01:06,200 --> 00:01:08,600 I'm sorry for the Argentinian people and the rest of the world. 14 00:01:12,100 --> 00:01:19,700 I'm sorry for the people from Germany and Holland. Well, also we got very good sports 15 00:01:20,360 --> 00:01:23,120 power gas. Very well. 16 00:01:23,300 --> 00:01:24,040 Rafa Nadal. 17 00:01:24,040 --> 00:01:24,180 Rafa Nadal. 18 00:01:24,200 --> 00:01:31,960 And Alberto Contador. We are very proud of that guy. And we got sexy people like Antonio 19 00:01:31,960 --> 00:01:38,520 Banderas. Oh, my God. Penélope Cruz. Oh, no. And, of course, Chema Alonso and Jose 20 00:01:38,820 --> 00:01:39,100 Palaco. 21 00:01:39,260 --> 00:01:39,600 Oh, yeah. 22 00:01:39,600 --> 00:01:40,840 That's very nice, guys. 23 00:01:43,180 --> 00:01:51,640 That's all. Well, maybe everybody knows where is Spain, but that's this Europe, and Spain 24 00:01:51,640 --> 00:01:52,880 is not that country. 25 00:01:52,880 --> 00:01:54,120 It's not that country. 26 00:01:54,520 --> 00:01:57,380 Spain is that small country in the south of Europe. 27 00:01:57,560 --> 00:02:02,780 You know, we got a long, long beaches around the whole country. 28 00:02:03,000 --> 00:02:04,580 So it's a very nice place to be. 29 00:02:04,720 --> 00:02:06,300 Please come to Spain. 30 00:02:06,520 --> 00:02:07,440 We will love you. 31 00:02:08,540 --> 00:02:11,860 And, of course, in Spain we got parties for everybody. 32 00:02:12,140 --> 00:02:13,800 We got the most famous party. 33 00:02:15,220 --> 00:02:16,560 This is San Fermines. 34 00:02:16,860 --> 00:02:19,940 It's the greatest party ever. 35 00:02:20,220 --> 00:02:21,160 It's very nice. 36 00:02:21,240 --> 00:02:21,940 And it's very simple. 37 00:02:21,940 --> 00:02:22,900 You only have to run. 38 00:02:23,380 --> 00:02:24,140 It's quite simple. 39 00:02:25,560 --> 00:02:28,960 And, of course, we got food and flamenco. 40 00:02:29,120 --> 00:02:30,640 Everybody knows flamenco, of course. 41 00:02:30,820 --> 00:02:32,040 And that's very nice. 42 00:02:33,100 --> 00:02:36,760 And we got very good people like Dalí. 43 00:02:38,020 --> 00:02:39,720 Painters like Dalí or Picasso. 44 00:02:40,040 --> 00:02:40,780 Maybe you know it. 45 00:02:41,260 --> 00:02:42,020 Who knows? 46 00:02:42,180 --> 00:02:43,420 Picasso and Dalí. 47 00:02:45,240 --> 00:02:49,320 Despite all the good things that Spain has done for the world, we have to apologize 48 00:02:49,320 --> 00:02:50,660 on behalf of the government. 49 00:02:50,660 --> 00:02:53,920 And pretty much 80% of the population for the Macarena. 50 00:02:54,860 --> 00:02:55,980 Oh, Macarena. 51 00:02:57,320 --> 00:02:58,360 Sorry about that. 52 00:02:58,440 --> 00:02:58,900 I like it. 53 00:02:58,900 --> 00:02:59,840 I like the Macarena. 54 00:02:59,880 --> 00:03:02,660 How many of you have been dancing Macarena sometime in your life? 55 00:03:02,800 --> 00:03:03,880 Please, confess it. 56 00:03:05,600 --> 00:03:06,160 Macarena. 57 00:03:07,800 --> 00:03:09,160 Well, all right. 58 00:03:09,260 --> 00:03:10,220 Let's get into business. 59 00:03:11,460 --> 00:03:12,020 Okay. 60 00:03:12,080 --> 00:03:16,300 So what we're actually going to talk today is connection string attacks. 61 00:03:16,540 --> 00:03:19,140 So to define what this is. 62 00:03:19,140 --> 00:03:23,480 So basically a connection string is how do you define how your application, like a web 63 00:03:23,480 --> 00:03:27,360 application or any other kind of application is going to connect to a data source. 64 00:03:27,600 --> 00:03:35,080 Being a data source, either a database, LDAP, some kind of file system base, XML, kind of 65 00:03:35,080 --> 00:03:36,240 whichever you want to use. 66 00:03:37,360 --> 00:03:42,340 And in particular, what we're going to focus our work here is database connection strings. 67 00:03:42,660 --> 00:03:47,720 If you look at that slide, what you have here is the very minimal database connection string 68 00:03:47,720 --> 00:03:48,380 that you could put. 69 00:03:48,380 --> 00:03:49,480 That you can put together. 70 00:03:50,060 --> 00:03:52,120 It's in four lines for the sake of clarity. 71 00:03:52,420 --> 00:03:54,520 But you could consider that as like a single string. 72 00:03:54,740 --> 00:03:56,280 What you have is the data source. 73 00:03:56,440 --> 00:04:00,120 That is the server where your data source is going to be. 74 00:04:00,200 --> 00:04:01,140 Your database in this case. 75 00:04:01,460 --> 00:04:02,520 You have the schema. 76 00:04:03,520 --> 00:04:06,960 Of course, you might have many databases in your server. 77 00:04:07,080 --> 00:04:08,660 So you're going to choose which one you want to use. 78 00:04:08,820 --> 00:04:09,880 And then you have the credentials. 79 00:04:10,080 --> 00:04:10,900 Username and password. 80 00:04:12,220 --> 00:04:14,460 As I said, it is like a string. 81 00:04:14,700 --> 00:04:18,360 And this is an example of a piece of code where you can see how this string works. 82 00:04:18,380 --> 00:04:18,960 How the strings are constructed. 83 00:04:19,340 --> 00:04:24,120 Usually when an application connects to a database, there's two ways of doing that. 84 00:04:24,300 --> 00:04:26,500 It's either a static string or it's a dynamic string. 85 00:04:26,760 --> 00:04:32,000 If this is a static string, then you just put everything together, like data source, 86 00:04:32,180 --> 00:04:36,280 something, semicolon, the schema, something, semicolon, username and password. 87 00:04:36,700 --> 00:04:43,900 If this is dynamic, if for some reason, and we will see the cases afterwards, you want to use 88 00:04:43,900 --> 00:04:47,140 dynamic parameters here, you have to create this string somehow. 89 00:04:48,380 --> 00:04:52,080 Unfortunately, most of the times you create this string by simple concatenation. 90 00:04:52,420 --> 00:04:56,240 And I think we all know more or less where this is going, right? 91 00:04:56,420 --> 00:05:00,440 So that's an example of how you put together a string by concatenation. 92 00:05:00,680 --> 00:05:07,120 And you can see kind of pretty much good suspect there to allow us to play with that. 93 00:05:07,220 --> 00:05:10,640 There's a character there that we're using to separate the field. 94 00:05:10,820 --> 00:05:12,780 And we might be able to abuse that. 95 00:05:13,040 --> 00:05:13,980 So that's all. 96 00:05:15,780 --> 00:05:16,480 We're finished. 97 00:05:16,700 --> 00:05:17,040 That's all. 98 00:05:18,380 --> 00:05:19,100 You can go. 99 00:05:20,620 --> 00:05:25,720 Well, some of the cases is not needed even to inject to extract data from the connection 100 00:05:25,720 --> 00:05:26,000 stream. 101 00:05:26,320 --> 00:05:31,780 There are a lot of easy queries that you can throw through Google to discover a lot of 102 00:05:31,780 --> 00:05:33,120 information from connection stream. 103 00:05:33,320 --> 00:05:39,580 Just looking for loading pages with data source parameter and you can discover, of course, 104 00:05:39,680 --> 00:05:41,860 the data source, the username and the password. 105 00:05:42,160 --> 00:05:43,720 The password is this. 106 00:05:46,920 --> 00:05:48,300 It's quite simple to do this. 107 00:05:48,420 --> 00:05:48,820 There are a lot. 108 00:05:48,880 --> 00:05:53,260 In this case, this is an example with an IBM. 109 00:05:53,880 --> 00:05:54,940 There are a lot of cases. 110 00:05:55,140 --> 00:05:59,180 Just playing with Google, you can discover a lot of information from connection stream. 111 00:05:59,700 --> 00:06:07,820 And in some other cases, the database administrator creates a special file, which is only a plain 112 00:06:07,820 --> 00:06:08,320 text file. 113 00:06:08,780 --> 00:06:12,300 But with a special extension, which is UDL. 114 00:06:12,300 --> 00:06:16,300 And that file stores the information of the connection stream. 115 00:06:16,580 --> 00:06:19,980 So you can just use Google to discover that kind of files. 116 00:06:20,340 --> 00:06:23,880 Just searching for the file type UDL password. 117 00:06:24,220 --> 00:06:25,560 And there are a lot of cases. 118 00:06:25,820 --> 00:06:27,820 In this example, there is a very complex password. 119 00:06:27,940 --> 00:06:30,440 You will never figure out what it is. 120 00:06:32,080 --> 00:06:33,280 And you can do it. 121 00:06:33,380 --> 00:06:34,000 Let's do it. 122 00:06:34,440 --> 00:06:35,340 We got time. 123 00:06:35,660 --> 00:06:39,200 So just Google. 124 00:06:39,200 --> 00:06:44,640 So X UDL password. 125 00:06:45,760 --> 00:06:46,440 That's all. 126 00:06:46,720 --> 00:06:46,980 Oh. 127 00:06:47,900 --> 00:06:48,440 Oh. 128 00:06:49,040 --> 00:06:49,580 Oh. 129 00:06:49,920 --> 00:06:50,960 It's the other one. 130 00:06:51,140 --> 00:06:51,900 Thanks, Google. 131 00:06:52,340 --> 00:06:52,880 Yeah. 132 00:06:53,400 --> 00:06:55,220 They even suggest how to do it right. 133 00:06:55,540 --> 00:07:01,660 Well, as you can see, there are files with information about the database, about the 134 00:07:01,660 --> 00:07:02,160 connection stream. 135 00:07:04,180 --> 00:07:06,880 Let's download one of these for instance. 136 00:07:08,200 --> 00:07:09,020 Let's see. 137 00:07:10,260 --> 00:07:11,660 One of my country. 138 00:07:16,540 --> 00:07:17,440 Which one? 139 00:07:21,740 --> 00:07:22,340 Whatever. 140 00:07:22,860 --> 00:07:23,160 This one. 141 00:07:25,840 --> 00:07:26,880 The first one. 142 00:07:27,160 --> 00:07:27,400 Okay. 143 00:07:31,060 --> 00:07:32,300 Let's install the file. 144 00:07:33,500 --> 00:07:34,100 Okay. 145 00:07:34,240 --> 00:07:38,940 In Windows, it's quite simple because you only have to double-click the file. 146 00:07:39,040 --> 00:07:39,180 And then you can see it. 147 00:07:39,200 --> 00:07:42,740 And Microsoft has a special tool to connect against the databases. 148 00:07:43,020 --> 00:07:45,640 And you've got the user name, the password. 149 00:07:45,880 --> 00:07:47,420 And you just test the connection. 150 00:07:47,780 --> 00:07:49,720 It's in Spanish because in Spanish it's better. 151 00:07:50,080 --> 00:07:51,900 You only have to click this button. 152 00:07:52,060 --> 00:07:52,900 And that's all. 153 00:07:53,120 --> 00:07:54,620 So it's quite simple. 154 00:07:58,680 --> 00:07:59,200 Okay. 155 00:08:04,540 --> 00:08:05,980 So back to business. 156 00:08:07,260 --> 00:08:09,180 Let's review very briefly how to do it. 157 00:08:09,200 --> 00:08:11,040 How a web application connects to a database. 158 00:08:11,280 --> 00:08:17,540 Because when it comes to authenticating with the database, there's a big main separation 159 00:08:17,540 --> 00:08:18,600 that we want to do here. 160 00:08:19,420 --> 00:08:25,820 Usual kind of web application that you probably have built, you take control of your users. 161 00:08:25,960 --> 00:08:32,200 So you have to take care inside the database to create the columns and tables for the whole 162 00:08:32,200 --> 00:08:34,140 authentication and authentication scheme. 163 00:08:34,400 --> 00:08:38,840 So that's how you manage the users in your application. 164 00:08:39,880 --> 00:08:43,580 There's other ‑‑ I'll explain that in a bit later. 165 00:08:43,960 --> 00:08:49,520 The other main way of authenticating is when you don't want one single user authenticating 166 00:08:49,520 --> 00:08:50,100 to the database. 167 00:08:50,640 --> 00:08:54,220 And then you use ‑‑ you have your users inside the database. 168 00:08:54,440 --> 00:08:58,280 You actually want your users to be the database users, okay? 169 00:08:58,540 --> 00:09:04,760 So the ‑‑ in this slide, we have the two ‑‑ the two parts are how the strings 170 00:09:04,760 --> 00:09:05,940 are constructed here. 171 00:09:06,080 --> 00:09:08,820 And the main difference is if you're going to use the integrated security. 172 00:09:08,820 --> 00:09:14,900 Which is no when you want to handle your authentication, or yes, when you want to use the system 173 00:09:14,900 --> 00:09:15,600 authentication. 174 00:09:16,100 --> 00:09:16,180 Okay? 175 00:09:17,760 --> 00:09:25,240 Usually when you have the first one, most cases you have one single user that the application, 176 00:09:25,500 --> 00:09:29,520 the entire application uses to connect to the database, and then you do whatever. 177 00:09:29,840 --> 00:09:31,100 That is not very right. 178 00:09:31,260 --> 00:09:36,980 Because if something goes wrong, then whichever user, no matter how your permission scheme 179 00:09:36,980 --> 00:09:38,000 is in your application. 180 00:09:38,000 --> 00:09:43,200 If something is wrong, like you have a SQL injection problem, then you can exploit that 181 00:09:43,200 --> 00:09:46,860 with the ‑‑ with whichever permissions that user has in the database. 182 00:09:47,140 --> 00:09:52,080 And usually ‑‑ well, not usually, always, if you're using just one user, that user needs 183 00:09:52,080 --> 00:09:56,160 permission all over the database for writing, reading, and modifying. 184 00:09:56,520 --> 00:10:00,580 So if you have the chance, and you have to write one of these applications, ideally what 185 00:10:00,580 --> 00:10:06,500 you want to do is have as many roles as possible, not one role per user, but one role per kind 186 00:10:06,500 --> 00:10:07,900 of action or functionality. 187 00:10:07,900 --> 00:10:12,560 So you want one role to write, and if possible, one role to write here. 188 00:10:12,720 --> 00:10:15,960 One role to write in this other place, and then one other role to read. 189 00:10:16,140 --> 00:10:20,620 That way, if you have a SQL injection problem in a script that reads something from the 190 00:10:20,620 --> 00:10:26,040 database, then you're not going to be able to write or modify the database, right? 191 00:10:26,880 --> 00:10:29,240 So you can go back to the other? 192 00:10:29,380 --> 00:10:29,600 Okay. 193 00:10:30,980 --> 00:10:36,600 The way this works is, like, the way this application works, no matter if you use one 194 00:10:36,600 --> 00:10:37,200 single user. 195 00:10:37,900 --> 00:10:42,080 If you use several users, is that this is the user that the application is using to 196 00:10:42,080 --> 00:10:47,420 authenticate against the database, which is different than my user, when my user name 197 00:10:47,420 --> 00:10:51,300 as a user of the application, when I authenticate against the application. 198 00:10:51,600 --> 00:10:56,960 So in this case, first the application is going to use those kind of static credentials 199 00:10:56,960 --> 00:11:01,460 to authenticate against the database, and then the application is going to ask me, the 200 00:11:01,460 --> 00:11:06,160 user, for my credentials, and then using the database connection that has already been 201 00:11:06,160 --> 00:11:06,500 established. 202 00:11:06,500 --> 00:11:12,360 With that static credentials, then it's going to look in this scheme that I've defined to 203 00:11:12,360 --> 00:11:16,220 see if I have permissions to do whatever I've done as a programmer in the application. 204 00:11:19,300 --> 00:11:27,880 When the application is authenticated using database users, it goes the other way around. 205 00:11:28,100 --> 00:11:32,520 First, the application is going to ask me for my credentials, and it's going to use 206 00:11:32,520 --> 00:11:36,020 these credentials to establish the connection with the database, all right? 207 00:11:36,500 --> 00:11:41,620 And then all that I can do in the database is whichever my user has permissions to do 208 00:11:41,620 --> 00:11:42,040 on the database. 209 00:11:42,940 --> 00:11:49,180 That's good in those environments in which you have an internal application with single 210 00:11:49,180 --> 00:11:56,560 sign-on credentials, or you are working with internal user and you want to know what is 211 00:11:56,560 --> 00:11:59,080 doing every user in your database and so on. 212 00:11:59,200 --> 00:12:04,620 In the previous case, it's impossible to trace from the database who did anything, because 213 00:12:04,620 --> 00:12:06,480 the trace had been done. 214 00:12:06,480 --> 00:12:08,020 It has to be done in the web application. 215 00:12:08,440 --> 00:12:09,520 So it's different. 216 00:12:09,720 --> 00:12:16,240 In one case, one environment is good for one kind of application, and the other one is 217 00:12:16,240 --> 00:12:17,780 good for another kind of application. 218 00:12:18,200 --> 00:12:24,740 And of course, that environment is mandatory if you want to manage the database. 219 00:12:25,080 --> 00:12:31,480 If you want to manage the database to create tables, to create new databases, to expand 220 00:12:31,480 --> 00:12:35,760 table space or whatever, you need to manage the database. 221 00:12:35,760 --> 00:12:38,440 So you need a special connection against the database. 222 00:12:38,720 --> 00:12:42,580 This means that pretty much every possible control panel that you can find out there 223 00:12:42,580 --> 00:12:47,740 is going to use something similar to this to work, because the user that you're using 224 00:12:47,740 --> 00:12:51,060 when you're authenticating the application, it is actually a database user. 225 00:12:55,140 --> 00:12:59,120 So as we said before, this is put together in a string. 226 00:12:59,300 --> 00:13:02,640 And then you're going to do a string concatenation to put all these values together. 227 00:13:02,940 --> 00:13:05,400 So the way this works. 228 00:13:05,760 --> 00:13:11,620 Is you get one string with this value first, with the value equal, like parameter equal 229 00:13:11,620 --> 00:13:14,300 value, semi-colon, parameter equal value, semi-colon. 230 00:13:14,380 --> 00:13:18,460 So what we're going to do is we're going to use this semi-colon as a separator. 231 00:13:18,660 --> 00:13:26,220 And if this string is going to be put together as a standard CQL string, then we're going 232 00:13:26,220 --> 00:13:28,880 to be able to add new information here. 233 00:13:29,160 --> 00:13:32,940 So now we're going to see what can we do by adding new information. 234 00:13:36,100 --> 00:13:40,960 This was discovered, like the fact that this was not the right way of doing it, this was 235 00:13:42,300 --> 00:13:44,360 known something around 2005. 236 00:13:44,820 --> 00:13:47,240 And Microsoft was aware of this in 2005. 237 00:13:47,640 --> 00:13:50,940 So what they did is they provided the proper way of doing this. 238 00:13:51,060 --> 00:13:54,480 And I think it's ASP.net 2.0. 239 00:13:54,620 --> 00:14:00,880 So since 2.0, you have this CQL connection string builder, which is an object that the 240 00:14:00,880 --> 00:14:01,620 framework provides. 241 00:14:01,880 --> 00:14:03,420 And that's how you should do it. 242 00:14:03,440 --> 00:14:05,600 You shouldn't do string concatenations. 243 00:14:05,760 --> 00:14:06,380 To create your strings. 244 00:14:06,820 --> 00:14:07,980 And that's secure. 245 00:14:08,260 --> 00:14:14,380 The problem is that nobody was aware about how to exploit this vulnerability. 246 00:14:14,700 --> 00:14:19,580 What can we do if we got a connection string injection into a component? 247 00:14:19,960 --> 00:14:20,720 What can be done? 248 00:14:21,220 --> 00:14:29,120 When we were starting to do research, we were trying to discover all the information published 249 00:14:29,120 --> 00:14:29,680 about this. 250 00:14:29,820 --> 00:14:35,660 And in OWASP, last September, it was impossible to discover any single reference about connection 251 00:14:35,760 --> 00:14:38,840 string attacks or connection string injection and whatever. 252 00:14:39,140 --> 00:14:42,380 Nobody was aware about how can we exploit this. 253 00:14:42,680 --> 00:14:44,860 So the problem is, is this important? 254 00:14:45,120 --> 00:14:48,400 Can be done something important with the semicolon? 255 00:14:48,600 --> 00:14:49,580 Is this dangerous? 256 00:14:51,560 --> 00:14:52,980 So we did it. 257 00:14:53,240 --> 00:14:56,020 So you know that this is not how you should put together a string connection. 258 00:14:56,280 --> 00:14:58,200 But you didn't know that it's exploitable. 259 00:14:58,360 --> 00:15:02,080 So we've been working on a few ways of exploiting it. 260 00:15:02,400 --> 00:15:05,740 So there's two things. 261 00:15:05,740 --> 00:15:06,920 There's two main things that we're going to do. 262 00:15:07,060 --> 00:15:09,300 We're going to use the semicolon to add new parameters. 263 00:15:09,500 --> 00:15:12,600 Or we're going to use the semicolon to add existing parameters. 264 00:15:12,920 --> 00:15:17,060 And I'm going to refer now to something that I guess most of you know because it's been 265 00:15:17,060 --> 00:15:20,080 there for a couple of years now, which is HTTP parameter pollution. 266 00:15:20,520 --> 00:15:26,300 When you have HTTP parameter pollution, the way that works is you're going to have one 267 00:15:26,300 --> 00:15:27,700 parameter duplicated. 268 00:15:27,900 --> 00:15:32,900 So in your URL, you're going to have twice, two different values for the same parameter. 269 00:15:33,340 --> 00:15:35,640 Depending on what system you're using. 270 00:15:35,640 --> 00:15:37,320 That's going to behave differently. 271 00:15:37,780 --> 00:15:41,540 One platform, one set of technologies is going to take the first one. 272 00:15:41,680 --> 00:15:43,440 Another is going to take the second one. 273 00:15:43,820 --> 00:15:47,200 The most dangerous one is where sometimes you're going to use the first one and sometimes 274 00:15:47,200 --> 00:15:48,340 you're going to use the second one. 275 00:15:48,480 --> 00:15:51,240 So you can use that to go over filters and that. 276 00:15:52,500 --> 00:15:55,220 So we have something very, very similar here. 277 00:15:55,480 --> 00:15:56,680 Actually we have the same here. 278 00:15:56,800 --> 00:15:59,720 We have a parameter pollution behavior. 279 00:16:00,100 --> 00:16:04,680 And the way it works in this case is whichever happens last, that's what counts. 280 00:16:04,680 --> 00:16:12,040 So if in my string I have a value twice, sorry, I have two parameters twice, the second 281 00:16:12,040 --> 00:16:13,140 one is what I'm going to use. 282 00:16:13,260 --> 00:16:17,480 So if you look at the slide at the top, that would be my string, right? 283 00:16:17,620 --> 00:16:22,240 Then if I start reading left to right, I have value A for my first parameter. 284 00:16:22,760 --> 00:16:23,840 So that's fine. 285 00:16:23,960 --> 00:16:25,660 I have value B for my second parameter. 286 00:16:25,820 --> 00:16:26,300 That's fine. 287 00:16:26,440 --> 00:16:31,740 But then I repeat my first parameter with value C. Then what's going to happen is that 288 00:16:31,740 --> 00:16:33,140 value A is not there anymore. 289 00:16:33,300 --> 00:16:34,480 Value C is what counts. 290 00:16:34,680 --> 00:16:36,100 And the same for the second parameter. 291 00:16:37,000 --> 00:16:43,140 That's quite nice because you can rewrite the whole connection string, which is very 292 00:16:43,140 --> 00:16:43,320 good. 293 00:16:46,120 --> 00:16:47,580 And this is how it works. 294 00:16:47,720 --> 00:16:49,560 Like the previous slide was a generic example. 295 00:16:49,760 --> 00:16:54,460 This is how you modify the database connection object through the string. 296 00:16:54,620 --> 00:16:58,800 So you first usually have the data source, whichever value. 297 00:16:59,040 --> 00:17:00,260 Then you have your user name. 298 00:17:00,420 --> 00:17:01,400 Then you have your password. 299 00:17:01,640 --> 00:17:04,660 But then as your password, you can do this. 300 00:17:04,680 --> 00:17:09,040 You can do something, semicolon, data source equal, something different. 301 00:17:09,280 --> 00:17:13,340 And then you're changing the database that the application is going to connect to. 302 00:17:14,620 --> 00:17:16,320 So how can you use that? 303 00:17:16,600 --> 00:17:23,040 Well, you can use that, for example, to scan servers that you would not be able to scan 304 00:17:23,040 --> 00:17:24,020 because there's a firewall. 305 00:17:24,360 --> 00:17:30,460 Since the web application server is inside the network and the database server is inside 306 00:17:30,460 --> 00:17:32,100 the network, they can connect to each other. 307 00:17:32,240 --> 00:17:34,660 But you probably cannot connect to the database. 308 00:17:34,660 --> 00:17:38,360 You can't connect to the database from outside or to many other servers from outside because 309 00:17:38,360 --> 00:17:39,320 there's a firewall. 310 00:17:39,620 --> 00:17:46,440 However, we've just seen that I can override the data source parameter with whichever I 311 00:17:46,440 --> 00:17:46,620 want. 312 00:17:46,800 --> 00:17:53,700 So if in my string I override that to another internal server, I can just try to be using 313 00:17:53,700 --> 00:17:59,940 this application with development data server with maybe data that has not been released 314 00:17:59,940 --> 00:18:04,640 so far, important information inside the company like financial information. 315 00:18:05,880 --> 00:18:10,060 Or even things that have been there and are not maintained anymore. 316 00:18:11,220 --> 00:18:19,260 But there's another good thing that I can do, which is I can change the data source 317 00:18:19,260 --> 00:18:21,440 to a server that I control outside. 318 00:18:21,800 --> 00:18:25,420 And since most of the times the firewall is going to be allowing outbound connections, 319 00:18:25,800 --> 00:18:30,760 then if I change the data source to a server that I control, I'm actually getting the credentials, 320 00:18:31,100 --> 00:18:32,820 like the hash of the credentials. 321 00:18:32,960 --> 00:18:34,000 So I can use that. 322 00:18:39,760 --> 00:18:45,740 When you specify the value for the data source, you specify the server and the port. 323 00:18:46,040 --> 00:18:50,540 So same that we've just seen how to scan different servers, you can scan different ports. 324 00:18:50,880 --> 00:18:54,520 So the way it works is exactly the same. 325 00:18:54,740 --> 00:19:01,580 After whichever field in the data, in the connection stream where you can inject something, 326 00:19:01,780 --> 00:19:02,960 you do semicolon. 327 00:19:02,960 --> 00:19:05,280 And then overwrite the data source. 328 00:19:05,520 --> 00:19:11,960 In this case, try in different ports to do a port scan of a server that was not accessible 329 00:19:11,960 --> 00:19:13,460 to you before because of the firewall. 330 00:19:16,120 --> 00:19:19,940 That's how you change a parameter, right? 331 00:19:20,080 --> 00:19:22,400 We just change the data source to whichever. 332 00:19:22,740 --> 00:19:24,000 We've polluted the parameter. 333 00:19:24,300 --> 00:19:26,740 But you can also add a new parameter that was not there. 334 00:19:26,980 --> 00:19:30,660 The data stream, the connection stream that we've seen at the beginning is like the most 335 00:19:30,660 --> 00:19:32,300 simple string that you can have. 336 00:19:32,300 --> 00:19:33,240 With those four parameters. 337 00:19:33,500 --> 00:19:34,920 But there's more stuff that you can do here. 338 00:19:35,180 --> 00:19:39,600 And in this case, you can see that I can use my data source, my username, my password. 339 00:19:39,820 --> 00:19:44,160 But then I can inject other information that wasn't there before. 340 00:19:44,360 --> 00:19:46,340 Like integrated security equals two. 341 00:19:46,580 --> 00:19:51,320 This parameter is the one that defines the behavior between the two ways of authenticating 342 00:19:51,320 --> 00:19:52,620 that I've been explaining before. 343 00:19:53,080 --> 00:20:00,220 Integrated security equals no means that I handle the authentication by myself inside 344 00:20:00,220 --> 00:20:00,680 the database. 345 00:20:02,300 --> 00:20:08,020 Integrated security equals two is I'm going to use system and database accounts for this. 346 00:20:08,260 --> 00:20:15,480 So let's see this behavior in some demos in real with some commercial products. 347 00:20:15,840 --> 00:20:18,920 And first of all, let's analyze what kind of attacks can be done. 348 00:20:19,180 --> 00:20:23,480 So the first one, we're going to steal the system account of the web server. 349 00:20:23,680 --> 00:20:24,980 The idea is to steal the hash. 350 00:20:25,160 --> 00:20:26,320 And it's quite simple. 351 00:20:26,900 --> 00:20:32,040 First of all, we need a rogue server in which we are going to run a SQL server. 352 00:20:32,040 --> 00:20:33,820 That we are able to manage. 353 00:20:34,060 --> 00:20:37,620 Then we are activate one sniffer on it. 354 00:20:37,760 --> 00:20:43,120 And then we only have to rewrite the data source parameter into the connection stream. 355 00:20:43,440 --> 00:20:47,280 And of course, set the integrated security equals to true. 356 00:20:47,380 --> 00:20:53,240 That means that the credentials that are going to be used are the operating system credentials. 357 00:20:53,660 --> 00:21:00,160 And in this case, is the web application which is the one which is trying to connect to the 358 00:21:00,160 --> 00:21:00,500 database. 359 00:21:00,500 --> 00:21:03,620 And the web application is running on the web server. 360 00:21:03,860 --> 00:21:08,660 So the operating system account that is going to be used is the operating system account 361 00:21:08,660 --> 00:21:09,700 of the web server. 362 00:21:10,320 --> 00:21:10,880 Understood? 363 00:21:11,160 --> 00:21:12,540 So it's quite simple. 364 00:21:12,680 --> 00:21:14,360 Let's suppose that we got this connection stream. 365 00:21:14,680 --> 00:21:21,140 So attacker only has to inject something like semicolon data source equals to rogue server 366 00:21:21,740 --> 00:21:25,620 password empty semicolon integrated security equals to true. 367 00:21:26,440 --> 00:21:29,420 That's an example with ASP net enterprise manager. 368 00:21:29,580 --> 00:21:29,900 Which is. 369 00:21:29,900 --> 00:21:33,220 This is a product that is on the internet in a lot of places. 370 00:21:33,520 --> 00:21:34,840 And the idea is quite simple. 371 00:21:34,980 --> 00:21:41,480 In this example, as you can see, we just use semicolon data source to an IP address. 372 00:21:41,740 --> 00:21:44,260 And then just integrated security equals to true. 373 00:21:45,180 --> 00:21:46,260 It's a very bad product. 374 00:21:46,740 --> 00:21:49,960 As you can see, you can read the password even on the screen. 375 00:21:50,280 --> 00:21:50,360 But. 376 00:21:50,820 --> 00:21:52,140 And of course, you get access. 377 00:21:52,660 --> 00:21:59,700 If you have kind of running on your machine, you can read the hash of the system. 378 00:21:59,700 --> 00:22:01,140 Which is quite simple. 379 00:22:02,240 --> 00:22:03,340 Attack number two. 380 00:22:03,460 --> 00:22:04,400 Power scanning attack. 381 00:22:04,720 --> 00:22:10,100 In this example, we are going to duplicate the data source parameter. 382 00:22:10,500 --> 00:22:16,700 And we are going to use the data source, the target server. 383 00:22:16,880 --> 00:22:19,060 The server that we want to scan. 384 00:22:19,280 --> 00:22:23,800 So we only have to change the target port and check the error messages. 385 00:22:24,240 --> 00:22:29,560 In this example, if we obtain a no TCP connection, that means that the port is closed. 386 00:22:29,700 --> 00:22:39,680 If we retrieve no SQL server or no database and discover, then the port is open. 387 00:22:39,880 --> 00:22:44,280 And if we retrieve something like invalid password, then the SQL server is there. 388 00:22:44,440 --> 00:22:45,820 Which is very good. 389 00:22:46,100 --> 00:22:51,780 So in this example, with this connection string against SQL server 2005, the idea is just 390 00:22:51,780 --> 00:22:57,620 to inject something like semicolon data source equals to target server target port in the 391 00:22:57,620 --> 00:22:58,100 user ID. 392 00:22:58,260 --> 00:22:59,380 And in the password. 393 00:22:59,380 --> 00:23:02,560 Just something like semicolon integrated security equals to. 394 00:23:02,760 --> 00:23:04,600 This is a commercial product. 395 00:23:05,080 --> 00:23:06,620 Which is MySQL. 396 00:23:07,120 --> 00:23:08,340 My little admin. 397 00:23:08,540 --> 00:23:12,240 And in it, you've got a panel to connect to your database. 398 00:23:12,560 --> 00:23:16,580 And just trying to discover if Google is answering in the 80 port. 399 00:23:17,040 --> 00:23:21,500 You retrieve something like a connection work successfully established with the server and 400 00:23:21,500 --> 00:23:22,040 blah, blah, blah, blah. 401 00:23:22,360 --> 00:23:25,960 But if you try the 1420 port. 402 00:23:26,140 --> 00:23:27,580 You retrieve something like. 403 00:23:28,340 --> 00:23:28,920 There's. 404 00:23:28,920 --> 00:23:30,300 There's nothing listening there. 405 00:23:32,000 --> 00:23:35,200 The third attack is quite simple. 406 00:23:35,360 --> 00:23:40,360 The idea is just, okay, the web server has a system account that is in the company. 407 00:23:40,600 --> 00:23:43,720 The database is in the company. 408 00:23:43,960 --> 00:23:45,520 Why are you asking me a credential? 409 00:23:45,880 --> 00:23:47,700 Use your credential and get me in. 410 00:23:47,880 --> 00:23:49,340 Which is the idea. 411 00:23:49,580 --> 00:23:51,120 So duplicate the data source parameter. 412 00:23:51,580 --> 00:23:55,540 Then set integrated security equals to true. 413 00:23:55,640 --> 00:23:56,600 And that's all. 414 00:23:56,800 --> 00:23:58,360 Because the application is going to take. 415 00:23:58,360 --> 00:24:00,820 It's credential to connect again the database. 416 00:24:01,040 --> 00:24:04,100 And we are going to have a connection to the application. 417 00:24:04,500 --> 00:24:06,020 So the idea is quite simple. 418 00:24:06,180 --> 00:24:09,580 Just in this connection string. 419 00:24:09,980 --> 00:24:15,480 The only thing that we need to inject is data source equals to target server and integrated 420 00:24:15,480 --> 00:24:16,980 security equals to true. 421 00:24:17,520 --> 00:24:18,420 Quite simple. 422 00:24:18,680 --> 00:24:21,260 In this example, web data administrator. 423 00:24:21,620 --> 00:24:24,480 Which is, it was a Microsoft application. 424 00:24:24,880 --> 00:24:25,840 In 2004. 425 00:24:26,360 --> 00:24:27,560 It releases. 426 00:24:27,620 --> 00:24:28,340 A server. 427 00:24:28,340 --> 00:24:29,320 It's an open source tool. 428 00:24:29,620 --> 00:24:33,620 And right now it's not depending on Microsoft. 429 00:24:34,280 --> 00:24:36,320 But the idea is similar. 430 00:24:36,540 --> 00:24:37,240 Is the same. 431 00:24:37,380 --> 00:24:41,120 We got the user name and password to connect to the database. 432 00:24:41,380 --> 00:24:43,780 So data source equals to the database. 433 00:24:45,720 --> 00:24:48,940 Password set as integrated security equals to true. 434 00:24:49,120 --> 00:24:53,060 And then just we get into the control panel. 435 00:24:54,260 --> 00:24:57,720 And of course you get access to all the users and so on. 436 00:24:58,340 --> 00:25:02,920 So you can do the same with the rest of the products that we've been seeing before. 437 00:25:03,220 --> 00:25:06,260 And in this example, you can see better how it works. 438 00:25:06,440 --> 00:25:11,100 This is the connection string information that you can see when you get into a My Little 439 00:25:11,100 --> 00:25:14,100 Admin control panel. 440 00:25:14,340 --> 00:25:19,780 And in this example, you can see that we got one data source that is pointing to the 441 00:25:19,780 --> 00:25:27,200 original database and our data source, which is pointing to the local host server and then 442 00:25:27,200 --> 00:25:28,320 the integrated server. 443 00:25:28,340 --> 00:25:36,560 Integrated security is equals to no in the original connection string and in our connection 444 00:25:36,560 --> 00:25:39,280 string is set to true. 445 00:25:39,580 --> 00:25:42,980 So in this example, the last value wins. 446 00:25:43,320 --> 00:25:44,540 So it's quite simple. 447 00:25:44,740 --> 00:25:48,180 And we can do the same, of course, with the ASP net enterprise manager. 448 00:25:48,780 --> 00:25:56,080 So semicolon data source equals to whatever and semicolon integrated security equals to 449 00:25:56,080 --> 00:25:56,280 true. 450 00:25:56,660 --> 00:25:58,320 And you get into the database. 451 00:25:58,340 --> 00:26:06,780 So this we've been talking about how usually .NET applications connect to SQL server databases. 452 00:26:07,180 --> 00:26:12,620 But this if you want to extend this to other, MySQL doesn't really extend this. 453 00:26:13,560 --> 00:26:17,420 You can so doesn't really it doesn't support integrated security. 454 00:26:17,720 --> 00:26:24,580 But if you're using .NET application with a connection string to connect to MySQL database, 455 00:26:24,820 --> 00:26:27,040 you still can do all the other stuff that we're doing. 456 00:26:27,040 --> 00:26:28,340 Like the post scanning and stuff. 457 00:26:29,740 --> 00:26:32,260 With Oracle, it works. 458 00:26:32,500 --> 00:26:32,860 It works. 459 00:26:32,980 --> 00:26:37,640 All everything that we've said works, like scanning and the whole integrated security. 460 00:26:37,960 --> 00:26:39,200 It even works on Unix accounts. 461 00:26:39,600 --> 00:26:47,020 And it is there's this thing that you can use in Oracle to kind of use your users, kind 462 00:26:47,020 --> 00:26:50,960 of a super user to do every administration thing that you want to do in the database. 463 00:26:51,180 --> 00:26:55,640 So that's something that you can even do if your database here is Oracle. 464 00:26:55,820 --> 00:26:56,320 You will just. 465 00:26:56,320 --> 00:26:58,820 Append to your connection string this thing. 466 00:26:59,500 --> 00:27:01,560 And then your user has full control there. 467 00:27:02,000 --> 00:27:04,340 So let's see this in action. 468 00:27:04,680 --> 00:27:11,560 We got a testing environment in this example. 469 00:27:11,840 --> 00:27:25,540 It's a window 2003 and meet the password and let's open Internet Explorer and let's connect 470 00:27:25,540 --> 00:27:28,620 to different parameters, connection string. 471 00:27:29,400 --> 00:27:31,600 So let's start with the HP net. 472 00:27:33,200 --> 00:27:34,940 This is the connection string. 473 00:27:35,400 --> 00:27:39,300 This is the control panel for Microsoft SQL server. 474 00:27:39,560 --> 00:27:42,120 There are a lot of control panel like this on the Internet. 475 00:27:42,880 --> 00:27:45,880 Any of you are using this software to manage a database? 476 00:27:47,980 --> 00:27:49,980 Well, the idea is quite simple. 477 00:27:50,120 --> 00:27:51,860 We need to use only one tool. 478 00:27:51,980 --> 00:27:54,680 It's the most powerful tool ever created. 479 00:27:54,680 --> 00:27:57,520 Integrated, which is the notepad. 480 00:27:59,260 --> 00:28:04,640 And just integrated security equals true. 481 00:28:04,900 --> 00:28:05,680 That's all. 482 00:28:06,140 --> 00:28:11,360 Then right button, copy, it's in Spanish, but you know, in Spanish. 483 00:28:13,680 --> 00:28:15,720 So the user is test. 484 00:28:16,340 --> 00:28:24,180 The user is test and we are going to try to duplicate the parameter pollution to local 485 00:28:24,180 --> 00:28:24,480 host. 486 00:28:24,780 --> 00:28:30,880 In this example it's the same because you can set up in this field whatever servers, 487 00:28:31,060 --> 00:28:34,800 but to do this we are going to connect to the white house. 488 00:28:38,180 --> 00:28:42,380 It's not going to connect to the white house because the last parameter wins, you know. 489 00:28:43,660 --> 00:28:51,600 And then text integrated security equals to true and connect and that's all. 490 00:28:51,820 --> 00:28:53,100 And you get into the control panel. 491 00:28:53,100 --> 00:28:54,120 It's so easy. 492 00:28:54,240 --> 00:28:55,480 You can do the same on Internet. 493 00:28:55,860 --> 00:28:56,880 It's so easy. 494 00:28:57,040 --> 00:28:58,500 Just doing this. 495 00:28:59,680 --> 00:29:01,360 But it's illegal, don't do that. 496 00:29:06,320 --> 00:29:10,040 So web data administrator, the same idea. 497 00:29:14,640 --> 00:29:15,760 Username palako. 498 00:29:16,440 --> 00:29:17,180 Thank you. 499 00:29:18,220 --> 00:29:18,820 I love you. 500 00:29:20,600 --> 00:29:21,160 Palako. 501 00:29:21,160 --> 00:29:27,040 Palako and data source equals to local host. 502 00:29:27,300 --> 00:29:33,120 Index example is a SQL Server express edition. 503 00:29:33,460 --> 00:29:47,440 So we need to use ‑‑ we need to use ‑‑ to use the ‑‑ it's not here. 504 00:29:48,020 --> 00:29:49,700 Integrated security equals to true. 505 00:29:49,700 --> 00:29:54,880 Just space and get into ‑‑ okay. 506 00:29:54,980 --> 00:29:57,580 And you get into the database and manage whatever. 507 00:30:00,180 --> 00:30:11,600 The last one, the commercial product, my little admin, that's a SQL ‑‑ that's control 508 00:30:11,600 --> 00:30:14,020 using SQL Server express. 509 00:30:14,320 --> 00:30:18,420 We need to connect against a SQL Server express. 510 00:30:18,880 --> 00:30:19,680 It's simple. 511 00:30:19,700 --> 00:30:32,280 is more or less the same, but with local host slash SQL server express. That's it. And right 512 00:30:32,280 --> 00:30:40,800 button, paste, connect, and you get access to the database. In the example, we can analyze 513 00:30:40,800 --> 00:30:49,680 the connection stream. So connection. And as you can see here, we have a connection 514 00:30:49,700 --> 00:30:56,640 stream. We got in the first place the original data source parameter, which is pointing to 515 00:30:56,640 --> 00:31:04,480 blah, blah, blah. And then we got our data source, that in this case is on the same machine, 516 00:31:04,600 --> 00:31:12,720 but you can use another machine. And the original integrated security is set to no, but our 517 00:31:12,720 --> 00:31:19,580 integrated security is set to true. Then the last wins. And we get access to the 518 00:31:19,580 --> 00:31:28,140 control panel. And you can do the same with an Oracle application in this example. It's 519 00:31:28,140 --> 00:31:36,500 just a testing application because it's not that common to find on the Internet control 520 00:31:36,500 --> 00:31:43,720 panels to manage Oracle databases with integrated security enabled. So in this example, this 521 00:31:43,720 --> 00:31:49,560 is just a testing application that we developed doing the same. So user, Oracle, integrated, 522 00:31:49,580 --> 00:31:58,560 data source equals to local host, right button, integrated security equals to true, and you get 523 00:31:58,560 --> 00:32:02,040 access to the internal application. Is that all? 524 00:32:10,760 --> 00:32:19,000 So the good idea with this is that if something, someone is working on your company, like a 525 00:32:19,000 --> 00:32:26,420 vendor or a partner or whatever, or an internal user, he can try to do the same with the integrated 526 00:32:26,420 --> 00:32:27,400 security parameter. 527 00:32:27,860 --> 00:32:36,500 The idea is that he is able to publish an ASP or JSP application on the web server. 528 00:32:37,140 --> 00:32:42,560 He's going to be able to try to connect against any database on your company, which is very 529 00:32:42,560 --> 00:32:48,660 bad. In a hosting environment in which somebody is able to put a file into your server or 530 00:32:48,660 --> 00:32:54,060 Or maybe he's using FOCA and discovered a put option, put method enabled on your website. 531 00:32:54,300 --> 00:33:00,240 He can upload a scanner to discover the whole network trying the integrated security connection 532 00:33:00,770 --> 00:33:01,780 against the database. 533 00:33:02,120 --> 00:33:02,980 It's so simple. 534 00:33:03,320 --> 00:33:13,500 So we developed a scanner, which is CHPP scanner, which is available for download in that URL. 535 00:33:13,760 --> 00:33:15,300 And you can try it in your company. 536 00:33:15,560 --> 00:33:17,020 So the idea is quite simple. 537 00:33:17,020 --> 00:33:23,540 You put the ASP file on your website and just click the button, and then the application 538 00:33:23,540 --> 00:33:29,000 is going to scan the whole network with internal IP address trying to connection and string 539 00:33:29,000 --> 00:33:31,720 with the integrated security equals to true. 540 00:33:31,960 --> 00:33:40,020 And if the application discovered SQL Server, then try to give you a SQL query environment 541 00:33:40,020 --> 00:33:43,560 in which you can throw your SQL queries against the internal database. 542 00:33:43,860 --> 00:33:45,020 So it's quite simple. 543 00:33:45,620 --> 00:33:46,060 Let's see. 544 00:33:46,060 --> 00:33:57,740 see this in our demo, in our testing environment. So it looks like this. And the idea is that 545 00:33:57,740 --> 00:34:06,160 you only have to put this file into R, into the website, then the application is going 546 00:34:06,160 --> 00:34:13,400 to check how many network interface you have on the web server and just click it on the 547 00:34:13,400 --> 00:34:24,500 network interface. You can scan the whole network. Scan with 100 threads. Scan SQL servers. 548 00:34:25,080 --> 00:34:31,980 And now it is going to try to discover the SQL servers. In this case, there is only one 549 00:34:31,980 --> 00:34:39,600 SQL server, which is the one I'm using for the demos. And once it discovers it, I only 550 00:34:39,600 --> 00:34:41,720 have to click on it and get connection. 551 00:34:45,180 --> 00:34:55,340 So, finishing. All this product, all this commercial software was advised before we 552 00:34:55,340 --> 00:35:04,140 released the talk. And they released an advisory in September. People of my little admin and 553 00:35:04,140 --> 00:35:11,700 my little back up released this security advisory about this vulnerability. And it was a very 554 00:35:11,720 --> 00:35:12,220 successful service that was in use. So let's talk about that. How much the service was 555 00:35:12,220 --> 00:35:16,640 designed with? It says there is a new version, that fixes one security vulnerability. The 556 00:35:16,640 --> 00:35:21,760 good idea is, or the funny thing about this software is, there at the beginning, when we 557 00:35:21,760 --> 00:35:27,720 got into contact with the main developer, he said, that wasn't a vulnerability. That 558 00:35:27,720 --> 00:35:37,640 wasn't a feature. So, yeah. So it released, first, a small patch with minor security, minor 559 00:35:37,640 --> 00:35:41,700 security update, vulnerability because it's minor that anyone can get into that security. That's the 560 00:35:41,720 --> 00:35:47,460 your database. It's a minor security. It's not that important. Your application is running. 561 00:35:47,820 --> 00:35:54,700 So that's important. And that guy was very, very nervous at the beginning when we got 562 00:35:54,700 --> 00:36:01,780 in contact with him because he was worried about the business. So he counterattacked 563 00:36:01,780 --> 00:36:07,500 with a marketing campaign saying, okay, there's a minor security vulnerability or a minor 564 00:36:07,500 --> 00:36:15,020 security bug, but a lot of companies are using our products. Like the US government, go daddy. 565 00:36:18,760 --> 00:36:26,220 US Army. US Army again. Oh, my God. That's quite nice. Because I got the cam, but now I got 566 00:36:26,220 --> 00:36:37,360 the target. So it's quite nice. I love it. That's for you. This application is not 567 00:36:37,360 --> 00:36:42,340 maintained anymore. If you are so unlucky to be using this, you're going to have to patch it 568 00:36:42,340 --> 00:36:49,920 yourself. So it's basically you just have to go over the code. It's actually not very well 569 00:36:49,920 --> 00:36:53,860 written. So there's no one single place where you go and change it. There's connections and 570 00:36:53,860 --> 00:36:58,260 strings all over the place. So you have to go over the code and change these connection 571 00:36:58,260 --> 00:37:03,820 and strings for the proper way of doing it with the objects in the framework that we were 572 00:37:03,820 --> 00:37:07,340 mentioning before. And the last one is the HTTP 4.0 application. If you're running an 573 00:37:08,880 --> 00:37:15,900 originally it was a Microsoft application that in 2004 released as an open source project 574 00:37:16,280 --> 00:37:23,420 and since that moment Microsoft didn't maintain the software. The problem is that Microsoft 575 00:37:23,420 --> 00:37:30,820 was publishing the old version on the Internet and there is a small problem with the search 576 00:37:30,820 --> 00:37:38,960 engine optimization that Microsoft has more page rank than open source project. So everybody 577 00:37:38,960 --> 00:37:44,620 was trying to download the ASP net web data administrator, the first link that appears 578 00:37:44,900 --> 00:37:52,200 on the web search web engine was the Microsoft link. So it was a problem because there was 579 00:37:52,200 --> 00:37:58,320 no difference between the original which was unsecure and the open source project which 580 00:37:58,320 --> 00:37:58,840 is secure. 581 00:37:59,160 --> 00:38:00,800 So we got a problem. 582 00:38:00,820 --> 00:38:05,320 We got in contact with Microsoft and Microsoft in the end take it off from the Internet. 583 00:38:05,560 --> 00:38:10,080 So right now it's impossible to download the unsecure version which is good. 584 00:38:12,380 --> 00:38:22,980 How do you fix this? So first of all, we've seen that you can steal credentials by allowing 585 00:38:22,980 --> 00:38:30,800 outbound connections to your server. So set up your firewalls correctly and don't allow 586 00:38:30,820 --> 00:38:35,680 connections, outbound connections that you shouldn't. You've also seen that by using 587 00:38:35,680 --> 00:38:40,140 integrated security equals true, you can use system accounts to try different servers inside 588 00:38:40,140 --> 00:38:45,460 the network. Usually you don't need that many accounts in all your servers. So if you 589 00:38:45,460 --> 00:38:50,000 could take care of individual servers, what accounts do I need here and there, it's going 590 00:38:50,000 --> 00:38:56,400 to harden a lot of your organization. Because even with integrated security equals true, if 591 00:38:56,400 --> 00:39:00,800 there's no credentials in the other servers, then there's nothing you can do. So we're going to 592 00:39:00,800 --> 00:39:07,160 have to fix this. Of course, don't use string concatenations. Use the connection string builder 593 00:39:07,160 --> 00:39:13,380 object that is provided to you by the framework. And if you don't have any other option, filter 594 00:39:13,380 --> 00:39:20,300 the semicolons. And that's all. Questions at room 113. Thanks for all. Thank you.