I'm a reverse engineer. I work for a security company, or for a company in Germany called Sabre Security. We do obscure reverse engineering tools for niche markets. And I'm going to give one of the oddest talks I've given in my life, mainly because this talk will not actually present any solutions to anything, but mainly list a bunch of things that I think are not that hard to solve, but haven't been publicly solved yet, and things that I would like to see solved. It will also include a few problems that are a bit more difficult. All right, so this talk is quite different from the other talks I've given. No bugs, no new tools, no solutions, mainly a wish list of things that I would like other people to solve, or that I will work on at some point, I just don't know when. Secondly, ideas. For many of the problems that I'll be presenting, I'll have a vague idea of how to do this. This idea is most likely going to be completely wrong, and thoroughly misleading, so take them with a grain of salt. All right, I think I'll just start. Now, reverse engineering has grown quite a bit over the last few years, and perhaps we should start understanding or trying to understand what reverse engineering means. And in order to understand reverse engineering, we first have to understand engineering, because reverse engineering obviously is the inverse process of engineering. So when you engineer, then you have a problem, you define a problem, and then you design a system consisting of multiple components and their interaction. And then you construct these components, or you buy them, or you steal them, or whatever. And then, finally, you integrate them, make them all work together, and hopefully your problem is solved. So in software, this means that the source code that you actually compile is the last step of a concretization process, where you start with an abstract design, an abstract understanding of your problem, an abstract understanding of the solution you want to build. And then you build it on the source level, and that is really, like, once you have the source code, that's the last step of the engineering process. Then it's just compilation and running, testing, selling. So I have to work in a few jokes to compete, I guess, but I'm very bad at this being German. So the engineering process is not only producing the final output. Like, when I engineer or build a car, I don't only get the car in the end. I get a whole bunch of high-level design. I get interactions between the cars. I get interactions between the components. I get specifications for the components, and so forth. So the engineering process produces way more than just the source code or the final problem. It produces an understanding of the problem or of the program that we're building. So, well, everybody of us who has been involved in engineering at some point knows that the actual process of building something is a lot messier than what I just described. This does not change the fact that even if I just puke a bunch of code into a file somewhere, it doesn't change the fact that the actual process of building something is as successful What I want to show you today is theimentation. If I have to go back and fix a problem, I one idea. But if I have to go back and fix the problems from a concept or a concept. I can do both. Ok. As a result, a lot of the problems were solved. The problem is that it was really hard to fix. So the problem is that it was just afraid of people because of the results of the input. So what if I was to go to a computer and I was to go to a computer and it's not working well? I was going to follow it, I was going to go to a computer that was at the start first step, but really, well, reverse engineering is way beyond that. Just given a large, large set of disassemblies, you don't really understand anything. So a good disassembler is, of course, something that you absolutely need to understand more, but it is not the end goal. Like, having a clean disassembly cannot be the end goal of reverse engineering. A good disassembler should recover all the functions in the executable and which function calls which other function and properly or mostly properly separate data from code. So secondly, what is not reverse engineering? A lot of reverse engineers think that decompilation would be the holy grail of reverse engineering, but honestly, decompilation cannot be the end goal of reverse engineering either because, as I just described, we start in the engineering process at a very high level and then whittle down to have source code and then compile. So the source code is already like the last step of the engineering process, which means that recovering source code does not recover any of the high level abstractions. If I give you the source code to Oracle now, you have no clue of how the different components interact and fit together, so I might as well just give you the assembly. This scales upwards because I don't think anybody at Microsoft really understands Vista or anybody really understands any larger piece of software. So there's a big difference between decompiling something and really understanding it. If I have all the... Like, if I can... If I can completely disassemble or take apart a car and have all the pieces there, I still have no understanding of the rationale behind the design of each individual component and I have no understanding necessarily of how an engine works. All right. So the really broad definition of reverse engineering would be recovery of high level abstractions and program understanding. So ideally, we should try to, given an arbitrary executable, well... Reconstruct the things that a good design process would have had, like remodularize the functions, just get one bit of functions in the relations. Separate them into modules. Build things that help us understand the program. Of course, for most of us, bug finding is the primary target. Like, why would we need to understand the program in order to find bugs and so forth? So the thing is that, realistically speaking, I don't know if it's going to be two years or five years or ten years or twenty years. But at the moment, I'm going to say roughly but out-of-bounds memory access will be gone at some point. Just gone, gone. I mean, the A340 avionics code was verified with a static checker that works soundly and proven to be free of out-of-bounds memory access. And that's 110,000 lines of code and multi-threaded. So that's a fair achievement. Now, scale this 10 years into the future and you can see that most things that are critical will be verified to be free of out-of-bounds memory access. So anything, any bugs that we want to have in order to break systems will require us understanding the system and then finding ways that it was misdesigned or there's flaws in the logic and so forth. So we will need these things a few years down the line. So what does software really consist of? And what would be a proper way of abstracting like a bunch of functions that you just get thrown into your face into something that makes more sense? Well, one possible abstraction would be that an application is a set of modules. Like you have the network interaction module, you have the packet parsing module, you have the authentication crypto module, and so forth. And these modules interact with each other and they interact with the operating system and they're strung together to form an application. So what is a module in itself? A module is a set of functions and a bunch of these are being, well, exported. So you don't call every function in a module. You call a number of predefined APIs and they act as gateway nodes basically in the core graph. Meaning, in order to reach most of the functions of the module, you pass through a relatively small number of well-defined interfaces. So you have the external interface, external functions. And then you have external data structures, which are data structures that the module uses to communicate with the outer world. And then you have the second set. You have the internal functions. Functions that are never actually called from the outside are only called through the gateway nodes. And these functions might have a set of internal data structures which are used only internally to that module. And in, well, the idea would be that, well, the idea would then be to try to recover these structures. So we just assume that somebody is somewhat sane in the process of building software. And we then look at any book on design principles. Since I don't own any books on design principles, I had to use a book on source code auditing that Mark Dowd and John McDonald have written. Excellent book, pre-ordered on Amazon now. It's great. And there's two principles that should, well, apply to modules. One is loose coupling. Not, well, whatever. I know what you people are thinking. Which means that modules should communicate using very, very few well-defined interfaces that do clear input sanitization and so forth. Secondly, strong cohesion. Modules should provide functions that operate on very much related tasks. So it would be interesting if given an executable, we could decompose the executable into modules that exhibit, well, loose coupling and strong cohesion. In a situation where you look at OOP code, stuff gets a lot easier. Just, well, OOP, we have objects. We can reconstruct classes from the executable. We can reconstruct class hierarchies from the executable and so forth. So once we can do that, we have a lot of the abstract architecture already recovered. So factually, I think that reconstructing higher level design patterns or higher level, getting a higher level understanding of executables might actually be easier in the object-oriented case. Than in the standard C case. Just because more of the higher level design thinking is still present in the executable. All right. So the thing is that reverse engineering is in some aspects stuck in the 80s. What I mean with that is not very bright colors and shoulder pads in your jackets. But what I mean is reverse engineering is a really, really small community. And most of it has been done in secret or has been done by government agencies and so forth. So we have on one side the development like software development. And that's like a huge industry. And they do all this crazy research into how to build better tools. You have these round trip engineering tools which generate code from your UML diagrams and UML diagrams from code and so forth. And on the reverse engineering side, we have EDA. And not so much else. Or not so much in addition to that. So the reverse engineering scene has grown a lot in the last few years, which means well, it's just crazy these days. The fact that I'm standing in front of a room of these many people who seem to have a cursory interest in reverse engineering at least is already showing that the industry is growing a lot. And we now have more reverse engineering tools that are coming in like H.P. Garry's Inspector and Pedram's PyME or Bindif and Binnavi, the two products which we're selling. But all these products are really, really niche and really tiny in their reach. But because reverse engineering has been growing so much it might be possible that we finally get some real research and development money flowing in from somewhere. And what I'll do in the following now, I'll name ten research problems that, well, for most of them I think that they can be solved using moderate amounts of time and money investment. For some of them, I don't know. Well, many of the problems that I'll be presenting will be NP-hard in the general case. But luckily enough, I've never met the general case. So don't be turned off by that. A very, very simple first challenge. It's so simple that it's got the number zero. It's really, really not that difficult. I find it surprisingly useful to have a program that, given a set of functions, generates me for each function the set of possible return values of that function. So you just see a sub-function call and you see that this function can return plus one, minus one, zero. You can almost deduce that this is a comparator of some sorts. And you get a function that returns minus one or the return value of malloc. You know that minus one signals failure of malloc. Things like these. This is really, really trivial and can be done in a few hundred lines of Python. So let's go on to something more interesting. Something that we really want is full executable data structure reconstruction. Given an executable, reconstruct all data structures that are used in this executable. Just get me all of them. Secondly, reconstruct all the points-through relations between the data structures. Meaning, if possible, try to recover nested data structures. And whenever you have a structure member pointing to another data structure, include that in your, well, recover this relation as well. Finally, once you're done doing that, construct a graph consisting of the data structures. Every data structure is a node. And whenever a data structure contains a class member or a data structure member pointing to another data structure, add an edge. This graph will immediately tell you a lot about the relations of data structures in that program. You'll immediately see recursive data structures such as graphs and trees. You'll be able to very much understand what is going on a lot quicker. This would even be useful on the source code level. And there it's really trivial to generate. Yeah, so, I think this is relatively easily doable. I think it's even doable for venture capital backed companies. Which means it's not difficult. And it's definitely doable for anybody who does not run after cheap money. Alright. I even have a little bit of pseudo code which might or might not work if you build this. A very, very rough algorithmic sketch. So you iterate over all functions in the executable and you find all the memory cells like the separate memory cells accessed in that function. You retrieve the offsets for these separate memory cells and you create a data structure for that. So basically in each function for each memory cell you get a data structure. What you do then is you iterate through the entire executable and build prototypes for function call arguments from the data structures that you've just recovered. So basically you iterate over all functions in the executable and merge data structures that are passed. So if I have like a function prototype as my local data structure in this function is being passed in as first argument and you have a parent function which says well, the local data structure there is being passed as first argument to that sub function you merge the two. And you iterate that and in theory you should be terminating this after n half iterations where n is the maximum depth of the call graph. Alright. Well creating the graph of relations now after should be really, really easy so I won't talk too much about that. So let's go to challenge two. Given an executable, don't only reconstruct the data structures but reconstruct classes then associate functions to the classes, so recover all the methods and reconstruct the inheritance hierarchy between the classes. Finally create UML diagrams from the executable. Merge the UML diagrams with the type info generated in challenge one and you have something that will at least allow you to understand large object oriented programs a lot more quickly than what we can do now. I very much think this is doable. You might be to a certain extent compiler specific although I have yet to see a C++ compiler that doesn't build objects in the manner that putting like we put a V table at the first data member and then pad stuff at the end and so forth. There's in fact a striking convergence of compilers towards like a sane optimum for implementing C++ language features. So I think this is definitely doable. So just a few ideas on how to do what. You can glean the inheritance relationships between classes by looking at the constructors meaning I have a constructor it passes my this pointer on to another constructor I can usually if there's V tables present infer that my current class is being derived from the other class. Recovering the virtual methods while you have V tables that should not be too difficult. Recovering regular methods would imply doing a bunch of data flow analysis so that might take time and might be a bit more difficult. The amusing thing is that once you've done this you can very very cheaply build a runtime object editor. So what you do then is you scan through memory to find V tables like V table pointers and every time you find a V table pointer you know there's a class instance here and then you can just because you've reconstructed the types provide the user with an editor where he can run runtime edit the contents of the individual class instances in memory. Alright. This is definitely doable. I think the hardest part of this is going to be improving on silly obstructionist patents which have been put there by companies backed by venture capital. Sorry I'm alright. So challenge number three decomposing executables into modules. Given an executable not written in an object oriented manner decompose it into modules. Find all functions performing a similar task. The modules should reflect loose coupling and strong cohesions and you should try to minimize the number of external like of exported functions. Separate the data structures within these modules into internal and external data structures. Now I really have no idea at all how to do this. I have a bunch of rough ideas that might be starting points but really don't know how to proceed from there. Approach number one would be calculate trees on the call graph mainly because you will thus find like the nodes in the dominator tree once it's constructed which have a very high odd degree will reflect gateway nodes meaning nodes that dominate many other nodes meaning nodes that well through which you have to pass in order to reach other functions. So these would be candidates for gateway nodes to separate a call graph into individual modules. Approach number two might be consider this an optimization problem. Try to decompose the call graph into strongly connected components by removing a minimal number of nodes. This would be equivalent to or not equivalent but this would be similar to trying to find the gateway nodes. Approach number three would be try to group the functions not by the call hierarchy but by having them operate on the same data structures. So if you know that this set of functions here all operate on a set of data structures, group them together. A rough idea for this would be for every data structure in the executable look at the set of functions operating on this data structure. Then try to choose a set of functions that minimizes the number of nodes while maximizing the number of subsets operating on data structures which we've just described. That might work. I don't know. You will probably need some sort of fuzziness and configurability for this because it's not a problem where you have a very discrete solution space where you can say okay now this is the right solution and this is the wrong solution because we're speaking about decomposing things into something that appears logical to a human observer. Alright. Challenge number four. Recovery of template generated code from the executable. Well templates we've all seen them. They tend to generate a lot of duplicate code because essentially every time you instantiate a template with a new type all the functions for that template will be duplicated in the executable. So you'll get like 50 variants of the same function which only differ in, well basically in subsets and call targets. And that just means that you have a massive explosion of code size and we as the reverse engineers should not be bothered with having to see oh I've read this before. Like we can programmatically tell now this function really is the same as the other function. It's just changed a few offsets, right? This should be very, very, very easy in most cases. The only cases where I can imagine complications with this is if somebody starts, like if the compiler starts inlining some functions of the template and doesn't inline others. I don't know. This depends on the madness of the compiler. I would assume that in most cases it's going to be very, very easy. Alright. Perhaps with like bindiff style structural comparison and then a little bit of semantic tracking thereafter. Okay. Challenge number five. Now this is my favorite one and it's also probably one of the hardest problems I can imagine. In fact I have a very hard time imagining a problem that is more difficult than this. The problem is given a location t in the executable we want to reach a well, we are given a location t which is our target location and we're given a location s that is our source location. We know how to get to s because, I don't know, we've traced the application we know we're here. And t is where our bug is. Now we would like to automatically construct input to reach t. And yeah. So that is difficult. And to make things a little bit more interesting we do not only want one input to reach t. We want a description of the set of all possible inputs that reach t. So that is going to be a bit tricky. In the general case this is this is three set and thus NP-hard and we can basically forget about it. As I said you never ever actually run into the general case but we shall see. The first obvious idea which has been explored by Sherry Sparks and her co-researchers is to use genetic algorithms for this. Because you have a very very easily measurable fitness function. Meaning you can measure the distance to your target node which means that for any input you can say okay now this came this close to my target node, this came that close to my target node. So it's really ideal for genetic algorithms in that sense. I saw the talk of Cunningham, Hamilton, Sparks at Black Hat. It was a good talk. I personally am not totally sure whether genetic algorithms will be the way to go for all of it. Mainly because you only get one solution to reach a certain place and you don't know which fields you can change which will not invalidate your sample. Because consider the fact that you want to overflow something and now you have reached a location and you still need to know whether you can actually put, like you still need to trigger that bug so you will need to modify your sample thereafter and I don't know, I have my doubts. Then again my idea is completely crazy so I don't think that anybody is crazy enough to pick up on this. The idea with this would be to model a path for the executable as an equation system mixing modular arithmetic, meaning modular 2 to the power of 32 and the Boolean functions XOR and OR, NOT and ROAR. We would basically transform a path for the executable into a satisfiability problem. Or alternatively into a set of possibly very large polynomials over GF2 which is the field of 0 and 1 where all the unknown bits are the inputs. And then we try to solve either the equation system or the satisfiability problem. Rotate right or rotate left, just bitwise rotation. If you find a general way to solve these equation systems, you've got MD5 and SHA solved so there won't be a really general way for solving arbitrary equation systems like this. They're equivalent to 3SAT. Alright, so for the satisfiability stuff we can use published SAT solvers. These things have gotten relatively good, like they can solve satisfiability problems with a few million variables by now. So perhaps they might be able to solve our path problem. What I've been mostly experimenting with was using OBDD style algorithms. OBDDs are special data structures with which you can represent functions that map from a series of bits like from a bit string to 0 and 1 and can thus be used for representing very large data sets. And what I have gotten solved so far is solving equation systems that don't involve multiplication and rotation. Like if you only have addition and Boolean functions, I can solve the equation systems. Can't deal with multiplication or rotation yet, so oh well. There's going to be complications for all of this. There's another very, very nasty edge to the problem which is it's not enough to craft input for one path because most paths will not only be dependent on user input but on program state which means in order to exercise a certain path you first have to authenticate or you first have to send a different packet which leads to the fact that you basically have to determine okay now which state, like what for example, what state is the program in here and how can I get that program to that state. So if they test for like are we in state number 2, then I have to find out whether setting state to 2 and then try to exercise the code path to go to state 2 and so forth. So this can very easily go massively out of hand. Oh well. Um enough of number 5. Number 5 is really, really a bitch in every way. Like it's just hard. Challenge number 6. This is going to be a little bit easier. Trying to automate the analysis of translation and emulation based obfuscators. Um, well code obfuscation is getting a bit boring. 96 was the first time that Soda Designer published a CrackMe which was based on a virtual machine where you basically created a CPU and paper, wrote an emulator, wrote the CrackMe in the instruction set, executed it. Very, very, very difficult at the time to take apart. And these things have gotten boringly common by now. And there's no generic methods to analyze these things. And let's not kid people into thinking that these things are actually hard to take apart. So a good research topic would be try to build a framework which allows the rapid analysis of VM based obfuscations. Um, and usually all these VM based obfuscations operate in the same manner. You have like a context structure which describes the inner state of the virtual machine. And you have a decoding loop that fetches the next instruction. And that then branches off to the individual instruction handlers. So, um, my rough idea of this would be try to exploit the existing structure of these things. Um, for example you could very, very easily build a debugger for an arbitrary virtual machine. You just have to identify the decoding loop. If you identify the decoding loop set a breakpoint inside the decoding loop and dump the context structure on every step. Whoa, we have a single stepping debugger for the virtual machine. Very, very cheaply done. Should be able, like, should be possible to do this in Python very quickly. Um, and then comes the difficult part. Try to recover the semantics of the individual instructions. Because most of the people writing these virtual machines are not very imaginative. Meaning, they'll just have an addition instruction and a XOR instruction and the instructions will mirror like a real CPU that we know very closely. So the question is, can we somehow automatically, either statically or dynamically, recover the semantics of the individual instruction handlers? So, um, this could be done either by trying to statically analyze them, or by just seeing, okay, now, um, I just, like, I set the context to this state, I execute the handler, I see the output. I set the context to a different state, execute the handler, see the output. And, uh, well, if you see that always the, like, register C is the result of register A plus register B, obviously this function is going to be an addition. Um, I don't know how difficult all of this is going to be. I think that the first part is going to be very, very easy. I think the second part is going to be, uh, arbitrarily hard, depending on how clever the guy writing the virtual machine is. But I think in practice, for most existing virtual machines, it should not be hard. Challenge number seven. An algorithm to transform code into a canonical normal form. Now, uh, this ties in a little bit with the lecture we had before I started talking. Um, which is, basically, almost all the obfuscators, or many, many obfuscators, essentially, um, translate instructions by doing table lookups. So you have one instruction, and you have multiple tables which have equivalent entries, equivalent but different entries to represent a certain instruction. What they'll then do is they'll just do a lookup into the table. And replace one instruction with another one, and iterate this, and, uh, well, here in an example, we can obfuscate at EAX20 in these two different ways, and you can come up with an arbitrary number of ways to represent this. And you just iterate this over a bunch of garbage code for, uh, over a bunch of code, and your code, like your signal-to-noise ratio in your code can get arbitrarily small, like you can have, uh, one instruction in the end being represented by two hundred instructions, of which you can't remove a single one because the output would not be the same. So, the question is, um, under the assumption that the obfuscation introduces no new memory access, and no self-modifying code, can we create, uh, a reduction relation that is confluent, meaning, um, that holds, has the following property. If you have a code sequence s and s prime, derived by replacing one instruction with a sequence of equivalent instructions, as I described, um, without introducing memory access or self-modifying code, we want, uh, a function that reduces s and s prime to the same normal form n. This need not necessarily be the same instruction that was mutated. It just needs to be the same representation, no matter how I mutate my original one. So I can compare, I can later on test, is this the same as this? Um, yeah, so, if you are able to, to construct such a thing, you should be able to trivially deobfuscate most metamorphic engines. So, that would be fun. Uh, concerning the difficulty of this, I'm not sure whether it's possible, but it looks like a really, really fun exercise for anybody who is a bit mathematically inclined. Alright, uh, challenge number eight, we're back to fuzzy visualization, uh, clicky stuff. Um, basically, call graphs are really nice, and they're really useful to visualize and see which function calls which, but they have one big drawback. They lose the ordering of sub-function calls, which means, if I have a function that calls malloc string length memcpy, um, I just see in the graph, okay, now this node calls malloc string length memcpy, but I can't, um, know in which order they're called. But the thing is that the structure of the individual flow graphs of every function, um, introduces a partial ordering on the sub-function calls. And I would like to have a mode of visualizing a program which is similar to looking at the call graph, but which doesn't lose the information of which call comes before which other call. That somehow represents this partial order on the sub-function calls visually to me. Because then, I mean, it's very different whether a function first calls memcpy, then string length, then malloc, or a function that calls string length malloc memcpy. Like, just by looking at the two orderings, you can infer about what the function is actually doing. And, as such, it should be a lot better if we can actually see that order. Alright. Challenge number nine. Um, this is a fun one. Um, given a network daemon that has some sort of internal state, like an ISA-KMP parser or whatever, and they have some state variable internally, um, that they update depending on well, on what's happening on the network, can we construct basically a state diagram from the executable? First of all, we'd need to separate the functions into functions that can be reached in a certain state. So you'd be separating it like, these functions are reached in state one, these functions are reached in state two, these functions are reached in whichever state. And then, you try to reconstruct okay, now they're writing the value four to the state variable in a function reachable from state two. So obviously your state diagram should now have a transition from state two to state four. And the question is whether you can do this generically enough so you can reconstruct the, a diagram of possible straight transitions just from the executable. This would be tremendously useful for the analysis of anything that does any sort of network protocol parsing. Alright. Challenge number ten. Um, semantics-based library signatures. Um, semantics-based library signatures means um, well, if somebody hand rolls his string copy, I would like to see that. I would like my, my signature algorithm to somehow recognize somebody has hand rolled a string copy. And I want this to work, uh, no matter how, not necessarily no matter how, but I want this to work without having to have, requiring him to have a very specific implementation of string copy. Like, I want this to work even if you call it string length and mem copy, or also if he hand rolls both loops. I just want, uh, a semantic signature for these things. I want to semantically identify or I want to identify this function is inserting into a linked list. This function is removing from a linked list. And so forth. So, um, I think this, this, the difficulty of this can vary very, very much depending on what the function is doing. But I think for relatively simple library functions, it should not be that difficult. A possible, possible idea on, on how to do this would be well, I'm not sure whether this will work, but what you could do is you can represent memory as an abstract graph and try to represent a function as an operation on an abstract graph. And then see how a function manipulates this memory graph. And that should yield you information like you should be able to immediately see a linked list insert. I don't know whether this will work. Um, good luck. Uh, challenge number 11 is not all that, that serious in fact. So, uh, it's beyond the number 10. Um, but if we have the, the things that we just discussed here, we should be able to string them together to build something that's like a something that statically analyzes executables, finds bugs, crafts inputs to trigger these bugs, and then we would still have to tackle the problem of automated exploitation. Um, I'm not totally serious on this one, so, um, let's just skip it here. So to reiterate my, my difficulty estimates, I think challenge number 0 is trivial. Challenge number 1 should be doable, is not totally trivial, but doable to anybody skilled in the craft. Um, very important phrase, patent law. Challenge number 2 doable, not totally trivial, but doable to anybody skilled in the craft. Uh, challenge number 3, um, that was decomposition to modules. I have no clue how difficult that is. Um, number 4 was template recognition. Should be relatively easy. Uh, number 5, uh, input crafting. Uh, as difficult as any problem you can think of, I think. Um, yeah, number 6, VM disassembly. Uh, VM analysis should be easy if we have a VM given, like with a structure as I described. Um, challenge number 7, what was challenge number 7? Oh, yeah, uh, confluent normal form. Yes, uh, very, very, very cool. Uh, probably quite difficult. Challenge number 8, I have no clue how difficult that is. Uh, challenge number 9, reconstruction of the state diagrams, uh, should be possible, but depends, depends of course on the, the structure of the executable. Um, challenge number 10, um, semantics-based library signatures. Looks very, very difficult at first, but getting something that recognizes some things should be relatively easy. Alright. Some other th- other stuff. Um, we as the reverse engineering community suffer from the fact that we have tools that are all closed and all fragmented and don't talk to each other. So, um, what we've been doing at, uh, Sabre recently was we sat down and we created, uh, a SQL schema to, uh, have an architecture independent rep- um, representation of disassemblies in a flat address space. And, um, what we're doing currently is we're dumping all our, we're remodeling all our reverse engineering tools to work on this database. So, um, we can have interaction between different tools that just all operate on the same disassembly, uh, operate on the same floor graph structure, same core graph structure, and you can dump data into that executable, take it out again, and so forth. Um, we had originally planned to make that thing public at, at Black Hat. Um, we've fallen behind a bit with the documentation, like the, the SQL schema itself is ready and in testing and seems to be quite good. Uh, it's just not very documented yet. And some of the SQL queries are non-obvious and took us quite a few time to, to probably build. So we will be releasing this in the next two to three months with full documentation. And we just encourage everybody to, uh, dump stuff and read stuff from the database format and then we'll hopefully have an open database format with which to exchange disassemblies on, on, with which to process disassemblies and on which to work. Um, so, please wait for two months while we get the documentation sorted. We're not very good at these, these things. Um, what else? What else? Anybody have any questions? Um, is this on? Okay. Um, for problem number seven, I was actually, something I've actually been looking at before and I'm wondering if you've ever looked at using, um, trace caches or looked into the research, I believe it was done by Motorola on real-time machine code to machine code translation. Um, basically being able to analyze machine code in real-time and then translate to an intermediary language and then spit out machine code that did the equivalent thing in real-time. They did this about like ten years ago. Yeah, but that's, like, there's lots of research on translation but they usually don't have the requirement of, um, after I translate something and get an output, I want to reduce this to, uh, a normal form that is the same for any translations from the same source. So what, what's, what's the important part here is that you really converge on something that is identical for every, everything that was generated from the same source. Okay. Uh, I have two questions for you. The first one is related to the first part where we're talking about we need, we're going to move into a world where all the variables are managed or at least are, you know, state-bound, etc. So then we, you know, the big issue would be application logic. Uh, so the question is do you think that the current managed language that we have today, namely .NET and Java, can fit that? And the second one is what about doing these challenges and starting them at the ma- at the .NET and Java world so we can perfect techniques and then move into the unmanaged world which is the C++ assembly world? I personally don't think that we'll all move to managed code. I think that static analyzers on unmanaged code will get strong enough not to have out-of-bounds memory access. I think, uh, just because the, the world is moving embedded in everything and the embedded devices are all written in C but they're statically verified whenever they're really critical. And there's no, no use in having a managed language if I can verify, verify C code. Because if I can ver- do the verification upfront, then I can run at full CPU speed and don't have to worry about out-of-bounds memory access because I've proven beforehand that there is none. So- But if you take, sorry, if you take the .NET approach, the compiled code is running at full speed. The managed sort of environment is just a way to get there with better rules. So you, you still have, you know, C++ assembly code being executed. It's just that we had some rules to get there, which is the whole, you know, managed world. Yeah. Well, um, yeah, then we can of course start on, on the managed level. The managed level will make almost all of these problems, not all of them, but a number of them trivial because you can trivially extract classes and hierarchies and so forth from the managed code. So that's not really a challenge then. Well, it's still a challenge to do them, but at least you can, you have a good base to start. Yeah, yeah. But you might as well start with a real challenge. Any other questions? Bring up 11 again. Automated exploitation? Can you talk a little bit about the bug recognition? Can you stand up and talk and, like, speak into the microphone? I guess I was just curious about the bug recognition. So you find, it was kind of related to Sherry's talk that I, I went to at Black Hat. And she was talking about the starting point and the end point. But really you have multiple end points and, and end point is kind of defined as like, say, one variable overwriting another with an out of bounds memory check. And trying to define those as bugs and what other classes of bugs might be found there. So the question is that, like, what, what are the end points or? Okay. Okay, sorry, I, if you can rephrase it, I might be able to answer it. Like, let's try it after the talk. Alright, any other questions? No questions. I still have quite a bit of free time. Should I just discuss a bit of the research that we've been, or not research, but a few of the things that we've been building at Sabre recently? Alright. So, well, one of the things that we've been doing, of course, is building wait, now I need to, the microphone holder because I'll be monkeying around on the keyboard a lot more. Alright, so. Can we turn on the light again, please? Thanks. Alright, so one of the things we've been doing well, we've been optimizing the the diffing engine quite heavily and we've rewritten the bindiff engine to be very, very fast and with very fast I mean we can diff a 25,000 function World of Warcraft image against another one on this laptop in less than 10 minutes which also allows us to do basically a very large number of diffs, which means we can do, like it's not a big deal to do 100,000 diffs a day or so. So what we've started doing is we've built an infrastructure for automatic classification of new malwares into family trees I'll show you a few of the results. It works basically by you sending an executable in and that gets unpacked with a statistical unpacker and then disassembled and compared to everything in the library and then we create family diagrams based on on similarity mattresses using a little bit of bioinformatic stuff one second so we've classified about a thousand samples here and we can see that they basically belong to mostly one family and then a bunch of smaller ones so I'll try to zoom in well here we have the entire gobot family which are just different variants, they all have a different hr1 sum, they have a different md5 sum and we have the output of other antivirus scanners as what they classify what I'm looking, there's a few samples in here that were not recognized by one or more of the av scanners but which are like 99% similar to things that we already have in the database yes it's very amusing to see the different naming conventions for things because this is all gobot and some of them are called exploitmydoom, win32delph whatever yadayadayada where's something that's not, ah here this one here for example is a mydoom variant that trendmicro doesn't recognize and so forth there's quite a few of these things very amusing, very cute works quite well it's one of the primary arguments for buying a big cluster because when you diff n samples against n samples well you still have to populate the matrix of n square size so you probably want to parallelize that other stuff we've been doing well we've been working hard on binnavi which is basically a graph visualization and one second too many windows open which is a graph visualization framework it'll take a minute to load close a few windows in the meantime it's an older version that is doing a lot of xml parsing which we've since dropped now that we've moved to the database we don't have to wait for two minutes to open a project anymore so apologies for this now we'll just have to wait any questions in the meantime regarding the malware classification nope, okay come on piece of crap ah here we go so basically what we have on the left side here is a list of all the functions in the executable and yes we can look at them and they're nice and shiny and we can well move things add comments all sorts of things we have mozilla start searching we can look at sub functions by oh well let's take another one no worries you can disable those animations once they get on your nerves alright so you can open sub functions which is not all that interesting but what is interesting is you can inline sub functions into the existing function and that's fun what you can also do is you can well this is coupled with a debugger I'll quickly start my vmware to demonstrate alright so what we can do here now is well let's open the call tree of all functions in the executable that is going to take another few seconds because it's about 8000 functions blackberry message router very much fun alright so we can search for for example the receive function and this is the receive function these are all the functions that directly call receive these are all the functions that directly call receive two layers upwards these are all the functions that call receive one layer downwards then what we can do also now is we can set breakpoints on all functions at once so what we do is we just hit record and in the background it will start talking to the vm and set 8000 breakpoints alright so while it's setting breakpoints set all the breakpoints we'll now send some data and we hit stop again and what we can do now is we can see well we can just see all the debug events that happened and get the graph of all the functions that were just executed we can lay them out hierarchically they're not that bad really make great wallpapers if you have a plotter alright so these are the functions other stuff that we can do is um let me quickly try to find the relevant function here it is so if we look at this function here this is the main hello main SRP message parser yes here we are and we can now of course just collect the same debug events on this graph and see the path it executed right there was a mistake here hey demo effect I've been waiting for you alright alright so we can now see the path that was just executed through this function and we can zoom in and we can inline a sub function one second and then we have the whole function and we can set the breakpoints again and then we can see the trace of the debugger through multiple functions alright so there's a whole bunch of fun stuff you can do with this it can also calculate your paths through the executable where you have like two basic blocks and you want to get from A to B and so forth and so forth now we've been moving this away from operating on XML files to operating on the generic Java on the generic SQL format and for that we've also ported a small Python interpreter into it I'll quickly give you a snap or like a glimpse of the development version so we connect to the database we have multiple executables in the database which is quite advantageous if you have a team of reverse engineers you can just all work on the same database at once and you don't have to hunt for your disassemblies anymore alright and now well this is all something that you've seen previously in the last variant of it the nice part is having the Python interpreter so we can do stuff like manipulate, disassemble disassemblies in a very very easy way like x equals basic block 0x402080 print x and well we can have the thing show us it's operands like print x dot instructions minus two dot operands print x dot instructions minus two dot operands one, yes thanks x instructions operands minus two whatever show the operands are actually stored in the database as trees which is the most generic way of representing them and then you can manipulate them easily and you can do fun stuff like creating a new graph and adding a node to that graph which consists of the HTML code generated from a basic block and then you can show the graph and continue manipulating it adding edges, adding comments, whatever you want so there's a whole bunch of fun in this one in general having a database format that is generic is really really really empowering and I'm very much looking forward to everybody trying to use it and yelling at us for all the things that we've done wrongly any other questions currently? cool is the small microphone like a ok I had a question on the first product that you were demonstrating where you had all the agobots it looked like you had parents, grandparents, children and so forth how do you determine what are the precedents and descendants of a particular version you're speaking by passing the microphone currently, sorry how do you determine the precedents you know the parents and the children of particular flavors we have a basically percentual similarity metric we do structural comparison with the stuff that Bindiff does and then we have basically a mapping between the functions between the two executables and we just measure how many functions in the executables we were able to match percentually to the total number of functions so we have a percentage similarity measure and then we use UPGMA or whatever it's called as clustering algorithm to generate these parent-child hierarchies it's similar to genetic analysis where you measure mutants over time yeah it's basically the simplest algorithm we could glean from a bioinformatics book thank you any other questions? well then I hope this was moderately entertaining and have a good DEF CON