1 00:00:00,500 --> 00:00:06,500 >> All righty. The last talk of the day. Before we go to the closing ceremonies. With that, 2 00:00:09,167 --> 00:00:16,875 here is Svetlana and Ivan. >> So hi guys. I am a student at Moscow state university. My 3 00:00:16,875 --> 00:00:23,042 co-speaker is Ivan a Masters student at the same university as well. Today we're going 4 00:00:23,042 --> 00:00:30,042 present our work on shellcode detection for ARM based platform. We'll briefly discuss. 5 00:00:30,042 --> 00:00:44,875 After the we'll briefly discuss the one difference between two platforms. X86 and ARM. Because 6 00:00:44,875 --> 00:00:51,375 sorry. Nowadays it's well-known that we have a lot of shellcodes. A lot of shellcode 7 00:00:51,375 --> 00:00:57,375 detection, algorithm approach which web-based for catching shellcodes before the x86 8 00:01:00,292 --> 00:01:06,292 platform. Our research is mainly focused on if those methods are applicable (sic) to ARM base 9 00:01:10,417 --> 00:01:16,917 platform and how different between two platforms can possibly impact the structure of 10 00:01:16,917 --> 00:01:22,917 shellcode and some other features of shellcodes. So actually and what can we learn 11 00:01:25,500 --> 00:01:31,500 from it. So let's start. Okay so now we know that a lot of ARM-based devices increases 12 00:01:37,542 --> 00:01:43,542 significantly, actually we know that it's already a (inaudible) times on x86 platform. For 13 00:01:47,500 --> 00:01:53,500 example our cell phones and tablets, it's network devices, a lot of routers and controllers 14 00:01:58,125 --> 00:02:04,125 work on ARM based devices. So actually it's already laptops for example we know about and so 15 00:02:08,875 --> 00:02:15,375 on. We still have a huge space of code written in c and c++. So those codes we want to inherit 16 00:02:15,375 --> 00:02:26,417 from other systems. We want to reuse it somehow. So it contains a lot of vulnerabilities and 17 00:02:26,417 --> 00:02:34,250 we're talking about vulnerabilities. They're still there. Every time I speak about 18 00:02:34,250 --> 00:02:40,250 this problem, people who are interested in virus detection and so on and so on, I'm hearing 19 00:02:42,583 --> 00:02:48,583 one simple question, is this problem decidable at all? Because the world could have a 20 00:02:55,750 --> 00:03:01,792 huge variation of what it can do. So how's it possible to detect it. Answer is we, uhm, 21 00:03:01,792 --> 00:03:08,833 exploit certain vulnerabilities, like memory corruption vulnerabilities. We want to 22 00:03:08,833 --> 00:03:14,250 overwrite some pointers and these leads to some structure limitations and shellcodes. We 23 00:03:14,250 --> 00:03:20,250 will focus on that later. That's a simple example of shellcodes which focus on stack. So 24 00:03:26,125 --> 00:03:32,125 typically stack shellcodes have activator which can be presented by some kind of code which 25 00:03:34,667 --> 00:03:40,667 trying to understand its own location of the address executable process. So, if we 26 00:03:46,208 --> 00:03:52,208 want to (inaudible) detectors like signature based detectors so we want to our code somehow. 27 00:03:54,417 --> 00:04:00,417 So this way we typically have decryptor thee. That situation maybe it's not that bad itself. 28 00:04:11,250 --> 00:04:17,250 Because well since we know about the problem if I remember everything correctly modern for 29 00:04:20,000 --> 00:04:27,250 20 years already. So we have a lot of protection techniques. Like stack canaries, ourselves 30 00:04:27,250 --> 00:04:33,250 age, depth, so on. Probably we don't have problem but, unfortunately, it's all 31 00:04:39,750 --> 00:04:45,750 bypassed. But to our problem. We have as I mentioned before we have a huge base detectors which 32 00:04:51,542 --> 00:05:05,958 focus on detecting shellcodes on x86. So we have for platform, we have shellcodes, so they already 33 00:05:05,958 --> 00:05:18,000 exist in data repository such that exploit database and so. But unfortunately we don't have 34 00:05:18,000 --> 00:05:26,083 shellcode detection method that will be at least a little bit smarter than, like, simple 35 00:05:26,083 --> 00:05:32,667 signature based. So what are we going to do with it? First of all, as I mentioned before, we 36 00:05:32,667 --> 00:05:41,542 want to understand how two platforms differ from each other. Of course it is two 37 00:05:41,542 --> 00:05:49,000 different platforms and the number of differences is huge but we want to focus on those 38 00:05:49,000 --> 00:05:54,000 that can possibly impact how shellcode looks like. So let's briefly discuss it. First of 39 00:05:54,000 --> 00:06:21,167 all, the common thread in ARM platform is fixed and x86. In x861-byte from 16. Actually in 40 00:06:21,167 --> 00:06:28,542 ARM base platform we have 32-bit for ARM and 16-bit for some. So it's led to such techniques that 41 00:06:28,542 --> 00:06:34,125 self-synchronize or disassembly. So X86 it doesn't matter from which byte of stack we started 42 00:06:34,125 --> 00:06:38,250 to assemble our code. We certainly will have some point at which we will synchronize or 43 00:06:38,250 --> 00:06:43,833 disassembly. It will be it helps us to detect shellcode because it doesn't matter on each 44 00:06:43,833 --> 00:06:51,000 offset. But we can probably miss some significant destruction. So there's the ability we don't 45 00:06:51,000 --> 00:06:57,000 understand that we engage shellcode or something bad. So as I mentioned before, again, we 46 00:06:59,458 --> 00:07:05,458 have two different CPU modes. There's this ability to switch between them dynamically. So 47 00:07:07,500 --> 00:07:13,500 what -- in shellcodes we have already analyzed, I mean for ARM platform we have already seen 48 00:07:16,000 --> 00:07:21,250 this application. So, for example, you trying to disassemble your shellcode and 49 00:07:21,250 --> 00:07:27,250 your bit of data to ARM mode. So you have some signature on it. So you try to detect those 50 00:07:29,833 --> 00:07:35,833 signatures. If you switch to another CPU mode dynamically, you will break your signature. 51 00:07:39,958 --> 00:07:47,375 Simple application technique. Another interesting stuff there's this ability of 52 00:07:47,375 --> 00:07:53,292 conditional interaction applications. So in our platform we have several group of 53 00:07:53,292 --> 00:08:00,542 instruction and some of them can be executed or not executed. It strictly depends on the flight 54 00:08:00,542 --> 00:08:08,083 values. So speak about for example shellcode. When you are trying to construct your 55 00:08:08,083 --> 00:08:15,125 malicious payload from legitimate binary from piece of library here we're not speaking 56 00:08:15,125 --> 00:08:21,125 about it but it's some kind of same probably high level idea. So imagine totally legitimate 57 00:08:25,125 --> 00:08:31,250 executable. So, if you construct the executable from conditional instructions so you can have 58 00:08:31,250 --> 00:08:37,250 your malicious payload executable by, like, just by flight values. So to be honest 59 00:08:40,125 --> 00:08:46,625 we haven't seen that shellcodes yet but probably will see them in future. Because, again, for 60 00:08:46,625 --> 00:08:52,625 me it's very interesting. In this platform to have access to problem we have to have some 61 00:08:58,500 --> 00:09:04,500 kind of PC code. Here in ARM we don't have to do it, because there's this ability of direct 62 00:09:08,833 --> 00:09:16,333 access to it. In ARM we have lots of storage detection. So it isn't possible to access memory 63 00:09:16,333 --> 00:09:24,250 directly from arithmetic instructions. And function arguments and return addresses, 64 00:09:24,250 --> 00:09:30,250 go to registers, not stack. Both registers. What you can do with shellcodes. How we can run it 65 00:09:37,500 --> 00:09:45,167 because it's not in stack. Actually in ARM we have such functions, it will have some 66 00:09:45,167 --> 00:09:51,167 imbedded functions every second. And other functions registers go to stack. It's totally 67 00:09:54,500 --> 00:10:00,500 executable. Definitely. Here is a simple example of conditional execution. Conditional execution 68 00:10:02,833 --> 00:10:10,333 that was used in imbedded system. So it was used for compilation of programs because 69 00:10:10,333 --> 00:10:16,333 it was critical. In imbedded systems that limitation and memory limitation is very 70 00:10:18,750 --> 00:10:24,750 critical. But, again, as I mentioned before it's relatively new for application. Here is 71 00:10:27,708 --> 00:10:33,708 example of thumb CPU mode and ARM CPU mode, it is the same piece of code so we can see 72 00:10:35,875 --> 00:10:43,792 somewhat we can, again, compress our binaries and we have some free space to do everything 73 00:10:43,792 --> 00:10:49,792 else. Again, so we analyzed also for detection techniques which I use detection of shellcode for 74 00:10:54,667 --> 00:11:00,667 x86 platform. And here's, like, what we found. Static analysis is very difficult. Static 75 00:11:03,250 --> 00:11:11,208 analysis which we use for detection of x86 shellcode. Because if, for example, 76 00:11:11,208 --> 00:11:15,083 somewhat an analysis of functional flow graph instruction flow graphs, So it's 77 00:11:15,083 --> 00:11:21,083 very difficult in case for example of conditional executions to construct such functional flow 78 00:11:24,042 --> 00:11:31,625 graph. It's very time consuming. So it's not reasonable to use it here. Makes it all much more 79 00:11:31,625 --> 00:11:37,625 difficult. I mentioned it before. Okay. What's the next step? So we already have some 80 00:11:41,208 --> 00:11:49,000 on-going research on detection of shellcodes for x86 platform. Basically how we did it. We 81 00:11:49,000 --> 00:11:55,000 identified set of features which are typical for shellcodes. And features -- not features of 82 00:11:59,750 --> 00:12:06,292 code, it's not signature based. It's typically behavior based and it's trying to analyze some 83 00:12:06,292 --> 00:12:11,208 specific type of application which typically used by shellcode writers. Now we want 84 00:12:11,208 --> 00:12:17,208 to understand other features applicable to ARM base platform and can we identify something 85 00:12:21,375 --> 00:12:27,375 new. So here is the list of static features. >> Here is the list of shellcode features which 86 00:12:34,083 --> 00:12:42,000 could mark the shellcode. Half of the features came from x86 shellcodes and the remaining 87 00:12:42,000 --> 00:12:47,000 ones are the ARM shellcode features. So we'll run through this list of features and then 88 00:12:47,000 --> 00:12:52,250 check them on the examples of real shellcode. The first feature is correct disassembly 89 00:12:52,250 --> 00:12:59,292 of data. The point is that the shellcode is executable program. So it has a continuous chain of 90 00:12:59,292 --> 00:13:04,958 instructions. If you like this do a simple random data in chain of instructions with high 91 00:13:04,958 --> 00:13:10,958 probability, this chain will not have particularly (inaudible). We can assure that we see a 92 00:13:13,958 --> 00:13:19,917 shellcode. Second feature is one related to the shellcode for ARM. This represents the 93 00:13:19,917 --> 00:13:26,208 technique of writing ARM shellcodes. More than 80 percent of existing ARM shellcodes uses 94 00:13:26,208 --> 00:13:32,208 this technique. So it's a good feature. Another one tells the shellcode is trying to find its 95 00:13:34,917 --> 00:13:40,917 location in memory. This feature is changed x86 so-called feature. The Get-UsePC code. The 96 00:13:42,958 --> 00:13:50,542 difference is that we check not only in excess to information about location but also check 97 00:13:50,542 --> 00:13:56,542 how shellcode is used this information in functioning. Then features of problems which 98 00:13:58,792 --> 00:14:05,458 currently the system calls or library calls. Every shellcode is an executable program. So you 99 00:14:05,458 --> 00:14:12,625 need to make system codes with the right arguments. So we can use this as a detection 100 00:14:12,625 --> 00:14:19,542 characteristic. Another one tells the shellcode contains (inaudible). Shellcode can be 101 00:14:19,542 --> 00:14:33,917 encrypted and requires some functions to decrypt it. And to direct the control of flow to 102 00:14:33,917 --> 00:14:41,458 the shellcode payload. Next feature is (inaudible) which (inaudible). We can check the 103 00:14:41,458 --> 00:14:50,958 incoming flow or (inaudible). And the remaining ones are normal conditions for every 104 00:14:50,958 --> 00:14:57,250 shellcode. Okay let's see a few examples. First and the simplest feature is the length of this 105 00:14:57,250 --> 00:15:06,125 assembled chain. With a help of the feature we can distinguish random data from the executable 106 00:15:06,125 --> 00:15:13,500 code. Here you see the shellcode and random data. Then they were disassembled to a chain of 107 00:15:13,500 --> 00:15:24,292 instructions. Seems like the shellcode is longer than random data. So, if we want to detect a 108 00:15:24,292 --> 00:15:30,667 shellcode we should check the length of chain. Then some fresh code. But ARM code has a huge 109 00:15:30,667 --> 00:15:36,792 density. So random data could be disassembled in a long chain too. How can we find necessary 110 00:15:36,792 --> 00:15:44,875 threshold? The answer is the initial code is surrounded by random data and the data 111 00:15:44,875 --> 00:15:54,208 increase the length of the disassembled chain of the shellcode. So it's not a problem 112 00:15:54,208 --> 00:15:59,708 to find proper fresh code. The second feature. This is the most interesting feature, I think. 113 00:15:59,708 --> 00:16:05,333 This feature tells the shellcode you should change to ARM code. More than 80 percent of the ARM 114 00:16:05,333 --> 00:16:12,500 shellcodes on the web were created with this technique. What is this technique? 115 00:16:12,500 --> 00:16:19,167 Shellcode are written in thumb mode and at the beginning of the code the release a selector to 116 00:16:19,167 --> 00:16:27,875 thumb mode. For the change in CPU mode we need to make a jump to the address of thumb code and 117 00:16:27,875 --> 00:16:34,792 the rest of the IP address should be set into one. In ARM architecture code is linked byte 118 00:16:34,792 --> 00:16:41,625 for byte so we can use last IP address information. Let's take a look at the example. Here's 119 00:16:41,625 --> 00:16:52,583 the shellcode that you can download from Ex....com. At the beginning of the shellcode we 120 00:16:52,583 --> 00:17:02,292 have the graphics which takes the code with write in it to a six register and add in as one 121 00:17:02,292 --> 00:17:09,250 which is thumb mode number. Next instruction is branch instruction. Which makes the 122 00:17:09,250 --> 00:17:15,750 switch between CPU modes and jumps to the thumb code. This technique is used for making 123 00:17:15,750 --> 00:17:22,250 shellcode smaller or to provide more functionality in the same size of a buffer. Because the 124 00:17:22,250 --> 00:17:27,708 length of ARM instructions is four bytes and some instructions is two bytes. So the code is far 125 00:17:27,708 --> 00:17:32,250 more compact. This way more than 80 percent of the shellcodes have been created in this way. 126 00:17:32,250 --> 00:17:38,000 But it is not to the size of shellcode it can go further. He can use this technique before 127 00:17:38,000 --> 00:17:44,833 application. One can divide the code into small parts and write every part in some process or 128 00:17:44,833 --> 00:17:52,542 mold that is different for preceding part of the code. So, if we try to disassemble these 129 00:17:52,542 --> 00:17:59,792 from every step, every instruction chain will be small. Because instruction for one may 130 00:17:59,792 --> 00:18:06,917 not be to disassemble construction for another processor mold. But the attacker 131 00:18:06,917 --> 00:18:15,458 still needs to produce switching between these molds. So every disassembled chain should 132 00:18:15,458 --> 00:18:23,042 contain this switch routine. Thus we may check instruction chains or this chains. The next 133 00:18:23,042 --> 00:18:30,375 feature, Get-UsePC Code. In x86 the code was a normal feature because there's no access to 134 00:18:30,375 --> 00:18:36,875 problem count register. So we used different methods to get it. For example we could call 135 00:18:36,875 --> 00:18:42,208 function then the other return address from the stack. This method gives us a certain 136 00:18:42,208 --> 00:18:48,917 fingerprint in the control flow graph which can be detected with control flow graph analysis. 137 00:18:48,917 --> 00:18:57,750 Unfortunately in ARM we can direct the get program counter register without any 138 00:18:57,750 --> 00:19:05,250 redirections. That is to say the existence of the code could not be proper detection. So we can 139 00:19:05,250 --> 00:19:14,167 later GetPC feature to get and usepc the feature. What is this feature? This feature tells 140 00:19:14,167 --> 00:19:22,000 there was an excess to problem count register then it was used in load, store or jump 141 00:19:22,000 --> 00:19:29,292 instructions. Let's take a look on the example. Here is a shell project (inaudible). The first 142 00:19:29,292 --> 00:19:36,958 instruction puts address of the last decrypted instruction to x86. Then used to make a jump to 143 00:19:36,958 --> 00:19:44,458 the bl instruction. Here is the pattern we need. Then the program counter is written to 144 00:19:44,458 --> 00:19:57,000 the link register with the use of the bl instruction. Because the bl is a function code and 145 00:19:57,000 --> 00:20:00,750 the rest is LR register. So LR was the shellcode. This way you use three things. To get another 146 00:20:00,750 --> 00:20:04,083 encrypted word, to put the decrypted word back and to jump to the start of the of the 147 00:20:04,083 --> 00:20:10,333 decrypted shellcode dialogue. How do we define the ARM specific code? We define it by 148 00:20:10,333 --> 00:20:17,458 running an extra execution. We forward the instructions but don't make iterations on the 149 00:20:17,458 --> 00:20:23,750 registers. But our register has two Boolean values. The first value means that this register 150 00:20:23,750 --> 00:20:29,667 has been initialized by a counter value. For example, if we put constant in our zero 151 00:20:29,667 --> 00:20:34,542 register, it becomes initialized. The second value shows that this register is 152 00:20:34,542 --> 00:20:40,583 somehow in directly referred to the place of shellcode in memory. How we define it? If 153 00:20:40,583 --> 00:20:51,833 there were iterations that put program count to the register, this register started to point 154 00:20:51,833 --> 00:20:55,750 to the rest of some part of the shellcode and the second Boolean value becomes true. Then if we 155 00:20:55,750 --> 00:21:01,833 make preparations at this register and if all arguments of the separation are initialized 156 00:21:01,833 --> 00:21:10,083 registers for constancy, the register remains in direct iteration on the shellcode on 157 00:21:10,083 --> 00:21:16,708 the stack. Otherwise this register becomes uninitialized. Next feature is the existence of 158 00:21:16,708 --> 00:21:23,792 character form, system calls or library calls. This means that arguments of this cause should 159 00:21:23,792 --> 00:21:30,958 be initialized. Let's consider the parts of the shellcode from the framework. Here we can see 160 00:21:30,958 --> 00:21:39,000 some system calls. How we use system call in ARM. All registers i0 to i6 use arguments 161 00:21:39,000 --> 00:21:48,250 for system call. And a sound register keeps the (inaudible). To understand that we've got a 162 00:21:48,250 --> 00:21:52,917 current system called we need to check that some arguments have been initialized and some 163 00:21:52,917 --> 00:21:57,125 register has been initialized, too. If we wouldn't check for this and only check the 164 00:21:57,125 --> 00:22:02,292 existence of system call the precision of our detection would be critically small. Because 165 00:22:02,292 --> 00:22:09,708 there is a big probability to disassemble the system call somewhere in random data. This 166 00:22:09,708 --> 00:22:17,625 call is only for byte value. So, if we have a lot of this system call bytes we should not be 167 00:22:17,625 --> 00:22:25,625 interpreted as a shellcode. Seems that our feature already works twice. As you can see here 168 00:22:25,625 --> 00:22:31,917 calls socket connect and there will be more following. The existence of read, write cycle. 169 00:22:31,917 --> 00:22:37,833 This feature tells the decrypted routine should have the cycle that can always load and store 170 00:22:37,833 --> 00:22:46,000 instructions. Because this routine should load encrypted payload from memory. Decrypt it 171 00:22:46,000 --> 00:22:53,000 and put it back. Let's consider the shellcode decrypted from (inaudible). We put the count on 172 00:22:53,000 --> 00:23:01,250 the cycle and with the use of r14 we ran the shellcode where the shellcode will be executed. 173 00:23:01,250 --> 00:23:07,667 In this instruction we put the value of the program count from the register. So it refers to 174 00:23:07,667 --> 00:23:19,208 the shellcode. We see the cycle and it covers two instructions, load and store. We make some 175 00:23:19,208 --> 00:23:25,833 limitations on this feature. All registers that I use to load and store instructions should be 176 00:23:25,833 --> 00:23:31,750 initialized. So we have to use the same abstract execution technique that we have seen 177 00:23:31,750 --> 00:23:39,125 previously. If there was not such a limitation it will be more than 50 percent of false 178 00:23:39,125 --> 00:23:46,083 positive degree. Because sometimes the random data has cycles. This can waste a lot of 179 00:23:46,083 --> 00:23:53,208 data that may contain log and store instructions. But if these registers were initialized only 180 00:23:53,208 --> 00:24:01,000 then we will be able to mark the degree. Another interesting feature is the existence of 181 00:24:01,000 --> 00:24:08,292 return address zone. The return address zone is the ridge of very useful addresses. These 182 00:24:08,292 --> 00:24:14,083 addresses should be valid because they direct the control flow to the shellcode. So this 183 00:24:14,083 --> 00:24:20,750 return zone should allow execution of instructions. Otherwise we will get an excess 184 00:24:20,750 --> 00:24:26,708 violation. On the example we see how the shellcode overflows the buffer to derive this return 185 00:24:26,708 --> 00:24:35,542 address. So, if we check the data for this valid address results we can detect shellcode. 186 00:24:35,542 --> 00:24:47,042 This is a very simple technique. Almost all features that we review earlier have (inaudible) 187 00:24:47,042 --> 00:24:50,708 to the dynamic detectors. The dynamic detectors are identified in the virtual environment. We 188 00:24:50,708 --> 00:24:55,083 run an emulator then run the shellcode in the emulator to identify these features. We can 189 00:24:55,083 --> 00:25:01,375 the last malicious system use of program count to register, switch to different processor 190 00:25:01,375 --> 00:25:07,792 models with that emulator. It will have more accuracy but will also will have more complexity. 191 00:25:07,792 --> 00:25:14,542 To arrange and combine the (Inaudible) static and dynamic detectors, we come to the idea 192 00:25:14,542 --> 00:25:21,542 of (inaudible) that will be explained a bit later. Now let's consider the features that can 193 00:25:21,542 --> 00:25:29,625 be examined only in dynamic analysis. The read and write from memory which marks the 194 00:25:29,625 --> 00:25:35,583 decryptor. We run a shellcode and we see that the end number of reads and he also did the end 195 00:25:35,583 --> 00:25:41,208 number of writes. You may assume this is a shellcode which has read some payload, decrypted it 196 00:25:41,208 --> 00:25:48,083 and put it back on the stack. Therefore to understand that we've got a decryptor routine we 197 00:25:48,083 --> 00:25:54,333 should count the number of reads and writes and compare them with the fresh value. A very 198 00:25:54,333 --> 00:26:02,083 important point. We count the number of the unique memory reads and writes. I mean, the 199 00:26:02,083 --> 00:26:05,792 number of memory where reads and writes were done. If we didn't do that, then maybe random data 200 00:26:05,792 --> 00:26:16,208 which has an endless cycle which writes only one byte in the same place. By all indications this 201 00:26:16,208 --> 00:26:23,500 is not a decryptor. Another decryptor feature is providing control flow to the shellcode 202 00:26:23,500 --> 00:26:28,625 payload. After decryption the routine should make a jump to the start of decrypted 203 00:26:28,625 --> 00:26:33,833 shellcode. Thus we need to check there was a jump to addresses where the writes were done 204 00:26:33,833 --> 00:26:40,083 before. And we also take into account the number of these writes should exceed the write 205 00:26:40,083 --> 00:26:48,333 number of fresh code. But this could not be only jump. It could be every automatic instruction, 206 00:26:48,333 --> 00:26:55,000 because we can directly move the address to the problem count register. We run this end 207 00:26:55,000 --> 00:27:06,708 emulator so we need to check on the value of the PC register iS equal to address where the 208 00:27:06,708 --> 00:27:11,542 writes were done before. Here is an important example why the dynamic method get complicated 209 00:27:11,542 --> 00:27:16,792 in the ARM architecture. ARM architecture provides additional execution. This means the 210 00:27:16,792 --> 00:27:23,125 instructions can be executed or ignored depending on the flight register value. This provides 211 00:27:23,125 --> 00:27:29,125 bi-conditional suffiz in the instruction. For example, we have two emulations of one 212 00:27:29,125 --> 00:27:36,375 program with different enter conditions. At first, there is a block of the instructions with 213 00:27:36,375 --> 00:27:43,792 the AL suffix. Provided this instruction will be executed with all register values. So it 214 00:27:43,792 --> 00:27:51,833 seems that this block will be executed in both emulations. Then we have instruction with 215 00:27:51,833 --> 00:27:58,458 the not equal suffix. That means that this instruction will be executed only when zero flag set 216 00:27:58,458 --> 00:28:05,083 to 1. So the instruction will be executed only in second emulation. There we see the 217 00:28:05,083 --> 00:28:13,417 suffix. This means this instruction can change the flags register value. In the second 218 00:28:13,417 --> 00:28:19,792 emulation, flags become zero and one. Then we have the CS block, it works when C is set to 1. 219 00:28:19,792 --> 00:28:26,833 After the block there is empty NE with instructions that executes only when zero flag is 220 00:28:26,833 --> 00:28:34,625 set to zero. This block change the r3 and r4 registers. So the next ACCS instruction that 221 00:28:34,625 --> 00:28:41,417 executes in both emulations give different result. I mean, the same instruction in the same 222 00:28:41,417 --> 00:28:49,792 place gives different result in different emulations. This example means that we can now 223 00:28:49,792 --> 00:28:58,167 work initial values of the flags register, use at start of emulation. So we should emulate 224 00:28:58,167 --> 00:29:04,375 the same code 15 times. Because we have 50 conditions in the ARM architecture. If we want to use 225 00:29:04,375 --> 00:29:10,792 only the dynamic detectors we should emulate the same code from every off set. Because 226 00:29:10,792 --> 00:29:23,417 shellcode can be anywhere in the analyst data and that affects the performance of detection. 227 00:29:23,417 --> 00:29:34,500 So, if we want to wisely use all the features together we should make that hybrid classifier. >> 228 00:29:34,500 --> 00:29:42,417 I talked in depth in simple (inaudible). So of course we don't want to throw away all 229 00:29:42,417 --> 00:29:54,417 research approaches which were done on software detection. So, basically, we want to combine 230 00:29:54,417 --> 00:30:03,375 them in some of multiplier. But that characteristic that we mentioned before. They provide a 231 00:30:03,375 --> 00:30:09,667 good distinguish between legitimate flow. So what I mean? So we implemented all the 232 00:30:09,667 --> 00:30:17,792 features at the code detection library. So each and every vertex in the graph means that 233 00:30:17,792 --> 00:30:26,167 it has some classifier or some specific feature of code. So each vertex says that it's 234 00:30:26,167 --> 00:30:33,417 probably shellcode we would transfer it to their adverse one. So the main idea here is to 235 00:30:33,417 --> 00:30:40,375 put the simplest detectors at the top of the list of detectors on top of that. So that help us 236 00:30:40,375 --> 00:30:48,083 to, like, you know, reduce legitimate flow as fast as possible and to analyze with 237 00:30:48,083 --> 00:30:51,958 dynamic methods or with existence compilation methods which works and are sometimes 238 00:30:51,958 --> 00:31:03,917 time consuming on top of the (inaudible). Run it on the most probable shellcode. So this 239 00:31:03,917 --> 00:31:09,792 works like decision making tree. And after that all information collected on decision making 240 00:31:09,792 --> 00:31:14,458 models which says that it's possible shellcode. And it's classified shellcode. By 241 00:31:14,458 --> 00:31:22,458 classifying shellcode I mean that we are able to say that this shellcode is shellcode 242 00:31:22,458 --> 00:31:29,458 because it has, for example, no threat. This shellcode we believe that this piece of data 243 00:31:29,458 --> 00:31:36,833 shellcode because it have some certain type of classification and so on. So as I mentioned 244 00:31:36,833 --> 00:31:51,000 before our previous work was focused on the shellcode detection for the x86 platform. 245 00:31:51,000 --> 00:31:53,583 So we implemented it as open source shellcode detection tool called Demorpheus. Well here we 246 00:31:53,583 --> 00:32:00,833 extended it for model which works with shellcodes for ARM. So our experiment wasn't for 247 00:32:00,833 --> 00:32:12,375 data set. It was shellcodes which were collected from public depositories and (inaudible) as 248 00:32:12,375 --> 00:32:20,083 well. So we were also testing on legitimate binaries because all of the shellcode detection 249 00:32:20,083 --> 00:32:34,000 methods works -- doesn't work really good on legitimate binaries. They have a lot of 250 00:32:34,000 --> 00:32:36,542 positive. So it was also random data like the collect normal traffic of normal user working 251 00:32:36,542 --> 00:32:41,292 on the system. And again it was lead -- we collect multimedia because shellcode detection 252 00:32:41,292 --> 00:32:45,542 algorithm which exist right now worked really bad on multimedia. Our experiment shown on the 253 00:32:45,542 --> 00:32:58,542 current slides. And this is result on throughput. Again we used a simple laptop. (Applause) 254 00:32:58,542 --> 00:33:04,542 >> Hi! >> Excuse the interruption. We have a tradition. A new tradition. 255 00:33:22,333 --> 00:33:25,083 (Laughter) You like that right? 256 00:33:25,083 --> 00:33:30,000 No, no you're part of the tradition. Come back over here. So this young lady's a new speaker. 257 00:33:30,000 --> 00:33:42,333 What do we do with new speakers? What do we do with new speakers? (Shouting) 258 00:33:42,333 --> 00:34:16,083 >> There you go. >> I'm sure they just heard me on the moon. 259 00:34:16,083 --> 00:35:12,792 >> How about some love for the new speakers? (Applause) It's much more fun now. 260 00:35:12,792 --> 00:35:26,583 >> Actually, he drinks for the first time. >> Oh yes. (Applause) 261 00:35:26,583 --> 00:35:33,542 Reproduced on applications for Android smartphone. The version of Android 262 00:35:33,542 --> 00:35:39,333 is 2.3.3. The vulnerability is a simple buffer overflow and it hides 263 00:35:39,333 --> 00:35:46,958 In the dynamics delivery that is loaded through the Java interface to our caption 264 00:35:46,958 --> 00:36:11,833 We wrote exploit for vulnerability and exploit and use the shell as a payload 265 00:36:11,833 --> 00:36:40,792 We adjust the parameter of exploit and -- just a second. 266 00:36:40,792 --> 00:36:52,042 >> And here we made the tool to (inaudible) the incoming and outgoing traffic. Okay. 267 00:36:52,042 --> 00:37:07,000 Here we see the tool found the shellcode in outgoing traffic for this IP address and TCP port 268 00:37:07,000 --> 00:37:11,875 >> Again, it works surprisingly well on the simple heuristics 269 00:37:11,875 --> 00:37:14,625 but, again, as I mentioned before we used sophisticated 270 00:37:14,625 --> 00:37:20,583 algorithms which ran on applicator shellcodes. So thank you guys 271 00:37:20,583 --> 00:37:31,042 for your attention. Thanks for being for the very last talk. So we really appriciate it 272 00:37:31,042 --> 00:37:39,708 (Applause) 273 00:37:39,708 --> 00:38:01,042 As far as I can understand Q & A session will be in the lobby. Yeah. Okay. (Applause) 274 00:38:01,042 --> 00:00:00,000 Thank you.