foreign is sneaky it tries to hide it tries to evade detection and to obfuscate its actions and it turns out that most of what we know about these sneaky behaviors comes from observing the malware samples in lab environments and in the next 20 minutes I will tell you some of the lessons from the largest study of malware behavior in the wild where we looked at the how the behavior individual samples changes from one host to the next in one week to another now the main tool that we have today for analyzing for understanding uh malware
behavior is called Dynamic malware analysis which involves collecting and analyzing execution traces um of these malware samples and this is in contrast to static analysis which involves analyzing the binaries now now Dynamic malware analysis has many applications such as creating rules and signatures for malware detection clustering malware samples into families and online detection understanding new malicious behaviors and campaigns attack attribution and many more and dynamic malware analysis is an experimental technique so you probably see something like this so um detection rates uh that are pretty high above 95 for fairly low false positive rates and
if you the the situation is the same in research where there are many research papers published on new ideas for detecting malware most of them the evaluations report very high performance numbers uh to the point that there that they appear to leave very little room for improvement so this would make it seem that malware detection is a solved problem but unfortunately when these tools are deployed in the real world the performance is nowhere near to these numbers so in fact uh instead of reflecting a solved problem these numbers provide a false sense of security now
we are fairly skeptical in this community uh so I bet that you can already think of a few reasons why this may be happening so I just want to clarify that this talk is not about flaws in experimental evaluations the base rate fallacy uh malware Evolution that leads to concept Drift actually for this one stick around for the next talk um or misleading marketing claims right even in the absence of all these problems the performance in the lab will not match the performance in the real world and to understand why let's take a closer look
at how Dynamic analysis is done today so uh usually um most often actually the behavioral traces are collecting by executing the samples in a controlled environment called a Sandbox usually based on Virtual machines and this is an environment that prevents the malware samples from causing damage or for from from propagating however we know that in the real world the same hour sample may have different behaviors when it's executed on different hosts and at different times and researchers have coined the term split personalities for this type of behavior now this is not a New Concept um
Security Professionals have known about split personalities for a while but this became a problem that that really came to the attention of the community there's something serious that needs to be fixed with a discovery of red pills which malware can use to detect that it's running inside of a virtual machine and therefore to uh to evade detection and Analysis now the first thread build dates from 2004 but many more have been discovered since then and the research in response to this has followed mainly two directions the first one is program analysis techniques to detect split
personalities in sandboxes and these mainly focused on time uh time-based triggers and sandbox evasion and on the other hand um the the other direction was towards developing better sandboxes by bringing them closer to bare metal or by adding aging artifacts or by randomizing the VMS so because all this past work focused on what malware does in a sandbox we asked ourselves what else could we learn about split personalities but by analyzing traces from the wild um and to begin answers this question let's take a look at some of the answers that the previous research did
not answer so first of all is how do malware behaviors vary in the wild so how much variability there is between executions uh what parts of the behavior vary the most how does this impact malware Dynamic analysis perhaps it doesn't impact that much so we shouldn't worry about it and finally what can we do about it so now to put this um in a more on more concrete terms let's take a look at an example so here on this slide you have a portion of the pseudocode for the ramnet worm and one of the things
that the uh this worm does is that it uh uh it tries to exploit a certain vulnerability this is on line 22 here with the aim of achieving privileged escalation now when this happens when the exploit executes this results in the creation of hundreds of Windows mutexes until the exploit succeeds however this only happens on Windows 7. on hosts that have not been patched and when the worm is run in a non-admin mode so who cares well if you are an engineer developing malware detection signatures and you base your signature on the trace that includes
these hundreds of mutexes this signature may be ineffective on hosts where that have been patched or that where the worm is running in admin mode um now if you are a user of such tools um that include signatures based on these these types of signatures you may not know the true effectiveness of of the tool because this will depend on how prevalent this Trace is in the wild uh if if it's if it accounts for one percent or for 99 of the traces in the wild you will see very different results in what's worse even
the vendor will be unable to estimate the effectiveness uh without collecting traces in the wild and then malware analysts are facing this problem of determining which part of the traces that are analyzing are representative of the worms of the of the malware's Behavior Uh in this case the trace that contains all the string of mutexes mutex Creations um is is not representative so now the reason why we don't know these things is because it's hard we need executions from the wild execution traces collected from Real World hosts right and it turns out that some security
companies are already collecting such data so we partnered with one of these companies to conduct a large empirical study of split personalities in the wild so we collected 7.6 million execution traces uh coming from over 5 million real users machines this map shows the uh the geographic distribution and importantly this includes multiple traces per per sample now this data these execution traces represent real world infections because we do not distribute any samples to these hosts we do not provide inputs and we do not trigger the executions and the antivirus will block all known malware the
executions are collected not for the purposes of our study but as the last line of defense and they're only collected when the antivirus cannot classify a sample as either benign or malicious and as soon as the sample does something that the AV will recognize as being malicious the execution is terminated finally no private user data is collected here so the first finding that I want to tell you about uh is that benign programs also have variable Behavior so if you look at a typical benign sample and you look at the difference between the longest 25
traces and the shortest 25 traces uh this difference is eight or more actions now potentially unwanted programs have more variability uh in this case the difference is 19 actions but malware samples have a lot more variability here the difference is going to be 59 actions so now the uh word clouds on this slide uh illustrate the relative of amount of variability for different types of actions note that file Creations are the type of actions that vary the most for all categories of of software and this is true both in terms of the number of actions
as well as the parameters so the different file names that are created especially malware tends to create a lot of unique and random foundings so now there are many reasons for these uh behavioral differences there are of course malware implemented basic techniques but there are also differences in operating systems and and libraries like we've seen in the ramnet example malware may attempt some risky operations that fail on some hosts uh malware may receive different commands from its command and control Channel we've also seen differences between the first execution and the second execution of the same
of the sample on the same host and that's because the initial installation performs a one-time operations random file names and many others so now most of the research has focused on addressing sound activation which is the first bullet here but as you see there are many other reasons for Behavioral variabilities so even so sandboxes sandbox traces cannot account for the range of behaviors that are encountered in the wild and that's even if you always catch sandbox evasion now there are a lot more results in our paper I encourage you to uh to read it if
you're interested I want to spend the rest of this talk uh focusing on what these results mean for you so if the problem of split personalities affects your job then what can you do about it so I expect the most of you here do not work on malware analysis directly but you may need to use tools such as malware detection or malware classification to protect your organization so in this case my advice is trust but verify and to illustrate this we conducted an experiment with a malware clustering technique with the aim of understanding the impact
of this Behavior variability of malware clustering now clustering is an unsupervised learning unsupervised machine learning technique and the goal here is to identify which samples are similar enough that they likely belong to the same family so usually the way this is done is a bunch of traces for different samples are provided to the clustering tool and the different clusters are produced that correspond to that indicate different families of malware now all the papers that I've read on this topic used only one Trace per sample so we decided to use four traces per sample just because
we could um and um if uh clustering is really able to separate the malware families then we would expect to see something like this we would we would expect to see that all the traces of a sample would be placed in in the same cluster but actually what we see is this uh one third of the samples we experimented with exhibit sufficient variability that their traces are placed in more than one cluster with one percent of samples uh each Trace being placed in a separate cluster um and note that we only observe this because we
used four samples four traces per per sample so uh this suggests that uh whenever you're doing clustering experiments with only one Trace per sample the results uh the resulting accuracy will be overestimated and what's even worse even independent evaluators and researchers and the vendors themselves will not be able to tell you how large the overestimation is without using traces in the wild so for this reason my advice is trust but verify evaluate the tool rigorously in your environment because even with the most rigorous evaluations the results May still not reflect what you are going to
see in the future now if you are somebody Who develops rules for detecting malware my advice is to use traces from multiple executions in the wild so here I'm going to tell you about another experiment where we looked at the impact of variability on malware detection and in this experiment we focused on on one cry the the famous worm and ransomware um we we trained several supervised machine learning models to detect wannacry and in this case we also collected contemporaneous sandbox traces so these these traces were actually executed by two different sandboxes at the time
around the time when we were doing the data collection in the wild um and we looked at two sandbox traces two two separate sandboxes because some of the best practices recommend combining some uh sandbox traces in order to account for Behavior variability so the results that I'm presenting here are in terms of the true positive rates or the detection rate for one percent false positives so when we train our models on Cuckoo sandbox and we test Uncle sandbox we get 76 uh percent uh true positives when we test when we train on Cuckoo sandbox and
test on Hubble sandbox we have a little bit of a performance drop but when we train on google sandbox and trade test on the wild we have a huge performance drop uh 18 true positives is basically useless so therefore we combined you know as recommended we combine the the sandbox traces uh and we trained on the combined sandbox traces and tested in the wild and uh we got a little bit of improvement but not much so to understand why this happens we try to visualize the feature space that these classifiers are operating on and so
our features are accounts of token exactly extracted from wannacry parameters and so this is a high dimensional space so we use the projection into two Dimensions to visualize it here this means that the two axes the X and Y axis on this plot are not meaningful that the numbers on the axis are not meaningful but the relative distances between the points are so we can see here this this uh plot here only shows the two sandboxes we can see that the the traces in the sandbox are are pretty well uh pretty well clustered together but
then when we look at what happens in the wild we see a lot more variability and in fact if we try to identify where the sandbox traces are on this second plot they are right here in this very small area and this is because sandboxes do not account for the broad range of behaviors in the wild it seems that models based on one sandbox tend to generate generalize well to another sample box but very poorly to behaviors observed in the wild so for this reason my advice is to use multiple traces from executions in the
wild to the to create these rules now you may be wondering okay just how many uh different environments and it seems that three uh is a is a pretty good number after three we have we observe diminishing returns uh and this is actually good news because it suggests that there isn't an infinite number of environments uh where where the behavior will differ uh that after observing a few number of uh the same the sample in a few number of environments we can uh get a good coverage of of Its Behavior now behaviors also vary over
time um here uh uh you you wanna collect executions three to four weeks apart however here um this seems to be less useful than executing the sample multiple machines in terms of improving the the coverage so now summarizing the current practices malware analysis tools are in demand there is a 5 billion malware analysis Market expected to grow over the next decade and today it relies heavily on Sandbox collected traces and this introduces a number of blind spots it we tend to overlook environment and time dependent Behavior especially when we're using only one Trace per sample
we observe a narrow range of behaviors compared to what's happening in the wild even assuming that you have the perfect solution against sandbox evasion um well it's hard to determine which actions or parameters are representative of the Bowers behavior and this ultimately ends up in an overestimation of the accuracy of clustering in and detection so before I conclude I want to thank my collaborators first of all my student Erin avlaza guy who was the lead author of the study my student ID John Kaya and my former student currently Dr Zhu as well as my collaborators
Leila bilge and David de balzarote this project is a great example of Industry Academia collaboration with thought-provoking findings and actionable implications and generally there is a lot of great science coming out of such collaborations I think we've heard another couple of examples today here at Enigma these collaborations will have a transformative effect on the next generation of security products and services so I invite you all to check them out and perhaps you will even find Opportunities to participate in these collaborations so now I want to leave you with two thoughts the first one is that
malware analysis should be based on multiple executions from the wild that this can be done ethically and there are security companies today who are in a position to do it and the second one is that this is a radical shift in the way uh from the way the dynamic analysis is done today but it's a shift that can bring a unique new insights and if you're looking for the next big thing in a dynamic malware analysis this may be it thank you [Applause]