1 00:00:00,000 --> 00:00:09,240 Hello. Hello everybody. How many of you speak Spanish? Okay, perfect. Well, we got here a 2 00:00:09,240 --> 00:00:19,540 trophy because today, this morning, we had a tournament of soccer and our team won the 3 00:00:19,540 --> 00:00:24,020 trophy, the Spanish team, the FOCA team. I'm sorry for the Argentina, South Africa, the rest of 4 00:00:24,020 --> 00:00:27,220 the team. We won the trophy. Next year, maybe. 5 00:00:32,480 --> 00:00:41,160 Well, thank you for coming to this session. First of all, first of all, let me introduce to 6 00:00:41,160 --> 00:00:48,180 us. My friend is Juan Garrido, and I'm Chema Alonso. We are working in a small company in 7 00:00:48,180 --> 00:00:53,480 Spain called Informatica 64. And before that, before starting with the topic, we would like to 8 00:00:54,340 --> 00:00:57,020 introduce our country. We are from Spain. 9 00:00:57,560 --> 00:00:58,160 . 10 00:00:58,160 --> 00:00:59,120 Probably. 11 00:00:59,560 --> 00:00:59,980 . 12 00:01:00,000 --> 00:01:05,500 It's a small country. This is a small country in the middle of everything. We are in the 13 00:01:05,500 --> 00:01:11,640 middle of Europe and Africa and South America because of our history. And if you never went to 14 00:01:11,640 --> 00:01:16,420 Spain, you have to go there. I'm from Madrid, which is a very nice city. It was the capital of 15 00:01:16,420 --> 00:01:23,600 the big empire five centuries ago. But it's a very nice city. And if you go to Madrid, you will 16 00:01:23,600 --> 00:01:29,420 never be a foreigner because if you go to Madrid, you are from Madrid. So come to our city. Juanito 17 00:01:29,420 --> 00:01:37,920 is from another city. It was the capital of the Arabic empire in the 7th century when Spain was an 18 00:01:37,920 --> 00:01:47,380 Arabic country a lot of centuries ago. And from that tower is the gold's tower, the first tower on 19 00:01:47,380 --> 00:01:53,800 the left, is where the gold from America came to Europe. That's the gold's tower. It's on 20 00:01:53,800 --> 00:01:59,400 Sevilla. And Sevilla is very famous because of the parties, because of the flamenco, and so on. And 21 00:01:59,400 --> 00:02:07,120 especially there are big monuments. This is one of the most famous monuments in Sevilla. It's the 22 00:02:07,120 --> 00:02:14,620 Plaza de España. Probably all of you know this monument. And you have to visit it because it's a 23 00:02:14,620 --> 00:02:21,560 monument in which you will fall in love because if Anakin Skywalker could fall in love in 24 00:02:21,560 --> 00:02:29,120 Sevilla, you can do it also. So don't forget to visit our country. Well, Juanito is from a 25 00:02:29,400 --> 00:02:36,060 very small area of Sevilla, which is Triana. Triana is an independent republic in Sevilla. And 26 00:02:36,060 --> 00:02:41,960 it's very famous for the holy week because they are very religious. And there are thousands of 27 00:02:41,960 --> 00:02:52,020 people carrying the images and, of course, after that, having drinks. Well, we work in Informatica 28 00:02:52,020 --> 00:02:59,380 64, and probably some of you have been listening about FOCA, which is one of the most famous 29 00:02:59,400 --> 00:02:59,420 cities in the world. And it's a very famous place, because it's a very popular place. And 30 00:02:59,420 --> 00:03:02,240 it's a very famous place for the tools that we develop and it's a free tool that you can use for 31 00:03:02,240 --> 00:03:07,060 strike information, pen testing and so on. Tomorrow we are going to deliver a workshop of 32 00:03:07,060 --> 00:03:13,880 eight hours with a new version, which is the version 3. So if any of you want to attend, I'm not 33 00:03:13,880 --> 00:03:21,920 sure if you can book for a seat, but you can ask for it. What is the topic that we are going to talk 34 00:03:21,920 --> 00:03:28,900 today? Well, we are going to talk about something which is very, very common, which is the remote 35 00:03:29,400 --> 00:03:36,460 communication using Citrix and terminal services. There are a lot of work done previously about 36 00:03:36,460 --> 00:03:43,120 this topic, about Citrix application and Windows terminal services, but we still believe that it is 37 00:03:43,120 --> 00:03:52,120 important because nobody is taking care about it and, well, nobody. A lot of people have an 38 00:03:52,120 --> 00:03:59,380 insecure environment, and we are going to see how easy a hacker can get into a remote 39 00:03:59,400 --> 00:04:04,760 company just using this kind of environment. So first of all, it's very easy to discover the 40 00:04:04,760 --> 00:04:10,560 entry point of a company just searching for remote application or remote connection on Google. 41 00:04:10,740 --> 00:04:18,120 Just searching for RDP files, you can discover almost 2,000 places, almost 2,000 servers, 42 00:04:18,360 --> 00:04:25,900 publishing applications. Of course, you can discover also government sites. Government with 43 00:04:25,900 --> 00:04:28,960 term remote application that you can just click on it. 44 00:04:29,400 --> 00:04:31,200 And that's it. We'll see what happens. 45 00:04:32,900 --> 00:04:39,800 Well, you can do the same, more or less the same in Bing. In Bing, you cannot use the extension 46 00:04:39,800 --> 00:04:45,840 modifier, but you can use the file type. This is a TXT file. And searching for any of the 47 00:04:45,840 --> 00:04:52,500 modifiers which appears in all the files, you can discover thousands of remote applications. 48 00:04:53,020 --> 00:04:58,440 So some of the places that we discovered with this remote application. 49 00:04:59,580 --> 00:05:05,460 This is from the government. This is one of the sites. This is the patrol order management 50 00:05:05,460 --> 00:05:12,780 system. It's a .mil domain here in the States. But we were going to do a demo with this 51 00:05:13,340 --> 00:05:19,940 server, but we were talking to Jeff, and Jeff found someone, and today it's fixed. I don't 52 00:05:19,940 --> 00:05:28,100 know why. But we are going to do the demo with the California transportation, Department of 53 00:05:28,100 --> 00:05:28,460 Transportation. 54 00:05:29,400 --> 00:05:31,000 Which is another site. 55 00:05:31,540 --> 00:05:39,280 Well, just reading the websites, you can discover the remote application. There is a NICA file. 56 00:05:40,060 --> 00:05:43,460 And you can download the file and just click on it. 57 00:05:44,400 --> 00:05:45,600 Let's see what happens. 58 00:05:55,960 --> 00:05:58,600 I promised five minutes ago. 59 00:05:59,400 --> 00:06:00,500 It was working. 60 00:06:05,300 --> 00:06:07,300 Five minutes ago, it was working. 61 00:06:07,500 --> 00:06:13,100 Well, no problem. We are going to do the next demo. Don't worry. 62 00:06:16,280 --> 00:06:22,300 Well, I secured this environment. Well, as we are going to see, there are a lot of things to worry 63 00:06:22,300 --> 00:06:28,260 about, and it's very complicated to secure all the environments. And, well, this picture with the 64 00:06:28,260 --> 00:06:30,700 demo, it doesn't make sense. 65 00:06:30,900 --> 00:06:31,640 But after. 66 00:06:32,700 --> 00:06:33,100 . 67 00:06:35,520 --> 00:06:36,120 Sorry. 68 00:06:38,100 --> 00:06:38,700 . 69 00:06:40,700 --> 00:06:41,300 Sorry? 70 00:06:41,900 --> 00:06:42,500 . 71 00:06:47,300 --> 00:06:48,380 Are you sure? 72 00:06:48,600 --> 00:06:49,020 No. 73 00:06:49,340 --> 00:06:49,940 . 74 00:06:49,940 --> 00:06:51,960 I downloaded it five minutes ago. 75 00:06:53,760 --> 00:06:54,360 . 76 00:06:55,580 --> 00:06:56,180 . 77 00:06:56,180 --> 00:06:56,200 . 78 00:06:56,200 --> 00:06:56,380 . 79 00:06:56,380 --> 00:06:56,560 . 80 00:06:56,560 --> 00:06:57,260 . 81 00:06:57,260 --> 00:06:57,320 . 82 00:06:57,320 --> 00:06:57,380 . 83 00:06:57,380 --> 00:06:57,480 . 84 00:06:58,260 --> 00:06:58,640 . 85 00:06:59,120 --> 00:06:59,540 . 86 00:06:59,540 --> 00:06:59,640 . 87 00:06:59,640 --> 00:07:00,360 . 88 00:07:00,360 --> 00:07:00,760 . 89 00:07:00,760 --> 00:07:01,020 . 90 00:07:01,020 --> 00:07:04,960 But, we downloaded five minutes ago. 91 00:07:05,420 --> 00:07:09,720 So, California. Transportation. 92 00:07:20,840 --> 00:07:22,200 Route and database. 93 00:07:23,200 --> 00:07:24,040 . 94 00:07:25,420 --> 00:07:35,900 Here it is, call trance, no, no, they fixed it. 95 00:07:39,240 --> 00:07:42,680 Five minutes ago, it was working, believe me. 96 00:07:43,980 --> 00:07:45,040 Well, don't worry. 97 00:07:46,100 --> 00:07:53,640 Well, one of the biggest problems with these files, these configuration files is the verbosity. 98 00:07:54,040 --> 00:07:58,580 Just reading the files, which are TXT files, you can discover a lot of crap information 99 00:07:58,580 --> 00:08:02,620 like internal IP address, users, encrypted password. 100 00:08:03,040 --> 00:08:07,820 You cannot use that password, you can extract the password from the encrypted password, 101 00:08:07,880 --> 00:08:12,880 but you can't get access to the system using an anonymous account or a user account in 102 00:08:12,880 --> 00:08:13,220 the system. 103 00:08:13,720 --> 00:08:19,960 So these files are perfect for APTs, just for the people who is collecting information 104 00:08:20,300 --> 00:08:24,020 or for preparing some system. 105 00:08:24,020 --> 00:08:25,720 Special attacks, like the evil great attack. 106 00:08:26,340 --> 00:08:33,140 Just searching on the internet for this kind of files, just searching for an ICA file, 107 00:08:33,360 --> 00:08:48,260 you can search for X, ICA, and just searching for documents with R and T, you can discover 108 00:08:48,900 --> 00:08:53,520 files with the password for Oracle, just in the text. 109 00:08:53,520 --> 00:08:58,080 So you don't need to do any special. 110 00:08:58,580 --> 00:09:01,000 There are a lot of information in that file. 111 00:09:04,980 --> 00:09:12,420 So due to this, we decided to add this kind of files to FOCA, which is our tool for information 112 00:09:12,420 --> 00:09:16,740 gathering and for fingerprinting information about websites and companies. 113 00:09:17,060 --> 00:09:21,140 And right now, if you download, no, tomorrow, if you download tomorrow the FOCA 3 version, 114 00:09:21,320 --> 00:09:23,500 you will see that in the news. 115 00:09:24,120 --> 00:09:28,000 FOCA is searching for this kind of file and extracting information and so on. 116 00:09:28,760 --> 00:09:35,860 The second big problem is that it's a .txt file, so whoever has the file can modify 117 00:09:35,860 --> 00:09:42,440 the information and can try to get access to another terms you can into a system. 118 00:09:42,740 --> 00:09:50,120 So just modify the configuration file on your own message on the server, you can discover 119 00:09:50,120 --> 00:09:52,440 something like all the application. 120 00:09:52,880 --> 00:09:53,480 .github.com.szyjur 121 00:09:53,500 --> 00:09:53,980 operating system. 122 00:09:54,560 --> 00:09:59,160 You only need to create a logic with the error messages. 123 00:10:02,860 --> 00:10:09,580 Terminal services and Citrix server has different error messages when you cannot get access 124 00:10:09,580 --> 00:10:15,380 to the file than when the file is not on the server. 125 00:10:15,820 --> 00:10:20,280 So just trying to ask for applications, you can extract the whole list of applications 126 00:10:20,280 --> 00:10:21,680 installed in a computer. 127 00:10:21,680 --> 00:10:28,060 To do this in terminal services is quite simple because there is a modifier which is alternator 128 00:10:28,060 --> 00:10:28,320 shell. 129 00:10:28,660 --> 00:10:37,120 This option was created for versions of the RDP protocol previous to version 6, but it 130 00:10:37,120 --> 00:10:44,720 exists still in the RDP files of terminal service 2008. 131 00:10:45,380 --> 00:10:46,420 It doesn't work. 132 00:10:46,960 --> 00:10:48,960 But the option, it is there. 133 00:10:49,120 --> 00:10:51,260 So you can ask for an application. 134 00:10:51,260 --> 00:10:56,300 And the terminal server will say, okay, you cannot access this program because the alternative 135 00:10:56,300 --> 00:10:56,960 shell is forbidden. 136 00:10:57,380 --> 00:10:59,860 But you will receive different error messages. 137 00:11:00,180 --> 00:11:07,320 So if you receive access, which is in Spanish, because Spanish is better, you know that the 138 00:11:07,320 --> 00:11:10,100 file is in the operating system. 139 00:11:10,320 --> 00:11:15,700 But if you receive, you cannot get, you cannot access to this file, you know that this file 140 00:11:15,700 --> 00:11:16,660 is not in the server. 141 00:11:16,860 --> 00:11:20,640 So the good thing is that you can do the same in Citrix. 142 00:11:20,640 --> 00:11:28,200 And there is any protection against one connection and another connection and another connection. 143 00:11:28,320 --> 00:11:30,220 You don't have even to type a capture. 144 00:11:30,440 --> 00:11:34,340 So you can optimize this procedure with a tool. 145 00:11:34,380 --> 00:11:39,020 We created Kaka, which is a computer-assisted Citrix app. 146 00:11:42,180 --> 00:11:46,780 And it's just a tool to do this. 147 00:11:47,140 --> 00:11:49,460 So you only need to open Kaka. 148 00:11:51,880 --> 00:12:01,900 Select one ICA file, a list of applications, in this example, notepad, break edit, command, 149 00:12:02,320 --> 00:12:04,220 no exits, and calc. 150 00:12:04,240 --> 00:12:09,940 And Kaka, and the number of threads that you want to use in parallel, and Kaka will 151 00:12:09,940 --> 00:12:10,880 do this for you. 152 00:12:11,140 --> 00:12:14,880 So you can go to have a coffee. 153 00:12:18,760 --> 00:12:19,280 Kaka. 154 00:12:20,640 --> 00:12:21,080 Kaka is working. 155 00:12:21,360 --> 00:12:22,120 Kaka is working. 156 00:12:26,140 --> 00:12:30,540 Well, Kaka is trying to open the application. 157 00:12:30,900 --> 00:12:33,920 And the only thing that Kaka is doing is having a snapshot. 158 00:12:34,720 --> 00:12:40,200 So then when Kaka finishes, you only have to review the error messages. 159 00:12:43,980 --> 00:12:48,120 So of this way you know if the application exists or not. 160 00:12:48,300 --> 00:12:50,620 You can use a very big list. 161 00:12:50,620 --> 00:12:54,820 You can have a big list of applications and leave Kaka running on a computer for one day. 162 00:12:55,000 --> 00:13:00,380 And at the end of the day, you've got your list of applications in Kaka. 163 00:13:03,460 --> 00:13:04,640 Well, quite simple. 164 00:13:04,980 --> 00:13:10,880 The other thing with terminal application is what we call playing the piano. 165 00:13:11,260 --> 00:13:15,980 In the terminal services environments and Citrix environments, there are too many links, 166 00:13:16,140 --> 00:13:18,620 too many environments. 167 00:13:20,320 --> 00:13:20,600 Right? 168 00:13:20,620 --> 00:13:27,380 Too many variables, too many shortcuts, too many options that allows to a hacker to get 169 00:13:27,380 --> 00:13:33,040 a special part of the system that the system administrator didn't think of at the beginning. 170 00:13:33,320 --> 00:13:39,560 One of our favorites is Windows Server 2008 because Windows Server 2008 wants to help 171 00:13:39,560 --> 00:13:40,340 you everything. 172 00:13:40,840 --> 00:13:48,160 So if you ask for an application which is not in the operating system, Windows 2008 173 00:13:48,690 --> 00:13:50,440 shows you an error message. 174 00:13:50,620 --> 00:13:51,880 The error message is an error message, but you can fix that by using the help button. 175 00:13:54,580 --> 00:13:55,480 Would you like help? 176 00:13:55,640 --> 00:13:56,480 Why not? 177 00:13:57,080 --> 00:14:04,960 So just clicking on help, the help application appears and in this application, you've got 178 00:14:04,960 --> 00:14:11,980 a lot of links to open Internet Explorer or to open the Open File panel and run commands 179 00:14:11,980 --> 00:14:12,540 and so on. 180 00:14:14,020 --> 00:14:20,600 Playing the piano was a very, very nice thing to do with a lot of shortcuts to access the 181 00:14:20,600 --> 00:14:25,620 a different part of the operating system, but right now we've got more and more shortcuts. 182 00:14:26,020 --> 00:14:31,520 Sticky case, which is a funny thing, just clicking on shift key three or four times, 183 00:14:31,680 --> 00:14:37,260 the operating system will show you the sticky case menu, which is within the control panel, 184 00:14:37,540 --> 00:14:41,420 so even if you don't have access to the control panel with the sticky keys, you will be able 185 00:14:41,420 --> 00:14:45,620 to configure all the control panel of the operating system, just clicking on shift and 186 00:14:45,620 --> 00:14:46,020 so on. 187 00:14:46,020 --> 00:15:01,100 Is it easy to do this? Well, let's do a demo with Citrix. Well, this is the website of 188 00:15:01,100 --> 00:15:07,000 Citrix, but this is the website for demo servers, so it's a demo, it's legal. 189 00:15:10,860 --> 00:15:13,620 We got a user here, which is Tonto del Culo. 190 00:15:15,000 --> 00:15:16,000 It's very cool. 191 00:15:16,020 --> 00:15:16,520 Spanish name. 192 00:15:20,700 --> 00:15:23,080 The rest of the username was taken. 193 00:15:26,740 --> 00:15:27,180 No. 194 00:15:31,640 --> 00:15:32,560 No, no, no, no. 195 00:15:33,400 --> 00:15:34,040 No, no, no. 196 00:15:40,320 --> 00:15:43,640 No, it is working. 197 00:15:44,380 --> 00:15:46,000 Well, this is the environment of Citrix. 198 00:15:46,000 --> 00:15:48,820 As you can see, in this environment, we've got a lot of applications. 199 00:15:48,980 --> 00:15:52,060 We are going to use Excel, because this talk is about Excel. 200 00:15:52,320 --> 00:15:56,360 So let's go to the Office application and run Excel. 201 00:16:01,860 --> 00:16:03,100 Excel is working. 202 00:16:05,980 --> 00:16:14,060 Mm-hmm, mm-hmm, mm-hmm, mm-hmm, mm-hmm, mm-hmm, mm-hmm, mm-hmm, mm-hmm, mm-hmm, mm-hmm, 203 00:16:14,060 --> 00:16:15,100 mm-hmm, mm-hmm, mm-hmm. 204 00:16:18,960 --> 00:16:20,960 Well, Excel is working. 205 00:16:22,460 --> 00:16:30,980 Well, right now, the system is downloading the client component, so... 206 00:16:34,100 --> 00:16:35,540 Open Excel. 207 00:16:37,380 --> 00:16:38,100 Launch. 208 00:16:38,880 --> 00:16:40,280 You have to open launch. 209 00:16:40,540 --> 00:16:41,160 No? 210 00:16:43,580 --> 00:16:44,300 Maybe... 211 00:16:44,300 --> 00:16:45,080 No? 212 00:16:46,000 --> 00:16:46,760 No, no, no. 213 00:16:46,880 --> 00:16:47,140 No, no, no. 214 00:16:48,840 --> 00:16:49,280 Execute. 215 00:16:52,040 --> 00:16:52,480 Okay. 216 00:16:54,880 --> 00:16:55,320 Launch. 217 00:17:00,440 --> 00:17:02,160 Well, it's something with Internet Explorer. 218 00:17:04,200 --> 00:17:10,060 But we are going to launch the Excel. 219 00:17:13,620 --> 00:17:14,880 No, no, no, no, no, no. 220 00:17:14,900 --> 00:17:15,060 No. 221 00:17:24,840 --> 00:17:27,760 Excel is working, believe me. 222 00:17:29,520 --> 00:17:31,420 Starting Microsoft Excel. 223 00:17:44,220 --> 00:17:45,240 Internet is slow. 224 00:17:50,840 --> 00:17:51,220 No. 225 00:17:52,720 --> 00:17:53,280 No, man. 226 00:17:56,380 --> 00:17:57,700 I just going to tell a weapon, eh? 227 00:17:58,020 --> 00:17:58,580 No, no, no. 228 00:17:59,340 --> 00:17:59,720 Okay. 229 00:18:28,040 --> 00:18:29,340 It is working. 230 00:18:29,820 --> 00:18:30,760 In the end. 231 00:18:30,880 --> 00:18:31,400 No. 232 00:18:32,120 --> 00:18:32,600 No. 233 00:18:32,600 --> 00:18:37,580 Well, now connect to the remote Excel. 234 00:18:38,720 --> 00:18:39,380 Come on. 235 00:18:42,300 --> 00:18:46,620 Please, if someone is doing a man in the middle attack in this network, please don't do it. 236 00:18:49,660 --> 00:18:50,140 Moxie. 237 00:18:51,620 --> 00:18:52,100 . 238 00:18:58,280 --> 00:18:58,960 Don't tell me. 239 00:19:00,200 --> 00:19:00,680 Open. 240 00:19:01,000 --> 00:19:01,180 He says. 241 00:19:08,140 --> 00:19:08,740 . 242 00:19:09,340 --> 00:19:10,040 . 243 00:19:17,460 --> 00:19:18,660 . 244 00:19:18,660 --> 00:19:19,160 . 245 00:19:19,160 --> 00:19:19,620 . 246 00:19:19,620 --> 00:19:20,880 . 247 00:19:20,880 --> 00:19:22,280 . 248 00:19:22,280 --> 00:19:22,300 . 249 00:19:22,300 --> 00:19:22,320 . 250 00:19:22,320 --> 00:19:22,340 . 251 00:19:33,560 --> 00:19:45,060 open. This is the Citrix environment. It's supposed to 252 00:19:45,060 --> 00:19:49,440 be secure by the guys of Citrix. So let's try to, I don't know, 253 00:19:49,440 --> 00:19:57,420 use the environment variable to connect to the system root. It's forbidden to the user profile. 254 00:19:59,840 --> 00:20:06,060 It's forbidden, and so on. But you can do a lot of tricks. One of the tricks that we do was just 255 00:20:06,060 --> 00:20:18,880 to create a shortcut to the command, finish, show all files, and then run. 256 00:20:20,160 --> 00:20:29,840 Open. Oh, they fixed it. No, PowerShell. Too many consoles. PowerShell. Let's change. 257 00:20:36,380 --> 00:20:48,400 Now we are going to use another console. Same trick, another console. Open. It is working. 258 00:20:48,520 --> 00:20:48,740 Wow. 259 00:20:49,540 --> 00:20:58,340 Go to the, and you get access to all. It's very complicated, because every day, the operating 260 00:20:58,340 --> 00:21:03,800 system is getting more and more complex, and the application that we are publishing through N are 261 00:21:03,800 --> 00:21:06,780 more and more complex. Please stop, stop, stop, stop, stop. 262 00:21:16,180 --> 00:21:18,640 . Don't trust in people from Seville, believe me. 263 00:21:19,440 --> 00:21:19,960 . 264 00:21:19,960 --> 00:21:24,620 Well, the question is that the operating system is more and more complex, and the applications 265 00:21:24,620 --> 00:21:29,520 are getting more and more complex. So every application that you are publishing through 266 00:21:29,520 --> 00:21:36,120 terminal services is a path to your operating system or through terminal services. One 267 00:21:36,120 --> 00:21:42,160 of our favorites is the complex application, and, of course, Excel is one of the most complex 268 00:21:42,160 --> 00:21:49,400 applications that companies are publishing through remote application services. So the good thing, 269 00:21:49,440 --> 00:21:56,300 again, is that Excel is a very powerful tool, and bosses love Excel, because you can do 270 00:21:56,300 --> 00:22:03,200 a lot of funny graphics and analyze a lot of data, connect Excel to databases, perform 271 00:22:03,200 --> 00:22:09,480 data mining, and a lot of things which are very good for the business. And the good is 272 00:22:09,480 --> 00:22:16,440 that to do all that funny things, you need Visual Basic for applications. If you remove 273 00:22:16,440 --> 00:22:19,420 Visual Basic for applications from your operating system, you will not be able to do a lot of 274 00:22:19,440 --> 00:22:25,820 things. So Excel, your Excel becomes another kind of application, but Excel no more. So 275 00:22:25,820 --> 00:22:31,620 the idea is that with Excel you can do a lot of things. Let's do the first demo just in 276 00:22:31,620 --> 00:22:41,580 this, in local. We got a Windows 2008 with IPV, with terminal services, sorry, and we, 277 00:22:41,680 --> 00:22:49,420 in this environment, we published Excel 2007. Excel 2007. We didn't use IPV, we used the 278 00:22:49,440 --> 00:22:54,640 Excel 2010, because the security policies for macros are more or less the same. The 279 00:22:54,640 --> 00:23:00,260 main difference in security in Office 2010 and Office 2007 is about the sandbox, about 280 00:23:00,260 --> 00:23:05,820 the security option when you download a file from an unsecured location from the Internet 281 00:23:05,820 --> 00:23:11,340 and so on. But once you have the file in your machine, in your computer, the security policies 282 00:23:11,340 --> 00:23:19,420 for macros are the same. So in this environment, we are going to execute just an Excel file. 283 00:23:19,440 --> 00:23:26,200 Excel with macros. In a normal environment, in a normal environment when Excel is going 284 00:23:26,200 --> 00:23:34,180 to be executed in your local machine, the security option by default is that the user 285 00:23:34,180 --> 00:23:39,260 selects if he wants to execute the macro or not, because the user is running the macro 286 00:23:39,260 --> 00:23:44,360 on his machine. But in a terminal service environment, in a remote application environment, 287 00:23:44,720 --> 00:23:49,420 the security option by default, which is case by case, the user decides whether or not 288 00:23:49,420 --> 00:23:55,100 it is a bad option, because the user is running the Visual Basic for Applications not in their 289 00:23:55,100 --> 00:23:59,460 machine but in the server machine, which is completely different. In this environment, 290 00:23:59,580 --> 00:24:11,360 we are going to execute just a file with Visual Basic for Applications. It is working. 291 00:24:12,920 --> 00:24:16,220 Well, in this example, we created a panel. 292 00:24:17,200 --> 00:24:17,760 . 293 00:24:19,420 --> 00:24:25,940 And this is the by default option. The user decides, okay, enable this content or not. 294 00:24:26,080 --> 00:24:28,980 Okay, enable. It's not my machine. 295 00:24:31,800 --> 00:24:32,280 . 296 00:24:33,800 --> 00:24:40,840 So now you can, if the boss came, you can show the graph. It's a good trick. Then open 297 00:24:40,840 --> 00:24:41,720 the panel. 298 00:24:42,260 --> 00:24:42,740 . 299 00:24:42,740 --> 00:24:47,900 So just, you can do a lot of things with Visual Basic for Applications. For instance, see 300 00:24:47,900 --> 00:24:48,400 the process. 301 00:24:49,420 --> 00:24:49,500 . 302 00:24:49,500 --> 00:24:56,440 And so on. As you can see, close, you through the window instrument Você ve o window 303 00:24:56,440 --> 00:24:56,520 management you can, 304 00:24:56,700 --> 00:25:01,860 through command retrieved the results, and so then on the Excel file. 305 00:25:02,040 --> 00:25:02,180 . 306 00:25:02,180 --> 00:25:03,240 Okay, let's close it. 307 00:25:04,900 --> 00:25:07,580 So if we go back to the presentation... 308 00:25:08,440 --> 00:25:08,920 . 309 00:25:11,320 --> 00:25:17,240 well after seeing this demo it's clear that you have to take care about the security 310 00:25:17,240 --> 00:25:19,400 in, of Excel in a remote environment. 311 00:25:19,400 --> 00:25:27,320 One of the first things that system administrators tend to do is to block some special consoles 312 00:25:27,320 --> 00:25:34,300 like command con, like PowerShell, WMI, and so on. 313 00:25:34,440 --> 00:25:43,080 But there are too many consoles and in Windows Server 2008, the backup directories copied 314 00:25:43,080 --> 00:25:53,200 all those consoles, which it creates a double problem because you have the double of consoles. 315 00:25:53,600 --> 00:25:59,400 But in this environment, we are going to have all the consoles forbidden. 316 00:25:59,700 --> 00:26:09,020 We got using ACLs and using server restriction policies, we are going to forbid all the consoles 317 00:26:09,020 --> 00:26:10,160 that you are going to see. 318 00:26:10,260 --> 00:26:13,060 But we can use consoles even from other systems. 319 00:26:13,060 --> 00:26:13,700 Another operating system. 320 00:26:13,960 --> 00:26:17,660 This is a trick that was published by the DR Stevens, and the idea is that you can inject 321 00:26:17,660 --> 00:26:22,840 a DLL into your Excel file, and that DLL is a common interpreter. 322 00:26:23,400 --> 00:26:30,620 So just invoking the common interpreter from your DLL, you are going to have access to 323 00:26:30,620 --> 00:26:31,300 the server. 324 00:26:31,520 --> 00:26:32,580 So let's do a demo with this. 325 00:26:33,780 --> 00:26:37,840 So if we go to the Windows Server 2008 and try to execute... 326 00:26:37,840 --> 00:26:43,540 And try to execute command con. 327 00:26:46,020 --> 00:26:47,060 It is forbidden. 328 00:26:48,040 --> 00:26:48,940 It's forbidden. 329 00:26:49,160 --> 00:26:55,780 But in the Excel file that we are going to open, we've got a DLL of reactors and also 330 00:26:55,780 --> 00:27:00,920 a DLL for the registry editor of reactors. 331 00:27:01,260 --> 00:27:04,920 So just open the file and open the command line. 332 00:27:05,120 --> 00:27:06,860 Now the Excel file is... 333 00:27:06,860 --> 00:27:07,820 Okay. 334 00:27:07,840 --> 00:27:14,120 Extracting the DLL to execute it, and we are going to obtain the reactors common interpreter. 335 00:27:18,360 --> 00:27:19,340 Actually working. 336 00:27:21,840 --> 00:27:22,680 I hope. 337 00:27:22,900 --> 00:27:23,380 Well. 338 00:27:23,740 --> 00:27:24,640 Here it is. 339 00:27:24,720 --> 00:27:27,320 As you can see, we've got the reactors common interpreter. 340 00:27:28,900 --> 00:27:34,460 And it's like the common interpreter of Windows 2008. 341 00:27:34,940 --> 00:27:36,080 More or less the same. 342 00:27:36,260 --> 00:27:37,420 So this is a good trick. 343 00:27:37,840 --> 00:27:39,140 So go back to the slides. 344 00:27:42,400 --> 00:27:47,520 And, of course, in the tax manager, you cannot see the CMD because it's a DLL which had been 345 00:27:47,520 --> 00:27:48,900 loaded by the Excel file. 346 00:27:49,280 --> 00:27:51,540 So it's not in the tax manager. 347 00:27:51,820 --> 00:27:54,240 The user is only working with Excel. 348 00:27:55,160 --> 00:27:56,440 Which is good for the company. 349 00:27:59,160 --> 00:28:00,560 So go back to the slides. 350 00:28:05,180 --> 00:28:06,460 So of course. 351 00:28:06,520 --> 00:28:06,920 Okay. 352 00:28:07,480 --> 00:28:07,680 Okay. 353 00:28:07,840 --> 00:28:15,000 We are going to disable all the macros for my machine. 354 00:28:15,160 --> 00:28:20,280 If you use the first policy, which is disable Visual Basic for application, it's for all 355 00:28:20,280 --> 00:28:21,320 Office applications. 356 00:28:21,820 --> 00:28:22,900 Not only for Excel. 357 00:28:22,980 --> 00:28:25,680 It's for Word, PowerPoint, Access, and so on. 358 00:28:25,900 --> 00:28:28,340 And for Excel, you've got four options. 359 00:28:28,560 --> 00:28:31,960 The first one is execute all macros, which is unsecure. 360 00:28:32,200 --> 00:28:34,380 The second option is case by case. 361 00:28:34,460 --> 00:28:35,120 The user decides. 362 00:28:35,440 --> 00:28:35,900 Of course. 363 00:28:35,980 --> 00:28:37,200 If the user is the attacker. 364 00:28:37,200 --> 00:28:38,900 It's an unsecure option. 365 00:28:39,300 --> 00:28:42,060 The third one is no macros at all. 366 00:28:42,540 --> 00:28:49,080 So in this demo, we are going to select the no macros at all in an Excel file published 367 00:28:49,080 --> 00:28:50,620 through a remote environment. 368 00:28:51,460 --> 00:28:55,340 So we go to the Windows 2008 and select. 369 00:28:57,220 --> 00:29:01,600 We are going to log off the connection of the user. 370 00:29:02,120 --> 00:29:02,760 Okay. 371 00:29:03,680 --> 00:29:06,580 And now we go to the policies. 372 00:29:06,580 --> 00:29:11,860 And we are going to enable the policy and select no macros. 373 00:29:12,500 --> 00:29:14,580 No warnings for all macros. 374 00:29:14,760 --> 00:29:15,460 The third one. 375 00:29:15,600 --> 00:29:16,580 No warnings for all macros. 376 00:29:16,660 --> 00:29:18,140 But disable all macros. 377 00:29:18,500 --> 00:29:19,020 Okay. 378 00:29:19,100 --> 00:29:19,600 No warning. 379 00:29:19,860 --> 00:29:21,240 And macros off. 380 00:29:22,000 --> 00:29:23,040 So select that option. 381 00:29:26,780 --> 00:29:27,380 Okay. 382 00:29:27,640 --> 00:29:28,780 Apply the policy. 383 00:29:29,960 --> 00:29:30,560 Okay. 384 00:29:32,120 --> 00:29:33,520 Active directory is working. 385 00:29:34,660 --> 00:29:35,260 . 386 00:29:35,960 --> 00:29:36,260 Okay. 387 00:29:41,580 --> 00:29:44,860 Let's go back to the client and open the file. 388 00:29:45,300 --> 00:29:48,540 And this is one of my favorite tricks. 389 00:29:52,280 --> 00:30:01,420 So when you open the document, when the document is open, you will see how it's impossible 390 00:30:01,420 --> 00:30:02,960 to execute anything. 391 00:30:03,240 --> 00:30:05,280 Because everything is forbidden. 392 00:30:05,280 --> 00:30:07,820 Try to do anything. 393 00:30:08,020 --> 00:30:08,560 No. 394 00:30:08,640 --> 00:30:09,140 It's forbidden. 395 00:30:09,360 --> 00:30:10,220 You cannot do anything. 396 00:30:10,340 --> 00:30:13,360 But there is something special with Excel. 397 00:30:13,740 --> 00:30:15,820 There are trusted locations. 398 00:30:16,600 --> 00:30:22,740 A trusted location is a path in which security policies are not applied. 399 00:30:23,300 --> 00:30:28,780 So you only need to save the document in a trusted location. 400 00:30:29,240 --> 00:30:34,620 And of course, the trusted locations are in the user profile. 401 00:30:35,280 --> 00:30:36,760 So let's save the document. 402 00:30:39,600 --> 00:30:42,480 We are going to use a trusted location. 403 00:30:42,860 --> 00:30:47,720 You can have trusted location in the client machine or in the server machines. 404 00:30:48,000 --> 00:30:48,820 It doesn't matter. 405 00:30:49,040 --> 00:30:53,920 If the document is open from a trusted location, all the security policies will disappear. 406 00:30:54,180 --> 00:31:00,260 So we are going to save in one of the most famous trusted locations, which is the default 407 00:31:00,840 --> 00:31:01,140 book. 408 00:31:01,640 --> 00:31:04,840 When you open a new file, there is a template. 409 00:31:04,840 --> 00:31:12,580 So we are going to copy it here, save, close this document, and then close. 410 00:31:13,440 --> 00:31:16,480 And then open the document from the out-trusted location. 411 00:31:18,760 --> 00:31:19,860 And here it is. 412 00:31:30,260 --> 00:31:32,160 Well, no markers at all. 413 00:31:32,440 --> 00:31:33,700 It's not markers at all. 414 00:31:33,960 --> 00:31:34,280 Well. 415 00:31:34,840 --> 00:31:36,300 After seeing this demo, there is a solution. 416 00:31:36,520 --> 00:31:37,560 No trusted location at all. 417 00:31:38,200 --> 00:31:44,180 After seeing this demo, maybe the system administrator can trust in digitally signed 418 00:31:44,180 --> 00:31:44,920 macros. 419 00:31:45,040 --> 00:31:51,600 Only macros that have been digitally signed for a trusted certification authority. 420 00:31:52,380 --> 00:31:54,780 So let's do a demo with this. 421 00:31:55,700 --> 00:31:59,780 In this example, we are going to select the four options. 422 00:32:00,140 --> 00:32:02,600 Remember, first option, all macros. 423 00:32:02,660 --> 00:32:03,960 Second option, case by case. 424 00:32:03,960 --> 00:32:05,800 Third option, no macros. 425 00:32:05,920 --> 00:32:13,380 And fourth option is only digitally signed macros. 426 00:32:13,700 --> 00:32:15,660 So let's log out the session. 427 00:32:16,620 --> 00:32:18,840 And then go, go, go, go. 428 00:32:22,580 --> 00:32:24,920 Digitally signed macros. 429 00:32:25,080 --> 00:32:25,720 Okay. 430 00:32:26,700 --> 00:32:27,460 Okay. 431 00:32:27,540 --> 00:32:28,400 Go on. 432 00:32:28,420 --> 00:32:29,160 Apply. 433 00:32:29,660 --> 00:32:30,420 Okay. 434 00:32:33,180 --> 00:32:33,940 Go on. 435 00:32:34,680 --> 00:32:36,200 After this, it's working. 436 00:32:39,180 --> 00:32:40,980 We can apply in Minesweeper. 437 00:32:41,740 --> 00:32:42,040 Meanwhile. 438 00:32:44,980 --> 00:32:53,020 Well, we got digitally signed Excel file, but it's a self-signed Excel file. 439 00:32:54,380 --> 00:32:57,920 And we are going to obtain this message. 440 00:32:59,900 --> 00:33:01,000 Ding, ding, ding. 441 00:33:04,960 --> 00:33:09,560 Well, we obtain a warning because it's self-digitally signed. 442 00:33:09,700 --> 00:33:12,780 It's not from a trusted authority. 443 00:33:13,040 --> 00:33:18,580 And you got help protecting me from a no-content ban. 444 00:33:18,860 --> 00:33:23,600 There is a link, a link for show signature details. 445 00:33:23,960 --> 00:33:25,380 So just click on the link. 446 00:33:27,200 --> 00:33:30,420 Here is the digital certificate. 447 00:33:30,420 --> 00:33:40,460 So if we go to view certificate and the certification path, we can discover the root of the certification 448 00:33:40,460 --> 00:33:40,880 authority. 449 00:33:41,180 --> 00:33:44,060 And we can view the certificate of it. 450 00:33:44,560 --> 00:33:46,540 So view the certificate. 451 00:33:46,860 --> 00:33:50,160 Ah, we can install the certificate because it's at user level. 452 00:33:50,400 --> 00:33:50,960 Perfect. 453 00:33:51,160 --> 00:33:52,060 Install the certificate. 454 00:33:52,200 --> 00:33:52,560 Next. 455 00:33:53,640 --> 00:33:55,020 It's at user level. 456 00:33:55,200 --> 00:33:56,380 So no problem at all. 457 00:33:58,300 --> 00:33:58,960 All right. 458 00:33:58,960 --> 00:33:59,220 Bye. 459 00:34:04,620 --> 00:34:09,860 And now the message will change to enable this content. 460 00:34:10,320 --> 00:34:11,480 Ultra-sale. 461 00:34:11,680 --> 00:34:17,560 And the last one is the funny one, is throws all documents for. 462 00:34:18,040 --> 00:34:18,940 This is. 463 00:34:19,000 --> 00:34:19,660 . 464 00:34:23,360 --> 00:34:29,030 This is very important because with this option, you can start the third word. 465 00:34:29,580 --> 00:34:30,400 This. 466 00:34:30,400 --> 00:34:38,940 world war. Because in this example, we created a SIA that we installed right now. And if 467 00:34:38,940 --> 00:34:49,640 you install this SIA, every document signed by this SIA will be okay. And in the certificate, 468 00:34:50,500 --> 00:34:58,900 there is a link for the CRL. And the CRL is a link that could be an HTTP link, an LDAP 469 00:34:58,900 --> 00:35:07,120 link, and an HTTP link could be a SQL injection attack. So if you install a SIA and send an 470 00:35:07,120 --> 00:35:15,360 Excel file with a digital signed macro to someone relevant in the company, and he or 471 00:35:15,920 --> 00:35:22,660 she opens the document, automatically the crypto API will try to connect to the CRL. 472 00:35:22,880 --> 00:35:28,880 So if you discover, for instance, a SQL injection vulnerability in the core of China, for example, 473 00:35:28,880 --> 00:35:41,900 and you can install one of these SIA in one of the DHA's machines, and you send a file 474 00:35:41,900 --> 00:35:47,100 to a user which is working in that machine, you can discover who users are working in 475 00:35:47,100 --> 00:35:53,880 what machine using FOCA. You can start the third world war. Well, just kidding, but we 476 00:35:53,880 --> 00:35:54,900 are going to do the demo in log. 477 00:35:58,880 --> 00:36:10,260 So in this example, that trusted authority has now the CRL. So we are going to open a 478 00:36:10,260 --> 00:36:16,720 netcat, and we are going to send the document to a user. In this environment, it's the same 479 00:36:16,720 --> 00:36:22,780 user, but the problem is that in remote application environments, there are a pool of users that 480 00:36:22,780 --> 00:36:26,820 are shared for the rest of the user. So we are listening. 481 00:36:26,820 --> 00:36:31,760 And let's see if the query... 482 00:36:34,820 --> 00:36:43,720 Okay, as you can see, there is a message, notice, php id file is shut down, minus minus, 483 00:36:43,920 --> 00:36:51,480 hello Aurora, I don't know, whatever. So in the end, as you can see, it's very complex, 484 00:36:51,680 --> 00:36:56,400 very difficult to harden an environment with remote applications, so if you've got a terminal 485 00:36:56,400 --> 00:37:01,920 services environment, publishing a lot of applications or a citizen environment, the 486 00:37:01,920 --> 00:37:07,000 first thing that you have to do is re-evaluate the security of the whole environment, re-evaluate 487 00:37:07,000 --> 00:37:14,300 the security of all documents. Of course, you have to trust it in nobody, not in nobody, 488 00:37:14,460 --> 00:37:21,320 even in nobody, because in some operating system nobody could be dangerous. And be sure 489 00:37:21,320 --> 00:37:25,620 about the application that you are publishing. One of the funny things that we discovered 490 00:37:25,620 --> 00:37:32,340 is that in terminal services, with the TSA terminal services web access, a lot of administrators 491 00:37:32,340 --> 00:37:38,560 are using this option, which is hide in terminal server web access. That means that if you 492 00:37:38,560 --> 00:37:44,860 have a remote application published on your terminal services, this application won't 493 00:37:44,860 --> 00:37:52,720 appear in the HTTP panel, but the application is still published. So if you know the name 494 00:37:52,720 --> 00:37:55,000 of the application, you can connect. 495 00:37:57,260 --> 00:38:00,620 And that's all. Thanks for standing here.