1 00:00:25,380 --> 00:00:27,200 Shrinker and Expander 2 00:00:28,680 --> 00:00:36,380 For the Shrinker and Expander, I call a direct expansion just a different way of doing the same instruction. 3 00:00:37,140 --> 00:00:41,000 I say, like, for example, well, I think I've got an example coming up next. 4 00:00:41,360 --> 00:00:46,180 And basically, Expander makes different instructions that do the same thing. 5 00:00:46,540 --> 00:00:56,280 Shrinker converts them back down so you can have your same code skeleton, if you will, each time. 6 00:00:57,200 --> 00:00:58,540 Yeah, here's an example. 7 00:00:58,660 --> 00:01:03,800 You have your original code where you move register 2 and register 1. 8 00:01:04,800 --> 00:01:11,040 And that's just the same as doing push register 2, pop register 1, 9 00:01:11,180 --> 00:01:14,260 because all you're doing is using the system stack to move it. 10 00:01:14,780 --> 00:01:24,220 And I just decided I put the bytecode on there, so it actually shows that it creates just a different bytecode. 11 00:01:24,700 --> 00:01:26,160 And that's pretty big. 12 00:01:26,220 --> 00:01:26,480 Yeah. 13 00:01:27,200 --> 00:01:29,840 That's the one thing I'm always up for trying to do. 14 00:01:30,360 --> 00:01:37,680 And so the addition to it is the idea of being able to create random expanders, 15 00:01:37,680 --> 00:01:47,860 because these regular expanders are easily caught by just looking for them instead of, like, any other type of search for three bytes. 16 00:01:48,160 --> 00:01:55,980 You know, if I saw push register 1, pop register 2, I know that was just a move instruction that's been expanded, 17 00:01:56,160 --> 00:01:57,080 so I could shrink it. 18 00:01:57,200 --> 00:02:01,740 I could shrink it myself and, therefore, know what the code's supposed to be doing and have that original code skeleton. 19 00:02:02,780 --> 00:02:11,140 So it's just the basis of figuring out ways, rule-based, to figure out ways of how to create these random expansions. 20 00:02:12,200 --> 00:02:21,720 And so, like, an indirect one would be, like, as we see here, we got a, since we do, before we do pop register 1, 21 00:02:21,920 --> 00:02:27,180 the idea of the rule is that register 1 becomes a free register, where you can do whatever you want. 22 00:02:27,180 --> 00:02:33,980 You can do whatever you want with it, since all you're doing is waiting for it to pop at the end off the stack to do your standard move operation. 23 00:02:35,180 --> 00:02:44,420 And so you get a, it does increase code size, but it does give you a different signature for even just one operation, like we see for this. 24 00:02:47,140 --> 00:02:50,720 And, yeah, this is the part about the whole idea of using the rule. 25 00:02:51,060 --> 00:02:56,160 The rule is register 1 can be manipulated before any point. 26 00:02:57,180 --> 00:02:59,460 Any point before the pop of register 1. 27 00:03:00,340 --> 00:03:12,640 And, therefore, since you have that rule, that's why we can stick that or in there and add random registers and values to register 1 in that earlier example. 28 00:03:16,520 --> 00:03:25,460 And, then next, for generating these, the idea is if you have, just label the areas. 29 00:03:26,300 --> 00:03:26,940 And. 30 00:03:27,180 --> 00:03:35,900 For each area, you have a different combination of rules since it depends which set of labels 31 00:03:35,900 --> 00:03:37,320 you're within at that time. 32 00:03:37,700 --> 00:03:42,660 So it's just a basic owing of all the rules together. 33 00:03:43,640 --> 00:03:56,280 So if you're in a section that's within two boundary points, you can decide to use both 34 00:03:56,280 --> 00:03:59,960 of the rules together and stuff like that. 35 00:04:00,100 --> 00:04:01,380 Say, for instance, this one. 36 00:04:02,200 --> 00:04:09,800 We can see the rule one starts at the beginning of the code and ends right before the pop 37 00:04:09,800 --> 00:04:15,540 register one because pop register one is when the rule tells you that you can no longer 38 00:04:15,540 --> 00:04:17,500 randomly use register one. 39 00:04:21,620 --> 00:04:25,880 And then I just had some stuff on like basic metamorphic viruses. 40 00:04:25,880 --> 00:04:29,460 is if I, because that's where they first started from, 41 00:04:29,540 --> 00:04:32,600 and that's just some ones to check out 42 00:04:32,600 --> 00:04:33,940 that are usually really good. 43 00:04:34,100 --> 00:04:35,500 Metaforil was the first one 44 00:04:35,500 --> 00:04:37,400 that was a fully metamorphic virus. 45 00:04:37,520 --> 00:04:39,360 It actually had a shrinker in it 46 00:04:39,360 --> 00:04:42,320 as well as a code expander and various other stuff. 47 00:04:44,060 --> 00:04:46,720 There's also the executable trash generator 48 00:04:46,720 --> 00:04:48,020 that was written by Zombie, 49 00:04:48,220 --> 00:04:51,120 and that one's great for just creating random. 50 00:04:51,220 --> 00:04:52,800 You can pass in instructions, 51 00:04:52,800 --> 00:05:00,120 and it will output random opcodes for you, 52 00:05:00,650 --> 00:05:02,460 and you can tell it what you want 53 00:05:02,460 --> 00:05:03,500 as your destination registers, 54 00:05:03,800 --> 00:05:05,140 what you want as your source registers, 55 00:05:05,800 --> 00:05:08,520 and you have some instructions you can pick out of. 56 00:05:08,680 --> 00:05:11,220 So you just set all these bikes, push it in. 57 00:05:11,300 --> 00:05:12,340 I think I got it on the next slide. 58 00:05:12,580 --> 00:05:14,040 Yeah, here's calling it. 59 00:05:14,920 --> 00:05:18,300 So you just tell it how long you want it, 60 00:05:18,360 --> 00:05:19,480 point towards the buffer, 61 00:05:20,080 --> 00:05:22,400 and then the rest is just telling it 62 00:05:22,400 --> 00:05:22,740 what instructions. 63 00:05:22,800 --> 00:05:27,540 It can use what you want as your source 64 00:05:27,540 --> 00:05:28,660 and what you want as your destination. 65 00:05:29,660 --> 00:05:31,580 And there's also one other tool 66 00:05:31,580 --> 00:05:33,560 that I forgot to mention on that other page 67 00:05:33,560 --> 00:05:37,740 that's called the micro-length disassembler, 68 00:05:37,920 --> 00:05:40,900 and that one's great for... 69 00:05:40,900 --> 00:05:43,580 You can do incremental development of this engine 70 00:05:43,580 --> 00:05:46,040 because you're going to have to map your opcodes 71 00:05:46,040 --> 00:05:47,780 kind of to do your own parser. 72 00:05:48,180 --> 00:05:52,540 So this one, you can stick this micro-length disassembler, 73 00:05:52,580 --> 00:05:52,780 which is... 74 00:05:52,800 --> 00:05:53,200 I think... 75 00:05:53,200 --> 00:05:54,560 I can't remember the exact length, 76 00:05:54,620 --> 00:05:56,060 but it's nice and small. 77 00:05:56,840 --> 00:06:01,180 You can basically take this and stick it in your ELTS. 78 00:06:01,240 --> 00:06:05,460 So if you don't feel like mapping an operation, 79 00:06:05,760 --> 00:06:07,060 it just drops through to this. 80 00:06:07,380 --> 00:06:09,520 The micro-length disassembler will tell you 81 00:06:09,520 --> 00:06:10,940 the length of the instruction, 82 00:06:11,260 --> 00:06:12,760 and therefore you can just skip over it 83 00:06:12,760 --> 00:06:13,660 and go to the next one. 84 00:06:17,500 --> 00:06:22,430 So when we're using X-Keyboard Trash Generator, 85 00:06:22,800 --> 00:06:24,220 to generate our code, 86 00:06:24,980 --> 00:06:26,760 since we'll be mapping to show 87 00:06:26,760 --> 00:06:29,920 where the registers are in the opcode, 88 00:06:31,320 --> 00:06:36,480 I just would go by sticking ELX in for your source 89 00:06:36,480 --> 00:06:38,480 as well as destination register if you have two 90 00:06:38,480 --> 00:06:40,540 or anything like that, 91 00:06:40,640 --> 00:06:44,240 since they'll just give you all zeros in there. 92 00:06:44,340 --> 00:06:47,160 So you can easily map another register in there 93 00:06:47,160 --> 00:06:48,120 by just doing it, 94 00:06:48,820 --> 00:06:49,720 oring it in there. 95 00:06:49,900 --> 00:06:50,360 I think I... 96 00:06:50,360 --> 00:06:51,720 Yeah, I said oring it in there. 97 00:06:51,820 --> 00:06:52,280 You can... 98 00:06:53,200 --> 00:06:54,080 It's just... 99 00:06:54,080 --> 00:06:55,900 Yeah, if you do that oring and put it in there, 100 00:06:55,920 --> 00:06:57,640 I think I've got a little something on... 101 00:06:57,640 --> 00:07:02,420 Yeah, I put a little something on extracting register values 102 00:07:03,380 --> 00:07:05,920 out of opcode, 103 00:07:06,120 --> 00:07:06,980 and it's... 104 00:07:07,800 --> 00:07:09,860 Well, if you just got it mapped like so, 105 00:07:10,540 --> 00:07:13,080 then you know which you've got to or 106 00:07:13,080 --> 00:07:15,320 and which you've got to and to mess with stuff. 107 00:07:19,460 --> 00:07:20,140 And, like, 108 00:07:20,140 --> 00:07:20,560 it's... 109 00:07:23,180 --> 00:07:26,260 Here's just, like, a small algorithm for... 110 00:07:26,900 --> 00:07:32,200 or just showing how adding that register in would work. 111 00:07:32,980 --> 00:07:33,780 It's easy. 112 00:07:33,880 --> 00:07:36,540 It's oring it in as, like, that first push 113 00:07:36,540 --> 00:07:39,100 and the pop is shown. 114 00:07:39,920 --> 00:07:40,900 And it's... 115 00:07:41,960 --> 00:07:43,720 If you just or that in, 116 00:07:44,440 --> 00:07:46,600 it just goes into there 117 00:07:46,600 --> 00:07:49,480 and combines with the rest of the opcode. 118 00:07:50,400 --> 00:07:51,740 And it's safer. 119 00:07:51,900 --> 00:07:52,260 If you just... 120 00:07:52,260 --> 00:07:53,700 If you have a mobile piece of code and... 121 00:07:54,500 --> 00:07:57,140 Since if you fully, ever fully shrink something, 122 00:07:57,660 --> 00:07:59,660 say, with these old metamorphic engines, 123 00:07:59,880 --> 00:08:01,940 they always made sure to never shrink itself completely 124 00:08:02,600 --> 00:08:05,540 because then you fall into the same hole that you have 125 00:08:05,540 --> 00:08:08,560 when you're using regular encryption 126 00:08:08,560 --> 00:08:10,160 because your encryption, 127 00:08:10,700 --> 00:08:12,240 at one point or another, 128 00:08:12,520 --> 00:08:14,760 it's got to be decrypted so you can use it. 129 00:08:15,380 --> 00:08:17,540 And if you fully... 130 00:08:19,380 --> 00:08:20,720 fully shrink this, 131 00:08:21,080 --> 00:08:22,160 you just get the standard, 132 00:08:22,260 --> 00:08:26,300 you're looking on a high-coded skeleton. 133 00:08:26,620 --> 00:08:28,460 So this code skeleton, 134 00:08:28,520 --> 00:08:29,500 you can pick up in memory 135 00:08:29,500 --> 00:08:30,620 and it'll always be the same. 136 00:08:30,740 --> 00:08:33,200 So you always have to leave it somewhat unoptimized 137 00:08:33,200 --> 00:08:35,580 or it's just as easy as checking memory 138 00:08:35,580 --> 00:08:39,000 to find what it looks like. 139 00:08:39,180 --> 00:08:42,240 And since we were going to try to randomly generate 140 00:08:42,240 --> 00:08:44,740 these expansions, 141 00:08:46,980 --> 00:08:47,740 the idea... 142 00:08:49,580 --> 00:08:50,320 I didn't see that. 143 00:08:50,360 --> 00:08:50,960 It was right in there. 144 00:08:52,340 --> 00:08:53,940 The idea is that 145 00:08:53,940 --> 00:08:59,440 since we're going to be developing new expansions, 146 00:09:00,020 --> 00:09:02,120 and we can't fully shrink it, 147 00:09:02,180 --> 00:09:04,540 it's pretty much worthless to use. 148 00:09:05,480 --> 00:09:07,580 You have to find some middle ground 149 00:09:07,580 --> 00:09:10,540 to pass these expansions on to the next one. 150 00:09:11,140 --> 00:09:13,360 So I just have it that the shrinker knows 151 00:09:13,360 --> 00:09:19,080 that generation n as well as generation n-1, 152 00:09:19,180 --> 00:09:20,700 and it knows that I... 153 00:09:20,960 --> 00:09:22,000 the shrinkers were... 154 00:09:22,000 --> 00:09:22,780 I developed... 155 00:09:22,780 --> 00:09:23,700 or the shrinkers were 156 00:09:23,700 --> 00:09:25,920 the random expansions that were developed 157 00:09:26,640 --> 00:09:28,540 during those generations. 158 00:09:28,760 --> 00:09:29,500 So it's... 159 00:09:30,640 --> 00:09:32,440 And then, of course, your expander 160 00:09:33,060 --> 00:09:35,360 creates the expansions that go into 161 00:09:35,360 --> 00:09:37,280 the n-plus-1 generation. 162 00:09:37,420 --> 00:09:39,180 And therefore, you kind of just carry 163 00:09:39,180 --> 00:09:41,100 half of the older generation, 164 00:09:41,720 --> 00:09:43,080 you create half new, 165 00:09:43,640 --> 00:09:45,560 and you just keep on going from there 166 00:09:45,560 --> 00:09:47,020 and you always just drop the old one, 167 00:09:47,060 --> 00:09:48,400 develop the other half again 168 00:09:48,400 --> 00:09:50,940 as your new set of expansions. 169 00:09:50,960 --> 00:09:52,520 And you always... 170 00:09:52,520 --> 00:09:54,360 But to make sure, if you want to, 171 00:09:55,180 --> 00:09:57,980 that you don't end up just having geometric growth 172 00:09:57,980 --> 00:10:00,380 like a regular trash code generator, 173 00:10:01,380 --> 00:10:03,620 you've got to fully shrink 174 00:10:03,620 --> 00:10:06,600 the n-minus-1 generation's expansions 175 00:10:06,600 --> 00:10:09,780 because you would lose... 176 00:10:09,780 --> 00:10:11,840 By n-plus-1, you would have... 177 00:10:12,560 --> 00:10:14,860 You'd end up losing that generation 178 00:10:14,860 --> 00:10:16,020 of how to shrink that, 179 00:10:16,740 --> 00:10:19,180 and therefore just leaving trash code in there 180 00:10:19,180 --> 00:10:20,700 that's not reversible, 181 00:10:20,960 --> 00:10:23,380 and to be re-trunked to use. 182 00:10:26,320 --> 00:10:29,040 And I see this as an improvement 183 00:10:29,040 --> 00:10:30,280 on metamorphosis, oh my. 184 00:10:30,940 --> 00:10:34,320 Because in your standard metamorphic virus, 185 00:10:34,420 --> 00:10:36,580 when you have your expansions and shrinkers, 186 00:10:36,680 --> 00:10:39,160 it's easy as just scanning for these things. 187 00:10:40,120 --> 00:10:42,960 For studying, and usually they only go about five deep 188 00:10:42,960 --> 00:10:45,940 in most codes for doing expansions, 189 00:10:45,940 --> 00:10:48,360 so you optimize it five times, 190 00:10:49,020 --> 00:10:50,780 and you've got the original code. 191 00:10:50,960 --> 00:10:53,480 So, but hopefully by... 192 00:10:53,480 --> 00:10:55,640 It just adds, like, a little more complexity 193 00:10:55,640 --> 00:10:57,760 is really all I'm going for, 194 00:10:57,840 --> 00:10:59,920 is because you don't have... 195 00:10:59,920 --> 00:11:02,160 It's not as easy as this is automatically... 196 00:11:02,160 --> 00:11:04,540 You can't just have, like, a database of expansions 197 00:11:04,540 --> 00:11:06,700 and check that towards the code 198 00:11:06,700 --> 00:11:09,000 since you can randomly generate 199 00:11:09,000 --> 00:11:13,020 a fairly large amount of these expansions. 200 00:11:13,020 --> 00:11:15,540 So it wouldn't make sense to just use, like, 201 00:11:15,540 --> 00:11:18,500 a database of them, or just to have them 202 00:11:18,500 --> 00:11:20,700 so you can just brute force it or anything. 203 00:11:25,040 --> 00:11:28,180 And for using this technique, it's... 204 00:11:28,980 --> 00:11:32,060 Well, I'm still working on the engine, 205 00:11:33,280 --> 00:11:38,180 but for using it, I do believe it'll work 206 00:11:38,180 --> 00:11:42,180 because of adding these random opcodes in there. 207 00:11:43,440 --> 00:11:46,860 It will keep us away from just the standard 208 00:11:46,860 --> 00:11:49,420 and easy optimization and stuff, 209 00:11:49,540 --> 00:11:50,360 but also... 210 00:11:50,960 --> 00:11:52,860 Rather than just using a trash generator 211 00:11:54,860 --> 00:11:57,960 and combining the code of the trash generator 212 00:11:57,960 --> 00:11:59,340 with the expansions 213 00:11:59,340 --> 00:12:00,740 and not worrying about the shrinking, 214 00:12:00,960 --> 00:12:01,680 then you just... 215 00:12:01,680 --> 00:12:04,740 I got something that's exponentially growing 216 00:12:04,740 --> 00:12:05,980 generation to generation 217 00:12:05,980 --> 00:12:09,160 in comparison to actually being know how... 218 00:12:09,160 --> 00:12:10,500 to know how to shrink it, 219 00:12:10,600 --> 00:12:14,320 and therefore no longer having that exponential growth. 220 00:12:17,200 --> 00:12:19,080 And I realized this was... 221 00:12:19,080 --> 00:12:20,640 So I want the 20-minute presentation, 222 00:12:20,960 --> 00:12:21,200 and I want the 20-minute presentation 223 00:12:21,200 --> 00:12:22,340 of the questions that they just started doing this year. 224 00:12:22,520 --> 00:12:24,320 So I kind of... 225 00:12:24,320 --> 00:12:25,580 I just tried. 226 00:12:25,800 --> 00:12:27,600 I kind of went real quick through those. 227 00:12:27,800 --> 00:12:29,160 And I'd like to... 228 00:12:29,980 --> 00:12:32,360 I will put on the floor for questions if anybody... 229 00:12:33,220 --> 00:12:34,680 And so, for asking any. 230 00:12:34,800 --> 00:12:36,400 And I thank you for coming this morning. 231 00:12:38,420 --> 00:12:39,240 Any questions? 232 00:12:45,220 --> 00:12:46,100 All right. 233 00:12:47,040 --> 00:12:47,480 Thank you. 234 00:12:48,140 --> 00:12:48,580 Thank you. 235 00:12:49,100 --> 00:12:49,540 Thank you. 236 00:12:50,500 --> 00:12:50,940 Thank you. 237 00:12:50,940 --> 00:12:51,180 Thank you.