<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Kipple : Towards accessible, robust malware classification</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Andy Applebaum</string-name>
        </contrib>
        <contrib contrib-type="author">
          <string-name>The MITRE Corporation</string-name>
        </contrib>
      </contrib-group>
      <pub-date>
        <year>2021</year>
      </pub-date>
      <abstract>
        <p>The past few decades have shown that machine learning (ML) can be a powerful tool for static malware detection, with papers today still purporting to eek out slight accuracy improvements. At the same time, researchers have noted that ML-based classifiers are susceptible to adversarial ML, whereby attackers can exploit underlying weaknesses in ML techniques to specifically tailor their malware to evade these classifiers. Defending against these kinds of attacks has proven challenging, particularly for those not steeped in the field. To help tighten this gap, we have developed Kipple, a Windows Portable Executable (PE) malware classifier designed to detect attempts at evasion. Kipple uses a portfolio of classifiers, building on a primary classifier designed to detect “normal” malware by attaching classifiers designed to specific types of adversarial malware to it. While simplistic, this approach is able to make it significantly harder - though not impossible - to bypass the primary classifier. This paper reports on our process developing Kipple, specifically highlighting our methodology and several notable conclusions, including how our ensemble approach outperforms one using simple adversarial retraining and other performance notes. Our hope with publishing this paper is to provide an example defense against adversarial malware, and to also more broadly make the field more accessible to newcomers; towards this larger goal, we include a set of “lessons learned” for newcomers to the field, as well as an open-source software release containing Kipple's models, the data it was built from, and various scripts used to help generate it.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>
        • Rosenberg et al. [
        <xref ref-type="bibr" rid="ref18">18</xref>
        ] propose to generate adversarial malware by using explainable artificial
intelligence (AI), identifying what features should be perturbed to make a sample evasive.
• Li et al. [
        <xref ref-type="bibr" rid="ref13">13</xref>
        ] generate adversarial Android malware by using generative adversarial networks
(GANs), bypassing previously proposed defenses.
• Hu and Tan [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ] show how to attack a recurrent neural-network (RNN) based malware
classifier by substituting a victim classifier and generating adversarial examples against it.
      </p>
      <p>Many others abound in the literature as well – including many with accompanying open
source code.</p>
      <p>Unfortunately, defenses against these attacks are limited: both conceptually, as in there not
being any clear way to defend against adversarial example attacks, but also practically, in that
there are more papers purporting to attack models than to defend them. Moreover, in browsing
the open source availability, we find that there’s been little code – or models – published to help
defenders secure their systems against these kinds of attacks. This is problematic, and shows the
asymmetric capabilities around and/or interest in defending ML-based classifiers.</p>
      <p>In this paper, we seek to bridge this gap, walking through our own attempts to build a robust
malware classifier we term “Kipple”. While our approach is imperfect, we believe that increasing
the amount of discourse in this space, publishing lessons learned for newcomers, and highlighting
potential areas for future research, we can help advance the state of the art in defending against
evasive malware. Additionally, we have publicly released our code, data, and models online:
https://github.com/aapplebaum/kipple.
2</p>
    </sec>
    <sec id="sec-2">
      <title>Overview</title>
      <p>Kipple originated as a small personal project entered into the 2021 Machine Learning Security
Evasion Competition (MLSEC)1. The competition features a “defender” and an “attacker” track,
where in the former participants submit ML models designed to detect malicious Windows
Portable Executable (PE) files, and in the latter participants seek to evade the user-submitted
classifiers by leveraging obfuscation and adversarial ML techniques. For submission into the
defender track, the goal is to build a classifier that achieves no more than 1% false positive rate
with no more than 10% false negative rate on normal malware, trying to minimize the number of
evasions in the second track.</p>
      <p>
        Because Kipple was implemented as a side project, the initial efort was small, running only
on a personal computer and having the ultimate goal of merely submitting an entry regardless of
its performance. Originally the impetus for Kipple was to leverage ideas from diferential privacy
as a defense against adversarial examples [
        <xref ref-type="bibr" rid="ref15">15</xref>
        ], but this early approach was dropped after poor
performance testing against normal malware2.
      </p>
      <p>Instead, we adopted a more straightforward hypothesis: many adversarial malware
construction techniques are easily distinguishable from traditional benign and malicious Windows PE
ifles, and if we create an ensemble classifier consisting of a traditional malware classifier and a
set of classifiers designed to detect adversarial malware, we can greatly increase the eficacy of
the initial classifier. Doing this, we need not specifically evade our initial classifier, but rather
generate many instances of the adversarially generated examples and train a new classifier on
those.</p>
      <p>To implement this, our approach worked as follows:</p>
      <sec id="sec-2-1">
        <title>1. Create an initial classifier designed to detect “normal” malware;</title>
        <p>2. Create a set of adversarial malware, using a variety of approaches and resources to do so;
1https://mlsec.io/
2A longer write-up on this approach and its shortcomings is left for future work.</p>
      </sec>
      <sec id="sec-2-2">
        <title>3. Produce a separate classifier for each set of adversarial malware; and</title>
        <p>4. Create an ensemble classifier leveraging the initial classifier and each adversarial classifier.</p>
        <p>In the remainder of this paper, we walk through our process for each step, starting with
data creation and identification, building and testing the initial classifier, and then creating
the separate and ensemble classifiers. As part of this last step, we walk through the diferent
performance results for each of the diferent options we investigated for our ensemble.
3</p>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>Data</title>
      <p>This section covers the data used to generate and test Kipple, breaking it down by source.
Broadly speaking, we consider two primary classes for data: samples obtained from external
sources – termed “original samples" – and samples generated as part of adversarial example
construction, frequently referred to as “variants". Within both sets, most of the samples were
known to be either benign or malicious, although a small portion of the original sample data was
unlabeled.</p>
      <p>The rest of this section discusses the source, count, and methodology for generating the data,
with Table 1 providing summary statistics for the normal/original/non-adversarial samples, and
Table 2 providing summary statistics for the adversarially generated samples/variants.
3.1</p>
      <sec id="sec-3-1">
        <title>Original Samples</title>
        <p>
          We leverage the 2018 EMBER3 data set [
          <xref ref-type="bibr" rid="ref1">1</xref>
          ] as the core data for our approach. This data includes
feature vectors for 1 million PE files scanned in or before 2018, categorized into if the file was
benign, malicious, or unknown. The EMBER data set provides a solid base to build a classifier
from, but because it is provided as feature vectors and not as binaries themselves, our ability to
construct a more robust classifier from the EMBER data is limited. To remediate this, we look
to external sources to provide binaries which can be used to construct adversarial malware.
3.1.1
        </p>
        <p>VirusShare
We first investigated the free VirusShare platform 4 as a source for original malware samples.
While the platform ofers bulk downloads, due to size limitations – discussed further in Section 7
3https://github.com/elastic/ember
4https://virusshare.com/
– we opted to use the website’s API to obtain individual samples one at a time. This option
required us to specify an MD5 or SHA256 value for the sample we wanted; to get a list of relevant
hashes, we consulted the EMBER data set, resulting in us downloading the actual samples
referenced by EMBER. Unfortunately, the API limits the number of requests you can make to
one malware sample per 15 seconds; ultimately, after a period of a few weeks we were able to
obtain roughly 7500 samples in total.
3.1.2</p>
        <p>
          SoReL
The SoReL5 data set [
          <xref ref-type="bibr" rid="ref10">10</xref>
          ] contains the features and metadata of roughly 20 million diferent
PE files, half of which are malware and the other half benign. In addition to feature vectors,
SoReL also provides several pretrained models, and most importantly for our work, access to the
roughly 10 million malware instances for download. We do note, however, that as a precaution
the SoReL authors modified the hosted binaries to be non-executable, potentially altering each
instance’s representation and features.
        </p>
        <p>Unfortunately, due to local space constraints, downloading the feature vectors provided by
SoReL was prohibitive – when compressed, the features take up roughly 72GB of disk space,
with the malware instances themselves requiring 8TB of space. While the features themselves are
not particularly prohibitive for consumer hardware, design decisions made when provisioning the
Kipple training machine prevented its download at the time; moreover, training such a model
that makes use of all of the SoReL data could prove dificult using consumer hardware.</p>
        <p>Instead, we took a simple approach of randomly downloading malware instances one at a
time. Through this process, we were about to acquire roughly 32000 malware instances, with
delays from self-imposed and external factors including rate-limiting and download speeds.
3.1.3</p>
        <p>Local Files
We were able to pool together roughly 2600 benign files from the author’s personal computer
that were accumulated over a period of ten or so years. These files would be used primarily for
developing adversarial examples later in the next section, and were not used for actual training;
the split between training and test here reflecting which files were used for adversarial example
construction.
3.1.4</p>
        <p>MLSEC Data
As an entry into MLSEC 2021, we obtained three small labeled data sets:
• MLSEC 2019 data, including 50 normal malware instances used during the 2019 challenge,
and 545 malware variants submitted by contestants during the competition.
• MLSEC 2020 data, including 50 normal malware instances used during the 2020 challenge.
• MLSEC 2021 data, including 50 normal malware instances used for the 2021 challenge.
None of these files were used for training, with the 2019 data used as the primary metric for
accuracy for Kipple during development.
3.2</p>
      </sec>
      <sec id="sec-3-2">
        <title>Adversarially Generated Samples</title>
        <p>We took three diferent approaches to generate adversarial malware samples; for two of these
three, we leveraged public libraries designed to create adversarial examples against ML-based
malware classifiers. For the third, we leveraged prior research looking at evading ML-classifiers
using more traditional obfuscation techniques.</p>
        <sec id="sec-3-2-1">
          <title>Source</title>
        </sec>
        <sec id="sec-3-2-2">
          <title>SoReL</title>
          <p>SoReL
SoReL
SoReL
SoReL</p>
        </sec>
        <sec id="sec-3-2-3">
          <title>VirusShare</title>
          <p>VirusShare
VirusShare
VirusShare
VirusShare
msfvenom
msfvenom
msfvenom
MLSEC 2019-2021
MLSEC 2019-2021</p>
        </sec>
        <sec id="sec-3-2-4">
          <title>Generation Technique Training Size Testing Size Count</title>
          <p>3.2.1</p>
          <p>
            MalwareRL
Our first approach leverages the MalwareRL [
            <xref ref-type="bibr" rid="ref4">4</xref>
            ] open source software package6. This package
is an extension of prior work in [
            <xref ref-type="bibr" rid="ref2">2</xref>
            ], which originally sought to create a framework to develop
reinforcement learning-based agents that can modify malware to make it evade an ML-based
classifier; the updated MalwareRL package contains much of the original functionality of the
original package, updating it to use a newer version of Python and newer libraries, adding actions,
and providing better maintenance.
          </p>
          <p>
            The core idea of MalwareRL is that we can chain together small modifications to PE files in
such a way as make them evasive, with the goal being to create intelligent agents that are able
to eficiently select action chains. Out of the box, MalwareRL includes an implementation of 16
ifle-modification actions, an agent that makes decisions randomly, and an implementation of the
MalConv [
            <xref ref-type="bibr" rid="ref17">17</xref>
            ] detection model as specified in [
            <xref ref-type="bibr" rid="ref1">1</xref>
            ]. During a trial, the MalwareRL environment
will randomly select a malware instance and apply modifications as per the agent’s
decisionmechanism, stopping if too many modifications are made or if the modified sample evades the
classifier.
          </p>
          <p>We ran MalwareRL of and on over a period of a month using the included random agent
and MalConv classifier. As input, we provided the VirusShare and SoReL binaries downloaded
in the prior section. Additionally, we leveraged the local benign “train” data as input to several
of MalwareRL’s actions (e.g. – the add_section_strings action used strings from our local data).
During each trial, if the agent was able to successfully evade the classifier, we would save the
ifle. To prevent some over-fitting, we recorded at most about 10 diferent evasive variants per
sample7. The final counts for each of the VirusShare and SoReL data sets are listed in Table 2
with “MalwareRL” as the generation technique. Note that due to project constraints, we did not
save the list of modifications used for each trial.</p>
          <p>
            6https://github.com/bfilar/malware_rl
7This cutof changed throughout the project, both to be higher and to be lower, but hovered around 10.
Like MalwareRL, the SecML Malware [
            <xref ref-type="bibr" rid="ref6">6</xref>
            ] package is designed to provide functionality to create
adversarial attacks against Windows PE malware detectors8. SecML Malware difers, however, in
that its attacks are end-to-end and are not intended to be chained together, providing a variety of
diferent white-box and black-box attacks. To use the library, users need only provide the input
malware and some benign samples to build from, with the package able to construct adversarial
examples from there. By default, SecML Malware attacks an included instance of MalConv
similar to MalwareRL.
          </p>
          <p>
            We leverage three classes of attacks from the package:
• GAMMA attacks [
            <xref ref-type="bibr" rid="ref8">8</xref>
            ], including both the shift and section injection attacks;
• DOS manipulation [
            <xref ref-type="bibr" rid="ref7">7</xref>
            ], defaulting to partial as opposed to full; and
• Padding attacks [
            <xref ref-type="bibr" rid="ref12">12</xref>
            ], including a “smaller” version that pads a random number of bytes
less than 100, and a “larger” version that pads a random number of bytes less than 1000.
          </p>
          <p>We ran SecML Malware of and on over a period of a month using the above attacks against the
default MalConv classifier. As input, we provided the VirusShare and SoReL binaries, leveraging
the local benign “train” data as goodware, similar to for MalwareRL. Unlike MalwareRL, we
saved each resulting sample regardless of it was evasive or not. Anecdotally, we saw that the
padding attacks were not producing efective results, and stopped generating examples later in
our generation process.
3.2.3</p>
          <p>
            msfvenom
MalwareRL and SecML Malware are both designed to modify PE files to make them evade
classifiers; while these approaches are efective, we also wanted to investigate hardening our
model with more obfuscated malware instances and techniques. Towards this, we decided to
build on prior work in [
            <xref ref-type="bibr" rid="ref3">3</xref>
            ] where they created evasive implants by leveraging the open source
msfvenom utility9. We followed a similar approach, randomly choosing parameters based on the
values in Table 3, with our local benign training examples as templates, and embedding either
no code, a VirusShare instance, or a SoReL instance of malware. While prior work suggested
the use of templates would make the resulting implants evasive, we believed that including the
malware instances as “added-code” would make it easier for the classifier to detect the implant,
and also more robust from a training perspective.
          </p>
          <p>8https://github.com/pralab/secml_malware
9https://www.offensive-security.com/metasploit-unleashed/msfvenom/
We originally intended to split each data set generated in Section 3.2 into a set of samples used for
“training” and a set of samples used for “testing,” with the latter being the primary performance
metric to evaluate each model. This split is illustrated in Table 2.</p>
          <p>Unfortunately, in practice the split was challenging to execute: as it turns out, almost all
new models trained on the adversarially generated variants scored 100% on the test data. After
some analysis we saw that this was due to overlap between the test and training data: while no
sample itself was present in both sets, it was often the case that an original sample had distinct
but similar variants in each, and thus many classifiers were indirectly exposed to some of the
testing data during the training phase.</p>
          <p>To remediate this, we created two additional data sets used specifically for testing, represented
in the last two rows of Table 2. Both data sets leveraged the MLSEC 2019, 2020, and 2021
normal malware samples as the starting malware; because none of the classifiers were trained
on this data, there was no chance for pre-identification of the variants. In the first set, termed
MLSEC MalwareRL, we leveraged the MalwareRL framework to conduct a small set of 1433
variants of the original MLSEC samples. In the second set, termed MLSEC SecML Malware,
we leveraged the SecML Malware library to build a set of 746 variants, including the GAMMA,
DOS manipulation, and padding approaches.
4</p>
        </sec>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>Testing and Building a Base Model</title>
      <p>
        We built a base model following the most recent EMBER code and publication [
        <xref ref-type="bibr" rid="ref16">16</xref>
        ], using a
gradient boosted decision tree (GBDT) implemented in LightGBM10 (LGBM). For our base
model, we only used the EMBER malicious and benign training sets, choosing parameters similar
to that [
        <xref ref-type="bibr" rid="ref16">16</xref>
        ]11. We fix the threshold for our model to 0.85, using the EMBER benign test data to
match the 1% false positive rate required for submissions to the MLSEC defender track.
      </p>
      <p>Table 4 shows the accuracy of our model for each of the original sample data sets. Looking
at the benign data, we see that we hit 99% accuracy for the EMBER data as expected given our
threshold, but only 97.6% for the local benign data; we suspect this slight drop is due to the
nature of the local binaries, as some of them included author-written code and other academic
10https://lightgbm.readthedocs.io/en/latest/Python-Intro.html
11Unfortunately the exact configuration was lost, but we believe it is the same as the source on slide 16 but
with a lower number of leaves.</p>
      <sec id="sec-4-1">
        <title>Generation Technique Number Correct Total Samples Accuracy</title>
        <p>ifles. Looking at malware, we can see the classifier has fairly strong results, correctly classifying
98.5% of the EMBER test malware, 99.9% of the VirusShare malware, and missing only one out
of the 150 MLSEC base malware files.</p>
        <p>The SoReL malware proves much more interesting: even without any obfuscation, the classifier
only is able to correctly identify 90.3% of the instances. While this meets our 10% false negative
goal, it still falls short as opposed to the other sets. We posit this may be due to the model
being poor in general, the SoReL malware being particularly hard to classify (i.e., significantly
diferent than the EMBER training data due to it being more recent), or the modifications made
to the SoReL binaries to make them inactive causing them to appear as benign.</p>
        <p>The last data sets are the adversarial samples. Here, the classifier performs poorly on both
the MLSEC 2019 adversarial malware and the MLSEC MalwareRL variants, correctly identifying
53.8% of the former and 56.6% of the latter. While the classifier performs better on the MLSEC
SecML Malware set – identifying 76.4% of the samples – the poor performance on the other
sets indicates that while the base classifier may be strong against “normal" malware, it’s likely
susceptible to adversarially crafted ones. We note that the better performance in the SecML
Malware set is likely due to the ease in which it can identify some of the individual SecML
Malware attacks.</p>
        <p>Indeed, this conclusion is reinforced by looking at Table 5, which reports the accuracy of our
base classifier against the new samples we generated in the previous section. First, looking at
the bottom of the table, we can see that the base classifier is very weak against the msfvenom
samples, only correctly classifying 10.9% of the ones generated without added code. Contrary to
our expectations, we don’t see that adding code makes it much easier for the classifier to identify
the implant, scoring only 22.7% accuracy when a SoReL sample is added, and 24.3% accuracy
when a VirusShare sample is added. While highlighting a significant gap in our classifier, this
does align with the conclusion from prior work suggesting the msfvenom template option was
particularly efective as an evasion technique.</p>
        <p>Moving up the table, we see the classifier perform reasonably well on the VirusShare examples,
identifying the DOS Manipulation and both padding techniques nearly at nearly 100%. The
GAMMA attack is the strongest of the five, with the classifier correctly identifying 80.8% of the
instances, with the MalwareRL approach as second-strongest with 83.4% accuracy.</p>
        <p>The SoReL examples prove more problematic for the classifier. First, for the MalwareRL case,
we see it only correctly identify 58.9% of the samples – a much lower value than for VirusShare.
Similarly, GAMMA is just about nearly as efective, with the classifier only identifying 59.6% of
the samples. The DOS Manipulation case is not as dire, with the classifier spotting 89.2% of
the cases, and the two padding cases both show improvement over the prior three, although not
nearly as much as for the VirusShare case.</p>
        <p>One interesting trend apparent from looking at the SoReL and VirusShare cases is how much
better the classifier performs on the latter. This can be explained by examining the methodology
behind gathering the samples: the SoReL data were selected randomly, whereas the VirusShare
data was selected by pulling hashes from the EMBER data. Thus, it’s likely that the classifier
was indeed trained on the original malware sample used as part of the submission, and thus might
be more famliar with the adversarial one. If this is the case, it shows an interesting potential gap
in detection – we would expect the VirusShare GAMMA and MalwareRL accuracies to be higher
if indeed the classifier was trained on the underlying non-modifying malware; 80% accuracy on
adversarial examples perturbed from data the classifier was trained on seems rather low.</p>
        <p>As one last stray obseravation, we note that the MalwareRL and SecML Malware samples were
all generated targeting the MalConv classifier, one that uses a completely diferent architecture
than our base case, though does use the same training data. Still, looking at the SoReL case, we
ifnd it interesting that e.g. 58.9% of the MalwareRL samples were transferable from the MalConv
classifier to our GBDT one. We believe that this ease of transferability can have implications for
future ML-based detection approaches.
5</p>
      </sec>
    </sec>
    <sec id="sec-5">
      <title>Model Development</title>
      <p>In this section we discuss how we build on the base model to make it more robust to adversarial
attacks, focusing on the diferent options tested and the performance of each. This includes a
model using adversarial retraining, individual models built from the EMBER data set and the
new adversarial samples, and diferent portfolio options that leverage multiple models. Table 6
shows the final results for each model.
5.1</p>
      <sec id="sec-5-1">
        <title>Retraining</title>
        <p>Our first defensive approach is to try adversarial retraining. In this approach, we leverage a
GBDT similar to as for Section 4, with 1000 iterations, 1024 leaves, a bagging and feature fraction
of 0.5, and a learning rate of 0.005. We then train the classifier with the following data:
• The original EMBER benign data as benign;
• The original EMBER unknown data as discarded;
• The original EMBER malware data as malicious; and
• All new adversarial samples as malicious.</p>
        <p>Similar to as in Section 4, we set a cutof to ensure only 1% false positive on the EMBER test
data, using a threshold of .75.</p>
        <p>The second row (labeled Retrained ) within Table 6 shows the results for the retrained model.
Here, we see some initiall loss of performance as opposed to the base model: we have a lower
accuracy for the local benign data set, a lower accuracy for the EMBER test malware set, and
a lower accuracy for the MLSEC malware data. However, we do see a pronounced increase
of ˜20% accuracy across each of the 2019, MalwareRl, and SecML Malware adversarial test
sets. Whether this increase is worth the small decrease – ˜4% – in normal malware is likely
application-dependent, though in most cases it would seem that the additional coverage is likely
worth the small performance hit.
Our second approach is to develop a set of individual models that do not label the EMBER set
the same as the adversarial set. We specifically choose one of two paradigms for these models:
• All. Under this approach, we consider all EMBER data as benign, and all new adversarial
samples as malicious. This approach tests/assumes that our new variants will have diferent
signatures as opposed to the existing malware and benign data.
• Benign. Under this approach, we only consider the benign EMBER data as benign,
ignoring all others (i.e., malicious, unknown). This approach specifically tries to construct
a classifier that distinguishes between benign files and adversarial malware, without any
training on normal malware.</p>
        <p>Within these two categories, we create four diferent variations on the set of training data we
want to use for adversarial samples:
• Adversarial. This set includes all adversarial samples.
• Variants. This set includes all samples generated with MalwareRL and SecML Malware.
• msf. This set includes all of the msfvenom samples.
• undetect. This set only includes the msfvenom samples that were flagged as benign by
the Base classifier in Section 4.</p>
        <p>This results in 8 diferent models, each of which is trained as a GBDT, with the adversarial
and variants cases using the same parameters as the Retrained model and the msf and undetect
cases modifying the number of leaves to 512 and number of iterations to 500. We further fix
each model’s threshold to match the minimum needed to score a 1% false positive rate on the
EMBER test data.</p>
        <p>Rows 3-10 in Table 6 provide the results for each of the 8 models. First, we note that for each
of the adversarial, variants, and msf models, the “all” case significantly under-performs versus the
“benign” case. This is to some extent to be expected under this setup, as the classifier is unaware
of what normal malware looks like; this is perhaps most evident with the adversarial-all model,
where the classifier only correctly identified 4.3% of the EMBER test malware data. Interestingly,
the undetect category does not follow this pattern, with the all case outperforming the benign
case. We posit this may be due to the undetect samples appearing more like benignware – since
they evaded the Base classifier – and thus the all case better discriminates between normal PE
ifles and PE files designed specifically to look benign.</p>
        <p>Looking at the best case for each model type – focusing on “benign” for adversarial, variants,
and msf, and on “all” for undetect – we see that msf and undetect perform the worst, performing
quite poorly on the EMBER malware test set (6.7% for msf and 0.4% for undetect ) and
underperforming the Base classifier for each adversarial set. Both classifiers also score poorly with the
local benign data (˜20% accuracy each) likely due to some of the local benign files having some
variations present in both the test and train data12 This idea is corroborated by looking at the
variants and adversarial local benign scores as well: variants correctly identifies 95.5% of them,
and adversarial falls in the middle at 40.1%.</p>
        <p>On the other end of the spectrum, variants-benign is clearly the strongest, scoring highest for
EMBER malware, MLSEC malware, and even the adversarial MLSEC data. Indeed, this classifier
by itself is almost able to hit the 10% false negative threshold for that data. As runner-up,
adversarial-benign is a little less performant, having a lower accuracy across each data set but
falling within a reasonable 2% of variants-benign on the adversarial MLSEC 2019 data.
5.3</p>
      </sec>
      <sec id="sec-5-2">
        <title>Portfolio Approaches</title>
        <p>Moving past individual models, we investigate whether we can use a “portfolio” of models, focusing
on a few combinations. Here, we set a threshold for each model in the portfolio; if at least one
model flags a file as malicious, we record malicious. If none classify it as malicious, then we score
it as benign. To set each model’s threshold, we look at all threshold combinations that ensure
that the total false positive rate is 1%13; then, we find the best pair (or, if a portfolio of three
models, the best triple) to maximize the detection rate for the MLSEC data, ensuring we the
thresholds score at least 90% for the EMBER malware set. Rows 11 through 20 of Table 6 show
the results for our portfolio arrangement.</p>
        <p>We only test two portfolios of size two: the Base model along with either adversarial-all or
adversarial-benign. These two portfolios score roughly equally, with the benign configuration
slightly outperforming the all configuration for the adversarial MLSEC samples. Notably, both
portfolios ofer benefits over their singleton counterparts: versus the Base profile by itself, each
portfolio option provides much stronger coverage of the adversarial MLSEC data, at a cost of
only a few percentage points of of the EMBER malware set. However, the portfolio does struggle
with the local benign data, likely due to the included msfvenom data. Against the adversarial
singletons, the portfolios perform much better across the board, with only the adversarial-benign
case scoring near the portfolio for the adversarial MLSEC data.</p>
        <p>The last 8 rows of Table 6 correspond to the eight portfolios of size three that we tested.
Here, each portfolio includes the Base profile along with a version of the variants model and
either a version of the msf model or a version of the undetect model. Interestingly, we when
combined into a portfolio, we now see the all and benign cases each more competitive with their
respective counterparts, scoring roughly similar across categories for each. Indeed, most of the
12As an example, the same binary might be present in both but with diferent filenames.
13Nothing that a lower false positive rate would indicate a higher true positive rate.
size three portfolios seem roughly on par with each other, and all of them largely outperform the
size two portfolios, the Retrained model, and the Base model.</p>
        <p>That said, there are some diferences: even in the size three portfolio set the msf cases (rows
13 through 16) are not as strong as the undetect cases (rows 17-20). Within the latter set, two
options stick out as the strongest. First, against the adversarial samples, {Base, variants-all,
undetect-all } would appear the strongest, performing best on the 2019 and Malware RL data sets,
and within a small distance of the best score for the SecML Malware data set. More well-rounded
however is the {Base, variants-benign, undetect-all } portfolio. This option performs better by a
few percentage points on the normal EMBER and MLSEC sets and still is the second-highest
scorer for the adversarial samples.
6</p>
      </sec>
    </sec>
    <sec id="sec-6">
      <title>MLSEC 2021 Performance</title>
      <p>In this section we discuss Kipple’s performance in the MLSEC 2021 event, covering what the
ifnal submission looked like and taking a critical analysis towards its performance.
6.1</p>
      <sec id="sec-6-1">
        <title>Submission</title>
        <p>We ultimately entered “Kipple” into the 2021 MLSEC competition using the {Base, variants-all,
undetect-benign} configuration; this decision was made somewhat arbitrarily and was due to
some miscalculations on performance before submission. Additionally, we made several changes
to make the model more performant.</p>
        <p>First, in local testing, we realized that Kipple struggled to correctly classify some benign
binaries; specifically the local ones similar to the ones used to build it. To hedge against this, we
ifrst raised the undetect-benign model within the portfolio to have a much higher threshold; this
largely stopped it from misclassifying these files. Still, to make the approach even more efective,
we hardcoded in the specific MD5 values of the binaries it was trained on, bypassing the model
entirely and returning “benign” if a file was submitted that matched the hash.</p>
        <p>
          Second, we leverage the MLSEC-provided code14 implementing a “stateful" detection system
as described by Chen et al. [
          <xref ref-type="bibr" rid="ref5">5</xref>
          ]. This model works by keeping a “history” of prior queries that
were flagged as malware; when a new query is sent to the classifier, if it is identified as malicious,
the classifier stores it and returns malicious. If it is instead identified as benign, it is compared
to the history of prior malicious queries; if within a certain distance of an existing prior query, it
lfags the submission as malicious.
        </p>
        <p>Our submission followed the default implementation, but difered in that it added a query to
the history if and only if the variants-all model flagged it as malicious, ignoring whether the
submission was flagged by Base or undetect-benign. While including the other models would
likely have been more accurate, we did not have adequate time to test this approach and did not
want to increase our false positive rate.
6.2</p>
      </sec>
      <sec id="sec-6-2">
        <title>Results</title>
        <p>
          Kipple ultimately took third in the defensive track, with a score of 231 bypasses; the winner [
          <xref ref-type="bibr" rid="ref9">9</xref>
          ]
had 162 bypasses, second place [
          <xref ref-type="bibr" rid="ref14">14</xref>
          ] had 193, and fourth, fifth, and sixth place had 714, 734, and
1840 respectively. While an overall strong performance, Kipple did have several shortcomings.
        </p>
        <p>First, looking at the results in Table 6, Kipple is not perfect: it still misses a good portion
of the MalwareRL and SecML Malware attacks. Indeed, during the competition the authors
inadvertantly evaded Kipple by using MalwareRL during the attacker track.</p>
        <p>
          Second, and perhaps more importantly, Kipple has very little knowledge of traditional malware
obfuscation techniques. In self-testing, the authors found that many of-the-shelf packers and
crypters were able to sucfiiently obfuscate the MLSEC samples as to bypass Kipple’s detection.
While some of these approaches used some novelty, many of them were simple open-source scripts
and easy to run. In fact, the winners of the attacker track [
          <xref ref-type="bibr" rid="ref9">9</xref>
          ] – who also won the defender track –
recognized this, and were able to score the most evasions using a custom dropper they developed,
sans any specific adversarial ML techniques (though some of their action space did overlap with
the techniques in MalwareRL).
7
        </p>
      </sec>
    </sec>
    <sec id="sec-7">
      <title>Lessons Learned</title>
      <p>As a smaller side-efort, we encountered and overcame many barriers in developing Kipple that
those more unfamiliar with the field would likely also run into. As part of our goal to enrich the
research community, we report on several of these roadblocks, how we overcame them, and tips
for others looking to conduct similar research. While many of these may seem obvious at first
glance, for those just getting their feet wet these lessons may not be immediately intuitive.
7.1</p>
      <sec id="sec-7-1">
        <title>Space Requirements</title>
        <p>Kipple was initially to be built on a small (&lt;30GB) Linux virtual machine run on a personal
computer. This quickly became problematic – between the large size of EMBER/massive size
of SoReL, the needed Python/other libraries, and space requirements to save newly generated
variants, 30GB became too small fast. While we ultimately increased the space allotted to the
VM developing Kipple, some of the early decisions influenced the course of the project; and even
once the VM’s space was enlarged, we still found ourselves running out of storage. Ultimately
Kipple was allocated roughly 300GB of space, which appears suficient for most operations.
Recommendation. We recommend researchers start with at least 200GB of space if possible
when conducting adversarial malware research, with more preferred. Additionally, using VMs in
a cloud environment will likely make storage less of a problem as opposed to local hardware.
7.2</p>
      </sec>
      <sec id="sec-7-2">
        <title>Time Allocation</title>
        <p>Time played a key role in the development of Kipple: many of the ideas of the project were
straightforward, but were hard to test due to needed computation time and other dificulties.
Indeed, many issues compounded as we intended to deliver Kipple as part of the 2021 MLSEC
event which had a strict submission deadline. Some example issues include:
• Long-running code or scripts containing typos or mistakes at the end;
• Long computation time(s) for building new classifiers and models;
• Needing more time to construct adversarial examples; and
• Rate limiting for downloading malware samples.</p>
        <p>Ultimately we tried to mitigate these as best we could, but often many of experiments we ran for
Kipple would need to be configured late in the evening and run overnight, with some days lost
due to typos or other issues.
Recommendation. Understand that adversarial malware research may be time intensive.
Attempt to parallelize your work and research whenever possible; strongly consider using cloud
infrastructure if you can. Setup pipelines to run consecutive jobs and let the code run on its own
when you aren’t needed. Review your code for bugs before running, and consider letting your
long jobs run for a few minutes before stepping away.</p>
        <p>One other recommendation to help save on time is to avoid duplicative computation. As an
example, when training a new model, we would always convert each adversarial sample into its
feature vector during training, requiring a significant amount of time once we generated many
samples and had multiple models to test. Eventually we developed a storage system where upon
generation we would store the feature vector for a new adversarial sample, thereby bypassing the
need to convert the sample for each of the models we wanted to train. This approach itself was
time consuming to implement, but saved many hours of computation time further down the road.
7.3</p>
      </sec>
      <sec id="sec-7-3">
        <title>Record Keeping</title>
        <p>We tried many diferent implementations for Kipple, ranging from choosing diferent LGBM
parameters to training on diferent data sets. Unfortunately, we ran into issues keeping records of
some of our models, parameters, and other training information. This ended up slightly hurting
our eforts, as in some cases we did not have exact information regarding a model we built a
week before, or we needed to reproduce something due to a small code mix-up. Much of this
was the result of fighting time and storage issues, where we would implement something quickly
without following good practices; in these cases, even when the outcome was positive, we still
had to invest more time figuring out how to fix our implementation than if we would have done
it correctly the first time.</p>
        <p>Recommendation. Good coding practices help: use version control when possible, label
variables well in your code, and label all files/models/others to be descriptive. Keep track of all
important information, and backup often.
7.4</p>
      </sec>
      <sec id="sec-7-4">
        <title>Data Robustness</title>
        <p>Perhaps the most surprising result from our experiments was the accuracy of each model on
the test data sets we created for the adversarial samples. This came as a shock initially, first
indicating that the models were extremely efective – however, we ultimately realized that the
accuracy came as a result of training/testing overlap, where variants of individual samples wound
up in both the training and testing sets, thereby allowing the classifier to “see” example test data
while training.</p>
        <p>Recommendation. Identify training and test sets early, and try to identify any overlap
between the two early in the process. Make sure to include at least one data set that appears
disjoint from the training data.
8</p>
      </sec>
    </sec>
    <sec id="sec-8">
      <title>Discussion and Future Work</title>
      <p>We close out this paper with a discussion of some of our major results as well as identifying
diferent areas for future work. One immediate noteworthy result was the high rate of evasion for
the adversarial examples produced in Section 3. Even though these were produced to be evasive
against MalConv – a classifier using a very diferent architecture – they still were efective against
our GBDT classifier in Section 4. The transferrability of adversarial examples is an interesting
area of study, and we hope that these results can help inform future areas of research; anecdotally,
we found that many of the samples produced locally also transferred to the other models as part
of the MLSEC attacker challenge.</p>
      <p>Another notable result from Kipple is the efectiveness of the portfolio classifier versus the
adversarially retrained one. While the diference is perhaps not terribly large in performance, the
portfolio did seem to do convincingly better on the MLSEC data set. The final Kipple model,
while not bulletproof, was successful in stopping a large amount of evasion attacks. We believe
that a future approach could leverage more data and additional training modules to make the
solution even more robust.</p>
      <p>Finally, we note that one of our original hypotheses was that the existing benign and malware
would be suficiently diferent than our own generated adversarial samples to provide efective
training data in building a new classifier. Interestingly we found evidence both for and against this
hypothesis: for the adversarial, variants, and msf models it was clear that benign outperformed
all, but for the undetect model our hypothesis was indeed true and all outperformed benign. We
believe that this, as well as the eficacy of training on strictly evasive samples, is an interesting
area for further research.
9</p>
    </sec>
    <sec id="sec-9">
      <title>Code Availability</title>
      <p>As part of this project, we have released all of the code behind Kipple online: https://github.
com/aapplebaum/kipple. This includes code to train and evaluate models, the adversarial
variants we generated, and the models themselves. We hope that this release will help encourage
future research in this area.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>H. S.</given-names>
            <surname>Anderson</surname>
          </string-name>
          and
          <string-name>
            <given-names>P.</given-names>
            <surname>Roth. EMBER</surname>
          </string-name>
          :
          <article-title>An Open Dataset for Training Static PE Malware Machine Learning Models</article-title>
          . ArXiv e-prints,
          <source>Apr</source>
          .
          <year>2018</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>H. S.</given-names>
            <surname>Anderson</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Kharkar</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Filar</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Evans</surname>
          </string-name>
          , and
          <string-name>
            <given-names>P.</given-names>
            <surname>Roth</surname>
          </string-name>
          .
          <article-title>Learning to evade static pe machine learning malware models via reinforcement learning</article-title>
          .
          <source>arXiv preprint arXiv:1801.08917</source>
          ,
          <year>2018</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>Andy</given-names>
            <surname>Applebaum</surname>
          </string-name>
          .
          <article-title>Trying to make meterpreter into an adversarial example</article-title>
          . url: https: //www.camlis.org/2019/talks/applebaum,
          <year>2019</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>Bobby</given-names>
            <surname>Filar. MalwareRL</surname>
          </string-name>
          ,
          <year>2021</year>
          . URL https://github.com/bfilar/malware_rl.
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>S.</given-names>
            <surname>Chen</surname>
          </string-name>
          ,
          <string-name>
            <given-names>N.</given-names>
            <surname>Carlini</surname>
          </string-name>
          , and
          <string-name>
            <given-names>D.</given-names>
            <surname>Wagner</surname>
          </string-name>
          .
          <article-title>Stateful detection of black-box adversarial attacks</article-title>
          .
          <source>In Proceedings of the 1st ACM Workshop on Security and Privacy on Artificial Intelligence</source>
          , pages
          <fpage>30</fpage>
          -
          <lpage>39</lpage>
          ,
          <year>2020</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>L.</given-names>
            <surname>Demetrio</surname>
          </string-name>
          and
          <string-name>
            <given-names>B.</given-names>
            <surname>Biggio</surname>
          </string-name>
          .
          <article-title>secml-malware: A python library for adversarial robustness evaluation of windows malware classifiers</article-title>
          ,
          <year>2021</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>L.</given-names>
            <surname>Demetrio</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Biggio</surname>
          </string-name>
          ,
          <string-name>
            <given-names>G.</given-names>
            <surname>Lagorio</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Roli</surname>
          </string-name>
          ,
          <article-title>and</article-title>
          <string-name>
            <given-names>A.</given-names>
            <surname>Alessandro</surname>
          </string-name>
          .
          <article-title>Explaining vulnerabilities of deep learning to adversarial malware binaries</article-title>
          .
          <source>In ITASEC19</source>
          , volume
          <volume>2315</volume>
          ,
          <year>2019</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>L.</given-names>
            <surname>Demetrio</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Biggio</surname>
          </string-name>
          ,
          <string-name>
            <given-names>G.</given-names>
            <surname>Lagorio</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Roli</surname>
          </string-name>
          ,
          <article-title>and</article-title>
          <string-name>
            <given-names>A.</given-names>
            <surname>Armando</surname>
          </string-name>
          .
          <article-title>Functionality-preserving black-box optimization of adversarial windows malware</article-title>
          .
          <source>IEEE Transactions on Information Forensics and Security</source>
          ,
          <year>2021</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>Fabrício</given-names>
            <surname>Ceschin</surname>
          </string-name>
          and
          <string-name>
            <given-names>Marcus</given-names>
            <surname>Botacin</surname>
          </string-name>
          .
          <source>Adversarial Machine Learning</source>
          , Malware Detection, and
          <article-title>the 2021's MLSEC Competition</article-title>
          ,
          <year>Sept</year>
          .
          <year>2021</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <given-names>R.</given-names>
            <surname>Harang</surname>
          </string-name>
          and
          <string-name>
            <given-names>E. M.</given-names>
            <surname>Rudd</surname>
          </string-name>
          . Sorel-20m:
          <article-title>A large scale benchmark dataset for malicious pe detection</article-title>
          ,
          <year>2020</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11]
          <string-name>
            <given-names>W.</given-names>
            <surname>Hu</surname>
          </string-name>
          and
          <string-name>
            <given-names>Y.</given-names>
            <surname>Tan</surname>
          </string-name>
          .
          <article-title>Black-box attacks against rnn based malware detection algorithms</article-title>
          .
          <source>In Workshops at the Thirty-Second AAAI Conference on Artificial Intelligence</source>
          ,
          <year>2018</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          [12]
          <string-name>
            <given-names>B.</given-names>
            <surname>Kolosnjaji</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Demontis</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Biggio</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Maiorca</surname>
          </string-name>
          , G. Giacinto,
          <string-name>
            <given-names>C.</given-names>
            <surname>Eckert</surname>
          </string-name>
          , and
          <string-name>
            <given-names>F.</given-names>
            <surname>Roli</surname>
          </string-name>
          .
          <article-title>Adversarial malware binaries: Evading deep learning for malware detection in executables</article-title>
          .
          <source>In 2018 26th European signal processing conference (EUSIPCO)</source>
          , pages
          <fpage>533</fpage>
          -
          <lpage>537</lpage>
          . IEEE,
          <year>2018</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          [13]
          <string-name>
            <given-names>H.</given-names>
            <surname>Li</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Zhou</surname>
          </string-name>
          ,
          <string-name>
            <given-names>W.</given-names>
            <surname>Yuan</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Li</surname>
          </string-name>
          ,
          <string-name>
            <given-names>and H.</given-names>
            <surname>Leung</surname>
          </string-name>
          .
          <article-title>Adversarial-example attacks toward android malware detection system</article-title>
          .
          <source>IEEE Systems Journal</source>
          ,
          <volume>14</volume>
          (
          <issue>1</issue>
          ):
          <fpage>653</fpage>
          -
          <lpage>656</lpage>
          ,
          <year>2019</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          [14]
          <string-name>
            <given-names>A.</given-names>
            <surname>Mosquera</surname>
          </string-name>
          . amsqr at MLSEC-2021:
          <article-title>Thwarting Adversarial Malware Evasion with a Defense-in-</article-title>
          <string-name>
            <surname>Depth</surname>
          </string-name>
          ,
          <year>Sept</year>
          .
          <year>2021</year>
          . URL https://doi.org/10.5281/zenodo.5534783.
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          [15]
          <string-name>
            <given-names>Nicholas</given-names>
            <surname>Carlini</surname>
          </string-name>
          .
          <article-title>On evaluating adversarial robustness</article-title>
          . url: https://www.camlis.org/ 2019/keynotes/carlini,
          <year>2019</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          [16]
          <string-name>
            <given-names>Phil</given-names>
            <surname>Roth</surname>
          </string-name>
          .
          <article-title>Ember improvements</article-title>
          . url: https://www.camlis.org/2019/talks/roth,
          <year>2019</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref17">
        <mixed-citation>
          [17]
          <string-name>
            <given-names>E.</given-names>
            <surname>Raf</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Barker</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Sylvester</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Brandon</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Catanzaro</surname>
          </string-name>
          , and
          <string-name>
            <given-names>C. K.</given-names>
            <surname>Nicholas</surname>
          </string-name>
          .
          <article-title>Malware detection by eating a whole exe</article-title>
          .
          <source>In Workshops at the Thirty-Second AAAI Conference on Artificial Intelligence</source>
          ,
          <year>2018</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref18">
        <mixed-citation>
          [18]
          <string-name>
            <given-names>I.</given-names>
            <surname>Rosenberg</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Meir</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Berrebi</surname>
          </string-name>
          , I. Gordon, G. Sicard, and
          <string-name>
            <given-names>E. O.</given-names>
            <surname>David</surname>
          </string-name>
          .
          <article-title>Generating end-toend adversarial examples for malware classifiers using explainability</article-title>
          .
          <source>In 2020 International Joint Conference on Neural Networks (IJCNN)</source>
          , pages
          <fpage>1</fpage>
          -
          <lpage>10</lpage>
          . IEEE,
          <year>2020</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>