1 00:00:00,000 --> 00:00:05,940 This is hacking.net applications, the black arts. I'm going to be attacking .net applications 2 00:00:05,940 --> 00:00:12,540 developed by Microsoft protected with third-party applications. These are applications that 3 00:00:12,540 --> 00:00:18,320 people don't want you to have their source code. They don't want you to do malicious things. 4 00:00:19,020 --> 00:00:24,560 This is why we're all here, to fuck them up, right? Good. Then you're in the right talk 5 00:00:24,560 --> 00:00:30,400 because that's all this is going to be. Unfortunately, I have developed some good things, 6 00:00:30,540 --> 00:00:34,380 but that's not what goes into a hacker con. Everything I'm going to be showing you is 7 00:00:34,380 --> 00:00:47,040 specifically malicious. I'm digitalbodyguard.com, and let's fuck some shit up. There you go. 8 00:00:50,920 --> 00:00:54,540 So, no matter whether you're just a hacker or you're an attacker, you're not going to be 9 00:00:54,540 --> 00:00:58,820 attacked. These are some of the nice tools that you're going to want. You don't have to be 10 00:00:59,640 --> 00:01:06,500 highly skilled and have all sorts of IDA and machine code. This speech is targeted towards the 11 00:01:06,500 --> 00:01:11,260 average developer that wants to mess applications up. They want to look inside of it and do 12 00:01:11,260 --> 00:01:18,060 critically bad things to other people's applications. I'm going to talk about how to attack 13 00:01:18,060 --> 00:01:23,620 .net applications. Tools and methodologies for attacking. Overcoming secure .net applications. 14 00:01:23,840 --> 00:01:24,360 .net applications. Overcoming secure .net applications. Overcoming secure .net applications. Building 15 00:01:24,540 --> 00:01:29,840 keys, cracks, malware, and reverse engineering for protection. Whether you're a company or a 16 00:01:29,840 --> 00:01:40,020 hacker, this applies to you. And I'm going to fuck some shit up. Okay. Cracking and attacking. 17 00:01:40,380 --> 00:01:48,920 I'm going at it in memory and on disk. Attacking on disk, you gain access. You decompile. You 18 00:01:48,920 --> 00:01:54,520 infect the logic, drop some shims in there to get you in. You hook the logic and test. You 19 00:01:54,520 --> 00:02:00,800 get to your life cycle. Attack in memory. Inject into the target application. Navigate the 20 00:02:00,800 --> 00:02:06,900 structure, edit and control the structure. Whether you're attacking in memory or on disk, the 21 00:02:06,900 --> 00:02:13,680 same conceptual paradigm applies. Do your reconnaissance. Understand what technology it's 22 00:02:13,680 --> 00:02:21,020 using, what you think that their mechanisms for hardening the application would be. And do a 23 00:02:21,020 --> 00:02:24,500 little bit of reconnaissance into the company. Find out what other products they use. Find the 24 00:02:24,500 --> 00:02:30,120 use and what other products they sell. Maybe they have a product that they don't particularly 25 00:02:30,120 --> 00:02:35,000 harden, go look at that and they probably use the source code over again. Reconnaissance 26 00:02:35,000 --> 00:02:43,020 is nice. Gain access to your target. Whether that's getting access to the executables or 27 00:02:43,020 --> 00:02:48,940 getting past any of their security methods, you want to gain access. You want to find 28 00:02:48,940 --> 00:02:55,700 the weak spots. The spots that let you get in and affect it and the security is weak or the 29 00:02:55,700 --> 00:02:59,860 checking is weak, but you want to get in where it's easy. You don't want to blow a bunch of 30 00:02:59,860 --> 00:03:05,300 time, right? And you want to control what you need. You don't want to drop a lot of stuff in 31 00:03:05,300 --> 00:03:09,020 there that's going to bloat it. You're in someone else's application. Be clean and efficient. 32 00:03:11,260 --> 00:03:17,700 So attacking in memory at run time. This is Grey Dragon, a tool that I'm dropping. Free, of 33 00:03:17,700 --> 00:03:18,920 course. Just another one. 34 00:03:18,920 --> 00:03:23,820 So this is another injector that gets you in there, developed mainly out of .NET, but it's targeted 35 00:03:23,820 --> 00:03:28,860 specifically against .NET. This is going to take care of a lot of the threading issues and get you 36 00:03:28,860 --> 00:03:33,800 into .NET, which a lot of the other injectors aren't targeted at .NET, this specifically is. 37 00:03:34,960 --> 00:03:43,500 You inject into a process. It spins up a C++ bootstrap DLL that spins up a .NET bootstrap DLL. 38 00:03:44,040 --> 00:03:48,800 This takes care of the threading and all of the issues that you would find if you injected 39 00:03:48,800 --> 00:03:54,220 into someone else's application and started doing shit. This helps it be more stable with less 40 00:03:54,220 --> 00:03:59,360 work on your part. And then it puts you in the application. That's where you drop in your 41 00:03:59,360 --> 00:04:07,640 payload. I also developed a few other mechanisms real quick. I'll cover that. I did a USB 42 00:04:07,640 --> 00:04:13,060 keyboard that types in. It goes into PowerShell, does a whole bunch of keystrokes, and then it 43 00:04:13,060 --> 00:04:18,780 drops Grey Dragon into your target and into the process. Straight from keyboard. So I'm going to 44 00:04:18,780 --> 00:04:22,860 touch and you're not going to have a lot of forensics footprint. It's really nice because you're 45 00:04:22,860 --> 00:04:27,020 going into memory, straight from keyboard, you're not touching disk and it's going to be real clean. 46 00:04:28,480 --> 00:04:37,240 Also, I did a Metasploit payload last year. Same exact idea. Metasploit gets you in. I'm a little 47 00:04:37,240 --> 00:04:48,420 bit demo heavy, so I hope you enjoy demos. This is Grey Dragon and Grey Wolf. Grey Wolf is a 48 00:04:48,780 --> 00:04:54,060 nice decompiler. You can drag any executable and it will get you your basic things, right? 49 00:04:55,780 --> 00:05:05,200 This is a program that destroys files on your hard drive. I'm going to cover injection first, 50 00:05:05,440 --> 00:05:11,260 but this is something that's going to be very important later on. Gray dragon gets you inside 51 00:05:11,260 --> 00:05:27,280 of your target. This is the oh. The target is running its admin. So instead of being able to 52 00:05:27,280 --> 00:05:31,960 inject from user land, I have to elevate it to admin in order to inject into my target, of course. 53 00:05:33,860 --> 00:05:38,300 So I'm not really doing exploitation. I'm more taking advantage that once you own the box, 54 00:05:38,440 --> 00:05:40,800 you can mess up any application however you see fit. 55 00:05:41,260 --> 00:05:47,220 Then use it on that box or use it on other people's boxes for practical reasons. 56 00:05:47,720 --> 00:05:53,060 Okay. So I drop into my target and here is the .NET payload that I talked about earlier. 57 00:05:53,420 --> 00:06:00,200 This takes any .NET executable and just runs void main on it. So this is an executable that has a void main. 58 00:06:01,040 --> 00:06:09,740 I will select the payload. And we have a payload inside of our target. This is old talks if you've been 59 00:06:09,740 --> 00:06:11,100 to my speeches before. 60 00:06:12,480 --> 00:06:18,900 This is going to be very, very nice later on. I can come down to this unlock button and I have 61 00:06:19,400 --> 00:06:24,520 went in, I have edited the events that this button fires. When you right click on it, it fires 62 00:06:24,520 --> 00:06:30,160 something new. It says what functions do you fire and here's the functions that that button fires. 63 00:06:30,460 --> 00:06:35,720 This is heavily obfuscated. So this would take you hours to dig through to get to this class and this 64 00:06:35,720 --> 00:06:40,680 function. This is what that button fires. And that's the unlock button. So you know that unlock 65 00:06:41,100 --> 00:06:44,980 button is pretty close to the registration check, right? So when you want to crack the registration 66 00:06:44,980 --> 00:06:50,040 check, instead of digging for hours through obfuscation, this gets you straight to it and it'll cut your time 67 00:06:50,040 --> 00:06:54,000 way down. So that'll be very important much later. 68 00:06:58,900 --> 00:07:11,040 And okay. So I really like diagrams and pretty things. I think it makes shit easier. When you are on disk and you run an executable, it spins up a bunch of 69 00:07:11,100 --> 00:07:19,300 valid DLLs. They all go through the security systems of Microsoft and .NET. This all becomes a process. All the security 70 00:07:19,300 --> 00:07:27,700 systems have already completed. You inject in and it drops in your attack. This is where you get your hacks, cracks, malware, and back doors. 71 00:07:29,360 --> 00:07:37,300 This is really nice, because I'm going to talk about security systems later and they've all finished. At this point you are injecting 72 00:07:37,300 --> 00:07:41,080 after – I've seen two security systems used by Microsoft and a lot of other software companies have used this. The ones that 73 00:07:41,080 --> 00:07:45,940 two companies that can do anything against this. Every security system I'm 74 00:07:45,940 --> 00:07:49,920 going to talk about for the rest of this you can basically add and injecting in 75 00:07:49,920 --> 00:07:56,760 memory gets right past it. So I kind of went app happy and I developed a whole 76 00:07:56,760 --> 00:08:02,240 bunch of payloads and supporting applications and just put out a lot of 77 00:08:02,240 --> 00:08:07,620 research and a lot of applications to support you in this endeavor and wanting 78 00:08:07,620 --> 00:08:12,360 to see how I did what I did. So attacking applications, you gain full access, you 79 00:08:12,360 --> 00:08:16,340 reverse engineer as much as possible, you attack it in memory and take out 80 00:08:16,340 --> 00:08:22,300 whatever security might be there and then you control the program. Injection. 81 00:08:23,060 --> 00:08:30,560 Why should I use it? How does it impact me? Fuck, don't be a prick. Just accept it 82 00:08:30,560 --> 00:08:36,160 and it works. It's gonna get you in. It's gonna wrap all of your threading. It's 83 00:08:36,160 --> 00:08:37,600 gonna inject you in. 84 00:08:37,600 --> 00:08:43,060 project, and it's all free. These are all tools that I'm encouraging you to use. I'm 85 00:08:43,060 --> 00:08:47,000 not going to be charging, I'm not going to be selling these applications to a company 86 00:08:47,000 --> 00:08:50,440 that they can tell you you can't use it. I'm developing this for hackers. 87 00:08:52,280 --> 00:08:57,680 So here's two applications. I'm going to show injecting into them, and then I'm going to 88 00:08:57,680 --> 00:09:03,180 show injecting the same payload into both applications. And this is interesting, because 89 00:09:03,180 --> 00:09:07,260 .NET gives you a lot of power for a little bit of code. And I'm going to show you how 90 00:09:07,260 --> 00:09:10,320 that power can affect applications in a slightly new way. 91 00:09:14,340 --> 00:09:19,240 Okay. This application is basically a low end back up piece of software. It takes a 92 00:09:19,240 --> 00:09:22,340 password and if you don't put in the right password, it's not going to give you access. 93 00:09:24,280 --> 00:09:30,080 This applies to major back up software, but I thought I would not punch any company specifically 94 00:09:30,540 --> 00:09:34,400 and I would just go after some small time companies. I mean, they're good software, 95 00:09:34,560 --> 00:09:37,040 but they're not a Norton ghost. 96 00:09:40,220 --> 00:09:47,760 So here's our payload inside of our target. We drop it in, load it, and here it is. This 97 00:09:47,760 --> 00:09:53,220 payload iterates through the application, finds the hash code of the password, and populates 98 00:09:53,220 --> 00:10:00,360 it. And this crack starts brute forcing that password using the logic of our target. I've 99 00:10:00,360 --> 00:10:04,820 reached inside the application, got the hash of the password, and started a brute forcer. 100 00:10:07,040 --> 00:10:10,700 Here's another piece of software that's similar to the first. Slightly different, of course. 101 00:10:11,140 --> 00:10:17,020 We'll inject into it again. Grey dragon searches because I still have a little more work to 102 00:10:17,020 --> 00:10:22,520 do so it brute forces. It finds it. It's 64 bit. It's going to drop in a 64 bit payload. 103 00:10:23,360 --> 00:10:27,620 And there we are. We're inside of the next application. Take the same payload, drop 104 00:10:27,620 --> 00:10:32,640 it in. So we have essentially the same payload. Of course, it's a different hash. I'll start 105 00:10:32,640 --> 00:10:36,720 cracking it. I had the same exact payload cracking 106 00:10:36,720 --> 00:10:41,800 both of them. It's not hard to write it for other applications. You can even write an 107 00:10:41,800 --> 00:10:49,400 adaptive one. So these two applications. This one was processing at 10,000 checks per second. 108 00:10:49,760 --> 00:10:55,380 This one is much slower. It finds the password. This is your plain text that it's testing. 109 00:10:55,740 --> 00:11:00,220 It then takes this and drops it into your target application because I thought that 110 00:11:00,220 --> 00:11:06,040 would just be pretty. It auto types it in. There it is. It's cracked. I've gotten the 111 00:11:06,040 --> 00:11:06,700 password. I've got the password. I've got the password. I've got the password. I've got the 112 00:11:06,700 --> 00:11:12,140 password. I know what it is and I have access. This one's still crunching away because this 113 00:11:12,140 --> 00:11:19,180 one has a much more processor intensive check mechanism. And the same thing. It finds the 114 00:11:19,180 --> 00:11:25,660 password and types it into our target. And again, gets us in. I have access to the encrypted 115 00:11:25,660 --> 00:11:31,580 material. A brute forcer that can be adapted quickly and easily by an average level programmer. 116 00:11:31,980 --> 00:11:34,560 That's the target. And that's the power. 117 00:11:41,280 --> 00:11:41,840 . 118 00:11:42,920 --> 00:11:49,460 A little bit of cleanup from the demo. All right. A lot of this injection I covered last year. 119 00:11:50,760 --> 00:11:55,820 Injecting at runtime has a lot more power than attacking on disk, but it's much easier. You don't 120 00:11:55,820 --> 00:12:01,280 have to worry about security methods. You can catch my talks. Hacking.net applications a 121 00:12:01,280 --> 00:12:06,680 runtime attack. From DEF CON I presented to Arsenal at Black Hat last year. And I got a lot of 122 00:12:06,700 --> 00:12:13,340 I have them up on my website and this will walk you in depth through attacking in memory. 123 00:12:13,540 --> 00:12:17,740 Pretty much the same talk now but an entire length on just attacking in memory. 124 00:12:19,160 --> 00:12:21,500 So attacking in memory and on disk. 125 00:12:21,760 --> 00:12:23,400 This is the other distinct half. 126 00:12:24,160 --> 00:12:30,620 Attacking on disk doesn't quite have as much power as attacking in memory but it is much 127 00:12:30,620 --> 00:12:35,140 more permanent and effective but requires a little more skill and finesse. 128 00:12:36,400 --> 00:12:42,380 Gray wolf is a decompiler I wrote specifically for attacking .NET applications. 129 00:12:42,880 --> 00:12:47,200 Not a decompiler that gets you access to the source code but a decompiler for attacking. 130 00:12:47,680 --> 00:12:52,200 These are including the mechanisms that I normally use over and over and over again. 131 00:12:52,730 --> 00:12:54,100 This is by no means complete. 132 00:12:54,380 --> 00:13:00,100 It was an internal tool that the best decompiler that was on the market was free, a company 133 00:13:00,100 --> 00:13:00,520 bought it. 134 00:13:00,520 --> 00:13:01,580 Said they would keep it free forever. 135 00:13:01,780 --> 00:13:03,580 They then started charging at phones home. 136 00:13:03,700 --> 00:13:04,800 You need to give them your credit card. 137 00:13:05,060 --> 00:13:07,360 And I no longer pimp their products. 138 00:13:07,520 --> 00:13:09,260 So I released my internal tool. 139 00:13:10,380 --> 00:13:11,400 And it's free. 140 00:13:12,920 --> 00:13:18,620 It gets you access into other people's applications and brings along a lot of the things you're 141 00:13:18,620 --> 00:13:20,340 going to need to attack on a daily basis. 142 00:13:23,840 --> 00:13:28,340 Gray wolf iterates applications of the .NET ilk specifically. 143 00:13:28,340 --> 00:13:31,740 And that's its sole purpose. 144 00:13:32,440 --> 00:13:34,800 You drag and drop an executable or a DLL. 145 00:13:35,940 --> 00:13:37,580 This is decompiling. 146 00:13:37,700 --> 00:13:39,480 .NET gives you source code. 147 00:13:40,100 --> 00:13:44,500 It is an intermediate language as long as it's unprotected, you're perfectly fine. 148 00:13:44,640 --> 00:13:49,340 You're going to see proper classes, name spaces, you're going to click on a function and see 149 00:13:49,340 --> 00:13:50,020 source code. 150 00:13:50,280 --> 00:13:52,700 Pretty much what the original developer wrote. 151 00:13:53,680 --> 00:13:56,880 This is very, very effective for making cracks. 152 00:13:56,880 --> 00:14:00,400 When you're trying to black box test something and you have the source code. 153 00:14:00,620 --> 00:14:03,280 As well as the ability to quickly manipulate it. 154 00:14:03,460 --> 00:14:05,800 That's what this is specifically for. 155 00:14:08,420 --> 00:14:13,980 And we'll do stuff like if it's an obfuscated or unobfuscated application, you might want 156 00:14:13,980 --> 00:14:14,520 to find main. 157 00:14:14,720 --> 00:14:16,060 So I wrote a find main button. 158 00:14:16,600 --> 00:14:18,140 It simply moves you down. 159 00:14:18,300 --> 00:14:19,040 And this is main. 160 00:14:19,400 --> 00:14:22,300 People can change the name of main and it can be hard to find. 161 00:14:23,460 --> 00:14:24,580 And here's their main. 162 00:14:24,700 --> 00:14:26,440 And then you can start seeing if they put any protection. 163 00:14:26,440 --> 00:14:35,020 And you can do stuff like change whether something is public or private and all that. 164 00:14:35,400 --> 00:14:39,200 I haven't completed everything you need like changing public and private for the classes 165 00:14:39,200 --> 00:14:42,480 but it's on the functions because I had a project where I needed to change the public 166 00:14:42,480 --> 00:14:43,380 and private on a function. 167 00:14:43,940 --> 00:14:50,740 So as I either receive people that want to support it with monetary funds or I need it, 168 00:14:50,820 --> 00:14:51,420 I add features. 169 00:14:51,700 --> 00:14:53,060 And then you get free features. 170 00:14:54,500 --> 00:14:55,440 That's Grey Wolf. 171 00:14:57,920 --> 00:14:59,380 So attacking on disk. 172 00:15:00,040 --> 00:15:02,260 You connect in and you access. 173 00:15:02,680 --> 00:15:06,160 You decompile it and get the code and base technology of your target. 174 00:15:06,800 --> 00:15:10,960 You infect it and change your target's code to accomplish whatever goal you might want. 175 00:15:11,440 --> 00:15:16,940 You exploit whatever logical vulnerabilities or technological vulnerabilities that might 176 00:15:16,940 --> 00:15:17,260 be there. 177 00:15:17,420 --> 00:15:19,600 And then remold your application and deploy. 178 00:15:20,660 --> 00:15:25,440 That is pretty much as simply as I stated it. 179 00:15:25,440 --> 00:15:29,120 That's about as simply as it's done that you'll see later on. 180 00:15:30,520 --> 00:15:33,280 The weak spots that you're going to go after in an application. 181 00:15:34,000 --> 00:15:35,320 You want to flip a check. 182 00:15:35,500 --> 00:15:36,760 You want to set a value to true. 183 00:15:36,880 --> 00:15:37,820 You want to cut the logic. 184 00:15:37,920 --> 00:15:38,700 You want to turn true. 185 00:15:38,820 --> 00:15:39,940 You want to access a value. 186 00:15:41,600 --> 00:15:42,860 Set a value to true. 187 00:15:43,180 --> 00:15:44,260 Registered equals false. 188 00:15:44,580 --> 00:15:47,880 Grey Wolf registers equals true. 189 00:15:48,580 --> 00:15:51,540 A check A equals B. Password validation. 190 00:15:51,940 --> 00:15:55,180 A equals B becomes A not equals B. Only invalid. 191 00:15:55,440 --> 00:15:56,380 Passwords will succeed. 192 00:15:59,900 --> 00:16:01,960 You can see how you might want to do that one. 193 00:16:02,220 --> 00:16:03,500 And it's about six clicks. 194 00:16:05,320 --> 00:16:08,680 Registered equals true on this function. 195 00:16:08,980 --> 00:16:14,360 You simply insert or return true at the top, negating any logic that might be in that function. 196 00:16:15,080 --> 00:16:19,000 Is valid key returns true regardless of what you pass in. 197 00:16:19,620 --> 00:16:22,480 SQL cleaning, cutting the logic, very scary. 198 00:16:23,660 --> 00:16:25,080 Imagine how many applications. 199 00:16:25,080 --> 00:16:28,080 Have only one function because that's what good developers do, right? 200 00:16:28,440 --> 00:16:30,400 And it just returns the original string. 201 00:16:30,520 --> 00:16:32,560 It's been cleaned and sends it up to the server. 202 00:16:33,180 --> 00:16:36,500 Who would not actually take advantage of that? 203 00:16:37,460 --> 00:16:42,860 Valid password accessing a value is much stronger than you might think. 204 00:16:43,880 --> 00:16:49,480 When you have access to the internal variables of your target, you can do awful things like 205 00:16:49,480 --> 00:16:53,700 show the value you're comparing against instead of just subverting that check, you show it. 206 00:16:54,400 --> 00:16:57,780 Or put it in the clipboard, save it out to disk, whatever you want. 207 00:16:57,880 --> 00:17:00,340 You can just iterate the whole program and show every variable. 208 00:17:01,200 --> 00:17:04,080 This is much stronger than I had anticipated. 209 00:17:06,300 --> 00:17:07,140 Registration checks. 210 00:17:07,540 --> 00:17:09,000 We want to make keygens, right? 211 00:17:09,740 --> 00:17:10,560 That's a question. 212 00:17:11,060 --> 00:17:11,900 Clap, clap, clap. 213 00:17:12,780 --> 00:17:13,500 There you go. 214 00:17:14,640 --> 00:17:15,080 Okay. 215 00:17:15,400 --> 00:17:16,740 So keygens and cracks. 216 00:17:18,600 --> 00:17:22,660 This is, from my experience, the top mechanisms that they use. 217 00:17:23,700 --> 00:17:28,820 They'll make a public and private key, they'll sign a XML and they'll push it down to your 218 00:17:28,820 --> 00:17:29,180 machine. 219 00:17:29,340 --> 00:17:32,380 Inside the application, it'll decrypt it and execute it. 220 00:17:33,400 --> 00:17:35,260 This is subverted by changing the key. 221 00:17:35,400 --> 00:17:38,680 You simply change the public key and it's yours. 222 00:17:39,600 --> 00:17:45,300 This is all of these things are from six clicks to five or ten minutes. 223 00:17:45,440 --> 00:17:47,340 They're pretty easy on unprotected applications. 224 00:17:48,260 --> 00:17:51,420 The next one is a little weird, but I see it so often. 225 00:17:51,420 --> 00:17:56,880 You take your name and the registration code, you do a little bit of math and you compare 226 00:17:56,880 --> 00:17:57,740 it to a known value. 227 00:17:58,480 --> 00:18:01,700 You ask it what the known value is and that's your keygen. 228 00:18:02,040 --> 00:18:02,580 That's it. 229 00:18:03,580 --> 00:18:05,240 Calling the server, you hack the call. 230 00:18:05,520 --> 00:18:06,420 You just mess it up. 231 00:18:06,440 --> 00:18:13,620 Whatever they're calling, whether it's a UDP packet or TCP connection, you just mess it 232 00:18:13,620 --> 00:18:13,780 up. 233 00:18:15,000 --> 00:18:16,020 Demo equals true. 234 00:18:17,100 --> 00:18:18,560 It could be false and it might. 235 00:18:20,400 --> 00:18:21,260 Complex math. 236 00:18:21,320 --> 00:18:21,400 Okay. 237 00:18:21,420 --> 00:18:25,900 Math, this is my favorite because it's like a Rubik's cube that someone meant you never 238 00:18:25,900 --> 00:18:26,480 to solve. 239 00:18:26,820 --> 00:18:30,820 You sit there and you chop it up and you break it with complex math. 240 00:18:31,100 --> 00:18:32,060 It's always fun. 241 00:18:33,040 --> 00:18:37,900 And 1% of the time, they'll actually ship the key generation with the product. 242 00:18:39,180 --> 00:18:42,900 I'm sure it made sense to someone to put the key generation inside of the application 243 00:18:42,900 --> 00:18:44,280 and ship that to you. 244 00:18:44,360 --> 00:18:48,620 You simply go there, you fire it up, you put in what you want and you get the key generation 245 00:18:48,620 --> 00:18:50,080 and you don't even have to write anything. 246 00:18:50,080 --> 00:18:55,040 And it's a little more than ‑‑ it's 1% of the time, plus or minus. 247 00:18:56,200 --> 00:18:57,580 So public private keys. 248 00:18:57,880 --> 00:19:00,040 Like I said, if you can beat them, why join them? 249 00:19:00,220 --> 00:19:04,280 You have some complex math that you would have to do to break it or you just set it 250 00:19:04,280 --> 00:19:06,080 to an easy key that you have. 251 00:19:06,300 --> 00:19:10,520 And then you ship the product and you can turn out as many keygens as you want because 252 00:19:10,520 --> 00:19:11,460 you own the key. 253 00:19:12,600 --> 00:19:13,220 Server call. 254 00:19:14,060 --> 00:19:15,460 It points to whatever you want. 255 00:19:15,860 --> 00:19:18,820 The system ID you put in some easy value to manage. 256 00:19:18,820 --> 00:19:22,820 You simply give them whatever would solve it and that's it. 257 00:19:25,140 --> 00:19:26,760 Registration code replay attack. 258 00:19:27,080 --> 00:19:28,280 This is just fun. 259 00:19:29,200 --> 00:19:32,200 You have a name that you pass into a function. 260 00:19:32,940 --> 00:19:36,520 It returns whatever that function would do to that name. 261 00:19:36,760 --> 00:19:39,860 It then compares this to your registration code. 262 00:19:40,040 --> 00:19:43,960 If these two match, if they don't, you're not registered. 263 00:19:44,620 --> 00:19:46,100 Like I said, replay attack. 264 00:19:46,360 --> 00:19:47,620 You take the value. 265 00:19:47,620 --> 00:19:49,660 And then you play the game again. 266 00:19:50,720 --> 00:19:56,360 Of course, some people add more things where it seeds with registration code or something 267 00:19:56,360 --> 00:19:57,100 complex math. 268 00:19:57,560 --> 00:19:59,300 And it, of course, works. 269 00:20:00,900 --> 00:20:02,860 Complex math, my favorite. 270 00:20:03,000 --> 00:20:07,620 You chop up the math into its individual sections and then you attack each one of them individually. 271 00:20:08,000 --> 00:20:11,160 I like to start from the weak ones, start going to the strong. 272 00:20:11,580 --> 00:20:17,340 And for dev purposes, I recommend that you put a brute forcer on each section that you 273 00:20:17,340 --> 00:20:18,000 haven't completed. 274 00:20:18,280 --> 00:20:22,560 And so as you beat the weakest one, the rest of them are brute forced and you can validate 275 00:20:23,040 --> 00:20:27,340 as you go through until you've removed all of the brute forcing and you have a pure key 276 00:20:27,340 --> 00:20:27,560 gen. 277 00:20:30,260 --> 00:20:31,780 We would like to see that, right? 278 00:20:39,340 --> 00:20:45,160 Well, as some company might be mad if I showed how they did their registration check, here 279 00:20:45,160 --> 00:20:46,780 is a white boxed application. 280 00:20:48,160 --> 00:20:49,240 Drag and drop it. 281 00:20:49,320 --> 00:20:50,660 You get access to the source code. 282 00:20:51,460 --> 00:20:55,220 And at home, at your leisure, you can look and see how this is done. 283 00:20:55,920 --> 00:20:58,760 So it takes your user name and your key and doesn't work. 284 00:21:00,720 --> 00:21:03,520 Of course, there's a key gen and it works, all of that. 285 00:21:04,100 --> 00:21:08,320 So you pop open the application that you want to key gen. 286 00:21:08,500 --> 00:21:13,120 You target into what that button does that I showed you earlier, which happens to be 287 00:21:14,280 --> 00:21:15,080 key check. 288 00:21:15,080 --> 00:21:17,960 Key check, because a lot of people use good naming, right? 289 00:21:19,820 --> 00:21:25,380 So a lot of them will put something like this is version 12 of our enterprise application 290 00:21:25,860 --> 00:21:27,860 and they'll tag that at the front of the key. 291 00:21:29,240 --> 00:21:31,460 They'll then do a whole bunch of string manipulation. 292 00:21:31,920 --> 00:21:36,580 I'm just walking you through because I would have liked to know what a common key validation 293 00:21:36,580 --> 00:21:37,720 sequence looks like. 294 00:21:37,800 --> 00:21:38,680 So I figure you would, right? 295 00:21:39,780 --> 00:21:42,620 When it gets to the complex math, okay. 296 00:21:43,800 --> 00:21:44,920 One half is IL. 297 00:21:45,080 --> 00:21:45,940 The other is source code. 298 00:21:47,900 --> 00:21:52,760 So it gets to complex math and it starts doing bizarre stuff like taking powers and then 299 00:21:52,760 --> 00:21:53,280 modding it. 300 00:21:53,400 --> 00:21:54,220 This is pretty common. 301 00:21:54,420 --> 00:21:56,480 This is a lot of the complex math that you're going to see. 302 00:21:58,720 --> 00:22:02,260 And oddly enough, a lot of the complex math is kind of similar. 303 00:22:02,660 --> 00:22:07,300 That they will go out and see how someone else did it or they will look at an old and 304 00:22:07,300 --> 00:22:09,160 they will reuse that same paradigm. 305 00:22:09,600 --> 00:22:15,060 So you could look at how I did the key generator and see how I overcame each key. 306 00:22:15,080 --> 00:22:19,660 And there are some types of complex math that are very hard to overcome. 307 00:22:20,100 --> 00:22:26,020 And I put in a brute forcer that brute forced just two digits out of the long key. 308 00:22:26,240 --> 00:22:29,920 The rest of it I overcame with complex math. 309 00:22:30,160 --> 00:22:31,300 You can see how I did it. 310 00:22:31,340 --> 00:22:32,380 Play it at your leisure. 311 00:22:32,540 --> 00:22:40,980 And for dead purposes, it is very nice to see a completed key gen and key easy to find. 312 00:22:41,020 --> 00:22:41,900 Not obfuscated. 313 00:22:41,900 --> 00:22:44,080 Not going to spend a lot of time hacking through bullshit. 314 00:22:44,840 --> 00:22:45,060 Okay. 315 00:22:45,780 --> 00:22:48,120 So the best key logger. 316 00:22:48,200 --> 00:22:51,940 I decided that I wanted to hurt this application for this speech. 317 00:22:52,820 --> 00:22:56,480 This is a bad piece of software that you should never use on something you like. 318 00:22:57,120 --> 00:23:00,040 It's pretty much malware pretending to be a valid application. 319 00:23:00,480 --> 00:23:02,240 So I'm going to fuck it up. 320 00:23:07,120 --> 00:23:07,600 Okay. 321 00:23:11,320 --> 00:23:12,880 So this application. 322 00:23:14,300 --> 00:23:16,000 It's a key logger. 323 00:23:16,080 --> 00:23:22,060 It sits on your system and it says you pay me $50 and I'll be a key logger for you. 324 00:23:22,560 --> 00:23:24,060 It has a password. 325 00:23:24,240 --> 00:23:26,920 You type in the wrong password and it doesn't let you in. 326 00:23:28,440 --> 00:23:36,720 When you take this key logger and you drag and drop it into gray wolf, going to overcome 327 00:23:36,720 --> 00:23:37,440 that real quick. 328 00:23:39,580 --> 00:23:41,260 So inside of gray wolf. 329 00:23:41,260 --> 00:23:46,880 We'll tunnel down through the, this is the core executable. 330 00:23:47,000 --> 00:23:50,480 These are all of the supporting DLLs that you might want to go into. 331 00:23:50,780 --> 00:23:53,820 And of course you can pull up all of their source code just as easily. 332 00:23:54,000 --> 00:23:58,060 But we are going to target the core executable tunnel into that. 333 00:23:59,180 --> 00:24:00,960 So here's the top name space. 334 00:24:02,360 --> 00:24:05,500 I have a piece of paper since my computer is being used right now. 335 00:24:08,320 --> 00:24:09,720 And there we are. 336 00:24:12,700 --> 00:24:20,320 So classes and unlock. 337 00:24:25,220 --> 00:24:26,280 Here we are. 338 00:24:26,480 --> 00:24:29,240 The password validation sequence. 339 00:24:31,300 --> 00:24:32,640 We'll open this up. 340 00:24:32,880 --> 00:24:35,900 I designed this tool specifically for demos in mind. 341 00:24:36,060 --> 00:24:37,520 So I could zoom up the code for you. 342 00:24:38,580 --> 00:24:38,880 Okay. 343 00:24:40,120 --> 00:24:44,520 So if you read .NET, it's pretty easy to see how you might get past this, right? 344 00:24:45,240 --> 00:24:47,600 It takes the value you enter. 345 00:24:47,880 --> 00:24:51,080 It takes the known value and it directly compares them. 346 00:24:51,340 --> 00:24:54,340 This is comparing plain text against what you typed in. 347 00:24:54,900 --> 00:24:59,840 This is the worst type of check that you could possibly conceive of other than return true 348 00:24:59,840 --> 00:25:00,360 at the top. 349 00:25:02,660 --> 00:25:04,560 We have some Dropbox users, huh? 350 00:25:06,460 --> 00:25:06,980 Okay. 351 00:25:07,060 --> 00:25:09,260 So like I said, this is attacking. 352 00:25:09,260 --> 00:25:16,320 We're going to insert into this application and we'll turn off the C-sharp. 353 00:25:16,920 --> 00:25:17,440 Okay. 354 00:25:17,480 --> 00:25:18,980 So this is IL. 355 00:25:19,200 --> 00:25:22,480 I'm going to pop off getting the value that you enter. 356 00:25:25,960 --> 00:25:28,900 This is the value that you type in. 357 00:25:30,160 --> 00:25:32,020 I insert some no ops. 358 00:25:32,280 --> 00:25:34,380 It's pretty easy to know what no ops do, right? 359 00:25:34,680 --> 00:25:36,640 This just opens up some room. 360 00:25:37,640 --> 00:25:43,240 So we have our value that we got out of the application on our stack. 361 00:25:43,700 --> 00:25:56,260 We'll call a function system windows forms message box show. 362 00:25:57,880 --> 00:25:58,880 That's going to do it. 363 00:25:59,560 --> 00:26:00,780 That's the call sequence. 364 00:26:01,040 --> 00:26:02,080 We put call down here. 365 00:26:02,440 --> 00:26:04,360 We target what we want to put in there. 366 00:26:04,600 --> 00:26:06,200 And now we've done a call. 367 00:26:06,200 --> 00:26:08,280 We're going to call to show that password out to the screen. 368 00:26:08,480 --> 00:26:10,240 So when I said get a value, that's it. 369 00:26:11,560 --> 00:26:13,340 It then returns something onto the stack. 370 00:26:13,480 --> 00:26:14,120 We pop that off. 371 00:26:15,660 --> 00:26:18,540 We then have a comparison operation that was done before. 372 00:26:18,840 --> 00:26:23,240 We'll destroy that and we're going to push true onto the stack because it would be nice 373 00:26:23,240 --> 00:26:24,720 that that comparison was still there. 374 00:26:26,540 --> 00:26:28,740 This is push one onto the stack. 375 00:26:28,980 --> 00:26:30,460 An easy to read lookup. 376 00:26:30,640 --> 00:26:32,540 And that pushes one onto our stack. 377 00:26:33,300 --> 00:26:34,520 Here's our C-sharp code. 378 00:26:34,520 --> 00:26:36,600 You're going to clap when you read this. 379 00:26:38,480 --> 00:26:40,580 Message box show password true. 380 00:26:41,280 --> 00:26:41,920 That's it. 381 00:26:50,460 --> 00:26:51,960 We then come up here. 382 00:26:52,260 --> 00:26:53,100 Save it out. 383 00:26:54,300 --> 00:26:56,980 An executable with an easy different tag name. 384 00:26:57,520 --> 00:26:58,480 It's saved out. 385 00:26:58,640 --> 00:26:59,580 It's on disk. 386 00:27:00,620 --> 00:27:01,520 Open it up. 387 00:27:03,660 --> 00:27:04,500 Type in true. 388 00:27:04,500 --> 00:27:04,740 Jibberish. 389 00:27:06,140 --> 00:27:07,200 This is the password. 390 00:27:08,440 --> 00:27:08,900 Win. 391 00:27:19,340 --> 00:27:21,720 Like I said, I'm going to fuck this application up. 392 00:27:21,840 --> 00:27:22,820 So here's the next demo. 393 00:27:23,100 --> 00:27:25,380 We're going to attack the key generation on it. 394 00:27:27,960 --> 00:27:30,040 So we open up gray wolf again. 395 00:27:30,340 --> 00:27:33,300 This edited copy that I don't want to type the password into. 396 00:27:33,420 --> 00:27:34,280 We're going to take this. 397 00:27:34,280 --> 00:27:35,180 Crack its key. 398 00:27:37,740 --> 00:27:38,220 So... 399 00:27:42,940 --> 00:27:44,280 Drag and drop it. 400 00:27:45,160 --> 00:27:47,480 And this compiles a good version of it. 401 00:27:47,540 --> 00:27:47,840 All that. 402 00:27:48,620 --> 00:27:50,100 So that took what? 403 00:27:50,180 --> 00:27:52,680 Probably might take you a minute to do. 404 00:27:53,880 --> 00:27:55,720 And now I'm going to crack the key. 405 00:27:57,420 --> 00:27:58,380 That is... 406 00:28:02,980 --> 00:28:04,260 I'm using paper like this. 407 00:28:04,260 --> 00:28:04,780 Like a luddite. 408 00:28:08,380 --> 00:28:09,740 Okay. 409 00:28:11,000 --> 00:28:12,360 System. 410 00:28:19,620 --> 00:28:22,340 Fuck this. 411 00:28:23,980 --> 00:28:26,580 System class is core. 412 00:28:30,760 --> 00:28:31,440 Core. 413 00:28:32,840 --> 00:28:33,520 Okay. 414 00:28:37,140 --> 00:28:43,820 Okay, key check pass, system core, constructor, okay. 415 00:28:46,000 --> 00:28:50,040 So here is exactly what you're looking for inside of your target. 416 00:28:50,380 --> 00:28:54,720 I went and did my reconnaissance, I now know what the key validation sequence is. 417 00:28:55,220 --> 00:29:03,160 This is a string that I did before this, I'm going to take this string, come in here, here's 418 00:29:03,160 --> 00:29:12,520 our target, I'll go through the IL, and here's our target. 419 00:29:17,000 --> 00:29:17,840 Replace it. 420 00:29:19,680 --> 00:29:20,800 Here's our C sharp code. 421 00:29:22,520 --> 00:29:26,660 So that little change is the rekeying sequence. 422 00:29:27,000 --> 00:29:27,660 That's it. 423 00:29:28,240 --> 00:29:31,960 There's no going through and doing something complex. 424 00:29:31,960 --> 00:29:35,200 This is a very weak key validation. 425 00:29:36,120 --> 00:29:41,700 It uses a have you been signed with the public private key that I talked about earlier, and 426 00:29:41,700 --> 00:29:45,880 if so, then I'm going to decode it and implement it. 427 00:29:46,180 --> 00:29:49,820 So here's our target, opening up, type in random. 428 00:29:51,780 --> 00:29:55,900 It's a little fast, and that's the power of this. 429 00:29:56,100 --> 00:29:58,280 This is now keyed to I'm alive. 430 00:30:00,320 --> 00:30:01,060 Ta-da. 431 00:30:01,980 --> 00:30:03,080 And it's validated. 432 00:30:08,940 --> 00:30:10,780 I mean, that seems a little simple, right? 433 00:30:10,900 --> 00:30:12,540 Like I replaced one string. 434 00:30:13,280 --> 00:30:14,700 And that's kind of the power. 435 00:30:14,860 --> 00:30:18,260 Like I can say in six clicks you can rekey an application. 436 00:30:18,760 --> 00:30:20,940 You don't have to know IDA pro and be hardcore. 437 00:30:21,320 --> 00:30:25,900 You have a validated full, it looks legit, like there's something hardcore going on, 438 00:30:26,000 --> 00:30:27,060 and it's at one string. 439 00:30:28,200 --> 00:30:31,820 This takes a couple of minutes to read through their code, see how their key validation is 440 00:30:31,820 --> 00:30:31,960 done. 441 00:30:32,260 --> 00:30:33,200 Oh, I have to replace that. 442 00:30:33,420 --> 00:30:35,360 I want to use whatever complex algorithm. 443 00:30:35,660 --> 00:30:39,080 I'm not going to disclose it, but when you read through their code, it's pretty easy 444 00:30:39,080 --> 00:30:42,580 to make that random string that I threw in there. 445 00:30:44,580 --> 00:30:50,480 So they do have something weird going on where they do crazy obfuscation, where they literally 446 00:30:50,480 --> 00:30:56,600 do crazy obfuscation, I'll talk about that, and they have taken bad coding practices and 447 00:30:56,600 --> 00:30:59,940 just started shoving code inside and ripping code off of other people. 448 00:30:59,940 --> 00:31:04,700 And so they lie to you about they're doing this, that, and there's a lot of just bizarre 449 00:31:04,700 --> 00:31:06,240 shit going on, literally crazy. 450 00:31:08,720 --> 00:31:13,080 So one of their classes, when you type in keys, it's encrypted. 451 00:31:13,460 --> 00:31:18,060 It uses a hard coded key, combines this with your password, it then does AES. 452 00:31:19,200 --> 00:31:25,820 And there's another one where when it writes out, it uses triple DES, a bunch of hard crypto. 453 00:31:27,420 --> 00:31:29,280 However, in some of it... 454 00:31:29,280 --> 00:31:34,580 Like the triple DES, it only uses a hard coded key, it uses zeroed vectors, and it stores 455 00:31:34,580 --> 00:31:35,720 your password in the plane. 456 00:31:37,480 --> 00:31:39,280 So it might be easy to decode, right? 457 00:31:39,460 --> 00:31:41,980 I was like, oh, I can do that in an hour for the conference. 458 00:31:42,060 --> 00:31:45,700 So a couple of days ago, me and some friends started coding it up. 459 00:31:46,340 --> 00:31:47,260 And here it is. 460 00:31:47,320 --> 00:31:48,340 Here's the decrypter. 461 00:31:49,060 --> 00:31:54,400 And I'm not going to give it to you because they're literally crazy. 462 00:31:56,160 --> 00:31:58,760 Instead of using any of that crypto I talked about. 463 00:31:59,280 --> 00:32:04,680 They simply used something obscure like ASCII to encrypt it. 464 00:32:05,080 --> 00:32:06,720 And then saved it out to a file. 465 00:32:07,120 --> 00:32:10,120 They have all of this hard crypto, and then they don't use it. 466 00:32:10,440 --> 00:32:14,520 So I spent a couple of hours for this to develop that application that I showed you, 467 00:32:14,560 --> 00:32:15,740 and then they don't encrypt it. 468 00:32:18,120 --> 00:32:19,660 So I mean, good obfuscation. 469 00:32:19,760 --> 00:32:20,820 Like that threw me for a loop. 470 00:32:20,940 --> 00:32:23,300 That wasted a lot of my time for no good reason. 471 00:32:30,800 --> 00:32:31,900 So, Grey Wolf. 472 00:32:33,140 --> 00:32:39,520 I want to talk about the power of being able to look through an application. 473 00:32:40,300 --> 00:32:43,700 So Grey Wolf has a key inside of itself. 474 00:32:44,720 --> 00:32:47,220 When you dig into Grey Wolf, you go find main. 475 00:32:47,400 --> 00:32:54,500 A lot of old applications from the C++ days do their key checking call in void main, and 476 00:32:54,500 --> 00:32:56,940 then they put the key checking algorithm right next to void main. 477 00:32:57,460 --> 00:32:58,860 And then there's the key checking. 478 00:33:03,020 --> 00:33:07,180 So, something that's nice about Grey Wolf is it's free. 479 00:33:08,400 --> 00:33:10,120 And it has key validation. 480 00:33:10,680 --> 00:33:12,540 I've showed you how to jump straight to that. 481 00:33:12,980 --> 00:33:17,160 Inside of Grey Wolf Pro, I've packed all of the source code that you're going to need 482 00:33:17,160 --> 00:33:18,400 for Grey Wolf itself. 483 00:33:21,940 --> 00:33:23,020 I'm running a little short. 484 00:33:23,120 --> 00:33:23,880 We're going to skip that. 485 00:33:24,460 --> 00:33:24,900 Okay. 486 00:33:24,940 --> 00:33:25,720 So IL. 487 00:33:27,300 --> 00:33:28,580 It's kind of the code of the matrix. 488 00:33:28,820 --> 00:33:29,260 It's kind of the code of the matrix. 489 00:33:29,280 --> 00:33:32,020 You're looking at C sharp, you're looking at VB.net. 490 00:33:32,580 --> 00:33:33,720 It's actually IL. 491 00:33:34,380 --> 00:33:37,420 Also, if you're looking at obfuscation, you're looking at IL. 492 00:33:37,880 --> 00:33:40,520 It's kind of a new version of assembly code. 493 00:33:40,680 --> 00:33:42,660 There's pushes, pops, and all of that. 494 00:33:43,340 --> 00:33:46,520 It's definitely worth learning if you're serious about attacking applications. 495 00:33:46,960 --> 00:33:51,020 If you're not serious, you can just get your Wikipedia page, put it up next to the application, 496 00:33:51,340 --> 00:33:55,060 and just do it one line at a time, and it will take you a few lines. 497 00:33:55,880 --> 00:33:57,440 So you don't actually need to know it. 498 00:33:58,020 --> 00:34:00,640 So this is the midpoint, Q&A and all of that. 499 00:34:00,740 --> 00:34:04,780 So I'm trying to include a little bit more audience participation. 500 00:34:04,880 --> 00:34:07,960 If you have a burning question and you think it's highly applicable, you're welcome to 501 00:34:07,960 --> 00:34:08,540 raise your hand. 502 00:34:10,680 --> 00:34:11,120 No? 503 00:34:11,680 --> 00:34:12,120 Okay. 504 00:34:12,180 --> 00:34:13,560 So it can't be that easy, right? 505 00:34:14,960 --> 00:34:20,140 We all know that computers are secure and Microsoft has done all of their work to stop 506 00:34:20,140 --> 00:34:20,380 us. 507 00:34:22,460 --> 00:34:24,480 We use secure dongles. 508 00:34:25,280 --> 00:34:27,420 We phone home and do registrations. 509 00:34:27,420 --> 00:34:33,840 We do looking for updates and DB calls and Twitter, whatever, and we have crypto objects 510 00:34:33,840 --> 00:34:34,940 on our secure application. 511 00:34:35,980 --> 00:34:40,460 These are all nice targets because programmers segregate their code nicely. 512 00:34:41,220 --> 00:34:47,100 When you do an upgrade call to the server, just like that key gen server call hack, you 513 00:34:47,100 --> 00:34:51,720 simply say, why don't you come to my server and use my key to pull the new payload to 514 00:34:51,720 --> 00:34:55,520 update and then install the new malware that I want to ship to you. 515 00:34:56,360 --> 00:35:01,300 You want to leak new data that when your application phones home, you're going to 516 00:35:01,300 --> 00:35:04,780 send a little bit of exfiltration data and add your back doors. 517 00:35:05,060 --> 00:35:11,320 That secure USB dongle, a lot of them use return true, which is really scary when you're 518 00:35:11,320 --> 00:35:17,960 showing an executive, here you go, here's your $30,000 dongle, and crypto, chop it off, 519 00:35:18,020 --> 00:35:19,860 replace it with your own, whatever you want. 520 00:35:21,320 --> 00:35:23,180 So security by obscurity. 521 00:35:23,280 --> 00:35:25,500 This is what every single person wants. 522 00:35:25,520 --> 00:35:29,460 Every single person that has heard the Microsoft, this is how we're going to protect you will 523 00:35:29,460 --> 00:35:29,660 say. 524 00:35:29,920 --> 00:35:31,140 There's code obfuscation. 525 00:35:31,340 --> 00:35:33,900 There's logic obfuscation or crazy obfuscation. 526 00:35:34,560 --> 00:35:37,920 There's unmanaged calls that Microsoft uses a lot of the time. 527 00:35:38,200 --> 00:35:41,380 There's shells, packers, all of these things. 528 00:35:41,600 --> 00:35:45,480 This all shuts down decompilation or slows it down to a lesser extent. 529 00:35:47,620 --> 00:35:48,100 Obfuscation. 530 00:35:48,820 --> 00:35:50,180 This is what it looks like. 531 00:35:50,300 --> 00:35:54,260 Instead of using a proper name, they just put something that's hard to read. 532 00:35:55,520 --> 00:35:59,400 Instead of returning true or false or checking some variable, they do something a little 533 00:35:59,400 --> 00:35:59,720 bizarre. 534 00:35:59,900 --> 00:36:00,620 That's obfuscation. 535 00:36:01,060 --> 00:36:03,940 And they'll say, well, doesn't obfuscation stop you from getting source code? 536 00:36:04,080 --> 00:36:06,180 It's like, yeah, but I mean, that's source code. 537 00:36:06,640 --> 00:36:08,120 I mean, that's not harder. 538 00:36:08,320 --> 00:36:12,480 I mean, it's going to take me five or ten lines and it's going to take me an hour instead 539 00:36:12,480 --> 00:36:13,180 of five minutes. 540 00:36:13,340 --> 00:36:14,520 Sure, it slows me down. 541 00:36:14,840 --> 00:36:15,960 This is obfuscation. 542 00:36:17,640 --> 00:36:20,480 You can find your target, but it might take a little bit of time. 543 00:36:20,620 --> 00:36:21,940 There might be 12 other ninjas. 544 00:36:22,260 --> 00:36:24,220 It's a little bit harder. 545 00:36:24,220 --> 00:36:28,320 You might be a little worried about something that you missed, but that's it. 546 00:36:29,900 --> 00:36:32,800 There is security by security. 547 00:36:33,080 --> 00:36:37,300 There's signed crypto code that Microsoft has put on your applications that can verify 548 00:36:37,300 --> 00:36:39,100 the creator, strong names, blah, blah, blah. 549 00:36:39,800 --> 00:36:41,140 This shuts down tampering. 550 00:36:41,560 --> 00:36:42,760 This is a strong name. 551 00:36:42,920 --> 00:36:46,940 This is what it's constructed out of if you actually don't know this stuff and you want 552 00:36:46,940 --> 00:36:47,100 to. 553 00:36:48,080 --> 00:36:50,300 Private key signing, 1024 crypto. 554 00:36:50,660 --> 00:36:52,840 This is impossible to break. 555 00:36:52,840 --> 00:36:58,060 It guarantees you that your author is the only person that has made the modifications 556 00:36:58,060 --> 00:36:59,540 to the blah, blah, blah. 557 00:36:59,760 --> 00:37:00,680 Protection on disk. 558 00:37:00,760 --> 00:37:02,700 Shells, packers, your secure application. 559 00:37:03,660 --> 00:37:05,760 You can't get to it because it's secure. 560 00:37:07,180 --> 00:37:08,660 It's not going to decompile. 561 00:37:09,240 --> 00:37:14,920 There's a C++ that runs crypto that then unpacks it in memory and they'll tell you how this 562 00:37:14,920 --> 00:37:16,680 is impossible to break. 563 00:37:16,820 --> 00:37:18,720 It would take the CIA a million years. 564 00:37:19,280 --> 00:37:20,340 And here it is. 565 00:37:20,920 --> 00:37:21,400 . 566 00:37:23,360 --> 00:37:29,720 Gray wolf spins up and here's that application that I brute forced earlier. 567 00:37:30,620 --> 00:37:33,780 We're going to drag it in here and it works. 568 00:37:33,980 --> 00:37:35,380 It shut down gray wolf. 569 00:37:35,600 --> 00:37:37,320 It did not decompile. 570 00:37:37,440 --> 00:37:39,420 It's like, I don't know, it's packed with something. 571 00:37:39,540 --> 00:37:39,960 It's encrypted. 572 00:37:41,340 --> 00:37:45,680 So that same thing, okay. 573 00:37:46,220 --> 00:37:50,820 And so gray dragon, I really like it. 574 00:37:50,820 --> 00:37:51,840 I hope you like it. 575 00:37:51,880 --> 00:37:53,080 Let me know on the internet if you do. 576 00:37:54,820 --> 00:38:00,600 It scans through all of the processes, identifies the target, puts it up here and it says, okay, 577 00:38:00,660 --> 00:38:02,120 64 bit, drops us in. 578 00:38:03,120 --> 00:38:04,120 Oh, wrong one. 579 00:38:04,840 --> 00:38:05,240 Okay. 580 00:38:06,040 --> 00:38:07,080 Inject into the target. 581 00:38:07,880 --> 00:38:09,920 And as you can see, it found a new process. 582 00:38:10,100 --> 00:38:10,580 It's .net. 583 00:38:10,680 --> 00:38:11,680 I can inject into that. 584 00:38:12,860 --> 00:38:13,260 Okay. 585 00:38:13,300 --> 00:38:14,840 So back to injecting. 586 00:38:14,840 --> 00:38:17,740 Our payload's inside of our hard target, right? 587 00:38:18,760 --> 00:38:20,420 Like, you're inside of your target. 588 00:38:20,820 --> 00:38:21,340 And it's .net. 589 00:38:21,800 --> 00:38:24,720 But you don't have access to the source code. 590 00:38:25,280 --> 00:38:27,580 And we'll spin it up. 591 00:38:27,980 --> 00:38:34,280 We have access to our I did inject into the right application, right? 592 00:38:35,400 --> 00:38:36,000 Okay. 593 00:38:38,660 --> 00:38:40,680 I'll step back and run that one one more time. 594 00:38:40,920 --> 00:38:42,480 Just because it's really nice. 595 00:38:43,400 --> 00:38:44,000 Okay. 596 00:38:44,180 --> 00:38:45,800 So we have our payload. 597 00:38:46,500 --> 00:38:48,180 We inject into our target. 598 00:38:48,360 --> 00:38:49,340 Drop a target. 599 00:38:50,200 --> 00:38:50,800 Okay. 600 00:38:50,820 --> 00:38:51,940 Get our shim. 601 00:38:52,380 --> 00:38:53,360 Drop our payload. 602 00:38:53,920 --> 00:38:55,140 This edits the structure. 603 00:38:57,920 --> 00:39:02,060 Inside of every single payload, I've put a back door that talks over a named pipe. 604 00:39:03,120 --> 00:39:09,200 So that payload that I dropped in, it now reports into another application that says, 605 00:39:10,020 --> 00:39:11,700 why don't you run another payload? 606 00:39:11,880 --> 00:39:13,960 Because you can keep injecting multiple things. 607 00:39:14,180 --> 00:39:18,040 If you saw my talks or you look it up, you can shove as many applications together as 608 00:39:18,040 --> 00:39:18,320 you want. 609 00:39:18,420 --> 00:39:20,320 Just keep shoving applications together. 610 00:39:20,320 --> 00:39:22,260 And they'll mix and they'll be in the same memory space. 611 00:39:22,920 --> 00:39:24,260 So here's another payload. 612 00:39:24,580 --> 00:39:26,740 We have access to all of the objects in memory. 613 00:39:27,060 --> 00:39:29,200 And this iterates all of the source code. 614 00:39:29,340 --> 00:39:30,180 Here's the source code. 615 00:39:30,620 --> 00:39:31,680 This is all in IL. 616 00:39:32,140 --> 00:39:33,560 It's highly obfuscated. 617 00:39:33,780 --> 00:39:35,840 But as you saw, it was protected before. 618 00:39:36,120 --> 00:39:39,000 That would have shut down every single decompiler on the market. 619 00:39:39,220 --> 00:39:41,420 But now I'm getting their IL out of memory. 620 00:39:41,860 --> 00:39:45,000 Because like I said before, all of the protection falls away. 621 00:39:45,180 --> 00:39:49,240 This gets you straight into your target no matter how they I mean, they can move it down 622 00:39:49,240 --> 00:39:49,940 into C++. 623 00:39:50,320 --> 00:39:51,220 And they can put it in assembly. 624 00:39:51,580 --> 00:39:54,140 If they left it in .NET, you have their source code. 625 00:39:54,480 --> 00:39:54,880 Period. 626 00:39:55,180 --> 00:39:55,580 Always. 627 00:39:56,900 --> 00:39:57,960 They'll play some games. 628 00:39:58,100 --> 00:39:58,920 They'll try and move it. 629 00:39:59,120 --> 00:40:00,520 But you can always hunt them down. 630 00:40:00,680 --> 00:40:01,600 They can't hide from you. 631 00:40:01,680 --> 00:40:06,560 As long as you put it into memory and it's touched by the processor, you can get to it. 632 00:40:07,120 --> 00:40:08,520 So that's a hardened application. 633 00:40:10,300 --> 00:40:11,540 This is impossible. 634 00:40:11,900 --> 00:40:14,960 You can pay us a million dollars and we'll protect your secure application. 635 00:40:16,060 --> 00:40:17,260 And this is the pitch. 636 00:40:17,420 --> 00:40:20,080 Like you can develop your application for a hardened one. 637 00:40:20,320 --> 00:40:21,940 You can develop it for a friendly environment. 638 00:40:22,580 --> 00:40:25,360 And I've done other speeches where there's tradeoffs. 639 00:40:25,440 --> 00:40:28,780 Every single time that you add a protection, it adds a vulnerability. 640 00:40:29,060 --> 00:40:29,820 It can't be that easy. 641 00:40:30,060 --> 00:40:31,420 Of course it's that easy. 642 00:40:31,600 --> 00:40:32,460 I'm a hacker. 643 00:40:33,180 --> 00:40:36,500 Your public private key tokens, you simply steal them. 644 00:40:36,540 --> 00:40:38,760 You put them on an erroneously signed application. 645 00:40:39,260 --> 00:40:44,220 And at this point, it is still signed by the original key. 646 00:40:45,420 --> 00:40:47,640 And yeah, it's pretty much that easy. 647 00:40:47,780 --> 00:40:48,520 It's like the slide. 648 00:40:48,620 --> 00:40:49,380 It just moves it over. 649 00:40:49,380 --> 00:40:53,740 It moves it over to the erroneously signed executable because Microsoft leaves the sign 650 00:40:53,740 --> 00:40:54,820 code checking off. 651 00:40:55,780 --> 00:41:01,480 So there are 1,024-bit crypto that's going to stop you from attacking a core Windows 652 00:41:01,480 --> 00:41:02,760 DLL that's protected. 653 00:41:03,000 --> 00:41:04,240 It's off by default. 654 00:41:05,680 --> 00:41:11,840 So when that genuine Microsoft application runs, calls a DLL, you're inside of your 655 00:41:11,840 --> 00:41:12,120 target. 656 00:41:13,820 --> 00:41:15,480 This is how you turn it on. 657 00:41:15,660 --> 00:41:18,000 You can also add something to the manifest to turn it on. 658 00:41:18,100 --> 00:41:19,280 So it won't load. 659 00:41:19,380 --> 00:41:20,740 It will error out. 660 00:41:21,180 --> 00:41:26,580 However, you can still do it to the executable and the system will say, well, it's not signed 661 00:41:26,580 --> 00:41:26,880 properly. 662 00:41:27,040 --> 00:41:27,660 It's probably expired. 663 00:41:27,900 --> 00:41:28,340 And it runs. 664 00:41:28,640 --> 00:41:30,760 And so you're in just the same. 665 00:41:31,080 --> 00:41:34,540 So every single one of their mechanisms is subvertible. 666 00:41:34,660 --> 00:41:35,200 Pretty easy. 667 00:41:35,300 --> 00:41:36,020 Come on, Microsoft. 668 00:41:36,120 --> 00:41:36,720 Check it. 669 00:41:36,840 --> 00:41:40,800 If you ask for a password, don't tell people it's going to secure something if you're not 670 00:41:40,800 --> 00:41:41,460 going to check it. 671 00:41:43,120 --> 00:41:47,620 ASM, I'm not going to go into detail on this, but you can run assembly code inside a .NET 672 00:41:47,620 --> 00:41:48,000 application. 673 00:41:50,040 --> 00:41:51,460 And it's really fun. 674 00:41:51,680 --> 00:41:53,660 All you need is reflection or unmanaged calls. 675 00:41:53,800 --> 00:41:54,820 You can drop ASM. 676 00:41:55,100 --> 00:41:56,520 And I put this out there. 677 00:41:57,860 --> 00:41:58,220 GAC. 678 00:41:58,380 --> 00:41:59,700 You need to know what the GAC is. 679 00:41:59,900 --> 00:42:01,420 This is what the GAC looks like on disk. 680 00:42:02,020 --> 00:42:04,660 You take out desktop I and I. It's a regular folder. 681 00:42:05,880 --> 00:42:07,220 There's a bunch of GAC. 682 00:42:07,420 --> 00:42:09,960 There's a bunch of native images that you have to destroy. 683 00:42:10,920 --> 00:42:12,240 The GAC just goes on. 684 00:42:12,600 --> 00:42:14,480 And this is why you need to know about the GAC. 685 00:42:14,580 --> 00:42:17,560 When you call an executable, it puts its DLLs in the GAC. 686 00:42:17,560 --> 00:42:20,500 It then turns it into a native image. 687 00:42:20,700 --> 00:42:23,340 You delete the native image, replace it in the GAC, and then hack. 688 00:42:23,640 --> 00:42:25,240 So you destroy the native image. 689 00:42:25,460 --> 00:42:29,260 You have your application attacking in the GAC, not on disk. 690 00:42:30,660 --> 00:42:32,820 So it is calling into the GAC. 691 00:42:33,000 --> 00:42:34,460 It's attacking out of the GAC. 692 00:42:34,500 --> 00:42:35,240 They whitelist. 693 00:42:35,340 --> 00:42:37,600 They go through all of the program files. 694 00:42:37,880 --> 00:42:38,720 There's no changes. 695 00:42:38,820 --> 00:42:39,820 But you're attacking out of the GAC. 696 00:42:39,900 --> 00:42:44,520 Some random-ass application is being attacked instead of program files in Windows GAC. 697 00:42:44,960 --> 00:42:47,020 So it's a great place to hide and attack. 698 00:42:48,400 --> 00:42:51,360 Attacking from the same framework, same idea, becomes a process. 699 00:42:51,620 --> 00:42:52,580 You infect the framework. 700 00:42:52,860 --> 00:42:54,740 Every application calls a framework. 701 00:42:55,000 --> 00:42:55,840 And then you're in the process. 702 00:42:56,140 --> 00:43:00,440 So you're globally in every single application on the system that runs .NET. 703 00:43:01,220 --> 00:43:06,620 Visual studios, there's an exploit in Visual Studios to run arbitrary code. 704 00:43:07,040 --> 00:43:10,160 And it brings up, oh, you downloaded this off the Internet. 705 00:43:10,380 --> 00:43:12,060 You could be in danger, Will Robinson. 706 00:43:12,780 --> 00:43:15,480 So it runs arbitrary code when you open a form. 707 00:43:15,760 --> 00:43:16,900 That's what it does. 708 00:43:16,900 --> 00:43:18,920 So here's an application that it ran. 709 00:43:21,620 --> 00:43:23,100 I talked about this last year. 710 00:43:23,220 --> 00:43:27,780 But real quick, there's code inside of the constructor of a user control. 711 00:43:28,200 --> 00:43:30,480 It runs a constructor every time you view the form. 712 00:43:32,560 --> 00:43:39,100 And there's a payload that elevates past the UAC automatically, UAC hacks, all that. 713 00:43:40,360 --> 00:43:46,160 It would automatically elevate past the UAC and then shim and attack applications inside 714 00:43:46,160 --> 00:43:48,560 of Microsoft, those signed things that are hard to attack. 715 00:43:48,780 --> 00:43:50,960 Here's a payload that I developed to show that off. 716 00:43:51,540 --> 00:43:53,600 Something that should be hardened, say, PowerShell. 717 00:43:55,120 --> 00:43:58,140 I inject into PowerShell, modify PowerShell. 718 00:43:58,220 --> 00:43:59,580 This would all be completely silent. 719 00:43:59,740 --> 00:44:04,020 So you can imagine that the user opens the code, looks at the form, doesn't click run, 720 00:44:04,200 --> 00:44:07,040 opens PowerShell, and then something like this happens. 721 00:44:09,600 --> 00:44:10,040 . 722 00:44:15,620 --> 00:44:16,060 . 723 00:44:16,060 --> 00:44:16,100 . 724 00:44:17,280 --> 00:44:19,440 And of course, this is fun for an office prank. 725 00:44:19,680 --> 00:44:23,180 If it was a key logger, then we would be talking about some real danger, right? 726 00:44:23,520 --> 00:44:27,380 I mean, this is a great vector for doing viruses and malware. 727 00:44:27,640 --> 00:44:30,260 Because once you fuck up an application, you own it. 728 00:44:30,280 --> 00:44:32,440 You can do pretty much any viral thing you want. 729 00:44:33,660 --> 00:44:34,700 So you're not a hacker. 730 00:44:34,860 --> 00:44:36,680 You can defend your applications with this. 731 00:44:36,800 --> 00:44:38,220 You can harden them. 732 00:44:38,340 --> 00:44:40,380 You can verify your tools that you're downloading. 733 00:44:40,540 --> 00:44:44,220 Like you download my tools, how do you know that I'm not screwing over your applications 734 00:44:44,220 --> 00:44:45,140 in your system? 735 00:44:45,140 --> 00:44:53,520 You can look at my source code. This is very defensible. It's something we should do as a small part of our community for the rest of the community. 736 00:44:54,600 --> 00:44:59,260 When you look inside, you're going to be able to take control, don't be helpless, all that. 737 00:44:59,420 --> 00:45:05,860 You're going to find that all of the keys, you're going to find passwords, technology, weak spots, good code, bad code. 738 00:45:06,120 --> 00:45:11,000 You're going to find out what kind of security login. You're going to find out what kind of data leakage is happening. 739 00:45:11,180 --> 00:45:14,920 You're going to find out what kind of keys. You're going to find out what kind of crypto. It just goes on. 740 00:45:14,920 --> 00:45:17,040 You're going to understand what that application does. 741 00:45:18,120 --> 00:45:23,800 And here is Aircrack. Just because I thought I would show something positive instead of something negative. 742 00:45:24,240 --> 00:45:29,000 So here's Aircrack. It's just a little GUI that they threw together. 743 00:45:29,340 --> 00:45:35,220 And bam. It's prettier. It's better. It's a little more user-friendly. I can now upgrade Aircrack. 744 00:45:35,860 --> 00:45:39,660 And this is something that you can use not just to attack, but to make things better. 745 00:45:40,580 --> 00:45:44,000 So your malware. There's 1% of us that make malware. 746 00:45:45,180 --> 00:45:52,240 How do you hide? You use the same things. You use shells, cryptos, if they call unmanaged code, you break out and attack. 747 00:45:52,620 --> 00:45:56,380 You use office-gated code, signed DLL protection to make your target feel secure. 748 00:45:56,700 --> 00:45:59,780 You want to use intelligent names like your target. Coding style like your target. 749 00:46:00,400 --> 00:46:09,520 You want to blend in with your target. You want to do as much as you can to just look and feel as though you're the target. 750 00:46:09,640 --> 00:46:13,740 Because you're writing source code. You don't have to do ugly source code. Make it pretty. 751 00:46:14,700 --> 00:46:20,200 Don't use for loops. I mean, these people that are hunting malware are like, well, they're going to use a true. 752 00:46:20,440 --> 00:46:24,280 So I'm just going to look for a spinning loop and then I'll find the malware. 753 00:46:24,380 --> 00:46:28,640 Don't do it. Make it hard for them. Make them work for their millions of dollars that HBGary sells them. 754 00:46:30,820 --> 00:46:35,120 So all the tools, they're free. The source code, I'm going to sell for $80. 755 00:46:35,280 --> 00:46:37,260 Or you can decompile it and spend eight hours. 756 00:46:38,500 --> 00:46:43,400 You can join and catch my beta for $80. All of my new tools, they're coming out constantly. 757 00:46:43,740 --> 00:46:45,620 And you can see what's in constant development. 758 00:46:45,900 --> 00:46:47,620 And there's a bunch of tools that I'm holding back. 759 00:46:47,840 --> 00:46:52,220 If you join and you want specific things, I'll be more inclined to make them. 760 00:46:53,960 --> 00:46:55,320 And support the community. 761 00:46:55,580 --> 00:47:00,320 Because without community support, companies come along, buy this up, and then sell it to you. 762 00:47:00,440 --> 00:47:03,000 Or don't sell it to you and sell it to people that aren't you. 763 00:47:05,140 --> 00:47:07,680 So a root kit is vicious. 764 00:47:08,780 --> 00:47:10,440 Here's Windows media. 765 00:47:12,060 --> 00:47:13,160 Here's a Windows application. 766 00:47:13,160 --> 00:47:14,540 This is an application that auto elevates. 767 00:47:14,640 --> 00:47:19,740 When you have a shim inside of this application, this is just a little take my word for it. 768 00:47:19,800 --> 00:47:21,240 This is saying this is an administrator. 769 00:47:22,500 --> 00:47:24,160 So this is administration. 770 00:47:24,580 --> 00:47:29,460 This is an auto elevated application that you can inject into and do vicious things from. 771 00:47:31,220 --> 00:47:32,620 So story time. 772 00:47:34,000 --> 00:47:39,000 I thought that I would give a little bit of fun things from my experiences. 773 00:47:40,760 --> 00:47:42,860 So HBGary showed up at Black Hat. 774 00:47:43,160 --> 00:47:44,240 He didn't come here. 775 00:47:44,420 --> 00:47:49,920 But when he showed up at Black Hat, he was presenting things like his new shirt. 776 00:47:53,680 --> 00:47:57,200 Because we all know that HBGary pisses on anonymous, right? 777 00:47:58,900 --> 00:48:02,520 So he was giving away shirts and getting heckles from other vendors. 778 00:48:02,940 --> 00:48:07,420 I mean, these are corporate vendors that were heckling HBGary at Black Hat. 779 00:48:08,020 --> 00:48:09,380 How sweet, right? 780 00:48:10,600 --> 00:48:15,600 So if there's any last Q&A and if anyone wants this shirt, raise your hand. 781 00:48:16,900 --> 00:48:18,160 I didn't see any hands. 782 00:48:18,580 --> 00:48:19,580 Oh, there's a hand? 783 00:48:19,800 --> 00:48:20,540 Okay, okay. 784 00:48:26,140 --> 00:48:27,660 So that's the free stuff. 785 00:48:28,040 --> 00:48:30,320 I hope you enjoyed this shit because I worked hard. 786 00:48:39,380 --> 00:48:39,740 Thank you. 787 00:48:39,740 --> 00:48:39,960 Thank you.