1 00:00:00,000 --> 00:00:01,240 All been having a good DEFCON? 2 00:00:02,960 --> 00:00:05,520 Man, come on, how can you not have fun here? 3 00:00:07,120 --> 00:00:08,860 Well, that's true, but... 4 00:00:09,320 --> 00:00:12,920 Yeah, and one of the goons has an announcement, so... 5 00:00:13,400 --> 00:00:17,140 I've been asked to tell everybody that DT is in the dunk tank. 6 00:00:17,920 --> 00:00:21,380 DT is in the dunk tank, so if you would like to dunk him, he will be there. 7 00:00:22,100 --> 00:00:24,040 But unfortunately, you'll have to miss this talk, 8 00:00:24,180 --> 00:00:27,720 and from the look of the room, you probably don't want to miss this talk, so... 9 00:00:27,720 --> 00:00:30,540 I did my job, now you can have fun. 10 00:00:31,640 --> 00:00:32,880 Awesome, thank you. 11 00:00:35,460 --> 00:00:37,040 What were you talking about, Taylor? 12 00:00:37,340 --> 00:00:37,940 No. 13 00:00:38,360 --> 00:00:41,820 Okay, just so everyone knows, I'm Lennox. 14 00:00:41,960 --> 00:00:45,940 I run a site with a friend of mine called noxfiles.com. 15 00:00:46,540 --> 00:00:49,200 It's basically a security research type of thing, 16 00:00:49,360 --> 00:00:52,620 and the first presentation released by us 17 00:00:52,620 --> 00:00:55,460 is about advanced Windows-based firewall subversion. 18 00:00:56,280 --> 00:00:57,700 So this is not... 19 00:00:57,720 --> 00:00:58,860 It's not going to be just, you know, 20 00:00:58,920 --> 00:01:02,740 oh, yeah, run it over port 80, the firewall won't notice, hopefully, type of thing. 21 00:01:02,860 --> 00:01:04,680 This is a lot more technical than that. 22 00:01:04,860 --> 00:01:06,320 There will be a lot of reverse engineering 23 00:01:07,340 --> 00:01:09,420 and payload development, all that fun stuff. 24 00:01:10,800 --> 00:01:12,100 So, get ready. 25 00:01:12,580 --> 00:01:13,180 All right. 26 00:01:18,620 --> 00:01:20,400 Okay, first of all, a little background. 27 00:01:21,340 --> 00:01:25,140 There's a prevailing mentality throughout all of InfoSec 28 00:01:25,140 --> 00:01:26,920 and the corporate world that, you know, 29 00:01:26,960 --> 00:01:27,420 applications... 30 00:01:27,720 --> 00:01:31,920 aren't secure, so we pretty much need to develop something 31 00:01:32,440 --> 00:01:34,320 to cover up for someone else's vulnerability. 32 00:01:35,180 --> 00:01:39,460 And many people believe that a firewall, you know, an H-I-P-S, 33 00:01:39,680 --> 00:01:42,880 I guess you could use the terms interchangeably to an extent, 34 00:01:43,100 --> 00:01:47,080 but their H-I-P-S and personal firewall 35 00:01:47,080 --> 00:01:49,000 kind of do a little bit of a different thing. 36 00:01:49,180 --> 00:01:51,160 Well, they do the same thing, but in a different way. 37 00:01:51,820 --> 00:01:54,200 So, but there's one small problem. 38 00:01:54,440 --> 00:01:57,700 If we manage to exploit one of these vulnerable systems, 39 00:01:57,720 --> 00:01:59,800 we still have execution control. 40 00:02:00,140 --> 00:02:03,900 We still can do whatever the user running at that, you know, 41 00:02:03,900 --> 00:02:06,080 whoever owns the process can. 42 00:02:06,620 --> 00:02:09,920 And attempts to stop us can be broken. 43 00:02:10,180 --> 00:02:12,900 It may be a little bit difficult, but they can be done. 44 00:02:15,080 --> 00:02:17,860 Now, some former research in this area, 45 00:02:18,100 --> 00:02:22,700 I just wanted to cite FRAC 62, number 13, article 13 in there. 46 00:02:22,840 --> 00:02:27,140 It presents some standard methods for bypassing Windows, 47 00:02:27,720 --> 00:02:29,740 based personal firewalls. 48 00:02:30,460 --> 00:02:35,640 Now, what it mostly involves is injection of code 49 00:02:35,640 --> 00:02:37,160 into a trusted process. 50 00:02:37,880 --> 00:02:40,020 But as you'll see later, 51 00:02:40,220 --> 00:02:42,900 a lot of firewalls will detect this type of thing. 52 00:02:43,220 --> 00:02:46,880 It's kind of, if I recall, this issue is kind of old, 53 00:02:47,060 --> 00:02:50,500 but it's still good code, so I do recommend you all check it out. 54 00:02:50,720 --> 00:02:53,100 It presents some different methods of doing it, 55 00:02:53,200 --> 00:02:56,040 and, yeah, it is pretty good research. 56 00:02:57,420 --> 00:03:01,800 Now, there's another thing on this about why more research is needed in this field. 57 00:03:01,920 --> 00:03:02,520 Why is it important? 58 00:03:04,080 --> 00:03:06,960 These personal firewalls, these HIPS-like systems, 59 00:03:07,100 --> 00:03:08,960 are getting more and more common. 60 00:03:09,600 --> 00:03:13,200 They're pretty much moving to a point where firewalls, 61 00:03:13,200 --> 00:03:17,680 antivirus systems, and anti-spyware crap is going to be all in one product. 62 00:03:17,880 --> 00:03:21,040 You know, just, you know, one thing, not a suite. 63 00:03:21,800 --> 00:03:26,020 And not to mention, you have a whole lot more file format bugs. 64 00:03:26,040 --> 00:03:28,980 These days, like, just the WMF exploit, 65 00:03:29,800 --> 00:03:35,180 the Excel spreadsheet vulnerabilities that we've seen in, I guess, the past month or two. 66 00:03:36,160 --> 00:03:40,580 And in an application like Word, it, you know, it's kind of going to look funny 67 00:03:40,580 --> 00:03:43,100 if Word is trying to bind to a port. 68 00:03:43,360 --> 00:03:50,120 Now, now, maybe we want to get past that and not let the user know that that's happening, 69 00:03:50,240 --> 00:03:51,940 or just be able to break out in general. 70 00:03:52,180 --> 00:03:55,180 Basically, we have to start breaking out of the cage. 71 00:03:55,180 --> 00:03:55,880 Right? 72 00:03:56,280 --> 00:04:03,000 I haven't seen too many exploit frameworks or anything do this type of, this type of research, 73 00:04:03,380 --> 00:04:05,980 these type of payloads, or anything like that. 74 00:04:06,080 --> 00:04:06,860 It's kind of disappointing. 75 00:04:07,860 --> 00:04:10,100 But that's why we have this talk. 76 00:04:11,540 --> 00:04:13,320 So the tools needed to do this. 77 00:04:13,880 --> 00:04:15,320 Basically, you need a debugger. 78 00:04:15,720 --> 00:04:16,900 OliDBG is my choice. 79 00:04:16,980 --> 00:04:18,420 Many people prefer WinDBG. 80 00:04:18,540 --> 00:04:19,180 That's fine. 81 00:04:19,980 --> 00:04:24,380 A disassembler, not totally necessary if you have a debugger, but, 82 00:04:25,180 --> 00:04:27,460 you know, IDA Pro is a good choice for this. 83 00:04:27,940 --> 00:04:29,100 And an assembler. 84 00:04:29,360 --> 00:04:30,740 I prefer NASM. 85 00:04:30,840 --> 00:04:33,780 And that's what the Metasploit payload development kit uses. 86 00:04:33,900 --> 00:04:35,100 So I guess why not? 87 00:04:36,220 --> 00:04:38,380 And you're going to need a compiler also. 88 00:04:39,160 --> 00:04:42,920 And I chose Microsoft Visual Studio C++ 2005. 89 00:04:43,340 --> 00:04:46,540 And the free, the express version works and it's free. 90 00:04:46,700 --> 00:04:47,480 So you know what? 91 00:04:47,520 --> 00:04:49,380 You can go home and compile my code and run it. 92 00:04:49,740 --> 00:04:51,660 If it, you know, works on your system. 93 00:04:51,720 --> 00:04:52,540 And I'll cover that later. 94 00:04:53,380 --> 00:04:57,320 So the first firewall that we're going to go after is the Windows firewall. 95 00:04:57,860 --> 00:05:04,220 Service Pack 2 has brought us a, well, more improved firewall than the first one. 96 00:05:04,540 --> 00:05:06,960 And it, but, you know, it's integrated into Windows. 97 00:05:07,120 --> 00:05:10,000 And offers a little bit more control than the original. 98 00:05:10,520 --> 00:05:13,120 But there's a really big problem with this. 99 00:05:14,000 --> 00:05:15,260 Now, let me see. 100 00:05:15,300 --> 00:05:17,960 I'm going to bring up the MSDN library. 101 00:05:18,220 --> 00:05:19,120 I have it on my system here. 102 00:05:19,900 --> 00:05:22,020 So let's search for a little string here. 103 00:05:23,320 --> 00:05:25,780 Exercising the Windows firewall. 104 00:05:27,180 --> 00:05:27,740 All right. 105 00:05:27,780 --> 00:05:29,380 Let's just see what this comes up with. 106 00:05:36,000 --> 00:05:36,400 Okay. 107 00:05:36,520 --> 00:05:37,900 Let's see what this, oh. 108 00:05:37,980 --> 00:05:39,280 Using the Windows firewall API. 109 00:05:40,140 --> 00:05:41,180 Exercising the Windows firewall. 110 00:05:41,320 --> 00:05:42,200 Let's see what that does. 111 00:05:46,260 --> 00:05:48,140 Now, if my system would be fast. 112 00:05:48,320 --> 00:05:49,140 But, okay. 113 00:05:49,140 --> 00:05:52,220 Now, Windows firewall initialized. 114 00:05:52,300 --> 00:05:53,960 Let's see if we get to something interesting here. 115 00:05:55,160 --> 00:05:56,800 Windows firewall is on. 116 00:05:57,880 --> 00:05:58,540 Turn on. 117 00:05:59,780 --> 00:06:01,940 Oh, and here's something funny. 118 00:06:03,320 --> 00:06:04,980 Windows firewall turned off. 119 00:06:06,280 --> 00:06:10,280 Looks like it might do something that maybe people don't want it to do. 120 00:06:11,220 --> 00:06:17,620 So as you can see here, Microsoft has provided a full API. 121 00:06:17,620 --> 00:06:22,740 Well, it's through a com interface that allows you to do all sorts of fun stuff. 122 00:06:23,400 --> 00:06:25,920 So you can do things like enabling a service. 123 00:06:26,340 --> 00:06:28,640 Basically allowing one application out. 124 00:06:29,390 --> 00:06:31,420 Or, you know, here's my favorite method. 125 00:06:32,700 --> 00:06:34,020 Put firewall enabled. 126 00:06:34,920 --> 00:06:35,500 Yeah. 127 00:06:35,600 --> 00:06:39,140 So you can just put firewall enabled variant false. 128 00:06:39,460 --> 00:06:40,700 And what do you think that does? 129 00:06:42,540 --> 00:06:46,620 So it can, you know, arbitrarily authorize applications. 130 00:06:48,020 --> 00:06:51,320 To basically, you know, be allowed out through the firewall. 131 00:06:52,520 --> 00:06:58,760 And basically the shell code here will basically initialize a com object. 132 00:06:58,980 --> 00:07:00,300 Let me see if I can get the code up here. 133 00:07:00,440 --> 00:07:02,780 So you can all see the C code that I wrote. 134 00:07:06,020 --> 00:07:06,460 Okay. 135 00:07:06,580 --> 00:07:09,200 I think it's an FW killer. 136 00:07:16,360 --> 00:07:18,440 I have to remember which one this was. 137 00:07:18,600 --> 00:07:23,060 Because the C code is not as important as the actual assembly payload. 138 00:07:25,180 --> 00:07:25,660 Okay. 139 00:07:27,120 --> 00:07:32,660 So basically what you're going to do is initialize com via co-initialize X. 140 00:07:33,020 --> 00:07:35,320 And then you're going to initialize a com object. 141 00:07:35,800 --> 00:07:38,760 Which I believe is net FW manager. 142 00:07:39,520 --> 00:07:42,240 And then that has a method called get local policy. 143 00:07:43,040 --> 00:07:48,140 And that FW policy also has a method called get current profile. 144 00:07:48,380 --> 00:07:52,780 Which basically that contains a method called put firewall enabled. 145 00:07:52,920 --> 00:07:54,200 And we just set it to variant false. 146 00:07:54,460 --> 00:07:55,640 And that works. 147 00:07:57,220 --> 00:07:58,580 Sounds kind of funny, doesn't it? 148 00:07:58,700 --> 00:08:01,800 I mean, this shouldn't be that easy in my opinion. 149 00:08:02,040 --> 00:08:06,000 Now, granted, you do have to run this as an admin to get it to work. 150 00:08:06,120 --> 00:08:08,820 But there are a lot of ways. 151 00:08:08,820 --> 00:08:12,680 There are a lot of ways to escalate your privileges inside of any operating system. 152 00:08:13,040 --> 00:08:15,820 You know, hard on the outside, somewhat more mushy on the middle. 153 00:08:17,940 --> 00:08:18,900 So, demos. 154 00:08:19,240 --> 00:08:19,880 They're important. 155 00:08:20,760 --> 00:08:24,180 If you don't do them, people look at you like you don't know anything. 156 00:08:24,400 --> 00:08:25,760 So that, alright. 157 00:08:27,020 --> 00:08:31,660 Basically, I wrote up a payload for the Metasploit framework. 158 00:08:32,120 --> 00:08:35,280 You bring the window just to the right of the stage so we can see the load? 159 00:08:35,400 --> 00:08:35,880 Yes. 160 00:08:36,820 --> 00:08:38,420 Okay, great. 161 00:08:38,720 --> 00:08:40,960 You're all able to see that fairly well. 162 00:08:41,100 --> 00:08:44,640 I'm not sure if I can get the font any bigger on this because it's in a virtual machine. 163 00:08:45,580 --> 00:08:48,800 But the bottom line, who all knows what the Metasploit framework is? 164 00:08:50,460 --> 00:08:51,960 Alright, a good number of you. 165 00:08:52,060 --> 00:09:00,620 Just for those who don't know, the Metasploit framework provides an automated way to create and test exploits along with developing payloads for them. 166 00:09:01,020 --> 00:09:05,860 And just so happens the developing payloads is kind of what I was doing here. 167 00:09:05,880 --> 00:09:08,320 So, it proved to be quite useful. 168 00:09:09,080 --> 00:09:09,520 Alright. 169 00:09:14,920 --> 00:09:18,360 Now, I'm just going to bring up the Metasploit console here. 170 00:09:20,000 --> 00:09:21,340 If it will load. 171 00:09:23,340 --> 00:09:25,360 Now, there's a new version that's written in Ruby. 172 00:09:25,540 --> 00:09:28,920 I didn't have too much luck getting this payload to work with that. 173 00:09:29,140 --> 00:09:33,040 There are just some kind of, there must have been some kind of quirks in there. 174 00:09:33,260 --> 00:09:35,000 HD had been fixing some stuff. 175 00:09:35,000 --> 00:09:39,940 And I hear it's, there are a lot of the bugs taken out of the Ruby version, which is 3.0. 176 00:09:40,480 --> 00:09:44,340 But it seemed that 2.6 was the one that I had the most luck with. 177 00:09:44,540 --> 00:09:45,680 So, that's what I'm going to stick with. 178 00:09:46,340 --> 00:09:51,340 Now, to deliver this payload, the exploit that I'm going to use is the WMF exploit. 179 00:09:51,620 --> 00:09:57,800 And why this is important is if you think about it, there are a lot of, a lot more cross-site scripting attacks are happening these days. 180 00:09:58,100 --> 00:10:01,440 You know, redirecting the user to, you know, some other arbitrary site. 181 00:10:01,540 --> 00:10:02,240 You know, getting data. 182 00:10:02,340 --> 00:10:04,040 You know, you have all this Ajax stuff. 183 00:10:04,100 --> 00:10:04,440 Where. 184 00:10:05,000 --> 00:10:08,960 You know, basically, you're able to funnel data in without the user knowing. 185 00:10:09,180 --> 00:10:10,140 Fun stuff like that. 186 00:10:10,280 --> 00:10:17,360 If you all had seen Billy Hoffman's talk at Black Hat about that, that would be a little bit more informative on this subject. 187 00:10:17,600 --> 00:10:20,040 But cross-site scripting is a lot bigger. 188 00:10:20,220 --> 00:10:26,900 And you have a lot of L users who have the tendency to click on any link if it kind of looks like it's trustworthy. 189 00:10:27,020 --> 00:10:31,560 Even though it has like a script tag at the end and it says, I pwned you. 190 00:10:32,200 --> 00:10:32,960 I don't know. 191 00:10:33,080 --> 00:10:34,980 Maybe that's just me. 192 00:10:38,860 --> 00:10:39,500 Okay. 193 00:10:40,680 --> 00:10:42,280 And I'll set the payload. 194 00:10:47,600 --> 00:10:59,880 This is a bind payload, by the way, to demonstrate the fact that it seems that the Windows ICF is very tuned to basically blocking applications from binding. 195 00:11:00,020 --> 00:11:04,080 It doesn't do as much against stuff connecting out. 196 00:11:04,080 --> 00:11:11,440 But the reason that it's important to be able to disable this is what it will do is prevent you from accessing a lot of network resources. 197 00:11:12,340 --> 00:11:18,320 Now, if you want to be able to break into one system and own all the boxes on the network, you will want to be able to do that. 198 00:11:19,140 --> 00:11:22,700 And, you know, through SMB, you know, be able to browse the shares, all that fun stuff. 199 00:11:22,960 --> 00:11:25,820 So it is an important thing to be able to do. 200 00:11:27,160 --> 00:11:27,540 Okay. 201 00:11:27,680 --> 00:11:28,620 And exploit. 202 00:11:30,020 --> 00:11:33,440 So now we have a bind handler. 203 00:11:33,440 --> 00:11:34,760 Well, it's not a bind handler. 204 00:11:34,880 --> 00:11:38,600 It's basically a makeshift HTTP server. 205 00:11:38,860 --> 00:11:44,100 And, in fact, the 2.6 can't actually shovel a shell on this. 206 00:11:44,360 --> 00:11:49,520 So what I just did is, you know, use netcat like normal to gain that. 207 00:11:49,960 --> 00:11:50,320 Okay. 208 00:11:50,500 --> 00:11:53,180 That's 28.128. 209 00:11:56,520 --> 00:11:56,880 Yeah. 210 00:11:59,180 --> 00:12:00,920 That's the default port that it will be running on. 211 00:12:02,740 --> 00:12:13,540 So, okay, now let's see how usable this VM is because the screen resolution got kind of mangled in this whole process of setting it up. 212 00:12:15,260 --> 00:12:21,760 Now, okay, first of all, go to the control panel, see if the firewall is actually enabled here. 213 00:12:26,320 --> 00:12:28,160 And scroll up a little bit. 214 00:12:29,740 --> 00:12:30,280 Yep. 215 00:12:30,380 --> 00:12:30,880 It's on. 216 00:12:31,160 --> 00:12:38,800 So, and not to, I'm just going to leave don't allow exceptions off because it really doesn't matter in this case. 217 00:12:40,520 --> 00:12:41,860 So I'll go here. 218 00:12:44,460 --> 00:12:46,040 And I believe it was. 219 00:12:53,660 --> 00:12:55,720 I believe that was 128. 220 00:12:55,720 --> 00:12:56,060 128. 221 00:12:59,900 --> 00:13:00,660 All right. 222 00:13:01,940 --> 00:13:02,500 Yeah. 223 00:13:02,580 --> 00:13:03,060 So. 224 00:13:12,020 --> 00:13:12,580 Okay. 225 00:13:12,680 --> 00:13:14,160 So it's going in. 226 00:13:15,220 --> 00:13:18,380 Now, you should see an image pop up here. 227 00:13:20,460 --> 00:13:21,380 Now, oh, fun. 228 00:13:22,140 --> 00:13:23,840 Do I want to keep blocking this? 229 00:13:23,840 --> 00:13:24,460 Okay. 230 00:13:25,620 --> 00:13:30,340 Now, I wonder if I had set the payload correctly because it shouldn't do that. 231 00:13:31,500 --> 00:13:35,940 But to be fair, this is why I have flash demos of this stuff. 232 00:13:36,240 --> 00:13:36,440 Because. 233 00:13:41,900 --> 00:13:42,940 All right. 234 00:13:42,980 --> 00:13:43,140 Yeah. 235 00:13:43,720 --> 00:13:44,700 Sorry about this. 236 00:13:44,800 --> 00:13:48,400 I just figured that there would probably be some screw up during this. 237 00:13:48,500 --> 00:13:53,820 But you will be able to see how truly powerful Windows XP Firewall is. 238 00:13:54,660 --> 00:13:55,160 Okay. 239 00:13:59,540 --> 00:14:00,440 Oh, man. 240 00:14:00,760 --> 00:14:01,260 God. 241 00:14:01,600 --> 00:14:02,280 All right. 242 00:14:02,460 --> 00:14:03,420 So let's see here. 243 00:14:03,500 --> 00:14:04,800 Can you read that at all? 244 00:14:05,100 --> 00:14:07,600 Now, you basically get a general outline of what's going on. 245 00:14:07,760 --> 00:14:10,680 So as you can see, I'm enabling the firewall right there. 246 00:14:11,860 --> 00:14:12,760 And then. 247 00:14:13,860 --> 00:14:14,360 Okay. 248 00:14:16,160 --> 00:14:19,420 Go back to my terminal on my Linux system. 249 00:14:20,100 --> 00:14:23,240 And I'm launching the MSF console program right there. 250 00:14:23,240 --> 00:14:26,360 So basically I'm doing the same thing that I was before, but this time it will work. 251 00:14:27,200 --> 00:14:29,880 So I love live demos. 252 00:14:33,940 --> 00:14:38,580 Now I'm just entering the exploit to use right here. 253 00:14:44,980 --> 00:14:45,880 Excuse me? 254 00:14:47,540 --> 00:14:53,120 Yes, and the main reason I did that was basically the way you know that this 255 00:14:53,120 --> 00:14:57,520 is working is if you do a bind one and you don't get that message that you saw on the 256 00:14:57,520 --> 00:14:57,960 other part. 257 00:14:58,140 --> 00:14:58,940 Now I don't know. 258 00:14:59,000 --> 00:15:00,140 It was an act of God or something. 259 00:15:00,340 --> 00:15:05,160 I must have done something really bad last night, but okay, now why is that running so 260 00:15:05,160 --> 00:15:05,540 slow? 261 00:15:07,960 --> 00:15:08,560 All right. 262 00:15:08,740 --> 00:15:10,500 Well, hopefully it will get a bit faster here. 263 00:15:12,820 --> 00:15:14,220 Again, God, I love live demos. 264 00:15:15,180 --> 00:15:15,960 So let me see. 265 00:15:17,640 --> 00:15:21,200 I'll have disk activity because I have this virtual machine stuff running. 266 00:15:22,740 --> 00:15:23,100 Okay. 267 00:15:26,780 --> 00:15:27,500 All right. 268 00:15:27,540 --> 00:15:30,820 I think I need to like close some things here, like the MSDN library. 269 00:15:30,960 --> 00:15:31,560 That needs to go. 270 00:15:34,020 --> 00:15:34,620 Oh, fun. 271 00:15:34,700 --> 00:15:35,600 My system got locked up. 272 00:15:41,900 --> 00:15:44,360 Windows is exacting its revenge against me. 273 00:15:44,440 --> 00:15:49,380 That's, you know, it has a soul and all that, so, you know, you have all sorts of fun stuff 274 00:15:50,100 --> 00:15:50,860 going on there. 275 00:15:54,420 --> 00:15:54,800 Yeah. 276 00:15:54,920 --> 00:15:55,740 Close that. 277 00:15:56,260 --> 00:15:57,180 Big memory hog. 278 00:16:07,800 --> 00:16:08,180 Yeah. 279 00:16:09,460 --> 00:16:11,160 Very robust as you can see. 280 00:16:11,400 --> 00:16:11,720 Now. 281 00:16:11,780 --> 00:16:12,280 Oh, okay. 282 00:16:12,340 --> 00:16:13,760 Now it seems to be running a lot faster. 283 00:16:13,900 --> 00:16:15,220 So, okay. 284 00:16:15,360 --> 00:16:15,580 Yeah. 285 00:16:15,640 --> 00:16:17,600 Now doing exploit right there. 286 00:16:17,660 --> 00:16:19,440 So it's going to start the HTTP server. 287 00:16:20,460 --> 00:16:20,840 Okay. 288 00:16:20,860 --> 00:16:33,780 I just killed you. Good lord. Okay. Now waiting for the connection on, and then we'll go back 289 00:16:33,780 --> 00:16:38,660 to the VMware system right here. And then run, and then basically I'm running iExplore 290 00:16:38,660 --> 00:16:43,800 and then the URL of that malicious site. So just say some L user, you know, happened to 291 00:16:43,800 --> 00:16:49,600 click on that and some cross site scripting vulnerability. So basically it's going to 292 00:16:49,600 --> 00:16:55,620 be pushed down. It'll run. And it will say, as you can see, your firewall got disabled. 293 00:16:55,980 --> 00:17:05,340 So therefore, if you'll wait for it here, I'm netcatting to the port 444, which is the default 294 00:17:05,340 --> 00:17:11,340 port set up in Metasploit for which port to bind to. And we have a shell. As you can see. 295 00:17:17,600 --> 00:17:19,580 So it may have said something. 296 00:17:19,600 --> 00:17:23,300 It may have said something to the user, but we still owned them. So, I mean, you could 297 00:17:23,300 --> 00:17:26,280 basically shovel in your own payload that would, you know, do something like load a 298 00:17:26,280 --> 00:17:29,780 rootkit. So, oh, all of a sudden, you know, it doesn't really matter that they know anymore. 299 00:17:29,900 --> 00:17:30,540 They're still fucked. 300 00:17:31,500 --> 00:17:31,820 So... 301 00:17:33,120 --> 00:17:37,660 All right. Let's see here if I can... 302 00:17:40,840 --> 00:17:41,160 Yeah. 303 00:17:48,100 --> 00:17:48,420 Okay. 304 00:17:48,580 --> 00:17:48,740 No. 305 00:17:49,600 --> 00:17:49,780 Jeez. 306 00:17:51,240 --> 00:17:55,500 Yeah. Fun stuff here. 307 00:17:57,320 --> 00:18:00,420 Jeez, VMware. Come on. It's supposed to be reliable. 308 00:18:01,820 --> 00:18:04,420 Sorry for this, but... 309 00:18:06,700 --> 00:18:10,620 All right. Let's see. That should be in full screen. 310 00:18:11,460 --> 00:18:15,860 Oh, well. Now we have this fun up here. So if you can ignore that... 311 00:18:16,960 --> 00:18:17,480 Yeah. 312 00:18:19,020 --> 00:18:23,420 Yeah. Everything that can go wrong will go wrong. So that's just one of the rules here. 313 00:18:23,720 --> 00:18:28,660 So the next firewall that we're going to go after is the Zone Alarm Personal Firewall. 314 00:18:29,080 --> 00:18:33,840 And this is actually a little bit of an older version compared to the new one. 315 00:18:33,960 --> 00:18:35,240 And I will discuss the new one. 316 00:18:36,600 --> 00:18:40,560 Now, this is one of the main personal firewalls used. 317 00:18:40,720 --> 00:18:42,820 You know, everyone talks about Zone Alarm all the time. 318 00:18:43,440 --> 00:18:46,560 And these personal firewalls have a hard job. 319 00:18:46,560 --> 00:18:50,620 Because they have to defend from threats locally and remotely, a.k.a. people like me. 320 00:18:51,040 --> 00:18:59,520 So one of the most important components in this firewall is called True Vector. 321 00:18:59,700 --> 00:19:02,300 It's basically a driver and it's what... 322 00:19:02,300 --> 00:19:05,200 It's basically, you know, the network part of it. 323 00:19:05,400 --> 00:19:08,860 And Zone Alarm is really pretty much a GUI on top of it. 324 00:19:08,940 --> 00:19:11,580 This is basically a beneficial rootkit to your system. 325 00:19:12,240 --> 00:19:16,540 And it's basically what keeps you safe from all sorts of local threats and what have you. 326 00:19:16,540 --> 00:19:19,500 And it's quite aggressive about defending itself, as you will see. 327 00:19:20,900 --> 00:19:22,300 So reversing Zone Alarm. 328 00:19:22,460 --> 00:19:23,640 Our plan of attack here. 329 00:19:23,860 --> 00:19:27,560 We need to get write access to the zlclient.exe process. 330 00:19:28,600 --> 00:19:31,360 And inject code into it that will disable the firewall. 331 00:19:31,720 --> 00:19:32,680 We need to run that code. 332 00:19:33,000 --> 00:19:35,200 And make sure it's done quasi-stealthily. 333 00:19:35,260 --> 00:19:40,180 So then you don't have all sorts of, you know, flashing buttons come up on the screen and what have you. 334 00:19:40,320 --> 00:19:41,840 And I'm going to call it ZARooter. 335 00:19:42,900 --> 00:19:44,580 So first we have to find the process. 336 00:19:44,580 --> 00:19:48,640 We need to find a zlclient.exe's PID. 337 00:19:48,720 --> 00:19:49,640 Process ID. 338 00:19:50,340 --> 00:19:54,160 Now first, we'll run enum processes to get a process list. 339 00:19:54,460 --> 00:19:57,640 And then use open process with process... 340 00:19:57,640 --> 00:19:59,740 With the parameter of process query information. 341 00:20:00,280 --> 00:20:05,760 To be able to basically enumerate through what certain... 342 00:20:05,760 --> 00:20:07,700 Like the actual name of the executable. 343 00:20:08,200 --> 00:20:13,200 So then we'll use enum process modules to get the module handle of the process. 344 00:20:13,200 --> 00:20:16,060 And get module base name A to get the process name. 345 00:20:16,240 --> 00:20:20,080 Then we can just continually string compare this to zlclient.exe. 346 00:20:20,180 --> 00:20:22,740 And when we hit that, we'll know that we have the right process. 347 00:20:24,380 --> 00:20:25,800 Now there's a big problem here. 348 00:20:26,060 --> 00:20:28,200 True vector for us is a pest. 349 00:20:28,780 --> 00:20:29,740 It behaves... 350 00:20:29,740 --> 00:20:32,020 As I said before, it behaves like a rootkit. 351 00:20:32,920 --> 00:20:35,180 It hooks a lot of system calls. 352 00:20:35,380 --> 00:20:39,100 And this is why you cannot just do a terminate process on the firewall. 353 00:20:40,100 --> 00:20:43,120 Although I think if you follow the route that I've used to this. 354 00:20:43,120 --> 00:20:45,440 You actually can do a terminate process on the firewall. 355 00:20:45,980 --> 00:20:49,100 But it's pretty much going to kill all network activities. 356 00:20:49,260 --> 00:20:50,140 So you don't want to do that. 357 00:20:50,460 --> 00:20:52,700 And that's one of the reasons I took the route that I did. 358 00:20:53,660 --> 00:20:56,880 And the most important call that it hooks, at least for us. 359 00:20:57,300 --> 00:20:58,840 Is NT open process. 360 00:21:00,020 --> 00:21:03,280 If that's hooked by zone alarm and it's doing, you know, what it does. 361 00:21:03,400 --> 00:21:05,280 You know, preventing us from trying to attach to it. 362 00:21:05,680 --> 00:21:08,380 We will not be able to get a handle to zlclient.exe. 363 00:21:08,440 --> 00:21:09,520 And our code can't run. 364 00:21:09,940 --> 00:21:12,240 We won't be able to inject any code into the process. 365 00:21:12,240 --> 00:21:13,920 And that's a very big problem. 366 00:21:14,080 --> 00:21:15,940 Because how else, you know, you're going to shut it off. 367 00:21:17,040 --> 00:21:19,100 So, enter the ZARooter driver. 368 00:21:19,940 --> 00:21:22,980 Now, the funny thing in this version of zone alarm. 369 00:21:23,420 --> 00:21:24,940 True vector or zone alarm. 370 00:21:25,060 --> 00:21:27,240 Whatever, you know, is doing it in the back end. 371 00:21:27,300 --> 00:21:28,540 Does not mind if we load a driver. 372 00:21:28,860 --> 00:21:29,140 Ooh. 373 00:21:30,280 --> 00:21:30,720 Rootkit. 374 00:21:31,020 --> 00:21:31,460 Hello. 375 00:21:32,340 --> 00:21:35,340 So, we can write to the system service dispatch table. 376 00:21:35,560 --> 00:21:36,460 And this mean... 377 00:21:36,460 --> 00:21:39,680 And we can execute code on the same level as true vector. 378 00:21:40,180 --> 00:21:40,940 So, guess what? 379 00:21:40,940 --> 00:21:41,580 We can over... 380 00:21:41,580 --> 00:21:44,200 We can unhook every system call that it hooked. 381 00:21:45,120 --> 00:21:45,560 Yeah. 382 00:21:47,260 --> 00:21:49,980 So, basically, here we have the pseudo rootkit. 383 00:21:50,180 --> 00:21:54,400 Because it doesn't really do anything malicious other than unhook a system call. 384 00:21:54,620 --> 00:21:57,160 And no one's really going to notice that. 385 00:21:57,320 --> 00:21:58,480 But actually, you can. 386 00:21:58,780 --> 00:21:59,560 But it's like... 387 00:22:00,000 --> 00:22:05,000 For a normal user, even if they got their hands on one of these programs that, you know, you can view the syscall table. 388 00:22:05,200 --> 00:22:07,940 It's like, oh, no, there's one less hook in there. 389 00:22:08,000 --> 00:22:09,080 So, I'm less vulnerable. 390 00:22:09,300 --> 00:22:10,200 Something like that. 391 00:22:10,940 --> 00:22:14,320 So, basically, an outline of what... 392 00:22:14,320 --> 00:22:15,420 How this will work. 393 00:22:15,580 --> 00:22:20,600 We'll create a memory descriptor list for the system service dispatch table. 394 00:22:20,720 --> 00:22:24,960 Which is basically using this deckle spec right here. 395 00:22:25,400 --> 00:22:27,360 Now, that's not the most stealthy way to do that. 396 00:22:27,520 --> 00:22:33,120 But if you read rootkit.com, you'll find out some other ways to make this a bit more stealthy. 397 00:22:33,880 --> 00:22:40,740 And then we'll unhook NT open process and replace it with the address of the original syscall. 398 00:22:40,940 --> 00:22:42,820 Well, the original code that ran it. 399 00:22:43,480 --> 00:22:50,900 So, it turns out that zone alarm didn't actually, you know, rip out the code of that old system call. 400 00:22:51,120 --> 00:22:53,460 All it did was redirect it to its own stuff. 401 00:22:53,620 --> 00:22:54,260 So, it's still there. 402 00:22:54,400 --> 00:22:56,300 You just have to find the address of it and use it. 403 00:22:57,780 --> 00:23:00,120 So, basically, what it will... 404 00:23:00,660 --> 00:23:03,080 What you'll have to know is the... 405 00:23:03,080 --> 00:23:06,980 You'll have to know the syscall number and the address. 406 00:23:07,280 --> 00:23:09,340 And that differs between service packs. 407 00:23:09,340 --> 00:23:13,240 And I know my code isn't the most portable after you see what's going on. 408 00:23:13,800 --> 00:23:15,220 But you can make it portable. 409 00:23:16,580 --> 00:23:18,280 So, I'll discuss that later though. 410 00:23:18,480 --> 00:23:21,180 And basically, we have a macro here that's called hook syscall. 411 00:23:21,300 --> 00:23:23,960 Basically, it takes a syscall number and an address and it'll set it to that. 412 00:23:24,760 --> 00:23:26,680 And I can actually bring up the code on here. 413 00:23:26,780 --> 00:23:29,880 If my computer doesn't explode, just please pray that it doesn't. 414 00:23:29,960 --> 00:23:31,900 Because that was kind of odd last time. 415 00:23:34,300 --> 00:23:34,900 All right. 416 00:23:35,460 --> 00:23:36,680 You go back to... 417 00:23:40,500 --> 00:23:40,860 Okay. 418 00:23:46,840 --> 00:23:48,540 And go to ZARooter driver here. 419 00:23:49,200 --> 00:23:52,540 All this code will be up on the Noxus Files website, by the way, after the con. 420 00:23:54,180 --> 00:23:54,900 So, okay. 421 00:23:55,040 --> 00:23:56,380 You see ZARooter.c. 422 00:23:57,100 --> 00:23:58,840 And, of course, you have to edit these with vim. 423 00:23:58,880 --> 00:24:00,960 Because if you don't use vim, you're not lead, of course. 424 00:24:01,080 --> 00:24:01,760 It's just a rule. 425 00:24:03,480 --> 00:24:07,000 But, anyway, as you can see, some of this is kind of messy. 426 00:24:07,080 --> 00:24:09,120 Because I was kind of experimenting about which calls 427 00:24:09,340 --> 00:24:10,680 to unhook and what I could do with that. 428 00:24:10,780 --> 00:24:13,280 But I basically commented out the ones that don't really matter 429 00:24:13,280 --> 00:24:14,160 for our purposes. 430 00:24:14,780 --> 00:24:19,480 So, you basically have an array of what the address we want to set 431 00:24:19,480 --> 00:24:22,780 the hook syscall to and basically an array of syscall numbers 432 00:24:22,780 --> 00:24:23,600 that we want to unhook. 433 00:24:25,140 --> 00:24:28,300 So, basically, right here, it will iterate through all of this. 434 00:24:28,480 --> 00:24:32,440 And then it will say if you have a debug event viewer on your system, 435 00:24:32,520 --> 00:24:35,600 you can actually see status unhooking syscall number blah 436 00:24:35,600 --> 00:24:37,060 with address of blah. 437 00:24:37,060 --> 00:24:42,800 So, it will unhook the syscall and basically will win. 438 00:24:42,960 --> 00:24:44,660 So, that's the important thing. 439 00:24:46,360 --> 00:24:48,880 So, now we have to find a way to shut it off. 440 00:24:49,260 --> 00:24:51,540 Now, this takes some reverse engineering right here. 441 00:24:52,000 --> 00:24:55,760 And, basically, after a while of grinding through code, 442 00:24:55,940 --> 00:25:01,220 you find that there's this little function at this hex location right here. 443 00:25:01,700 --> 00:25:04,020 And it seems to be a pretty reliable address. 444 00:25:04,120 --> 00:25:05,880 You know, it doesn't change a whole lot. 445 00:25:05,880 --> 00:25:08,360 But, or at all that I've seen. 446 00:25:08,760 --> 00:25:10,560 And, basically, the funny part is, 447 00:25:10,700 --> 00:25:16,040 if you can see TVTF force shutdown right there. 448 00:25:16,480 --> 00:25:17,000 Yeah. 449 00:25:17,800 --> 00:25:22,360 So, anyway, basically, if you pass it a value of four, 450 00:25:22,540 --> 00:25:25,980 it will tell True Vector basically to, you know, screw off 451 00:25:25,980 --> 00:25:27,300 and, you know, don't do anything. 452 00:25:27,540 --> 00:25:29,360 So, that's pretty fun. 453 00:25:30,280 --> 00:25:34,800 So, we can call that the code that we inject into the firewall. 454 00:25:35,800 --> 00:25:40,000 Now, if you try to do, this is actual, if I recall correctly, 455 00:25:40,240 --> 00:25:43,460 methods that are basically at a lower level than this 456 00:25:43,460 --> 00:25:45,740 are in some of the zone alarm DLLs. 457 00:25:45,800 --> 00:25:48,180 But, don't try to call them because it pretty much won't work. 458 00:25:48,340 --> 00:25:51,600 It has some sort of authentication stuff that basically knows 459 00:25:51,600 --> 00:25:54,000 whether you're running it actually from the firewall or not. 460 00:25:55,680 --> 00:25:57,200 So, problem number two. 461 00:25:57,420 --> 00:25:59,900 We have a lot of alerts that are going to pop up. 462 00:26:00,000 --> 00:26:00,580 You know, that sucks. 463 00:26:00,760 --> 00:26:03,400 We don't want the user to know that we're actually rooting them. 464 00:26:03,940 --> 00:26:04,780 So, let's do that. 465 00:26:04,780 --> 00:26:06,340 You have icon changes. 466 00:26:06,600 --> 00:26:08,920 You have a text box like right here. 467 00:26:09,120 --> 00:26:13,500 And you have that nice, you know, message system error, please reboot. 468 00:26:13,760 --> 00:26:16,960 Maybe that would, you know, alert people that there is something 469 00:26:16,960 --> 00:26:17,840 a little bit wrong. 470 00:26:18,960 --> 00:26:20,620 And all that fun stuff. 471 00:26:20,780 --> 00:26:22,300 So, we basically need to get rid of these. 472 00:26:23,660 --> 00:26:28,620 Now, the first one is there is an icon change. 473 00:26:28,800 --> 00:26:30,640 As you can see right there, there's a big X. 474 00:26:30,740 --> 00:26:33,900 And then it will say True Vector security service is shut down. 475 00:26:33,900 --> 00:26:37,220 We don't want the user to see that because they might wonder 476 00:26:37,220 --> 00:26:39,420 why a big red X is in the bottom of their system. 477 00:26:39,720 --> 00:26:42,840 Although, with some users these days, it may not matter. 478 00:26:42,980 --> 00:26:48,360 But we still want to be cautious here and do what we can. 479 00:26:48,700 --> 00:26:55,460 So, what's kind of funny is shell notify icon basically takes two parameters. 480 00:26:55,760 --> 00:26:58,760 And one is like the message it's going to send. 481 00:26:58,940 --> 00:27:02,800 And this notify icon data structure right here. 482 00:27:02,800 --> 00:27:05,420 Now, I didn't research into all what that did. 483 00:27:05,520 --> 00:27:07,660 But basically, the bottom line is it changes the icon. 484 00:27:07,840 --> 00:27:08,520 And we don't want it to. 485 00:27:09,480 --> 00:27:14,680 So, we can pretty much replace that call with add ESP8 after it's pushed the parameters. 486 00:27:14,900 --> 00:27:16,680 And there is no more call. 487 00:27:18,540 --> 00:27:22,820 Do any of you know how like the stack works when calling a function 488 00:27:22,820 --> 00:27:23,960 like in assembly language? 489 00:27:24,960 --> 00:27:25,440 Anyone? 490 00:27:26,220 --> 00:27:29,780 Okay, well, the bottom line is things get pushed onto the stack 491 00:27:29,780 --> 00:27:32,000 kind of like you stack, you know, you stack plates. 492 00:27:32,800 --> 00:27:34,940 And the front like where the top plate is, 493 00:27:35,460 --> 00:27:37,980 that's where this register called ESP is. 494 00:27:38,240 --> 00:27:43,580 And basically, and indirectly, it will reference all of the arguments from that. 495 00:27:43,820 --> 00:27:48,480 So, all this does is pretty much resets that pointer, you know, 496 00:27:48,500 --> 00:27:50,260 from the top of the plates or the stack, 497 00:27:50,400 --> 00:27:52,680 depending on how you want to think of it, further back. 498 00:27:52,840 --> 00:27:57,400 So, it pretty much doesn't matter that they have these arguments for it. 499 00:27:57,800 --> 00:28:00,140 So, basically, we just killed that call. 500 00:28:00,340 --> 00:28:01,040 So, we win. 501 00:28:02,800 --> 00:28:03,060 Screen text. 502 00:28:04,580 --> 00:28:10,940 It uses a few resource strings in the .rsrc section of the portable executable. 503 00:28:11,100 --> 00:28:15,160 For those of you who do not know, the PE is the format, you know, 504 00:28:15,180 --> 00:28:17,980 like you have an EXE file, you run that, that's PE. 505 00:28:19,860 --> 00:28:24,520 So, basically, you see all these like system error messages and whatnot. 506 00:28:24,720 --> 00:28:26,320 Well, we can just overwrite them with our own. 507 00:28:26,980 --> 00:28:27,700 Sounds good. 508 00:28:28,580 --> 00:28:32,360 So, and it uses draw text to write this to the screen. 509 00:28:32,360 --> 00:28:36,540 That's a, I believe, GDI call, if I'm not mistaken. 510 00:28:36,640 --> 00:28:40,460 I think it's in user32.dll, but that's kind of not important right now. 511 00:28:42,520 --> 00:28:47,520 So, what we're going to do is have a user mode hook on draw text. 512 00:28:49,040 --> 00:28:54,380 Now, because we want to see whenever it's going to try to spit these nasty messages out. 513 00:28:55,400 --> 00:29:00,800 Now, what we're going to have to do first of all is pretty much preserve the program state at that moment. 514 00:29:01,060 --> 00:29:02,240 We can use these. 515 00:29:02,360 --> 00:29:06,480 These op codes right here, push A, push FD, pop FD, pop A. 516 00:29:06,820 --> 00:29:14,060 Basically, what that does is it saves the, it saves the state of all the registers and pushes it onto that stack, 517 00:29:14,160 --> 00:29:15,260 you know, the plate thing. 518 00:29:15,920 --> 00:29:20,080 So, and then also it does this for a flags register too. 519 00:29:20,320 --> 00:29:26,380 And basically that has some, has some info about whether you're going to, you know, jump this way, jump that way. 520 00:29:26,500 --> 00:29:28,540 But the bottom line is we're saving the program state. 521 00:29:28,740 --> 00:29:29,720 Everyone understand that? 522 00:29:30,400 --> 00:29:30,840 Yeah. 523 00:29:30,920 --> 00:29:31,600 Okay, good. 524 00:29:33,300 --> 00:29:45,040 Now, what we're basically going to do is where you see this move EBX ESP plus 2C after the push add and push FD, 525 00:29:45,580 --> 00:29:48,480 that's basically looking at one of the arguments of draw text. 526 00:29:49,220 --> 00:29:54,620 So, it's basically seeing what text is going to be written and it will check it for all. 527 00:29:54,900 --> 00:29:57,780 Now, I think I forgot to explain the reason why I did this. 528 00:29:59,160 --> 00:30:01,220 But if you see here, that's red. 529 00:30:01,580 --> 00:30:02,740 System error, please reboot. 530 00:30:02,860 --> 00:30:03,620 That's all in red. 531 00:30:04,540 --> 00:30:10,280 Now, if you notice when it's running normally, let me see if I have it running in the virtual machine here. 532 00:30:12,240 --> 00:30:12,600 Okay. 533 00:30:14,900 --> 00:30:15,480 Oh, no. 534 00:30:15,620 --> 00:30:15,980 Okay. 535 00:30:16,120 --> 00:30:17,560 Oh, that's all right. 536 00:30:17,900 --> 00:30:22,460 Yeah, I have that basic reminder there, but you saw it work, so that's important. 537 00:30:24,800 --> 00:30:26,080 Wait, that's not going to show it either. 538 00:30:26,240 --> 00:30:27,860 I'll just run, there's an alarm on this. 539 00:30:29,600 --> 00:30:31,200 Now, if, come on. 540 00:30:36,360 --> 00:30:36,760 Okay. 541 00:30:39,480 --> 00:30:40,040 All right. 542 00:30:40,060 --> 00:30:44,220 Now, if we can wait while this program runs and it will start up. 543 00:30:46,880 --> 00:30:48,840 But the bottom line is it's all in green. 544 00:30:49,040 --> 00:30:51,760 So, we don't want to have flashing red messages everywhere. 545 00:30:51,960 --> 00:30:52,820 That's going to be a problem. 546 00:30:53,840 --> 00:30:55,360 Now, I'll come back to that. 547 00:30:55,420 --> 00:30:56,840 That's going to take forever to load. 548 00:30:56,840 --> 00:30:58,520 With the amount of stuff I'm running on this. 549 00:30:59,900 --> 00:31:03,740 So, basically, we're going to check for all because, you know, that's the message. 550 00:31:03,980 --> 00:31:06,380 We want it to say all systems are active. 551 00:31:07,340 --> 00:31:10,020 That's pretty much what the original message was. 552 00:31:10,360 --> 00:31:12,720 And that's what we did with the overriding in memory. 553 00:31:14,920 --> 00:31:20,120 Now, pretty much what it's going to do is if it's there, it's just going to run set text color to set the text to green. 554 00:31:20,880 --> 00:31:23,220 And then we basically do the rest of the stack setup. 555 00:31:23,460 --> 00:31:24,260 And then we win. 556 00:31:25,460 --> 00:31:27,400 Now, there's one issue here. 557 00:31:27,520 --> 00:31:33,240 How are you going to transport that driver over to the infected, well, exploited user system? 558 00:31:34,120 --> 00:31:38,680 Now, one approach here is to include this as a resource in a DLL. 559 00:31:39,500 --> 00:31:48,380 Now, the nice thing about the Metasploit framework is that a guy named Scape wrote this little payload that did DLL injection basically over TCP. 560 00:31:48,640 --> 00:31:49,900 Remote DLL injection. 561 00:31:50,760 --> 00:31:53,420 Now, if you've ever seen someone. 562 00:31:53,420 --> 00:31:54,180 I don't know. 563 00:31:54,240 --> 00:31:59,880 Get a remote desktop display after running an exploit through VNC on someone else's box. 564 00:32:00,680 --> 00:32:01,300 That's it. 565 00:32:01,940 --> 00:32:02,940 That's what it's all about. 566 00:32:03,140 --> 00:32:05,140 Basically, you can transport a full program. 567 00:32:05,320 --> 00:32:08,460 No assembly language programming required in a DLL. 568 00:32:08,700 --> 00:32:09,580 And they'll run it. 569 00:32:11,360 --> 00:32:14,420 Unfortunately, my DLL had some problems with that. 570 00:32:14,500 --> 00:32:15,380 Like, it worked in the. 571 00:32:15,560 --> 00:32:16,400 Oh, okay. 572 00:32:16,480 --> 00:32:17,060 Here we are. 573 00:32:17,980 --> 00:32:18,700 Allow that. 574 00:32:18,880 --> 00:32:22,280 So, just to show you again, like, with the green text. 575 00:32:22,660 --> 00:32:23,400 It's right here. 576 00:32:23,420 --> 00:32:23,660 See? 577 00:32:23,820 --> 00:32:24,500 All systems active. 578 00:32:24,780 --> 00:32:25,580 So, yeah. 579 00:32:26,120 --> 00:32:28,280 Sorry, my computer is being a bit schizophrenic. 580 00:32:28,340 --> 00:32:29,140 But that's okay. 581 00:32:30,700 --> 00:32:37,760 And so, what I was talking about is transporting this driver, this malicious, quasi-malicious driver over to the other person's machine. 582 00:32:38,980 --> 00:32:41,680 So, what we can do is include this as a resource. 583 00:32:41,980 --> 00:32:47,480 Like, in that .RSRC section that you saw before, we can throw files in that and all sorts of fun stuff. 584 00:32:48,540 --> 00:32:51,600 So, we can use the find resource function, load resource. 585 00:32:51,600 --> 00:32:55,780 And basically, write it to the disk to, of course, write it to the disk. 586 00:32:56,060 --> 00:33:00,540 And then use the system control manager to load the driver. 587 00:33:02,780 --> 00:33:09,000 Now, somehow, during this, we're going to have to coerce this program into executing this code. 588 00:33:11,100 --> 00:33:18,860 Fortunately, Windows offers some process, I guess you would call it, interaction functions. 589 00:33:19,800 --> 00:33:24,840 Basically, the interfaces that you use for writing a debugger are the ones you kind of use here. 590 00:33:25,160 --> 00:33:29,740 And come to think of it, what this is really like is, do all of you know what a loader is? 591 00:33:29,860 --> 00:33:38,800 Like, with software piracy, like, if you, if the program is packed and you want it to decrypt itself and then inject the code later, what you can do is write a loader. 592 00:33:38,900 --> 00:33:48,840 And so, basically, it will use write process memory and all this other stuff to basically wait a certain amount of time, inject the code to disable, like, your serial check or what have you. 593 00:33:48,840 --> 00:33:49,920 End of the process. 594 00:33:50,920 --> 00:33:52,560 And then it will be okay. 595 00:33:53,120 --> 00:34:00,260 Some of them are more intelligent than others, but it's not that important here because we're not dealing with any obfuscation or encryption. 596 00:34:02,180 --> 00:34:11,320 But this shutdown code that I just, that I was talking about before, remember, if I told you that pass this a parameter before it shuts the firewall off deal? 597 00:34:12,580 --> 00:34:18,000 Will be, I basically went through the executable and found a whole bunch of slack space to write it into. 598 00:34:18,360 --> 00:34:18,820 Right. 599 00:34:18,840 --> 00:34:19,880 So, it's going to be pretty reliable. 600 00:34:20,060 --> 00:34:24,260 We won't have to make it really position independent in this case. 601 00:34:24,760 --> 00:34:31,540 Like, because jumps and stuff like that to other memory, other memory addresses can be thrown off depending on where you are in memory. 602 00:34:31,780 --> 00:34:34,100 So, I pretty much picked the static one and it's worked. 603 00:34:34,300 --> 00:34:35,760 So, don't question it. 604 00:34:37,740 --> 00:34:43,260 So, now what we're going to do is run this one function called create remote thread. 605 00:34:44,040 --> 00:34:45,500 Basically, it does what it says. 606 00:34:45,660 --> 00:34:46,780 It creates a remote thread. 607 00:34:46,920 --> 00:34:48,820 You basically pass it the starting address. 608 00:34:48,840 --> 00:34:50,700 The address of where you want to start your code. 609 00:34:51,000 --> 00:34:52,080 And then it will run it. 610 00:34:52,280 --> 00:34:53,400 Sounds fun, doesn't it? 611 00:34:53,500 --> 00:34:55,620 I mean, just running code in other applications. 612 00:34:55,920 --> 00:34:56,840 God, it's awesome. 613 00:34:58,000 --> 00:35:06,260 So, we do this after we've changed all the strings and injected the hooks like on draw text and what have you. 614 00:35:07,960 --> 00:35:09,240 So, we're going to have a demo. 615 00:35:09,420 --> 00:35:14,460 And this will hopefully work a lot better than the last one because I've tested it on here. 616 00:35:14,660 --> 00:35:17,360 And by God, you know, it needs to work. 617 00:35:17,360 --> 00:35:19,580 But I have a flash demo in case it doesn't. 618 00:35:19,920 --> 00:35:20,820 Just so you know. 619 00:35:22,640 --> 00:35:31,440 Now, what this MetServ test thing is, is it's a program that the Metasploit people use to test their thing called the Metterpreter. 620 00:35:31,600 --> 00:35:33,200 How many of you know what the Metterpreter is? 621 00:35:34,880 --> 00:35:35,400 Okay. 622 00:35:35,780 --> 00:35:36,980 That's a few people. 623 00:35:37,120 --> 00:35:47,260 But for those of you who don't know, basically the Metasploit people had this idea to throw something like, to put it in layman's terms, a hacker's command prompt into your system. 624 00:35:47,260 --> 00:35:49,920 And it will do this over DLL injection. 625 00:35:50,820 --> 00:35:55,280 And to test their payload, of course, what they would do is write a test program to load it. 626 00:35:55,440 --> 00:35:56,380 So, that's what they did. 627 00:35:56,580 --> 00:35:59,040 And basically, I'm too lazy to edit their code. 628 00:35:59,280 --> 00:36:02,540 So, it will pop up an alert saying that it's binding to a port. 629 00:36:02,660 --> 00:36:03,840 And it's completely unnecessary. 630 00:36:04,840 --> 00:36:09,820 But it was just for the way they have it set up is you want to be able to actually view what's going on. 631 00:36:10,040 --> 00:36:13,340 And with this, it's pretty much a blind shove it in and run. 632 00:36:14,560 --> 00:36:17,240 So, when it's actually, it's going to listen on a certain network. 633 00:36:17,260 --> 00:36:18,840 As you can see, I've already ran this. 634 00:36:18,960 --> 00:36:23,260 So, it's listening on port 31337, you know, because, of course, that's a late thing to do. 635 00:36:24,580 --> 00:36:28,180 And once you connect to that port, however, it will just run the DLL. 636 00:36:28,420 --> 00:36:31,040 So, as you can see, this is just a whole test thing. 637 00:36:31,200 --> 00:36:34,220 It doesn't really affect the performance of the DLL. 638 00:36:34,920 --> 00:36:36,420 So, we're going to run this. 639 00:36:37,500 --> 00:36:37,880 Okay. 640 00:36:38,180 --> 00:36:38,840 Start that running. 641 00:36:38,920 --> 00:36:39,500 It's going to listen. 642 00:36:39,680 --> 00:36:39,960 Yeah. 643 00:36:40,020 --> 00:36:41,380 See, like I told you. 644 00:36:41,680 --> 00:36:42,260 Allow that. 645 00:36:43,940 --> 00:36:44,320 Okay. 646 00:36:44,400 --> 00:36:45,680 Now, I will. 647 00:36:46,100 --> 00:36:51,600 Basically, I'm going to do this as a getaway and pretty much open up a web browser and tell it to go to that port. 648 00:36:53,100 --> 00:36:54,260 So, we'll run that. 649 00:36:55,740 --> 00:36:56,660 And it will come up. 650 00:36:57,060 --> 00:36:58,720 And, oh, you got owned. 651 00:36:58,900 --> 00:37:00,440 You know, going to have a message box there. 652 00:37:00,700 --> 00:37:02,000 So, that will run two times. 653 00:37:03,200 --> 00:37:08,160 And so then, oh, look at that. 654 00:37:08,340 --> 00:37:10,680 Your firewall just got disabled. 655 00:37:10,860 --> 00:37:11,340 And guess what? 656 00:37:11,640 --> 00:37:15,500 It doesn't really say much here about what just happened. 657 00:37:16,160 --> 00:37:17,180 It's kind of fun, isn't it? 658 00:37:18,080 --> 00:37:24,080 And in fact, one fun thing is that if you're waiting for a, like, say you want to ping someone, right? 659 00:37:24,280 --> 00:37:25,440 And you run the ping command. 660 00:37:25,680 --> 00:37:28,280 And then it will say, you know, allow or disallow this traffic. 661 00:37:28,820 --> 00:37:31,720 If you run this, that alert will stay up, but it won't matter. 662 00:37:32,460 --> 00:37:35,500 So, the user is like, oh, I'm going to be, you know, the big man now. 663 00:37:35,560 --> 00:37:36,160 You know, click deny. 664 00:37:37,020 --> 00:37:38,580 Well, it's not really going to do anything. 665 00:37:42,060 --> 00:37:43,900 So, that was the demo there. 666 00:37:43,900 --> 00:37:46,720 So, I didn't include, like, getting a shell on it. 667 00:37:47,120 --> 00:37:52,160 But I'm sure all of the bright minds out here can figure out how that works. 668 00:37:53,440 --> 00:38:02,860 So, I went in after we basically reversed these two firewalls and done some pretty, you know, technical in-depth methods of breaking them, right? 669 00:38:04,300 --> 00:38:08,540 So, I tested some other firewalls, you know, with basically some general tests. 670 00:38:09,200 --> 00:38:12,500 If we could inject code into another process and have it run. 671 00:38:12,500 --> 00:38:14,180 I did this in a very ghetto fashion. 672 00:38:14,400 --> 00:38:17,500 What I basically did is opened up Internet Explorer and OliDBG. 673 00:38:17,740 --> 00:38:21,120 Used a Metasploit payload generation program to generate a payload. 674 00:38:21,340 --> 00:38:24,280 And with some said magic, I could extract it and paste the payload in. 675 00:38:24,920 --> 00:38:27,400 So, it would just, you know, basically run the shell code. 676 00:38:27,580 --> 00:38:28,300 But, yeah. 677 00:38:29,640 --> 00:38:31,280 So, it will test for that. 678 00:38:31,600 --> 00:38:36,320 And also the ability to debug the main firewall process. 679 00:38:36,580 --> 00:38:39,220 Obviously, if you, as you saw in this. 680 00:38:40,580 --> 00:38:42,460 If you can debug the main firewall. 681 00:38:42,500 --> 00:38:43,960 The main firewall process, you pretty much owned it. 682 00:38:45,340 --> 00:38:49,240 So, and also whether syscalls were hooked in an obvious manner. 683 00:38:49,460 --> 00:38:55,080 Basically, because the whole idea is that if they were, then you could use the same driver that I wrote to unhook them. 684 00:38:56,780 --> 00:38:57,880 So, and yeah. 685 00:38:57,960 --> 00:38:59,760 Basically, the ability to load drivers, too. 686 00:38:59,800 --> 00:39:00,480 Because that's important. 687 00:39:00,720 --> 00:39:03,320 You know, you don't want rootkits to be able to be loaded on your system. 688 00:39:05,100 --> 00:39:05,540 Wait. 689 00:39:06,020 --> 00:39:06,840 I forgot to change. 690 00:39:06,940 --> 00:39:07,180 Okay. 691 00:39:07,280 --> 00:39:10,640 So, the first one we're going to talk about is Cario. 692 00:39:11,160 --> 00:39:13,580 Now, the main process can be debugged. 693 00:39:13,600 --> 00:39:20,280 So, it kind of, I haven't done any actual, like, I'm going to turn this off and here's the DLL for it. 694 00:39:20,300 --> 00:39:21,200 Like I did for zone alarm. 695 00:39:21,660 --> 00:39:25,480 But if the main process can be debugged, it's safe to assume that we can turn it off. 696 00:39:25,700 --> 00:39:26,120 Okay. 697 00:39:26,420 --> 00:39:32,120 So, but to its credit, it does detect code injection into trusted processes. 698 00:39:32,800 --> 00:39:35,140 But it didn't seem to detect a driver load either. 699 00:39:35,360 --> 00:39:36,460 So, yeah. 700 00:39:37,540 --> 00:39:37,980 Komodo. 701 00:39:38,800 --> 00:39:40,620 This is another popular firewall. 702 00:39:40,620 --> 00:39:41,040 I've seen. 703 00:39:41,260 --> 00:39:43,820 And the main process cannot be debugged. 704 00:39:43,880 --> 00:39:45,860 It has non-obvious hooking methods. 705 00:39:46,600 --> 00:39:50,520 And it also detected code injection into a trusted process. 706 00:39:51,440 --> 00:39:52,830 But here's the kicker. 707 00:39:53,260 --> 00:39:55,460 It didn't seem to be able to detect a driver load. 708 00:39:57,620 --> 00:40:00,020 So, and the latest zone alarm pro. 709 00:40:00,260 --> 00:40:02,640 And actually, this is the latest version. 710 00:40:02,880 --> 00:40:08,860 And it's learned its ways from my previous DLL. 711 00:40:08,860 --> 00:40:13,460 It does detect code injection into a trusted process. 712 00:40:14,120 --> 00:40:16,540 You cannot debug the main firewall process. 713 00:40:16,840 --> 00:40:18,060 And it does detect driver loads. 714 00:40:18,300 --> 00:40:22,920 And that's one of the few, if only, firewalls I've seen that does that. 715 00:40:23,060 --> 00:40:29,040 So, props to zone alarm for, you know, doing this, implementing this mechanism. 716 00:40:30,380 --> 00:40:34,580 But it does seem to have the same hooking mechanism as before. 717 00:40:35,440 --> 00:40:37,160 So, the idea is. 718 00:40:37,160 --> 00:40:39,960 If you're able to get kernel execution. 719 00:40:40,340 --> 00:40:41,380 Kernel mode code execution. 720 00:40:41,680 --> 00:40:44,760 You can still disable it pretty simply. 721 00:40:47,400 --> 00:40:50,840 So, now, let me go back here just a minute. 722 00:40:51,080 --> 00:40:52,380 What more needs to be done? 723 00:40:54,240 --> 00:40:54,780 Okay. 724 00:40:55,400 --> 00:40:57,680 Oh, I was supposed to talk about that after zone alarm. 725 00:40:57,820 --> 00:40:58,140 I'm sorry. 726 00:40:58,740 --> 00:41:06,060 But the thing with my zone alarm payload or DLL is basically that it really needs more portability to it. 727 00:41:06,060 --> 00:41:11,680 If you run this between different service packs or patch levels, even ill blue screen. 728 00:41:12,560 --> 00:41:22,560 Because it would basically tell, you know, the hook on NT open process to jump into an area of memory that, well, it didn't have the right code at it. 729 00:41:22,600 --> 00:41:23,460 Because it changed. 730 00:41:23,700 --> 00:41:23,880 So. 731 00:41:24,300 --> 00:41:32,100 And it needs to be able to have basically more dynamic resolving of the functions that are used. 732 00:41:32,300 --> 00:41:33,740 Like that set text color. 733 00:41:34,560 --> 00:41:35,620 Because we. 734 00:41:35,620 --> 00:41:40,700 If you run it as is now, you can have basically jump errors. 735 00:41:40,900 --> 00:41:44,780 I didn't do any arithmetic on calculating jump offsets and whatnot. 736 00:41:45,040 --> 00:41:47,060 So, that's going to break your program. 737 00:41:47,980 --> 00:41:52,900 And more intelligent generation of the jump hook that was placed on draw text. 738 00:41:53,240 --> 00:41:55,200 So, we could, you know, make it green and whatnot. 739 00:41:57,060 --> 00:41:57,540 Okay. 740 00:41:57,760 --> 00:41:58,640 So, conclusion. 741 00:42:00,020 --> 00:42:01,220 Things to be learned here. 742 00:42:01,560 --> 00:42:02,760 Firewalls are just applications. 743 00:42:02,980 --> 00:42:05,040 And they're not really the end all of security. 744 00:42:05,620 --> 00:42:07,960 Somehow, some way, you're going to be able to break it. 745 00:42:09,740 --> 00:42:13,100 And subverting them will only increase in importance later. 746 00:42:13,520 --> 00:42:15,460 Because more and more people are going to be running it. 747 00:42:15,520 --> 00:42:17,460 More and more people are going to be dependent on it. 748 00:42:17,620 --> 00:42:20,960 You know, you have Vista that has HIPS like features in it as well. 749 00:42:21,380 --> 00:42:26,020 So, you're going to have some more code that's going to come out for that by various researchers. 750 00:42:28,000 --> 00:42:30,080 And so, pretty much this is the end of the speech. 751 00:42:30,200 --> 00:42:35,440 But thanks to HD Moore who helped me write the Windows firewall disabling payload. 752 00:42:35,440 --> 00:42:37,280 Poncho, of course. 753 00:42:37,640 --> 00:42:40,540 Helped me with the Noxus Files website and optics. 754 00:42:40,680 --> 00:42:41,400 I know you're not here. 755 00:42:41,560 --> 00:42:42,760 But thanks anyway. 756 00:42:43,020 --> 00:42:45,420 You've had some great insight to stuff. 757 00:42:46,120 --> 00:42:51,600 So, if you want, the code should be up at noxusfiles.com later in the day. 758 00:42:51,620 --> 00:42:52,600 Like about an hour or two. 759 00:42:53,280 --> 00:42:54,680 So, get the code. 760 00:42:54,840 --> 00:42:55,800 You know, play around with it. 761 00:42:55,860 --> 00:42:56,520 Test it out. 762 00:42:56,600 --> 00:42:57,480 Everything like that. 763 00:42:58,300 --> 00:42:59,600 So, that's the end. 764 00:42:59,680 --> 00:43:00,200 Any questions? 765 00:43:13,420 --> 00:43:15,180 Yeah, and use the mic, please. 766 00:43:15,520 --> 00:43:16,500 I have a question. 767 00:43:16,700 --> 00:43:17,260 Yes, Ducky. 768 00:43:17,260 --> 00:43:19,120 I saw how you were, I'm sorry. 769 00:43:19,300 --> 00:43:20,140 I'm not that person. 770 00:43:22,780 --> 00:43:28,040 With disabling all the alerts and stuff, what about the actual disabling the Windows alerts, 771 00:43:28,200 --> 00:43:29,300 the balloon pop-ups? 772 00:43:29,500 --> 00:43:29,560 Yes. 773 00:43:29,720 --> 00:43:32,360 That is done via the WMI interface. 774 00:43:32,760 --> 00:43:35,420 And I imagine that if I took a look in my browser, 775 00:43:35,420 --> 00:43:38,060 and saw actually what that did, I would be able to kill it. 776 00:43:38,140 --> 00:43:40,640 Because I know there have to be API calls for doing this. 777 00:43:41,220 --> 00:43:43,740 Yeah, for anyone who knows about that type of thing, 778 00:43:44,200 --> 00:43:46,180 you know, feel free to download the code, implement that, 779 00:43:46,280 --> 00:43:47,860 and then, you know, contribute to it. 780 00:43:48,460 --> 00:43:50,740 So, that's my charge for you guys. 781 00:43:51,060 --> 00:43:51,400 Thank you. 782 00:43:51,520 --> 00:43:51,880 Yes. 783 00:43:53,080 --> 00:43:55,760 The Symantec firewall, did you experiment with that? 784 00:43:56,000 --> 00:43:56,580 No, I did not. 785 00:43:56,840 --> 00:44:00,560 I basically took those three firewalls. 786 00:44:00,560 --> 00:44:02,840 I kind of added that in at the last minute. 787 00:44:02,980 --> 00:44:05,100 So, I didn't have the chance 788 00:44:05,420 --> 00:44:08,580 to get actual, you know, firewalls that costed stuff. 789 00:44:08,940 --> 00:44:09,840 So, yeah. 790 00:44:09,980 --> 00:44:12,700 Because, of course, no one wants to pirate here, right? 791 00:44:12,880 --> 00:44:13,760 Just saying. 792 00:44:14,760 --> 00:44:15,220 Yeah. 793 00:44:15,720 --> 00:44:16,460 Next question. 794 00:44:16,680 --> 00:44:19,000 I'm curious on the, on your experience 795 00:44:19,000 --> 00:44:22,100 and what you found for disabling the firewall and getting at people, 796 00:44:22,280 --> 00:44:24,580 since they're probably behind NAT versus just doing reverse shell. 797 00:44:26,440 --> 00:44:29,980 Well, there are, what was the question again? 798 00:44:30,140 --> 00:44:31,180 Behind a NAT? 799 00:44:31,820 --> 00:44:34,240 I mean, if you were doing a reverse shell 800 00:44:34,240 --> 00:44:35,320 or a reverse meterpreter, 801 00:44:35,380 --> 00:44:37,200 pretty much that would subvert the NAT now, wouldn't it? 802 00:44:37,400 --> 00:44:37,540 Yeah. 803 00:44:37,820 --> 00:44:38,020 Yeah. 804 00:44:38,120 --> 00:44:40,280 So, but the reason, if you're, 805 00:44:40,300 --> 00:44:43,100 are you wondering about the bind that I did with the XP firewall? 806 00:44:43,400 --> 00:44:43,540 Yes. 807 00:44:43,960 --> 00:44:45,480 That was basically to show, 808 00:44:45,600 --> 00:44:47,400 because the Windows XP firewall, 809 00:44:48,100 --> 00:44:49,740 it pretty much blocks the bind. 810 00:44:49,940 --> 00:44:52,420 That's what it's most concerned with more than anything else. 811 00:44:52,660 --> 00:44:55,820 And so, by having you be able to get a bind shell, 812 00:44:55,880 --> 00:44:58,620 that shows for certain that it was disabled. 813 00:44:58,800 --> 00:45:00,820 So, that was basically a proof of concept right there. 814 00:45:01,000 --> 00:45:01,340 Okay. 815 00:45:01,360 --> 00:45:01,840 Thank you. 816 00:45:04,460 --> 00:45:07,220 I was just curious to see if this presentation was on the DEF CON CD? 817 00:45:07,440 --> 00:45:07,880 Yes, it is. 818 00:45:08,100 --> 00:45:08,300 Awesome. 819 00:45:08,460 --> 00:45:12,520 The last slides, I think about the other personal firewalls on there 820 00:45:12,520 --> 00:45:15,840 that I kind of smoke tested a little bit are not, 821 00:45:15,980 --> 00:45:19,480 but I mean, that's not the most important thing in the world, 822 00:45:19,520 --> 00:45:21,500 but you'll be able to download them from noxusfiles.com. 823 00:45:21,740 --> 00:45:22,120 Sweet. 824 00:45:22,320 --> 00:45:22,600 You rock. 825 00:45:22,980 --> 00:45:23,520 Thank you. 826 00:45:24,880 --> 00:45:25,700 Any other questions? 827 00:45:28,300 --> 00:45:28,700 No. 828 00:45:28,780 --> 00:45:30,740 I am currently not wearing pants. 829 00:45:31,180 --> 00:45:31,580 Yeah. 830 00:45:32,400 --> 00:45:32,800 Yeah. 831 00:45:32,800 --> 00:45:36,100 So, all right. 832 00:45:36,200 --> 00:45:38,280 I hope you've had a great DEF CON 833 00:45:38,280 --> 00:45:40,020 and will continue having a great DEF CON. 834 00:45:40,140 --> 00:45:40,740 Thanks for coming.