Malware Analysis and Detection With Explainable Machine Learning
Malware Analysis and Detection With Explainable Machine Learning
PHD DEGREE
Electronic and Computer Engineering
Cycle XXXIII
Abstract
Malware detection is one of the areas where machine learning is successfully em-
ployed due to its high discriminating power and the capability of identifying novel
variants of malware samples. Typically, the problem formulation is strictly correl-
ated to the use of a wide variety of features covering several characteristics of the
entities to classify. Apparently, this practice allows achieving considerable detection
performance. However, it hardly permits us to gain insights into the knowledge
extracted by the learning algorithm, causing two main issues. First, detectors might
learn spurious patterns; thus, undermining their effectiveness in real environments.
Second, they might be particularly vulnerable to adversarial attacks; thus, weak-
ening their security. These concerns give rise to the necessity to develop systems
tailored to the specific peculiarities of the attacks to detect.
Within malware detection, Android ransomware represents a challenging yet illus-
trative domain for assessing the relevance of this issue. Ransomware represents a
serious threat that acts by locking the compromised device or encrypting its data,
then forcing the device owner to pay a ransom in order to restore the device function-
ality. Attackers typically develop such dangerous apps so that normally-legitimate
components and functionalities perform malicious behaviour; thus, making them
harder to be distinguished from genuine applications. In this sense, adopting a well-
defined variety of features and relying on some kind of explanations about the logic
behind such detectors could improve their design process since it could reveal truly
characterising features; hence, guiding the human expert towards the understanding
of the most relevant attack patterns.
Given this context, the goal of the thesis is to explore strategies that may improve the
design process of malware detectors. In particular, the thesis proposes to evaluate
and integrate approaches based on rising research on explainable machine learning.
To this end, the work follows two pathways. The first and main one focuses on
identifying the main traits that result to be characterising and effective for Android
ransomware detection. Then, explainability techniques are used to propose meth-
ods to assess the validity of the considered features. The second pathway broadens
the view by exploring the relationship between explainable machine learning and
adversarial attacks. In this regard, the contribution consists of pointing out met-
rics extracted from explainability techniques that can reveal models’ robustness to
adversarial attacks, together with an assessment of the practical feasibility for at-
tackers to alter the features that affect models’ output the most.
Ultimately, this work highlights the necessity to adopt a design process that is aware
of the weaknesses and attacks against machine learning-based detectors, and pro-
poses explainability techniques as one of the tools to counteract them.
II
1 There is an appointed time for
everything, and a time for every affair
under the heavens.
2 A time to be born, and a time to die;
Eccles. 3, 1–8
Lk. 6, 47–49
III
Acknowledgements
Another slice of life has been spent. The last three years have been the most trouble-
some of my life; yet, the most fruitful ones by far. I have been rebuilding myself
from the ground up, which has made me feel extremely lost and desperately needy
of new landing places. Eventually, I have realised how precious this time could have
become; I was not lingering on the sand, but digging deeper to lay foundations on
rock. I am grateful for all the people around me: they have allowed me to face such
a turbulent process without collapsing.
Firstly, I owe my deepest and most sincere gratitude to Prof. Giorgio Giacinto.
He has been a solid pillar and, ultimately, the best supervisor I could ever wish
for. Specifically, I admire his day-to-day work and effort to enable continuous new,
fulfilling opportunities, along with careful, respectful, and wise support. I also
acknowledge his excellent scientific profile, which greatly contributes to the success
of PRA Lab; in this lab, I have found a wonderful mix of high competence and
warmth.
In this sense, I am pleased to thank Dr. Davide Maiorca. He has been an inspiration
since the days of my Master’s thesis. I applaud his remarkable gift of bringing
enthusiasm to each project, especially those oriented to students. For this reason,
I wish him all the best for his career, as I am sure he will contribute to raising the
level of the lab even further.
Moreover, I am grateful for spending a research period in another great lab at TU
Braunschweig, Germany. I thank Prof. Konrad Rieck and all the group for hosting
me. I found there excellent scientists that have allowed me to increase my skills,
together with warm hospitality that has made my stay incredibly enjoyable.
Besides thanking Dr. Battista Biggio and all the other PRA Lab’s senior components
for their fruitful collaboration and suggestions, I thank all my Ph.D. colleagues. I will
carry with pleasure all the days spent together exchanging opinions, collaborating,
and having fun.
A significant part of my gratitude goes towards my friends and family. It is
always fabulous and comforting to share openly with friends both our achievements
and struggles. It has been crucial for me to talk and have fun with all of them,
including the distant ones.
Finally, a special thanks to my family. I constantly feel amazed and blessed due to
their endless support and trust towards me, so much so that I feel embarrassed as
well: I cannot keep pace with the love I get from my parents, brothers, and sisters-
in-law. Naturally, a super, sweet thank is devoted to my wonderful nieces Martina
and Gioia, along with my speedy godson Nicola. I would never stop playing with
them.
With renewed eyes and enriched by incredible experiences and the unique mind-
set a Ph.D. is able to offer, I hope to give back the love I receive.
IV
Contents
Contents V
List of Tables X
1 Introduction 1
1.1 Malware and Ransomware . . . . . . . . . . . . . . . . . . . . . . . . 2
1.2 Contribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.3 Organisation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
3 Android Security 12
3.1 Background on Android . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.2 Android Malware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.2.1 Ransomware . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
3.3 Malware Analysis and Detection . . . . . . . . . . . . . . . . . . . . . 16
3.3.1 Approaches . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
3.3.2 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
3.3.3 Evasion Strategies . . . . . . . . . . . . . . . . . . . . . . . . 18
V
5 Explainable and Adversarial Machine Learning 51
5.1 Do Explanations Tell Anything About Adversarial Robustness? . . . 51
5.1.1 Background on Drebin . . . . . . . . . . . . . . . . . . . . . . 52
5.1.2 Adversarial Android Malware . . . . . . . . . . . . . . . . . . 54
5.1.3 Do Gradient-based Explanations Help to Understand Adversarial
Robustness? . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
5.1.4 Experimental Analysis . . . . . . . . . . . . . . . . . . . . . . 58
5.1.5 Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
5.2 Evaluating the Feasibility of Adversarial Sample Creation . . . . . . . 63
5.2.1 Threat Model . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
5.2.2 The Problem Space Domain . . . . . . . . . . . . . . . . . . . 65
5.2.3 Adversarial Malware Creation . . . . . . . . . . . . . . . . . . 68
5.2.4 Experimental Results . . . . . . . . . . . . . . . . . . . . . . . 70
5.2.5 Related Work . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
5.2.6 Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
6 Conclusions 79
VI
List of Figures
1.1 ENISA top threats ranking (out of 15 threats) of the last five years
for the malware and ransomware categories. The lower the ranking
value, the more relevant the threat. Data elaborated from [5–9]. . . . 2
VII
4.13 Top positive and negative attributions’ median values for two group-
ing criteria: family (a) and date (b). . . . . . . . . . . . . . . . . . . 48
4.14 Roc curve comparison. The classifiers with solid lines have been
trained with the full feature set, the ones with dotted lines with a
reduced feature set made of 33 features. . . . . . . . . . . . . . . . . . 49
VIII
5.12 Mimicry attack’s evasion rate for different choices of the reference
sample (a). Detection rate detail of the ransomware samples (b).
Both figures are the average results over five repetitions and include
the standard deviation in translucent colour. . . . . . . . . . . . . . . 73
5.13 Evasion rate for different levels of noise injection in the absolute and
relative cases (left side of the figure). Detection detail for a noise level
equal to 20 (right side of (a)) and a 1% noise level (right side of (b)).
All the results are the average over five repetitions and include the
standard deviation in translucent colour. . . . . . . . . . . . . . . . . 74
5.14 Average impact on the number of calls for mimicry (a) and noise (b)
attacks. The standard deviation is also reported in translucent colour. 75
IX
List of Tables
X
Chapter 1
Introduction
Such a connected society implies several impactful cybersecurity threats and the
need for considerable efforts to address the emerging challenges. As confirmed by
Europol [2], ‘as time passes, the cyber-element of cybercrime infiltrates nearly every
area of criminal activity’. As a consequence, recent decision ([3]) by the Members
of the European Parliament (MEPs) is the adoption of the ‘EU Cybersecurity Act’,
which establishes an EU-wide certification scheme to ensure that critical infrastruc-
tures (e.g. 5G), products, processes, and services meet cybersecurity standards.
Moreover, ENISA has received a permanent mandate, together with more human
and financial resources. Accordingly, increasing research efforts on cybersecurity will
be spent. ENISA identifies the main topics where future research should be focused;
they are the following ones [1]:
– Awareness building: it is making society aware of the impact and risks of
technological change;
– Capacity building: it is refreshing education in order to fulfil the need of
cybersecurity experts;
– Existential threats: these are trends and technologies that can be both an
opportunity and a risk, such as artificial intelligence, quantum technologies,
cybercrime, privacy.
Moreover, in a more recent report, ENISA highlighted the need to investigate
further the usage of Machine Learning (ML) in Cyber Threat Intelligence [4]. In this
sense, this thesis proposes to study the design of machine learning-based systems in
the context of cybersecurity, with a particular focus on the detection of malware, as
I discuss in the section that follows.
1
2 1. Introduction
12
10
Ranking
0
2015 2016 2017 2018 2019
Malware Ransomware
Figure 1.1: ENISA top threats ranking (out of 15 threats) of the last five years for the
malware and ransomware categories. The lower the ranking value, the more relevant the
threat. Data elaborated from [5–9].
To combat such kind of threats, which also affect the Android domain (as I
discuss in Section 3.2), the security community strives to develop effective defence
tools, such as malware detectors. In this sense, malware detection is one of the areas
where machine learning is successfully employed due to its high discriminating power
and the capability of identifying novel variants of malware samples. Typically, the
problem formulation is strictly correlated to the use of a wide variety of features
covering several characteristics of the entities to classify. Apparently, this practice
provides considerable detection performance. However, it hardly permits us to gain
insights into the knowledge extracted by the learning algorithm. This issue is crucial
since it negatively influences two main aspects of detectors:
1.2. Contribution 3
– Effectiveness: detectors might learn spurious patterns, i.e. they make de-
cisions possibly on the basis of artefacts or non-descriptive elements of the
input samples;
– Security: the learning algorithms might become particularly vulnerable to
adversarial attacks, i.e. carefully-perturbed inputs that overturn their out-
puts.
Both of these concerns undermine the actual use of such detectors in real working
environments. Consequently, this issue sounds an alarm and highlights the necessity
to (i) improve the design process of detection systems and (ii) make them tailored
to the specific peculiarities of the attacks to detect.
Within malware detection, Android ransomware represents a challenging yet illus-
trative domain for assessing the relevance of the considerations above. As a matter of
fact, the attackers typically develop such dangerous apps so that normally-legitimate
components and functionalities perform malicious behaviour; thus, making them
harder to be distinguished from genuine applications. In this sense, adopting a well-
defined variety of features and relying on some kind of explanations about the logic
behind such detectors could improve their design process since it could reveal truly
characterising features; hence, guiding the human expert towards the understand-
ing of the most relevant attack patterns. Moreover, new legislation may enforce
ML-based systems to be interpretable enough to provide an explanation of their
decisions, as they can have significant consequences depending on the domain, such
as the safety-critical cases of medical diagnoses or autonomous driving [11]. For
instance, the Recital 71 of the EU GDPR1 states:
The data subject should have the right not to be subject to a decision,
which may include a measure, evaluating personal aspects relating to
him or her which is based solely on automated processing and which pro-
duces legal effects concerning him or her or similarly significantly affects
him or her, such as automatic refusal of an online credit application or
e-recruiting practices without any human intervention. [...]
In any case, such processing should be subject to suitable safeguards,
which should include specific information to the data subject and the
right to obtain human intervention, to express his or her point of view,
to obtain an explanation of the decision reached after such assess-
ment and to challenge the decision.
For all these reasons, research on the so-called explainable machine learning is cur-
rently rising, and it represents one of the tools used throughout the work of this
thesis to counteract the above-discussed issues.
1.2 Contribution
Given the above-described context, the ultimate goal of the thesis is to explore
strategies that may improve the design process of malware detectors. In particu-
lar, the main contribution of this work is aimed at addressing concerns about the
detectors’ effectiveness, and can be summarised as follows:
1
https://eur-lex.europa.eu/legal-content/EN/TXT/HTML/?uri=CELEX:32016R0679&
from=EN
4 1. Introduction
Moreover, I co-authored work that intends to address the security of detectors and
provides the following contribution:
Ultimately, this work highlights the necessity to adopt a design process that
is aware of the weaknesses and attacks against ML-based detectors, and proposes
explainability techniques as one of the tools to counteract them.
1.3 Organisation
In this thesis, I first frame more extensively the challenges resulting from the usage
of machine learning for cybersecurity problems (Chapter 2). Thereafter, I focus on
the target domain of the thesis, i.e. Android malware detection. In particular, after
providing background notions on Android security (Chapter 3), I present the work
through two main pathways. The first one (Chapter 4) focuses on identifying the
main traits that result to be characterising and effective for Android ransomware
detection. Then, explainability techniques are used to propose methods to assess
the validity of the considered features.
The second pathway (Chapter 5) broadens the view by exploring the relationship
between explainable machine learning and adversarial attacks. I first illustrate work
aiming to define metrics extracted from explainability techniques that can reveal
models’ robustness to adversarial attacks. I then move to an assessment of the
practical feasibility for attackers to alter the features that affect models’ output the
most.
Finally, I discuss the findings and limitations of the thesis, along with potential
future work (Chapter 6).
Chapter 2
Challenges in Cybersecurity:
Adversarial and Explainable Machine
Learning
This chapter aims to introduce two of the main topics that characterise research on
machine learning, namely adversarial learning (Section 2.1) and explainable machine
learning (Section 2.2). Before jumping into them, it is worth discussing briefly the
general background of machine learning for cybersecurity tasks.
As hinted in Chapter 1, machine learning systems are nowadays being extensively
adopted in computer security applications, such as network intrusion and malware
detection, as they have obtained remarkable performance even against the increasing
complexity of modern attacks [12–14]. More recently, learning-based techniques
based on static analysis have proven to be especially effective at detecting Android
malware, which constitutes one of the major threats in mobile security. In particular,
these approaches have shown great accuracy even when traditional code concealing
techniques (such as static obfuscation) are employed (see Chapter 3) [15–18].
Despite the successful results reported by such approaches, the problem of design-
ing effective malware detectors — or solving different cybersecurity tasks — through
machine learning is still far from being solved, and it does not pertain only to ad-
versarial attacks and the lack of interpretability. As a matter of fact, several other
pitfalls may undermine the validity of such systems. In the process of working on
ML-based malware detection, I have been recognising more and more challenges
and caveats to pay attention to. Therefore, with no claim for this thesis to be im-
mune from those issues, it is worth encouraging awareness in this direction as it may
also help to catch the potential role that explainable machine learning may have to
address some of them.
5
6 2. Challenges in Cybersecurity: Adversarial and Explainable Machine Learning
inspection; thus, not solving it in practice. This issue is part of the motivation for
the work of this thesis, and explainable machine learning is definitely one of the
tools to limit it. Another pitfall consists of evaluating models with an inappropriate
baseline, i.e. without performing a proper comparison with other state-of-the-art
approaches. Notably, this also includes avoiding a comparison with non-ML-based
systems. Similarly, typical proposals for novel models are assessed lab-only, i.e. the
test of the system is only performed in vitro, with no discussion of the practical
limitations. As the last point — I refer the reader to [19] for a complete disquisition
of the pitfalls — the usage of an inappropriate threat model that does not consider
the security of the algorithms is another weakness. Notably, a proper threat model
should also examine the practical capabilities of attackers, as discussed in Chapter 5.
Attacker’s capability This aspect first refers to the possibility for the attackers
to manipulate training and test data. When they are able to act on both of them,
we talk about poisoning attacks, while altering samples at test time corresponds to
evasion attacks. In this thesis, I only consider evasion attacks.
Moreover, attackers are often constrained in the kind of modifications that they are
able to perform on a sample, e.g. a malicious Android application. For example,
the Android detection domain mostly allows the attacker to only add new elements
to the app (feature addition), but does not permit removing them (feature removal ).
Goals As Doshi-Velez and Kim [35] have pointed out, not all ML systems require
interpretability. Rather, it is needed when the formalisation of a problem is incom-
plete. For example, we may produce explanations for knowledge extraction since we
do not have a full understanding of the mechanisms of the problem under analysis.
If we want to validate models, explanations can be used to perform debugging; this
way, it is possible to find unexpected behaviour and the conditions under which the
model fails. Moreover, legal or ethical requirements are becoming more and more
pressing. For example, certain domains are particularly sensitive in ensuring no
biases are present in the model, e.g. racial ones in the context of fairness.
– Designers and theorists: they may want to improve the model design or the
algorithms, in order to fix their weaknesses or extract knowledge from them;
– Ethicists: they need explanations to ensure models are fair ;
– End users: explanations are welcome to gain trust about the decisions made
by the models.
to (i) provide explanations, (ii) produce them on top of transparent (see next para-
graph) models, as they are able to provide direct and faithful explanations [38]. In
the second case, having explanations could be beneficial but not strictly necessary;
hence, making the deployment of explainable algorithms optional. Recent work
started exploring more precisely both the context and the necessity for explainable
algorithms in human-agent systems. For example, Glomsrud et al. [39] have studied
the context of autonomous vessels. Besides developers and assurance figures, the
main human interactions, in this case, regard passengers and external agents. The
former ones may want to have feedback from the vessel (e.g. a ferry) during board-
ing, docking, or abnormal situations, in order to be warned about the travel status
or potential danger and prevent panic. External actors could be swimmers, kayakers
or boats that are close to the vessel; hence, they need to understand its intentions
as early as possible.
authors holds only for classifiers with differentiable loss functions. However, the au-
thors have empirically shown that their technique provides sensible prototypes also
for classifiers with non-differentiable losses if computed on a smoothed counterpart.
Finally, Guo et al. [45] have proposed LEMNA, a method specifically designed for
security tasks, i.e. that is optimised for RNN and MLP networks, and that highlights
the feature dependence (e.g. for binary code analysis).
∂f (x)
Gradienti (x) := (2.1)
∂xi
Gradient*Input This technique has been proposed by Shrikumar et al. [47]. This
approach is more suitable than the previously-proposed ones when the feature vec-
tors are sparse. For example, the previously proposed approaches [42, 46] tended
to assign relevance to features whose corresponding components are not present in
the considered application; thus, making the corresponding predictions challenging
to interpret. To overcome this issue, Gradient*Input leverages the notion of direc-
tional derivative. Given the input point x, it projects the gradient ∇f (x) onto x,
to ensure that only the non-null features are considered as relevant for the decision.
More formally, the ith attribution is computed as:
∂f (x)
Gradient*Inputi (x) := ∗ xi (2.2)
∂xi
Integrated Gradients Sundararajan et al. [48] have identified two axioms that
attribution methods should satisfy: implementation invariance and sensitivity. Ac-
cordingly to the first one, the attributions should always be identical for two func-
tionally equivalent networks, e.g. they should be invariant to the differences in the
training hyperparameters, which lead the network to learn the same function. The
second axiom is satisfied if, for every input predicted differently from a baseline (a
reference vector that models the neutral input, e.g. a black image) and that differs
from the baseline in only one feature, has, for that feature, a non-zero attribution. In
the same paper, they have proposed a gradient-based explanation called Integrated
2.2. Explainable Machine Learning 11
Gradients that satisfies the axioms explained above. This method, firstly, considers
the straight-line path from the baseline to the input sample and computes the gradi-
ents at all points along the path. Then, it obtains the attribution by accumulating
those gradients. The attribution along the ith dimension for an input x and baseline
x0 is defined as:
1
∂f (x0 + α · (x − x0 ))
Z
IntegratedGradsi (x) := (xi − x0i ) · dα (2.3)
α=0 ∂xi
To efficiently approximate the previous integral, one can sum the gradients computed
at p fixed intervals along the joining path from x0 to the input x:
p ∂f x0 + k · (x − x0 )
X p 1
IntegratedGradsapprox
i (x) := (xi − x0i ) · · (2.4)
k=1
∂x i p
Android Security
This chapter provides essential background about Android and its security. I first
summarise the main components of the operating system (Section 3.1). I then depict
the scenario of Android malware attacks, especially ransomware ones (Section 3.2),
and conclude with an overview of methods to analyse and detect them (Section 3.3).
Android Manifest This file contains core information about the Android ap-
plication, such as its package name or the supported API levels. It lists the app’s
components, i.e. the elements that define its structure and functionalities. For ex-
ample, the screens visualised by the user are built upon an activity; a background
task is executed through a service. App components can also listen to specific
events and be executed in response to them (receiver). This applies to developer-
defined events or system ones, such as a change in the device’s connectivity status
12
3.2. Android Malware 13
Dex bytecode The classes.dex file embeds the compiled source code of the
applications, including all the user-implemented methods and classes. For example,
it may contain specific API calls that can access sensitive resources such as personal
contacts (suspicious calls). Additionally, it contains all system-related, restricted
API calls that require specific permissions (e.g. writing to the device’s storage).
The main components of a .dex file are:
– Header: this contains information about the file composition, such as the off-
sets and the size of other parts of the file (e.g. constants and data structures).
This data collection is crucial to reconstruct the bytecode in the correct way
when the code is compiled to ARM;
– Constants: they represent the addresses of the strings, flags, variables, classes,
and method names of the application;
– Classes: this is the definition of all the class parameters, like the super class,
the access type, and the list of methods with all the references to the data
contained in the data structure;
– Data structure: this is the container for the actual data of the application,
such as the method code or the content of static variables.
Android has always been the top target of mobile malware attacks. To coun-
teract such offensives, several security improvements have been made to Android
over the past few years. Both Kaspersky’s (Figure 3.1) and Trend Micro’s data
show a declining trend of malicious installation packages since 2016, which seems
to indicate defence measures result to be effective (this will be discussed further
in the next section) [49, 50]. However, the context of mobile threats is highly dy-
namic. For example, Kaspersky [49] points out the appearance of several highly
sophisticated mobile banking threats in 2019, and Trend Micro [50] underlines the
increasing sophistication in targeted campaigns. To better understand such a trend,
the section that follows depicts the scenario for ransomware attacks, along with their
characteristics.
3.2.1 Ransomware
Similar to the trend illustrated in Section 1.1, mobile ransomware has apparently
reached its peak. More specifically, Figure 3.2 shows the steep rise of ransomware
from 2015 to 2017, in terms of the both number of installation packages and distri-
bution share over all types of mobile threats. This fact had motivated the focus of
most of the thesis’ work on ransomware. After that, we can observe a significant
decrease in infections. As of September 2020 and according to Kaspersky [51], such
a trend is motivated by two reasons: (i) it is much harder to extort cash from users
than to steal the bank account data; thus, making the device infection more costly,
and (ii) ransomware is a threat the user likely wants to fight in order to restore his
device, even by factory-resetting the device — except in the case of encrypted files.
Another reason I point out is the progress of security measures against such attacks.
In this sense, Kaspersky [51] highlights that most of the current spread families date
back from 2017. This fact could indicate attacks target older versions of Android
since — as of January 2021 — the majority of devices run Android Oreo (API level
27, released in August 2017) or lower. 1
Number of installation packages for mobile ransomware Trojans Distribution of mobile ransomware
200k 9
8
150k 7
Share (%)
6
100k 5
4
50k 3
2
0
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 1
20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 0
16 16 16 16 17 17 17 17 18 18 18 18 19 19 19 19 20 20
2015 2016 2017 2018 2019
(a) (b)
Figure 3.2: Number of installation packages (a) and share of distribution over all malware
types (b) for mobile ransomware. Data elaborated from [49, 51–54].
1
2 invo ke-vir tual { v9 } , L a n d r o i d / a p p / a d m i n / D e v i c e P o l i c y M a n a g e r ; - > lockNow ( ) V
3 move-object v9 , v0
4 move-object v10 , v1
5
6 ...
7
8 m o v e - r e s u l t - o b j e c t v9
9 move-object v10 , v7
10 const/4 v11 , 0 x0
11 invo ke-vir tual { v9 , v10 , v11 } , L a n d r o i d / a p p / a d m i n / D e v i c e P o l i c y M a n a g e r ; - >
resetPassword ( L j a v a / l a n g / S t r i n g ; I ) Z
The same behaviour is provided by Listing 3.2, which shows the encryption
2
MD5: 0cdb7171bcd94ab5ef8b4d461afc446c
16 3. Android Security
1
2 L j a v a / i o / F i l e I n p u t S t r e a m ; - > read ( [ B ) I
3 move-result v0
4 const/4 v5 , -0x1
5 if-ne v0 , v5 , : cond_0
6 invo ke-vir tual { v1 } , L j a v a x / c r y p t o / C i p h e r O u t p u t S t r e a m ; - > flush ( ) V
7 invo ke-vir tual { v1 } , L j a v a x / c r y p t o / C i p h e r O u t p u t S t r e a m ; - > close ( ) V
8 invo ke-vir tual { v3 } , L j a v a / i o / F i l e I n p u t S t r e a m ; - > close ( ) V
3.3.1 Approaches
A first relevant aspect for the different approaches to design detectors is the distinc-
tion between systems that perform static, dynamic, or hybrid analysis.
Static analysis is based on disassembling an Android application and scanning
its components to find malicious traces without executing the application. Con-
sequently, this approach has the advantage of being typically fast and resource-
efficient. Different research works have been published about this type of analysis.
Arzt et al. [57] have proposed FlowDroid, a security tool that performs static taint
analysis within the single components of Android applications. Feng et al. [58] have
proposed Apposcopy, another tool that combines static taint analysis and intent flow
monitoring to produce a signature for applications. Garcia et al. [59] have proposed
RevealDroid, a static system for detecting Android malware samples and classify-
ing them in families. The system employs features extracted from reflective calls,
native APIs, permissions, and many other characteristics of the file. The attained
results showed that RevealDroid was able to attain very high accuracy, resilience to
obfuscation. However, the number of extracted features can be extremely high and
depends on the training data.
Concerning dynamic analysis, it is based on executing and monitoring an ap-
plication in a controlled environment (i.e. sandbox or virtual machine). The goal is
to inspect the interactions between the application and the system to reveal all the
suspicious behaviours. Zhang et al. [60] have proposed VetDroid, a dynamic analysis
platform to detect interactions between the application and the system through the
3
MD5: 59909615d2977e0be29b3ab8707c903a
3.3. Malware Analysis and Detection 17
monitoring of permission use behaviours. Tam et al. [61] have proposed Copper-
Droid, a dynamic analyser that aims to identify suspicious high-level behaviours
of malicious Android applications. Chen et al. [62] have proposed RansomProber,
a dynamic ransomware detection system that uses a collection of rules to exam-
ine several execution aspects, such as the presence of encryption or unusual layout
structures. Dynamic analysis is more challenging to implement. It requires more
computational resources and time to be executed. This is why this type of analysis
cannot be implemented on a mobile device. However, it has better performances in
detecting well-known and never seen malware families.
Finally, the straightforward third approach combines static and dynamic analyses
to take advantage of their strengths and compensate for their weaknesses. An ex-
ample in this sense is the work from Chen et al. [16], who have proposed StormDroid,
a static and dynamic machine learning-based system that extracts information from
API-calls, permissions, and behavioural features.
3.3.2 Features
As hinted with the above-mentioned approaches, several characteristics (that trans-
late to features for ML-based systems) can be extracted to discriminate malware
from legitimate apps. The main ones are the following:
In this chapter, the focus is on the work done to design effective Android ransom-
ware detectors. In particular, I first examine the choice of System API calls as
features, in order to determine if they reveal to be both effective and resilient to
attackers’ anti-detection strategies (Section 4.2, based on the work by Scalas et al.
[18]). Then, I focus on proposing a method to leverage gradient-based explanation
techniques in order to understand if features (System API calls and permissions)
really characterise ransomware behaviour (Section 4.3, based on the work by Scalas
et al. [68]). Before diving into these works, a brief overview of the literature on
Android ransomware detectors is provided (Section 4.1).
19
20 4. Design of Android Ransomware Detectors
Song et al. [74] have proposed a method that aims to discriminate between ransom-
ware and goodware using process monitoring. In particular, they considered system-
related features representing the I/O rate, as well as the CPU and memory usage.
The system has been evaluated with only one ransomware sample developed by the
authors, and no implementation is publicly available.
Cimitile et al. [72] have introduced an approach to detect ransomware that is based
on formal methods (by using a tool called Talos), which help the analyst identify
malicious sections in the app code. In particular, starting from the definition of
payload behaviour, the authors manually formulated logic rules that were later ap-
plied to detect ransomware. Unfortunately, such a procedure can become extremely
time-consuming, as an expert should manually express such rules.
Gharib and Ghorbani [73] have proposed Dna-Droid, a static and dynamic approach
in which applications are first statically analysed, and then dynamically inspected
if the first part of the analysis returned a suspicious result. The system uses Deep
Learning to provide a classification label. The static part is based on textual and
image classification, as well as on API calls and application permissions. The dy-
namic part relies on sequences of API calls that are compared to malicious sequences,
which are related to malware families. This approach has the drawback that heavily
obfuscated apps can escape the static filter; thus, avoiding being dynamically ana-
lysed.
Finally, Chen et al. [62] have proposed RansomProber, a purely dynamic ransom-
ware detector that employs a set of rules to monitor different aspects of the app
execution, such as the presence of encryption or anomalous layout structures. The
attained results report a very high accuracy, but the system has not been publicly
released yet (to the best of our knowledge).
Table 4.1 shows a comparison between the state-of-the-art methods for specific-
ally detecting or analysing Android ransomware. It is possible to observe that there
is a certain balance between static- and dynamic-based methods. Some of them also
resort to Machine-Learning to perform classification. Notably, only HelDroid and
GreatEatlon are currently publicly available.
permanent data loss, making their early detection critical. The main characteristic
of such systems is that they rely on different types of information extracted from
multiple parts of the apps (e.g. bytecode, manifest, native libraries, and so forth),
which leads to using large amounts of features (even hundreds of thousands). While
this approach is tempting and may seem to be effective against the majority of at-
tacks in the wild, it features various limitations. First, it is unclear which features
are essential (and needed) for classification, an aspect that worsens the overall ex-
plainability of the system (i.e. why the system makes mistakes and how to fix them).
Second, increasing the types of features extends the degrees of freedom of a skilled
attacker to perform targeted attacks against the learning algorithm. For example,
it would be quite easy to mask a specific IP address if the attacker understood that
this has a vital role in detection [17]. Finally, the computational complexity of such
systems is enormous, which makes them unfeasible to be practically used in mobile
devices, an important aspect to guarantee offline, early detection of these attacks.
In the original work by Maiorca et al. [76], the proposed detection method (called
R-PackDroid) had allowed discriminating between ransomware, generic malware,
and legitimate files by focusing on a small-sized feature set, i.e. System API pack-
ages. The idea of that work had been to overcome the limitations described above
by showing that it was possible to solve a machine learning problem with a limited
number of features of the same type. However, System API-based information does
not only include packages but also classes and methods (particularly employed in
other works, especially mixed with other feature types [15, 59]) that can — poten-
tially — better define the behaviour of APIs. Intuitively, using finer-grained inform-
ation leads to better accuracy and robustness in comparison to other approaches.
Therefore, in the following, I present how we have explored such a possibility by
progressively refining the System API-based information employed in the original,
previous work [76]. In particular, we have inspected the capabilities of multiple
types of System API-related information to discriminate ransomware from malware,
and goodware, aiming to provide an answer to the following Research Questions:
The attained results show that all System API-based techniques provide excel-
lent accuracy at detecting ransomware and generic malware in the wild, by also
showing capabilities of predicting novel attacks and resilience against obfuscation.
More specifically, using finer-grained information even improves the accuracy at de-
tecting previously unseen samples, and provides more reliability against obfuscation
attempts. From a methodological perspective, such results demonstrate that it is
possible to develop accurate systems by strongly reducing the complexity of the ex-
amined information and by selecting feature types that represent how ransomware
attacks behave.
Finally, to demonstrate the practical suitability of System API-based approaches
on Android devices, we have ported to Android R-PackDroid (the package-based
strategy originally proposed in [76] and further explored in this work). Our applic-
ation, which can detect both ransomware and generic malware in the wild, shows
that methodologies based on System API can be implemented with good compu-
tational performances — e.g. with a processing timing that is acceptable for end
users — even in old phones, and its a demonstration of a full working prototype
being deployed on real analysis environments. R-PackDroid can be downloaded for
free from the Google Play Store1 .
With this work, we have pointed out that it is possible to create effective, de-
ployable, and reasonably secure approaches for ransomware detection by only using
specific feature types. Hence, this work acts as the baseline to make use of explain-
ability in order to make detection even more accurate and robust.
The organisation of the content of this work is the following: Section 4.2.1 de-
scribes the employed detection methods. Section 4.2.2 illustrates the experimental
results attained with all of them, as well as a comparison between our systems and
other approaches in the wild. Section 4.2.3 describes the implementation details
of R-PackDroid and its computational performances. Section 4.2.4 discusses the
limitations of the work, which is finally concluded by Section 4.2.5.
4.2.1 Method
As anticipated, the intuition for developing a ransomware-oriented detector is to
rely on a smaller set of information (System API calls) that is typically employed in
ransomware. However, as System APIs are also widely used in generic malware and
legitimate files, this information type also allows detecting other attacks that differ
from ransomware. In this way, it is possible to create a powerful, wide-spectrum
detector that features a much lower complexity in comparison to other approaches.
Accordingly, such a system may take as input an Android application, analyse it
and return three possible outputs: ransomware, generic malware, or trusted. The
analysis is performed in three steps:
Trusted
Ransomware
– Feature extraction: in this phase, the code lines received from the previ-
ous phase are further analysed to extract the related System API information
(either packages, classes, or methods). The occurrence of such pieces of in-
formation is then counted; thus, producing a vector of numbers (feature vector )
that is sent to a classifier.
– Classification: it is carried out through a supervised approach, in which the
system is trained with samples whose label (i.e. benign, generic malware or
ransomware) is known. Such a technique has been used in previous work with
excellent results [15, 17, 59]. In particular, our approaches employ Random
Forest classifiers, which are especially useful to handle multi-class problems,
and which are widely used for malware detection. The complexity of such
classifiers depends on the number of trees that compose them. Such a number
must be optimised during the training phase.
file from the APK. Since .apk files are essentially zipped archives, such an operation
is rather straight-forward.
Once pre-processing is complete, the classes.dex file is further analysed by the
feature extraction module, which inspects the executable file for all invoke-type in-
structions (i.e. all instructions related to invocations) contained in the classes.dex
code. Then, each invocation is inspected to extract the relevant API information for
each methodology, according to a System API reference list that depends on the op-
erating system version (in our case, Android Nougat — API level 25). Only the API
elements that belong to the reference list are analysed. In this work, we consider
three different methodologies, based on, respectively, package, class, and method
extraction. If a specific API element is found, its occurrence value is increased by
one.
In the following, we provide a more detailed description of the methodologies
employed in this work by referring to the example reported in Listing 4.1. Such a
listing comes from the .smali output, which uses a ‘/’ as separator between package,
class and method names. The code is parsed in three ways, according to each feature
extraction strategy. For each example, we used a very small subset of the employed
reference API.
Classes Extraction In this case, we extract the occurrences of the System API
classes (a total of 4609 reference features). Notably, such classes belong to the
System API packages of the previous methodology (and, for this reason, their num-
ber is significantly higher than packages). In the example of Listing 4.1, we use
a subset composed of two reference API classes: java.io.FileInputStream and
javax.crypto.CypherOutputStream, each of them appearing twice.
Methods Extraction In this third case, we extract the occurrences of the System
API methods (a total of 36148 reference features). These methods belong to the Sys-
tem API classes of the previous methodology, leading to a very consistent number of
features. This strategy is very similar to other ones employed by other systems (e.g..
[15, 59]), which have used these features together with user-implemented APIs and
other features. In the example of Listing 4.1, we use a subset composed of four refer-
ence API methods: read() and close() from java.io.FileInputStream, flush()
and close() from javax.crypto.CypherOutputStream. Each API call appears
only once. Note that, although there are two methods named ‘close’, they belong
to two different classes, and they are therefore considered as different methods.
1
2 Code
3
4 L j a v a / i o / F i l e I n p u t S t r e a m ; - > read ( [ B ) I
5 move-result v0
6 const/4 v5 , -0x1
7 if-ne v0 , v5 , : cond_0
8 inv oke-vi rtual { v1 } , L j a v a x / c r y p t o / C i p h e r O u t p u t S t r e a m ; - > flush ( ) V
9 inv oke-vi rtual { v1 } , L j a v a x / c r y p t o / C i p h e r O u t p u t S t r e a m ; - > close ( ) V
10 inv oke-vi rtual { v3 } , L j a v a / i o / F i l e I n p u t S t r e a m ; - > close ( ) V
11
12 Feat. Vectors
13
14 Packages - [2 2 0]
15
16 Classes - [2 2]
17
18 Methods - [1 1 1 1]
not run the experiments on Android phones, but on an X86 machine. However, we
built a full, working implementation of one of the three approaches, which can be
downloaded from the Google Play Store (see next section).
The rest of this section is organised as follows: I start by providing an overview
of the dataset employed in our experiments. Then, I describe the results attained
by four evaluations. The first one aimed to establish the general performances
of API-based approaches by considering random distributions of training and test
samples. The second one aimed to show how API-based approaches behaved when
analysing samples released after the training data. The third one aimed to show
a comparison between our API-based approaches and other systems that employed
mixed features. Finally, we evaluate the resilience of API-based approaches against
obfuscation techniques and evasion attacks.
4.2.2.1 Dataset
In the following, I describe the dataset employed in our experiments, including those
in other works of this thesis. Without considering obfuscated applications (which
are going to be discussed in Section 4.2.2.3), we have obtained and analysed 39157
apps, which are organised in the three categories mentioned in Section 4.2.1.
Ransomware The 3017 samples used for our ransomware dataset have been re-
trieved from the VirusTotal service2 (which aggregates the detection of multiple
anti-malware solutions) and from the HelDroid dataset3 [69]. With respect to the
samples obtained from VirusTotal, we have used the following procedure to obtain
the samples: (i) we have searched and downloaded the Android samples whose anti-
malware label included the word ransom; (ii) for each downloaded sample, we have
extracted its family by using the AVClass tool [77], which essentially combines the
various labels provided by anti-malware solutions to create a unique label that iden-
tifies the sample itself; (iii) we have considered only those samples whose family was
coherent to ransomware behaviours, or was known to belong to ransomware.
2
http://www.virustotal.com
3
https://github.com/necst/heldroid
26 4. Design of Android Ransomware Detectors
Family Samples
Locker 752
Koler 601
Svpeng 364
SLocker 281
Simplocker 201
LockScreen 122
Fusob 120
Lockerpin 120
Congur 90
Jisut 86
Other 280
80 80
True Positive Rate (%)
40 40
Figure 4.2: Results from Experiment 1. The ROC curves (averaged on 5 splits) attained
by the three System API methods for ransomware (a) and generic malware (b) against
benign samples are reported.
– Ransomware against benign samples: the crucial goal of this work has
been detecting ransomware attacks and, more importantly, avoiding them from
being considered benign files. A critical mistake would most likely compromise
the whole device by locking it or encrypting its data. For this reason, it is
essential to verify whether ransomware attacks can be confused with benign
samples;
– Generic malware against benign samples: even if System API-based
strategies are employed to detect ransomware, they could also be used to
classify generic malware (see Section 4.2.1). Hence, the goal here is to verify,
from a practical perspective, if System API-based information can correctly
detect other non-ransomware attacks and distinguish them from legitimate
files.
Figure 4.2 shows the ROC curves that describe the performances attained on
ransomware and generic malware detection by the three System API-based methods
(packages, classes, methods). By observing these curves, we can deduce the following
facts:
1. All System API-based techniques were able to precisely detect more than 97%
of ransomware samples, with only 1% of false positives. Because our dataset
included a consistent variety of families, we claim that all strategies can detect
the majority of ransomware families in the wild. Worth noting, there are no
differences in results between using packages, classes, or methods. This result
means that, concerning general performances, using finer-grained features does
not improve detection.
2. All System API methods featured good accuracy with relatively low false pos-
itives (around 90% at 1%, more than 95% at 2%) at detecting generic malware.
While using class-related features did not bring significant improvements to
28 4. Design of Android Ransomware Detectors
android.view
android.view android.app.Activity
android.app.Activity StringBu
StringB
android.telephony
android.telephony java.lang.Object
java.lang.Object StringB
StringB
android.os
android.os android.net.Uri
android.net.Uri Context@getPa
Context@getP
android.app
android.app android.content.Intent
android.content.Intent TelephonyManage
TelephonyManag
android.content.res
android.content.res android.telephony.TelephonyManager
android.telephony.TelephonyManager I
android.content.pm
android.content.pm android.content.Context
android.content.Context WindowManager@ge
WindowManager@ge
android.net
android.net android.util.Log
android.util.Log
java.io
java.io java.util.ArrayList
java.util.ArrayList I
java.util
java.util android.view.Window
android.view.Window ViewGroup
ViewGrou
android.content
android.content java.lang.StringBuilder
java.lang.StringBuilder SmsManag
SmsMana
android.media
android.media android.content.pm.PackageManager
android.content.pm.PackageManager
java.lang.ref
java.lang.ref java.lang.Boolean
java.lang.Boolean PackageManager@
PackageManager@
android.util
android.util android.widget.FrameLayout
android.widget.FrameLayout Context@ge
Context@ge
java.lang
java.lang android.view.Display
android.view.Display Arr
Arr
android.widget
android.widget android.content.res.Resources
android.content.res.Resources
android.webkit
android.webkit android.app.Dialog
android.app.Dialog Inpu
Inp
android.text
android.text android.view.ViewGroup
android.view.ViewGroup C
java.lang.reflect
java.lang.reflect android.widget.EditText
android.widget.EditText A
android.app.admin
android.app.admin android.widget.FrameLayout.LayoutParams
android.widget.FrameLayout.LayoutParams S
java.util.zip
java.util.zip android.view.View
android.view.View
java.nio
java.nio android.os.Bundle
android.os.Bundle Process@g
Process@
android.graphics
android.graphics java.util.HashMap
java.util.HashMap
java.net
java.net android.app.AlertDialog.Builder
android.app.AlertDialog.Builder ViewG
ViewG
android.graphics.drawable
android.graphics.drawable java.lang.Process
java.lang.Process Bun
Bun
android.database
android.database android.view.KeyEvent
android.view.KeyEvent Activity@getCo
Activity@getC
00 0.02
0.02 0.04
0.04 00 0.005
0.005
(a) (b)
android.app.Activity StringBuilder@toString
java.lang.Object StringBuilder@append
android.net.Uri Context@getPackageManager
android.content.Intent TelephonyManager@getDeviceId
ephony.TelephonyManager Intent@setType
android.content.Context WindowManager@getDefaultDisplay
android.util.Log Uri@parse
java.util.ArrayList Intent@getData
android.view.Window ViewGroup@removeView
java.lang.StringBuilder SmsManager@getDefault
ntent.pm.PackageManager File@mkdirs
java.lang.Boolean PackageManager@getPackageInfo
ndroid.widget.FrameLayout Context@getPackageName
android.view.Display ArrayList@remove
roid.content.res.Resources ArrayList@size
android.app.Dialog InputStream@read
android.view.ViewGroup Context@getDir
android.widget.EditText ArrayList@clear
rameLayout.LayoutParams String@valueOf
android.view.View ArrayList@get
android.os.Bundle Process@getInputStream
java.util.HashMap Runtime@exec
oid.app.AlertDialog.Builder ViewGroup@addView
java.lang.Process Bundle@putBundle
android.view.KeyEvent Activity@getComponentName
0 0.005 0 0.005
(c)
Figure 4.3: Results from Experiment 1. We report the top-25 features, ordered by the
classifier information gain (calculated by averaging, for each feature, the gains that were
obtained by training the 5 splits), for each methodology: (a) for packages, (b) for classes,
(c) for methods.
30 4. Design of Android Ransomware Detectors
For this assessment, we have included in the training set only the samples that
were first seen before a date Dtr , and we have tested our system on a number of
ransomware samples that had been released on a date Dte for which Dte > Dtr (we
choose the ROC operating point of the system corresponding to a false positives
value of 1%). We have performed our tests by choosing different values of Dte ,
where Dtr is December 31st, 2016. Concerning test data, we point out that the
samples (which were extracted by the VirusTotal service) are unevenly distributed
through the months. More specifically, the number of ransomware samples that
had been submitted to the VirusTotal service was significantly different for each
month of 2017. We have been able to retrieve only a little amount of samples whose
first release date was between January and September 2017. Conversely, we could
obtain a consistent amount of samples whose Dte was October and November 2017.
Therefore, we have grouped the samples gathered in subsequent months to obtain
temporal ranges with similar amounts of testing data. We considered three main
ranges for Dte : (i) January to September 2017; (ii) October 2017; (iii) November
2017.
0.88
01 09/2017 0.99
0.99
0.88
10/2017 0.93
0.93
0.73
11/2017 0.95
0.97
Results are provided in Figure 4.4, which shows that by training the system
with data retrieved in 2016, class- and method-based strategies can accurately de-
tect ransomware test samples released in 2017. However, the package-based strategy
struggles at detecting the test-set from November 2017. Notably, in comparison with
class- and method-based strategies, the package-based approach shows almost a 10%
accuracy loss when analysing samples released till October, and more than 20% ac-
curacy loss for samples released in November. Conversely, the other two methods
exhibit stable accuracy on each temporal range. This result is particularly interest-
ing, as it shows that the prediction of novel samples can be significantly improved
by employing finer-grained features. However, the results attained by package-based
4.2. On the Effectiveness of System API-related Information 31
features are nevertheless encouraging, as they showed that even a reduced number
of features could attain good performances at detecting novel attacks. Overall, this
experiment has further confirmed that System API-based strategies can predict new
ransomware attacks with good accuracy, even on test data released. In this case,
using finer-grained features brings a consistent advantage to detection.
Table 4.3: Detection performances for System API-based strategies, GreatEatlon, In-
telliAV, RevealDroid, and Talos on 512 ransomware test files released in 2017, by using
training data from 2016. We use the ND (Not Defined) to indicate that a certain tool
cannot provide the corresponding label for the analysed samples.
analysis, which also depends on the training data. With a much simpler set of in-
formation, we are able to obtain very similar performance concerning accuracy. This
result is especially interesting from the perspective of adversarial attacks, as using
fewer features for classification can make the system more robust against them (the
attacker can manipulate less information to evade the system) [81]. The perform-
ance attained by System API-based approaches is also better than IntelliAV, which
employes a combination of different features (including permissions, user-defined
API, and more). System API-based strategies also perform significantly better than
GreatEatlon, which based its detection also on information extracted from strings
and language properties. Notably, using methods significantly improves the accur-
acy performances in comparison to packages and classes, in line with what was
obtained from Experiment 2. Finally, we have analysed the performance attained
by Talos [72]8 , a static analysis tool that employs logic rules to perform detection
(hence, without machine learning). The attained results are very encouraging, but
they strongly depended on the set of rules that have been (manually) established to
perform ransomware detection. Conversely, System API-based approaches do not
require any manual definition of the detection criteria. Additionally, the analysis
times of Talos are significantly slower than the ones attained by methods proposed
in this work (an average of 100 seconds per application, 400 times slower than
ours) — see Section 4.2.3.1.
non-obfuscated) variant was already included in the training set. Such a choice has
been made because we wanted to assess if obfuscation was enough to influence the
key-features of System API-based methods; thus, changing the classifiers’ decision
for a sample whose original label was malicious.
To this end, we have employed a test-bench of ransomware obfuscated with the
tool DexProtector9 , a popular, commercial obfuscation suite that allows for protect-
ing Android applications through heavy code obfuscation. Although such a tool is
mostly used for legitimate purposes (e.g. protection of intellectual properties), it
can also be used by attackers to make malicious applications harder to be detec-
ted. Out of the 3017 ransomware samples, we could obfuscate 2668 samples (the
remaining could not be obfuscated due to errors of the obfuscation software) with
three different strategies (for a total of 8004 obfuscated samples). The strategies
employed to obfuscate samples are the following:
Figure 4.5 reports the accuracy attained by the three System API-based strategies
against the obfuscated samples. Such results show that all the detection strategies
(without significant differences between each other) are resilient against obfuscation
attempts. However, Class Encryption deserves separate consideration. This strategy
employs heavy obfuscation, and it was explicitly performed to defeat static analysis.
Typically, none of the static-based techniques that analyse the executable file should
be able to detect such attacks correctly. However, this obfuscation strategy intro-
duces a very regular sequence of System API-based routines that manage runtime
decryption of the executable contents.
For this reason, it is sufficient to inject only one sample inside the training set
to make all obfuscated samples to be detectable. Hence, we added the +1 mark to
Class Encryption. Notably, this may create false positives when legitimate samples
are obfuscated with the same strategy. Nevertheless, it is sporadic to find such
applications, as class encryption strongly decreases the application performances
[71], and much simpler obfuscation techniques are generally used.
0.99
Regular Ransomware 0.99
0.99
0.90
String Encryption 0.97
0.92
0.90
Resource Encryption 0.97
0.92
1.00
Class Encryption (+1) 1.00
1.00
scan it (or to scan the whole file system). Each application is identified by a box,
whose colour is associated with the application label (green for trusted, red for
malware, and violet for ransomware). After getting the result, by clicking on each
box related to the scanned application, it is possible to read more details about
the packages that it employs, as well as general information such as the app hash
and size. Moreover, if the user believes that the result reported by R-PackDroid is
wrong, she can report it by simply tapping a button (a privacy policy to accept is also
included). To this scope, we resort to the popular service FireBase. 12 R-PackDroid
is available for free on the Google Play Store. 13
0.5
0.4
0.2
0.1
0.0
0-1 1-2 2-5 5-10 10-50
Sample Size (MB)
Figure 4.7: Analysis performances on a X86 workstation, with the elapsed time in
seconds, for different APK sizes.
run the same analysis on a Nexus 5, a 5-year-old15 , 4-core device with 2 GB of RAM,
equipped with the 6.0.1 version of Android. Results are reported in Figure 4.8. Even
if the analysis times are slower than X86 machines, and even if we have been using,
in this case, the slowest version of the algorithm, the average analysis time for
very large apps is slightly more than 4 seconds. This result — at the time of the
test — was very encouraging, and it showed that R-PackDroid could be safely used
even on old phones. The higher dispersion of the time values, in comparison to the
ones attained in the previous picture, was possibly caused by the presence of other
background processes in the device.
Finally, it is also important to observe that the analysis time is not strictly pro-
portional to the APK size, as the file may contain additional resources (e.g. images)
that increase the APK size, without influencing the size of the dexcode itself. For this
reason, it was not surprising to see the attained average values do not necessarily
increase with the APK size.
0
0-1 1-2 2-5 5-10 10-50
Sample Size (MB)
Figure 4.8: Performance analysis on a real device, with the elapsed time in seconds, for
different APK sizes.
System API-based information, they may not be feasible. I cover and inspect these
adversarial-related aspects as well as the practical creation of evasive samples in
Chapter 5.
As highlighted in Chapter 3, it is also worth noting that since Android Oreo,
Google introduced new defences against background processes that are typical of
ransomware (e.g. the ones that directly lock the device). However, this does not
exclude other malicious actions on the application level. For this reason, it is always
better to have an additional system that can detect attempts at performing malicious
actions.
Finally, we also point out that, during our tests, we found samples that could not
be analysed due to crashes and bugs of the DexLib library, and that have therefore
been excluded from our analysis. However, their percentage (regarding the whole
corpus that we have analysed) is negligible (less than 1% of the whole file corpus).
4.2.5 Conclusions
With this work, we have provided a detailed insight into how System API-based
information could be effectively used (also on a real device) to detect ransomware
and to distinguish it from legitimate samples and generic malware. The attained
experimental results have demonstrated that, by using a compact set of information
tailored to the detection of a specific malware family (ransomware), it is possible to
achieve detection performance (also on other malware families) that is comparable
to systems that employed a much more complex variety of information. Moreover,
System API-based information has also proved to be valuable to detect obfuscated
samples that focused on hiding user-implemented information. Notably, although it
is tempting to combine as many information types as possible to detect attacks (or
to develop computationally heavy approaches), it may not be the only feasible way
to construct accurate, reliable malware detectors. For this reason, we claim that
future work should focus on developing reliable, small sets of highly discriminant
features that cannot easily be manipulated by attackers (with a particular reference
to machine learning attacks). Moreover, a clear understanding of the impact of each
feature on the classifier detection can help analysts understand (i) the classifiers’
errors, so to improve their detection capabilities. (ii) the attacks’ behaviour, so to
identify spurious patterns. The thesis proposes to cover the latter aspect in the
section that follows.
ity techniques help to identify the features that characterise ransomware samples,
i.e. the properties that are required to be present in order to combat ransomware
offensives effectively. In this regard, our contribution is threefold:
In this way, we believe that our proposal can help cyber threat intelligence teams in
the early detection of new ransomware families, and, above all, could be a starting
point to help designing other malware detection systems through the identification
of their distinctive features. Our approach is presented in Section 4.3.1, starting
from the strategy to perform ransomware detection and followed by the rationale
behind the usage of explanation techniques for identifying relevant features. Since
the methods we consider have been originally designed to indicate the most influ-
ential features for a single prediction, we propose to evaluate their output against
multiple samples to understand the average role of each feature. Notably, tailoring
such techniques to our domain and goal requires attentive checks. Therefore, in our
experimental analysis (Section 4.3.2) we first verify their suitability, and we even-
tually analyse their output to extract information. I discuss the limitations of our
approach, together with future research paths, in Section 4.3.3.
Influencing Factors A first concern arises around the choice of the classifiers.
Since several types of them can be used with success for this detection problem,
there could be as many different explanations as to the number of potential clas-
sifiers. For this reason, it is necessary to verify if the specific learning algorithm
affects the output of the attributions. Therefore, a reasonable check to perform is
to compare the explanation vectors within a set of plausible classifiers, one explan-
ation technique at a time. Complementary to this aspect, we should get insights
about which of the three explanation techniques is the most accurate, or to what
extent they are equivalent. In this way, if all the explanations are mostly similar,
it is possible to consider only one of them. Therefore, for each model, we compare
its attributions across the different attribution techniques, similar to the procedure
performed by Warnecke et al. [83]. It is worth noting that this approach gives rise
to the following tricky issue: how can we guarantee that similar attributions imply
faithful explanations? In this regard, in our setting, all the techniques are gradient-
based, which are known to be reasonably effective; hence, we make the assumption
that all of them are suitable despite their peculiarities.
The third concern comes from the influence of the data on the explanations; specific-
ally, the possibility that attributions could not be associated with the data labelling,
and, consequently, to what the model learns. For example, if attributions do not
change after random ransomware samples are assigned to the trusted class, then
the model would be bounded by the samples themselves, rather than by what it
learned through the training phase. This aspect can be of particular interest for
Gradient*Input and Integrated Gradients, where the input is part of their computa-
4.3. Explanation-driven Ransomware Characterisation 41
tion. In this case, we follow the method proposed by Adebayo et al. [84], where the
ordinary attributions of each classifier are compared to the ones of a correspondent
classifier trained with randomised labels.
I cover all the above-mentioned aspects in Section 4.3.2.2, where we practically per-
form different comparisons through the use of correlation and similarity metrics,
described in Section 4.3.2.1.
Knowledge Extraction The above concerns and our proposed answers for them
allow us to approach the problem with more awareness about the caveats that these
explainability techniques pose. Nevertheless, there are a few other aspects that
are worth focusing on. As the first remark, both the types of features of our set-
ting (API calls and permission requests) are examples of sparse features. More
specifically, each application uses only a small amount of APIs and permissions;
consequently, each sample exhibits a few non-zero (used) features. This fact marks
a non-negligible difference with respect to other domains, such as image recognition,
where the features (typically raw pixels) are all always used. Therefore, when using
explanations to characterise the Android ransomware samples under test, we expect
the attributions to be sparse as well. Moreover, as investigated by Lage et al. [85],
sparsity is one of the factors that make explanations more comprehensible for the
human expert. All other aspects being equal, we will then favour the techniques
that satisfy this requirement the most.
Once a specific set of reliable attributions is established, we should find a strategy
to analyse them and extract information concretely. In particular, looking at the
predictions’ relevance values, we aim to catch the average role of the features onto
the samples’ characterisation. Since the attribution methods we have chosen provide
us with a unique explanation for each prediction, it is necessary to define the concept
of average in practice. Figure 4.9 shows an example of the distribution of the at-
tributions obtainable with our setting, which I will describe in Section 4.3.2. In
this figure, two features representing two permissions —in this thesis, we indicate
permissions with capital letters — are shown; they are calculated with Integrated
Gradients against trusted samples for an MLP classifier.
The significant aspect to observe is that, in our setting, the distribution of relevance
values is typically bimodal. The attribution values could be zero for some samples
and be condensed around a certain value level for some others. In particular, they
exhibit a positive value if the feature converges towards the ransomware class; neg-
ative otherwise. Therefore, we could choose a synthetic metric that expresses the
central tendency of this kind of distribution. In our work, we consider the median
value. In this way, we highlight a feature as relevant when, for most of the samples,
it does not exhibit a zero value. Although using a unique, synthetic measure for
describing the attributions could seem too limiting, we claim that useful information
can actually be gathered by analysing appropriate sets of samples, as we describe in
Section 4.3.2.3.
WRITE_EXTERNAL_STORAGE
35
ACCESS_NETWORK_STATE
30
Occurrence (%)
25
20
15
10
5
0
−2 −1.5 −1 −0.5 0 0.5 1 1.5 2 2.5
Attribution value
Figure 4.9: Attribution distribution of two features, calculated for an MLP classifier
through Integrated Gradients. Positive values associate the feature to the ransomware
class, negative values to the trusted one. The dotted lines represent the median value.
4.3.2.1 Setting
We operate in a two-class setting, where the learning algorithms are trained to clas-
sify the positive class of ransomware samples against the negative one of trusted
samples. In the following, I briefly summarise the parameters and the implementa-
tion used for the experiments.
Dataset and Features We use the same dataset as [18] (Section 4.2), with 18396
trusted and 1945 ransomware samples, which span from 2011 to 2018 according
to their dex last modification date. As explained in Section 3.2.1, recent Android
versions limit the impact of older ransomware samples; however, since these system
updates are installed in a minority of devices, these attacks are still relevant and
suitable to assess the validity of our approach. The feature vector consists of 731
features. Among them, 196 represent the occurrence of the API package calls. We
cumulate all the Android platform APIs until level 26 (Android Oreo). Moreover,
the set of APIs is strictly limited to the Android platform [86] ones. The remaining
amount of features consists of checking the request of permissions extracted from the
AndroidManifest.xml: when one permission is used, we assign to the correspondent
feature a 1; 0 otherwise. In this case, we cumulate the list of permissions until level
29 (Android 10). Since each new API level typically adds new packages, the APIs
introduced after 2018 cause the correspondent features to be not used. aapt16
is employed to extract the permissions used by each APK. Permissions’ names are
indicated in capital letters.
machine with RBF kernel (SVM-RBF), both implemented with secml [87], a library
for performing adversarial attacks and explaining machine learning models. The
third classifier is a multi-layer perceptron (MLP), implemented with Keras. 17 Each
classifier has been trained and optimised in its parameters with a repeated 5-fold
cross-validation, using 50% of the dataset as the test set. Their detection perform-
ance are shown in Section 4.3.2.3.
Notably, these classifiers do not reach the state-of-the-art performance of a Random
Forest classifier, which indeed had been used in Section 4.2. The reason for not us-
ing it is that this ensemble algorithm presents a non-differentiable decision function;
therefore, it is not possible to use gradient-based techniques on top of it. Although
it could be possible to train a surrogate classifier to simulate the Random Forest
behaviour, it is not necessary to reach state-of-the-art performance in the context
of the experiments that follow.
( di=1 xi yi ) − dx̄ȳ
P
Pearson(x, y) := q P qP (4.2)
( i=1 xi ) − dx̄ ( di=1 yi 2 ) − dȳ 2
d 2 2
Pd
xi y i
i=1
Cosine Similarity(x, y) := (4.3)
kxkkyk
In both cases, the output value lies in the range [−1, 1]. Intersection size follows the
formulation used by Warnecke et al. [83], which is the following:
|Tx ∩ Ty |
IS(x, y) := (4.4)
k
where Tx and Ty represent the sets of k features with the highest relevance from
the attribution vectors x and y, respectively. The intersection size lies in the [0, 1]
17
https://keras.io/
44 4. Design of Android Ransomware Detectors
Model Influence In this first test, we correlate the attributions of the classi-
fiers with each other, given a fixed explanation method. The results are shown
in Figure 4.10. It is possible to notice how the Integrated Gradients case shows
particularly-high correlation values, which indicates that its explanations are quite
similar to each other across the three considered classifiers. Conversely, this is much
less valid for Gradient, where each classifier provides a more dissimilar distribution
of the attributions. This first result suggests that, in our setting, the impact of the
specific learning algorithm to the explanations is quite modest, especially for the
case of Integrated Gradients. In other words, each of the three considered classifi-
ers could be interchangeably selected as the reference model for the analysis of the
explanations.
SVM 1.0 0.65 0.63 1.0 0.65 0.62 1.0 0.4 0.33 SVM 1.0 0.42 0.93 1.0 0.42 0.93 1.0 0.6 0.67
SVM-RBF 0.65 1.0 0.54 0.65 1.0 0.53 0.4 1.0 0.53 SVM-RBF 0.42 1.0 0.54 0.42 1.0 0.54 0.6 1.0 0.6
MLP 0.63 0.54 1.0 0.62 0.53 1.0 0.33 0.53 1.0 MLP 0.93 0.54 1.0 0.93 0.54 1.0 0.67 0.6 1.0
SV
SV
SV
SV
M
SV
SV
M BF
SV
SV
M BF
SV
SV
M BF
SV
SV
M BF
LP
LP F
LP
LP
LP
LP
M
M
M
M
-R
-R
-R
-R
-R
-R
BF
SVM 1.0 0.88 0.95 1.0 0.88 0.95 1.0 0.53 0.67
SVM-RBF 0.88 1.0 0.95 0.88 1.0 0.95 0.53 1.0 0.53
MLP 0.95 0.95 1.0 0.95 0.95 1.0 0.67 0.53 1.0
SV
SV
SV
SV
M BF
SV
SV
M BF
LP
LP
LP
M
M
-R
-R
-R
BF
Gradient*Input and Integrated Gradients are very similar — and also equivalent
with linear classifiers. On the contrary, as the previous tests have suggested as well,
Gradient produces quite dissimilar explanations.
Cosine Similarity Pearson IS (k=15) Cosine Similarity Pearson IS (k=15)
G 1.0 0.17 0.17 1.0 0.18 0.18 1.0 0.27 0.27 G 1.0 0.31 0.35 1.0 0.3 0.34 1.0 0.33 0.33
GI 0.17 1.0 1.0 0.18 1.0 1.0 0.27 1.0 1.0 GI 0.31 1.0 0.78 0.3 1.0 0.78 0.33 1.0 0.6
IG 0.17 1.0 1.0 0.18 1.0 1.0 0.27 1.0 1.0 IG 0.35 0.78 1.0 0.34 0.78 1.0 0.33 0.6 1.0
G GI IG G GI IG G GI IG G GI IG G GI IG G GI IG
G GI IG G GI IG G GI IG
Data Influence Finally, we evaluate the possible impact of the data on the ex-
planations. To do so, we consider randomized labels for the samples of the training
set, and we train new classifiers with these labels, forcing a 50% accuracy on the
test set. Then we correlate the attribution vectors of these classifiers with those
of the original ones. The results, grouped by explainability technique, are visible
in Table 4.4. In this case, all the methods present similar results. Notably, only
Gradient has nearly-to-zero correlation values, but the Pearson metric exhibits high
p-values, making the results less reliable. Therefore, we can affirm that all the tech-
niques, included Gradient*Input and Integrated Gradients — besides the presence of
the input in their computation — reflect what the model learns, without particularly
being bounded by the samples.
Table 4.4: Data influence. The Pearson column also includes the p-value in brackets.
CS=Cosine Similarity.
Overall, although all the techniques appear to be not that diverse, we have also
observed by manual inspection that Gradient tends to produce less sparse explan-
ations; i.e. a larger amount of features presents non-null relevance values. Ul-
timately, we claim the most suitable technique is, for our problem, one between
Gradient*Input and Integrated Gradients.
46 4. Design of Android Ransomware Detectors
Table 4.5: Behaviour associated with each feature depending on the sign of the attribu-
tion values and the samples used to calculate the explanations.
Figure 4.12 shows the distribution of the attribution values for the top-5 pos-
itive and top-5 negative relevant features of the ransomware (a) and trusted (b)
classes. As a first observation, we can notice that the highest median values are
associated with the features that go into the direction of the ransomware class,
while trusted samples’ attributions exhibit lower sparsity and much higher vari-
ance. This fact suggests that trusted samples need a higher number of features to
have them described, being the set of apps much broader and diversified. Go-
ing into more detail, let us consider Figure 4.12a. The top-5 positive features
can be reasonably associated with the behaviour of a generic malware. For ex-
ample, RECEIVE_BOOT_COMPLETED enables an app to start after a device reboot,
while WAKE_LOCK avoids it being killed by the operating system. Moreover, we can
see the presence of a ransomware-specific feature — SYSTEM_ALERT_WINDOW — that
is a permission that allows the attacker to display an overlay window (see Sec-
tion 3.2.1), and that is often tied with android.app.admin. The top-5 negative
features, such as ACCESS_NETWORK_STATE, should be interpreted as typical of non-
ransomware apps. Concerning the trusted samples, Figure 4.12b shows as the most
4.3. Explanation-driven Ransomware Characterisation 47
Ransomware Trusted
8
12
6
10
Attribution value
Attribution value
4
8
2
6
4 0
2 −2
0 −4
−2 −6
−4 −8
RE
an
SY d.a T_C
RE
an LO
an d.c
an d.t
an d.p
AC d.a
ja
IN il.z
ja
ja
a n ng
an d.u
an d.w
an d.v
AC d.a
AK
va
va
ST
RI
dr BO
dr
dr
dr ele pm
dr
CE
AD
CE pp
TE
dr
dr
dr
dr
CE pp ess
a.
TE
x.
.la o
E_ NE_ ND
oi
oi K
oi
oi
oi
EM .a
I
ut E R N
RN
oi
oi l
oi
oi
SS
_P
VE
SS
cr
_E
_N
H
_A dm
ET
yp
_
_N
XT
O
on
C
pp
ro
ip
i
LE
ET
ti
t
ew
eb
ET
vi
te
ph
O
W
ki
.
de
T
nt
a
O
ST
on
t
_
O
cc
AL
W
r
.
RK
RK
A
in
O
y
I
_S
TE
_S
M
_S
TO
ib
PL
TA
TA
O
ili
RA
ET
TE
ty
TE
ED
G
E
(a) (b)
Figure 4.12: Top-5 positive and top-5 negative feature attribution distribution for the
ransomware (a) and trusted (b) samples of the dataset.
Family Date
Svpeng 2017-Q4 6
4
2017-Q3
Slocker 2017-Q2
3 4
Simplocker 2017-Q1
2 2016-Q4
Lockscreen
1 2016-Q3 2
Lockerpin 2016-Q2
0 2016-Q1
Locker 0
2015-Q4
−1
Koler 2015-Q3
−2 2015-Q2 −2
Jisut
2015-Q1
Fakeinst
−3 2014-Q4
2014-Q3
−4
Congur −4
2014-Q2
2014-Q1 −6
RE
an EIV
SY ro E_B
RE TE .ap OT
RE D_ _A .ad CO
IN D_ HO ERT min PL
M ER R O E_ W I
W UN ET ILE TA DO
an TE _U
CA ro EXT MO
an LL_ .ut RN UN
an ro HO
an ro .w E
IN o ap ki
RE TA .ha
AC _ P w
O N F S N
RI T
T P N _
S id p t
S id O
d
d _ N
d P il AL T_
d id N
dr id. eb
C
A M p _
A P L
AD LL_ rd
CE CO AC ar
RE
an EIV
SY ro _B
RE TE .ap OT
RE D_ _AL .ad OM
RE D_ RO RT in PLE
RE D_ HO ILE IN
IN EIV IST E_S
CA RN SM RY AT
CH L_P ET S BO
BR ANG O
RE AD E_N E
AC D_ CAS TW
SE ES ON _ST RK
AC _W _FIN AC CKY STA
AC ES LLP E_L S
SS N KA e
id E
TE E_ O T
T S T I _
S id O
d E
C
A M p _C
A P E m
A P F _W
C H N
A
L
C A
CE S_W AP OC
O
_N TA GE
SS IF ER AT
ET CT S
C
H
_N I_
W S
O
ET ST
N
T
E
RK
W AT
_S FIL
TE W
_S
M
O E
TO ES
T
_ E
O
TA
RK
RA Y S
ET
TE
_S
O
D
G TE
IO
KM
ED
TA
O
E M
N
W
TE
AR
TE
TE
KS
D
S
(a) (b)
Figure 4.13: Top positive and negative attributions’ median values for two grouping
criteria: family (a) and date (b).
installed after the user opens the original app and grants the requested privileges.
Therefore, the original app is merely a container.
positive and 10 negative) for both classes. Notably, we still use the attributions from
Integrated Gradients for the MLP classifier, but we only consider training samples.
We attain a set of 33 unique features. Figure 4.14 shows a ROC curve with a com-
parison between the original three classifiers, trained with the full feature set, and
the correspondent ones trained with this reduced set of features. Besides the min-
imal number of features, the results at the threshold of FPR=1% are not so far from
those with the full feature set (where 353 features out of all 731 ones are used with
our dataset). Only the linear SVM sees quite a significant drop in the detection
rate.
0.95
True Positive Rate
0.9
0.85 SVM
SVM-RBF
0.8 MLP
SVM (reduced)
0.75 SVM-RBF (reduced)
MLP (reduced)
0.7
0.1 0.2 0.5 1 2 5 10
False Positive Rate (%)
Figure 4.14: Roc curve comparison. The classifiers with solid lines have been trained
with the full feature set, the ones with dotted lines with a reduced feature set made of 33
features.
do and do not share with generic malware. Moreover, we have used requested
permissions as additional features, while at the same time not considering System
API class or method calls. Therefore, we believe that further new insights can
be revealed by considering other setting variants. For example, we could check if
classifiers using finer-grained API calls provide coherent explanations with the ones
using packages.
Another limitation is related to the usage of attribution techniques, i.e. the fact that
it is not possible to understand how the features — especially of different types as in
this specific setting — interact with each other. This is one of the open issues in the
field of explainable machine learning [40, 41], and we think discovering high-level
concepts might greatly improve the understanding of the applications under analysis.
We expect that the proposed approach could be refined by making it more systematic
and, above all, further inspecting the practical difference between each gradient-
based technique. In this way, it could also be possible to combine the complementary
peculiarities of each one, instead of selecting a single technique. Moreover, although
our work has shown that gradient-based explanation methods are quite effective
against the considered feature space, it could be beneficial to broaden the focus to
other attribution techniques. Lastly, being Android ransomware one of the possible
case studies, we point out the possibility to generalise our method to other malware
detection problems.
Chapter 5
The previous chapter has shown that learning-based techniques based on static ana-
lysis are especially effective at detecting Android malware, which constitutes one of
the major threats in mobile security. In particular, the described approach, along
with the ones in the literature, show great accuracy even when traditional code con-
cealing techniques (such as static obfuscation) are employed [15–18].
Despite the successful results reported by such approaches, the problem of detecting
malware created to fool learning-based systems is still far from being solved. The
robustness of machine-learning models is challenged by the creation of adversarial
examples [20, 27–29] (see Section 2.1). In particular, recent work concerning An-
droid malware has demonstrated that specific changes to the contents of malicious
Android applications might suffice to change their classification (e.g. from malicious
to benign) [17, 91]. The main characteristic of these attacks is their sparsity, mean-
ing that they enforce only a few changes to the whole feature set to be effective. Such
changes may be represented by, for example, the injection of unused permissions or
parts of unreachable or unused executable code. For example, adding a component
that is loaded when the application starts (through a keyword called LAUNCHER) can
significantly influence the classifier’s decision [81].
On the basis of such issues, this chapter presents the effort to address them
through two different points of view, both sharing the usage of gradient-based ex-
planation techniques. The first one (Section 5.1, based on the work by Melis et al.
[92]) aims to establish a way to assess through explanations the expected vulner-
ability of classifiers to evasion attacks. The second work (Section 5.2, based on the
article by Cara et al. [93]) has the main goal of studying the practical feasibility of
creating Android adversarial samples through the injection of System API calls.
51
52 5. Explainable and Adversarial Machine Learning
shown that classifiers that avoid overemphasising specific features, weighting them
more evenly, can be more robust against such attacks [17, 94, 95]. Simple metrics
characterising this behaviour were proposed to identify and select more robust al-
gorithms, especially in the context of linear classifiers, where feature weights can
be used as a direct measure of a feature’s relevance to each decision [17, 96, 97].
In parallel, the ability to understand the classifiers’ behaviour by looking at the
input gradient, i.e. the feature weights in the case of linear classifiers, was also
explored by multiple works in the field of explainable machine learning [33, 46–48].
In particular, it became of interest to figure out if the information provided by
these gradient-based methods can also be employed to understand (and improve)
the robustness of learning-based systems against attacks [98].
In the following, I present our effort to investigate the possible correlations
between gradient-based explanations and the classifiers robustness to adversarial
evasion attacks on an Android malware detection case study. We assess our findings
on Drebin, a popular learning-based detector for Android (Section 5.1.1). I first
provide a description of the adversarial vulnerabilities of learning-based systems for
Android malware detection (Section 5.1.2). Then, motivated by the intuition that
the classifiers whose attributions are more evenly distributed should also be the
more robust, as they rely on a broader set of features for the decision, we propose
and empirically validate a few synthetic metrics that allow correlating between the
evenness of gradient-based explanations and the adversarial robustness — a measure
we propose to represent the classifier robustness to adversarial attacks along with
an increasing attack power in a compact way (Section 5.1.3). Our investigation
(Section 5.1.4) unveils that, under some circumstances, there is a clear relationship
between the distribution of gradient-based explanations and the adversarial robust-
ness of Android malware detectors. I finally make concluding remarks on how our
findings can pave the way towards the development of more efficient mechanisms
both to evaluate adversarial robustness and to defend against adversarial Android
malware examples (Section 5.1.5).
x2
φ (z) x1 f (x)
z x2 x malware Classification label: malware
Feature Decision Detection score: +1.92
... Classifier
Extraction (Explanation) Explanation
xd 0.52 NETWORK:lebar.gicp.net
Android app (apk) 0.45 PERMISSION:SEND_SMS
0.45 INTENT:SMS_RECEIVED
Training
Class labels (malware, benign) ...
benign x1
Figure 5.1: A schematic representation ([17]) of Drebin. First, applications are repres-
ented as binary vectors in a d-dimensional feature space. A linear classifier is then trained
on an available set of malware and benign applications, assigning a weight to each feature.
During classification, unseen applications are scored by the classifier by summing up the
weights of the present features: if f (x) ≥ 0, they are classified as malware. Drebin also
explains each decision by reporting the most suspicious (or benign) features present in the
app, along with the weight assigned to them by the linear classifier [15].
manifest dexcode
S1 Hardware components S5 Restricted API calls
S2 Requested permissions S6 Used permission
S3 Application components S7 Suspicious API calls
S4 Filtered intents S8 Network addresses
Drebin are presented as strings and organised in 8 different feature sets, as listed in
Table 5.1.
Android applications are then mapped onto the feature space as follows. Let us
assume that an app is represented as an object z ∈ Z, being Z the abstract space
of all APK files. We denote with Φ : Z 7→ X a function that maps an APK file z to
a d-dimensional feature vector x = (x1 , . . . , xd )> ∈ X = {0, 1}d , where each feature
is set to 1 (0) if the corresponding string is present (absent) in the APK file z. An
application encoded in feature space may then look like the following:
··· ···
0 permission::SEND_SMS
1 S2
permission::READ_SMS
· · ·
x = Φ(z) 7→ ···
1
api_call::getDeviceId
0 S5
api_call::getSubscriberId
··· ···
Explanation. Drebin explains its decisions by reporting, for any given application,
the most influential features, i.e. the ones that are present in the given application
and are assigned the highest absolute weights by the classifier. The feature relevance
values reported by Drebin correspond exactly to its feature weights, being Drebin
a linear classifier. For instance, in Figure 5.1 it is possible to see that Drebin
correctly identifies the sample as malware since it connects to a suspicious URL
and uses SMS as a side-channel for communication. In this work, we use different
explanation approaches to measure feature relevance and evaluate whether and to
which extent the distribution of relevance values reveals any interesting insight on
adversarial robustness.
where Equation (5.2) is the `1 distance constraint between the original x and the
modified (adversarial) x0 sample. Equation (5.3) is a box constraint that enforces the
adversarial malware’s feature values to stay within some lower and upper bounds,
5.1. Do Explanations Tell Anything About Adversarial Robustness? 55
while Equation (5.4) enforces the attack to find a Boolean solution. The afore-
mentioned problem can be solved with gradient-based optimisation techniques, e.g.
Projected Gradient Descent (PGD), as described in Algorithm 1 [27, 97, 101]. At
each step, this algorithm projects the feature values of the adversarial sample onto
the constraints (Equations (5.2)–(5.3)), including binarisation in {0, 1}.
Feature Addition To create malware able to fool the classifier, an attacker may,
in theory, both adding and removing features from the original applications. How-
ever, in practice, removing features is a non-trivial operation that can easily com-
promise the malicious functionalities of the application. Feature addition is a safer
operation, especially when the injected features belong to the manifest; for example,
adding permissions does not influence any existing application functionality. When
the features depend on the dexcode, it is possible to add them safely introducing
information that is not actively executed, e.g. by adding code after return instruc-
tions (dead code) or methods that are never called by any invoke type instructions
(i.e. the ones that indicate a method call). Therefore, in this work, we only consider
feature addition. To find a solution that does not require removing features from
the original application, the attacker can simply define xlb = x in Equation (5.3).
However, it is worth mentioning that this injection could be easily made ineffective,
simply removing all the features extracted from code lines that are never executed.
In this way, the attacker is forced to change the executed code, which is more dif-
ficult, as it requires considering the following additional and stricter constraints.
Firstly, the attacker should avoid breaking the application functionalities. Secondly,
they should avoid introducing possible artefacts or undesired functionalities, which
may influence the semantics of the original program. Injecting a large number of
features may be, therefore, difficult and not always feasible. This aspect will be
discussed further later in this chapter (Section 5.2).
Adversarial robustness
Adversarial
Classifier
manipulation
Research question: is adversarial
Android malware robustness correlated with
explanation evenness?
Explainer
0.52 NETWORK:lebar.gicp.net
0.45 PERMISSION:SEND_SMS
0.45 INTENT:SMS_RECEIVED
... Explanation evenness
Figure 5.2: Schematic representation of the analysis employed to verify the correlation
between explanation evenness and adversarial robustness. First, for each malware in the
test set, we create its adversarial counterpart. Then, for each of those adversarial ap-
plications, we evaluate: (1) a measure of the classifier robustness against it (adversarial
robustness) (2) the evenness of the application attributions (explanation evenness). Finally,
we asses the correlation between them.
where the lower and upper bounds on w are defined by the vectors wlb = (w1lb , . . . , wdlb )
and wub = (w1ub , . . . , wdub ), which are application dependent. Section 5.1.2.2 can be
easily optimised using a constrained variant of the Stochastic Gradient Descent
(SGD) technique, as described in [17].
n
1 X −`i
R(Dε , f ) = e , (5.6)
n i=1
where `i = `(yi , f (xi )) is the adversarial loss attained by the classifier f on the data
points in Dε = {xi , yi }ni=1 , containing the ε-sized adversarial samples optimised with
Algorithm 1.
We finally define the adversarial robustness R of a classifier f as the average of
R(Dε , f ) on different ε:
R = Eε {R(Dε , f )} . (5.7)
Pk
i=1 |r(i) |
F (r, k) = Pm ,
j=1 |r(j) |
The range of E1 is [0, 1], E1 = 0 and E1 = 1 indicates respectively to the most uneven
and to the most even relevance vector.
The second metric we consider is the one proposed in [96], based on the ratio
between the `1 and `∞ norm:
1 krk1
E2 (r) = · . (5.9)
m krk∞
To have a broader perspective of the attributions evenness, we compute the
metrics on multiple samples, and we average the results. More formally, we define
the explanation evenness as:
n
1X
E= E(r i ) , (5.10)
n i=1
where r i with i = 1, 2, . . . , n is the relevance vector computed on each sample of a
test dataset D = {xi , yi }ni=1 , and E can be equal either to E1 or E2 . In the following,
we represent the average evenness computed considering the per-sample metric E1
(E2 ) with E1 (E2 ).
58 5. Explainable and Adversarial Machine Learning
95 20
94 0
0.5 1 2 5 10 0 5 10 25 50
False Positive Rate (%) ε
Figure 5.3: (left) Mean ROC curves for the tested classifiers on the Drebin data. (right)
White-box evasion attacks on Drebin data. Detection Rate at 1% False Positive Rate
against an increasing number of added features ε. We can see how the Sec-SVM, although
it provides a slightly lower detection rate compared to the other tested classifiers, requires
on average more than 25 different new feature additions to the original apps to be fooled
by the attacker.
SVM-RBF (E1 = 46.24%, E2 = 22.47%, εmin = 6) Sec-SVM (E1 = 73.04%, E2 = 66.24%, εmin = 31)
Set Feature Name r (%) Set Feature Name r (%)
S2 SEND_SMS 10.35 S2 READ_PHONE_STATE 3.51
S7 android/telephony/TelephonyManager 10.05 S7 android/telephony/TelephonyManager 3.51
;->getNetworkOperator ;->getNetworkOperator
S4 LAUNCHER -8.89 S2 SEND_SMS 3.51
S5 android/os/PowerManager$WakeLock -8.01 S3 c2dm.C2DMBroadcastReceiver 3.51
;->release S2 INTERNET 3.44
S2 READ_PHONE_STATE 5.03 S3 com.software.application.ShowLink 3.39
S2 RECEIVE_SMS -5.00 S3 com.software.application.Main 3.39
S3 c2dm.C2DMBroadcastReceiver 4.56 S3 com.software.application.Notificator 3.39
S2 READ_SMS 3.52 S3 com.software.application.Checker 3.39
S4 DATA_SMS_RECEIVED 3.50 S3 com.software.application.OffertActivity 3.39
S5 android/app/NotificationManager -3.49
;->notify
SVM-RBF (E1 = 60.74%, E2 = 25.84%, εmin = 31) Sec-SVM (E1 = 63.14%, E2 = 52.70%, εmin = 39)
Set Feature Name r (%) Set Feature Name r (%)
S4 LAUNCHER -1.89 S2 ACCESS_NETWORK_STATE 0.93
S7 android/net/Uri;->fromFile 1.34 S2 READ_PHONE_STATE 0.93
S5 android/os/PowerManager$WakeLock -1.25 S6 READ_HISTORY_BOOKMARKS 0.93
;->release S7 android/telephony/TelephonyManager -0.93
S2 INSTALL_SHORTCUT 1.23 ;->getNetworkOperatorName
S7 android/telephony/SmsMessage -1.21 S6 ACCESS_NETWORK_STATE -0.93
;->getDisplayMessageBody S7 android/telephony/SmsMessage;- 0.93
S7 android/telephony/SmsMessage -1.20 >getDisplayOriginatingAddress
;->getTimestampMillis S7 android/telephony/TelephonyManager 0.93
S2 SET_ORIENTATION -1.20 ;->getNetworkOperator
S2 ACCESS_WIFI_STATE 1.15 S7 android/net/Uri;->getEncodedPath -0.93
S4 BOOT_COMPLETED 1.08 S2 SET_ORIENTATION -0.93
S5 android/media/MediaPlayer;->start -1.06 S7 java/lang/reflect/Method;->invoke 0.93
Table 5.2: Top-10 influential features and corresponding Gradient*Input relevance (%)
for a malware of the FakeInstaller family (top) and a malware of the Plankton family
(bottom). Notice that the minimum number of features to add εmin to evade the classifiers
increases with the evenness metrics E1 and E2 .
reported in Table 5.2, which show higher values for Sec-SVM. Table 5.2 also shows
the εmin value, i.e. the minimum number of features to add to the malware to
evade the classifier. We can notice how the εmin parameter is strictly related to the
evenness distribution, since higher values of E1 and E2 correspond to higher values of
εmin , i.e. a higher effort for the attacker to accomplish her goal. In particular, it is
possible to identify a clear difference between the behaviour of SVM-RBF and Sec-
SVM: the diversity of their evenness metrics, which cause the εmin values to be quite
different as well, indicates that, for this prediction, SVM-RBF is quite susceptible
to a possible attack compared to Sec-SVM.
Conversely, considering the second sample, the attributions (regardless of the
sign) and the evenness metrics present similar values. Such behaviour is also reflected
in the associated εmin values. In this case, the relevance values are more evenly
distributed, which indicates that the evasion is more difficult.
We now correlate the evenness metrics with the adversarial robustness R, in-
troduced in Section 5.1.3.1. Figure 5.4 shows the relationship between this value
and the evenness metrics for 100 samples chosen from the test set, reported for each
explainability technique. From this broader view, we can see how the evenness val-
ues calculated on top of the Gradient*Input and Integrated Gradients explanations
present a significant connection to the adversarial robustness. This seems not to be
applicable to the Gradient technique, and specifically against the linear classifiers,
whose dots in Figure 5.4 are perfectly vertical-aligned. This fact is caused by the
constant value of the gradient across all the samples, which implies constant values
for the evenness metrics as well. In order to assess the statistical significance of this
5.1. Do Explanations Tell Anything About Adversarial Robustness? 61
Gradient Gradient
1.00 1.00
Adversarial Robustness
Adversarial Robustness
0.75 0.75
Adversarial Robustness
Adversarial Robustness
0.75 0.75
0.50 0.50
0.25 0.25
0.00 0.00
0 5 10 15 0 5 10 15
Evenness E1 (%) Evenness E2 (%)
IntegratedGrads IntegratedGrads
1.00 1.00
Adversarial Robustness
Adversarial Robustness
0.75 0.75
0.50 0.50
0.25 0.25
0.00 0.00
0 5 10 15 0 5 10 15
Evenness E1 (%) Evenness E2 (%)
Figure 5.4: Evaluation of the adversarial robustness R against the evenness E1 (left), E2
(right) metrics for the different gradient-based explanation techniques computed on 1000
samples of the test set (only 100 samples are shown).
plot, we also compute the associated correlation values with three different metrics:
Pearson (P), Spearman Rank (S), Kendall’s Tau (K). They are shown in Table 5.3.
Finally, we inquire whether the connection between the evenness metrics and the
detection performance of a classifier can provide a global assessment of its robust-
ness. Figure 5.5 shows the correlation between the explanation evenness and the
mean detection rate under attack, calculated for ε in the range [1, 50]. Similarly to
the previous test, Gradient*Input and Integrated Gradients explanations present a
significant connection to the adversarial robustness in most cases, while the Gradient
technique does to a less extent.
5.1.5 Conclusions
With this work, we have empirically evaluated the correlation between multiple
gradient-based explanation techniques and the adversarial robustness of different
linear and non-linear classifiers against sparse evasion attacks. To this end, we have
employed two synthetic measures of the explanation evenness, whose main advantage
is not requiring any computationally-expensive attack simulations. Hence, they may
be used by system designers and engineers to choose, among a plethora of different
models, the one that is most resilient against sparse attacks.
As we have validated the proposed synthetic vulnerability measure by considering
only the Drebin malware detector as a case study, it would be interesting to inspect
other malware detectors as well as other application domains. Moreover, as the
proposed metrics may be used to estimate the robustness only against sparse evasion
62 5. Explainable and Adversarial Machine Learning
Table 5.3: Correlation between the adversarial robustness R and the evenness metrics
E1 and E2 . Pearson (P), Spearman Rank (S), Kendall’s Tau (K) coefficients along with
corresponding p-values. The linear classifiers lack a correlation value since the evenness
is constant (being the gradient constant as well); therefore, resulting in a not defined
correlation.
60 60
40 logistic 40
ridge
SVM
SVM-RBF
20 Sec-SVM 20
80 90 100 25 50 75 100
E1 (%) on Gradient E2 (%) on Gradient
60 60
40 40
20 20
4 5 2 4
E1 (%) on Gradient*Input E2 (%) on Gradient*Input
60 60
40 40
20 20
4 5 2 4
E1 (%) on IntegratedGrads E2 (%) on IntegratedGrads
Figure 5.5: Evaluation of the evenness metrics E1 (left) and E2 (right) against the
Detection Rate (FPR 1%) for the different gradient-based explanation techniques computed
on the Drebin dataset.
5.2. Evaluating the Feasibility of Adversarial Sample Creation 63
This way, we believe this proposal starts to highlight the actual, viable injection
strategies attackers have at their disposal for the creation of evasive Android malware
samples.
In the following, the threat model of our setting is depicted (Section 5.2.1), fol-
lowed by a discussion about the problem space and its constraints (Section 5.1.2).
Our implementation for the generation of Android adversarial samples is described
in Section 5.2.3, while the experimental analysis is presented in Section 5.2.4. Sec-
tion 5.2.6 makes conclusive remarks.
Attacker’s goal In our setting, the attackers aim to make the detection system
classify ransomware apps as trusted ones. In particular, since we consider the evasion
strategy, they fulfil this goal by modifying the Android apps at test time rather than
by poisoning the system’s training set.
The goal of this work is to evaluate to what extent it is feasible to generate real-world
Android adversarial samples. In particular, the focus of our analysis lies specifically
on the constraints and consequences of injecting system API calls. With this respect,
the first concern to consider is the so-called inverse feature-mapping problem — or
the more generic problem-feature space dilemma [103]. As hinted in Section 5.2,
this refers to the difficulty of moving from the feature space to the problem domain
(or vice versa), i.e. finding an exact, unique correspondence between values in the
feature vector and characteristics in the problem domain, e.g. functionalities in an
Android application. The feature mapping problem can be defined as a function ψ
that, given a sample z, generates a d-dimensional feature vector x = [x1 , x2 , ..., xd ],
such that ψ(z) = x [104]. Conversely, the opposite flux in the inverse feature-
mapping case is a function S, such that taking a feature vector x, we have S(x) = z 0 .
However, it is not guaranteed that z ≡ z 0 .
As an example, let us consider the feature vector of our setting, which consists
of the occurrence of API package calls. Due to this choice, the value of a feature xi
in the feature vector can be increased through two main behaviours in the Android
application: (i) the call of a class constructor and (ii) the call of a method. In both
cases, the class involved in these calls must belong to the package that corresponds
to the i-th feature. This means that there are as many ways to change that feature
value as the number of callable classes in the package. Figure 5.6 exemplifies this
aspect by showing, for a few packages, their related classes that we identify as
callable for our purposes. By contrast, an alternative feature vector (as discussed in
Section 4.2) that describes the occurrence of system API method calls would have
a one-to-one mapping between the i-th feature and the call of the corresponding
method.
Figure 5.6: Example of callable classes for three different API packages.
5.2.2.1 Constraints
I now present the constraints that we consider in our approach and their implications
on the injection strategy design. I illustrate them on top of the definitions proposed
by Pierazzi et al. [104]. I refer the reader to that work for further details.
likely. However, a more sophisticated strategy should take care of the coherence of
the injected code with the application context. For instance, adding permissions
that do not pertain to the app’s scope could be suspicious to the human expert.
Figure 5.7: The architecture of the system. Firstly, it processes the given malicious
sample to retrieve its feature vector. Then, it performs the modifications to the feature
vector using either the benign reference vector (mimicry) or the noise vector (random noise
adding). Finally, it generates the adversarial malicious sample.
Feature Mapping In this phase, the malicious Android sample is statically ana-
lysed to detect and count all the Android system API calls and create the numeric
vector of features x = [x1 , x2 , ..., xd ]. As shown in Figure 5.8, firstly, we parse the
.dex files (using Dexlib) to get the API called through the invoke functions (see
Chapter 3), matching the Android system calls previously gathered from the official
Android documentation. Then, we count the occurrences for each API call. Finally,
we generate a sparse feature vector where, for every non-zero feature, there is the
occurrence of the references to the specific package inside the analysed Android ap-
plication.
Figure 5.8: Example of feature mapping for the creation of the feature vector.
Attack The extracted malicious feature vector is then modified to perform the
attack. This phase aims to generate an adversarial feature vector using a mimicry
or a random noise addition approach. As shown in Figure 5.7, for the mimicry case,
5.2. Evaluating the Feasibility of Adversarial Sample Creation 69
Inverse Feature Mapping This phase is the opposite of the feature mapping
phase, so each value of the adversarial feature vector, which is not already in the
malicious sample, is matched with the corresponding Android system call and added
in the malicious sample. We use Apktool to disassemble the Android application;
then, we employ Dexlib to perform all the modifications on the bytecode level.
Finally, we leverage Apktool again to reassemble and sign the generated adversarial
sample, which is manually tested to verify that the functionality is preserved. As
introduced in Section 5.2.2, for each feature (package), there may be more than one
usable constructor since multiple classes can be available. Thus, for each feature, we
randomly choose a constructor among the available ones. In this way, we increase the
plausibility of the adversarial app, as it would be easier for a code analyst to notice
the same class called multiple times rather than different classes of the same package.
In this sense, we also spread the injected calls across all the methods already defined
in the .dex file, so that they are not concentrated in a unique portion of code.
Each injected call is added by defining an object of the related class and calling
its constructor. Figure 5.9 shows a smali-like representation of the injection code.
70 5. Explainable and Adversarial Machine Learning
We can see a new-instance function to create an object of the class to add and an
invoke-direct function to call the constructor of that class. The injected instructions
are placed before the return statement of the selected method. Notably, the choice
of calling constructors does not cause any side-effect since no features other than
the target ones are modified within the feature vector.
5.2.4.1 Setting
0.8
True Positive Rate
0.6
0.4
0.2
Ransomware
Malware
0
0.1 0.2 0.5 1 2 5 10 20 50 100
False Positive Rate (%)
Figure 5.10: Average ROC curve of the MLP classifier over repeated 5-fold cross-
validation. The lines for the ransomware and malware classes include the standard de-
viation in translucent colour.
Dataset We use the same dataset as [18] (and Section 4.2), composed of 39157
Android applications, 3017 of which are ransomware applications, 18396 trusted
applications, and 17744 generic malware applications.
Features We use R-PackDroid (see [18, 76] and Chapter 4) as a reference detection
system. The feature set consists of the cumulative list of system API packages up to
Level 26 (Android Oreo), for a total of 196 features. In particular, the set of APIs
is strictly limited to the Android platform [86] ones.
5.2. Evaluating the Feasibility of Adversarial Sample Creation 71
(a)
Are the modifiable features effective for evasion attacks? The number of
available packages and classes inferred in the previous experiment appears to be not
really high. However, as introduced in Section 5.2.2.2, it is also worth inspecting the
importance of the usable features to the classification. From now on, we conduct
all of our experiments using the ransomware samples of the test set, which emulates
the set of samples at the attacker’s disposal. We compute the explanations using
DeepExplain [88].
As a first point, we evaluate the percentage of relevant features modifiable by
the attacker for each sample. We attain a mean value across the samples of 72.1%
for the no-parameters case and of 73.8% in the primitive-parameters one. This
result suggests that the attacker can modify a good number of useful features to
evade detection. As a second test, we identify which relevant features are the most
frequent among the modifiable ones. The results are shown in Figure 5.11. As can
be seen, the shown features correspond, as expected, to the ones that are known
to be descriptive of the trusted samples, i.e. a broad set of functionalities related,
for example, to the app’s user interface.
100
80
Frequency (%)
60
40
20
0
an j a a a a a a j o a a j a a
dr ava.u ndr ndr ndr ndr ndr ndr ava.t rg.js ndr ndr ava.l ndr ndr
oid t i oid oid oid oid oid oid ex on oid oid ang oid oid
.ap l .w . . .gr .m . t .lo . . .
p idg net os ap e vie ca cont .ref view web
et hic dia w tio
n
en .in kit
s t.r pu
es tm
eth
od
Mimicry Attack Figure 5.12a shows the evasion rate for four different reference
samples, as illustrated in Section 5.2.3; that is, how many adversarial samples evade
the classification. In the x -axis, we evaluate an increasing percentage of modified
features, i.e. the number of injected packages out of the total number of modifiable
ones by the attacker. Since the choice of the subset of features to modify for each
percentage level below 100% is random, we show the average result over five repe-
titions. Moreover, it is worth noting that each chosen feature exhibits a different
number of calls to inject because some APIs are being called in the app thousands
5.2. Evaluating the Feasibility of Adversarial Sample Creation 73
of times, while others might be referenced only a few times. In the same figure, it
is possible to see that all the curves present similar trends.
In Figure 5.12b, we focus on the median strategy and show how the samples
are classified. We can see that the evasion works as desired because the number
of samples classified as trusted increases while the number of samples classified as
ransomware and malware decreases. Notably, in Figure 5.12a, the evasion rate at 0%
of modified features is not zero because some ransomware samples are mistakenly
classified as benign or malware. For the same reason, Figure 5.12b shows that the
detection of the samples as ransomware is not 100% when no features are modified.
Mimicry Attack Evasion Rate Mimicry Attack Detection (median case)
100
100 Reference Sample Real mean Real median Mean Median Trusted Malware Ransomware
80 80
60 60
40 40
20 20
0 0
0 20 40 60 80 100 0 20 40 60 80 100
Number of modified features (%) Number of modified features (%)
(a) (b)
Figure 5.12: Mimicry attack’s evasion rate for different choices of the reference sample
(a). Detection rate detail of the ransomware samples (b). Both figures are the average
results over five repetitions and include the standard deviation in translucent colour.
Random Noise Attack After the mimicry attack, we have performed a random
noise addition attack, which can be useful as a reference since it only consists of
injecting API calls without any specific pattern or target class. Following the same
procedure as Section 5.2.4.3, the results are shown in Figure 5.13. Specifically,
the absolute approach is the one shown in Figure 5.13a. On the left side, we evaluate
the evasion rate for different levels of added noise. As we can see, the higher the
noise level is, the higher the evasion rate is. On the right side of the figure, we
show the detail of the assigned classes for a noise level equal to 20, which achieves
similar evasion levels as the mimicry case. As we can see, the curve also exhibits
the same tendency, i.e. it causes an increasing detection of the ransomware samples
as legitimate ones as if it was a targeted attack. This is significant since it seems
to suggest that no specific injection pattern is needed to make ransomware samples
classified as trusted ones. Consequently, attackers would not need a set of trusted
samples with the same probability distribution of the target system’s training set,
which is necessary to perform the mimicry attack.
The relative approach is shown in Figure 5.13b. The evasion rate on the left side
of the figure is, in this case, completely different from the absolute one, reaching a
value of around 15% at the highest point. Notably, there is no significant difference
between each noise level. This can be related to the sparsity of the samples’ feature
vector. In fact, several features have a zero value, so the percentage of a zero value
would always end up with no addition. Therefore, in our implementation, we chose
to set a random increase between zero and one. Ultimately, this result shows that
adding a high percentage of noise only to the features that already had non-zero
values is insufficient to accomplish the evasion.
74 5. Explainable and Adversarial Machine Learning
80 80
60 60
40 40
20 20
0 0
0 20 40 60 80 100 0 20 40 60 80 100
Number of modified features (%) Number of modified features (%)
80 80
60 60
40 40
20 20
0 0
0 20 40 60 80 100 0 20 40 60 80 100
Number of modified features (%) Number of modified features (%)
Figure 5.13: Evasion rate for different levels of noise injection in the absolute and relative
cases (left side of the figure). Detection detail for a noise level equal to 20 (right side of (a))
and a 1% noise level (right side of (b)). All the results are the average over five repetitions
and include the standard deviation in translucent colour.
The mimicry and the random noise addition attack results have shown that the
evasion rates can go up to around 80%. This appears to be an outstanding result;
however, it does not depict the full view of the problem. For example, it does not tell
anything about the plausibility of the adversarial sample. In fact, we may say that
the plausibility for the method proposed in this work is inversely correlated to the
number of injected features. The more additional calls (with respect to the original
sample) there are, the lower is the plausibility. Therefore, with Figure 5.14, we
evaluate the impact on the samples of both the considered attacks (median case for
the mimicry attack, absolute noise level equal to 20 for the noise attack), in terms of
extra calls added. As with the previous figures, in the x -axis, we put an increasing
percentage of modified features. We insert two y-axes to show the average number
of added calls both as a percentage of the original amount (left axis) and as the
absolute number (right axis). As can be seen in Figure 5.14a, the mimicry attack
causes a massive increase in calls. For example, let us fix the evasion rate to 50%,
which requires modifying around 35% of the modifiable features (see Figure 5.12a).
With this setting, the increment of system API calls would be almost nine thousand
per cent on average. Notably, the standard deviation is quite high, so this number
can be significantly higher or lower; nevertheless, the generated adversarial sample
would most likely not be realistic.
The random noise addition attack attains much better results in this sense.
A 50% evasion rate is accomplished by modifying around 30% of the modifiable
5.2. Evaluating the Feasibility of Adversarial Sample Creation 75
features (see Figure 5.13a), which means injecting 69% additional calls with respect
to the original samples on average. Although the difference with the mimicry at-
tack is significant, the level of additional calls to add results in being too high to
be plausible.
Overall, the results show the detector’s vulnerability to perturbed inputs, even
with a non-targeted attack. However, to achieve a sufficient evasion rate, attackers
need to inject a vast number of calls, which weakens the attack’s plausibility.
Mimicry Attack Injection Impact (median case) Noise Attack Injection Impact (noise level=20)
30k 500
20k
Number of injected calls (%)
0 0 0 0
0 20 40 60 80 100 0 20 40 60 80 100
Number of modified features (%) Number of modified features (%)
(a) (b)
Figure 5.14: Average impact on the number of calls for mimicry (a) and noise (b) attacks.
The standard deviation is also reported in translucent colour.
5.2.6 Conclusions
With this work, we have presented a study about the feasibility of performing a fine-
grained injection of system API calls to Android apps in order to evade machine
learning-based malware detectors. This kind of strategy can be particularly effective
for creating a massive amount of adversarial samples with a relatively low effort by
the attackers. However, we have discussed the necessity of satisfying several con-
straints to generate realistic, working samples. The experimental results show that
both the mimicry and the random noise attacks, which do not require a high level
of knowledge about the target system, suffice to evade classification. Nevertheless,
they cause a substantial loss of plausibility of the generated adversarial sample since
they add an excessive number of additional calls; therefore, weakening the effective-
ness. Therefore, we believe that future work should focus on performing this kind of
5.2. Evaluating the Feasibility of Adversarial Sample Creation 77
Table 5.5: Comparison of related work on practical creation of evasive Android apps.
analysis using a gradient approach that minimises the number of injected features
to preserve plausibility. This aspect is also relevant to highlight that the detector
considered in our work employs non-binary features (differently from all previous
articles in the literature). Consequently, we think an interesting future work would
be to compare the impact of the feature vector design (binary vs. non-binary) on
the practical feasibility of adversarial malware creation.
We also point out that our specific implementation to address the inverse feature-
mapping problem is not optimal as well in terms of plausibility. In fact, other work
in the literature — such as the one by Pierazzi et al. [104] where portions of real
code were injected through automated software transplantation — present, among
others, the potential issue of injecting code that is out of context with respect to
the original app. In our case, the main concern lies instead in the choice of injecting
calls to class constructors. That is, we call new objects that are not used in the
rest of the code. Therefore, a more plausible solution for future work could be the
injection of method calls, which are more likely to be realistic even without being
referenced next in the code.
Chapter 6
Conclusions
Machine learning for malware detection has proven to be an effective tool. How-
ever, its design process may hide pitfalls that undermine the deployment in real
scenarios. Such concerns may refer to the usage of complex algorithms and feature
sets that, all in all, allow neither interpreting what the models learn nor catching
the actual characteristics of malware. Consequently, systems with these issues may
learn spurious patterns and be particularly vulnerable to adversarial attacks.
In this scenario, the work of this thesis has put its main focus on the detection
of Android ransomware, an impactful threat that had swift spread in the past few
years. In this respect, I have first explored the detection performance of different
sets of a single kind of feature, taking into account typical strategies from attackers
to prevent detection, such as obfuscation. Then, using techniques from explainable
machine learning, I have inspected the validity of the developed systems, with the
ultimate goal of proposing effective methods to employ those techniques. In par-
ticular, experimental work has been done to start understanding how explainability
can positively impact malware detection. Associated with the aim of improving the
design process of machine learning-based systems, I have broadened my focus and
co-authored work on adversarial attacks. In this case, I have collaborated in un-
derstanding potential relationships between explainable and adversarial learning, in
order to assess models’ vulnerability to evasion attacks. Moreover, by putting the
hat of an attacker, the concrete feasibility of creating adversarial Android apps has
been explored.
Overall, I claim the topics I have explored have turned out to be quite relevant
and worth to be studied. The thesis has put major emphasis on experimental ana-
lysis. With this respect, I have realised the importance of beware of several different
aspects within the set-up and design process of ML-based models. The work on
the detection of Android ransomware has highlighted the necessity of examining the
validity of the feature set from multiple perspectives, both the ML-specific and the
domain-specific ones. In this sense, I point out that the proposed system API-based
features present the typical disadvantages of static analysis. Moreover, a thorough
assessment of their robustness against adversarial strategies has not been performed.
Specifically, the practical feasibility of evasion attacks has only been tested against
mimicry and random noise alterations. Therefore, future work should evaluate the
vulnerability of system API calls against gradient-based evasion attacks. This way,
it could also be possible to assess if this kind of strategy allows attackers to minimise
the number of injected features; hence, preserving the plausibility of the adversarial
79
80 6. Conclusions
samples.
Differently from previous work in the literature, this thesis has the merit to consider
practical attacks against non-binary features. However, the specific implementation
to address the inverse feature-mapping problem is not refined enough in terms of
plausibility compared to the newest works. Therefore, it would be interesting to
inspect the effectiveness of more complex feature injections, such as automated soft-
ware transplantation, against settings using non-binary features. Ultimately, such a
further in-depth analysis would be relevant to understand if the architecture of oper-
ating systems or their components (e.g. the APIs) facilitate or prevent the practical
accomplishment of evasion attacks.
The usage of explainable machine learning has revealed its potentialities in help-
ing to interpret even security-specific elements of detectors. However, the considered
two-class setting, where ransomware apps are evaluated against legitimate ones, is
not able to fully capture behaviour in the middle. In other words, it would be relev-
ant to also identify the characteristics that ransomware attacks do and do not share
with generic malware. Moreover, the settings using system API class or method calls
have not been inspected. Therefore, I point out that further new insights can be
revealed by considering other setting variants. For example, it would be significant
to check if classifiers using finer-grained API calls provide explanations that embed
the same conceptual meaning of the coarser-grained settings.
Another limitation is related to the usage of gradient-based attribution techniques
only, which do not allow understanding the interactions among the features. In this
sense, combining different techniques may enable one to grasp the particular nu-
ances of each kind of explanation. Even more, discovering high-level concepts might
greatly improve the understanding of the applications under analysis.
Finally, the thesis has explored empirical ways to relate adversarial and explain-
able machine learning through proxy metrics. In this sense, I point out the possibility
for future research work to first go deeper with the proposed experimental paths.
Then, I also observe the necessity to develop more theoretically-sound frameworks
that may embed the lessons learnt on the usage of explainable machine learning
more systematically. Such an enhancement would ultimately allow generalising all
the analyses and proposed methods of this thesis to other malware detection prob-
lems.
Bibliography
81
82 6. Bibliography
[12] Yousra Aafer, Wenliang Du and Heng Yin. ‘DroidAPIMiner: Mining API-
Level Features for Robust Malware Detection in Android’. In: Proc. of In-
ternational Conference on Security and Privacy in Communication Networks
({SecureComm}). 2013, pp. 86–103. doi: 10 . 1007 / 978 - 3 - 319 - 04283 -
1{\_}6. url: http://link.springer.com/10.1007/978-3-319-04283-
1_6.
[13] Martina Lindorfer, Matthias Neugschwandtner and Christian Platzer. ‘Mar-
vin: Efficient and Comprehensive Mobile App Classification Through Static
and Dynamic Analysis’. In: Proceedings of the 39th Annual International
Computers, Software & Applications Conference (COMPSAC). 2015.
[14] Hao Peng, Chris Gates, Bhaskar Sarma, Ninghui Li, Yuan Qi, Rahul Potharaju,
Cristina Nita-Rotaru and Ian Molloy. ‘Using Probabilistic Generative Mod-
els for Ranking Risks of Android Apps’. In: Proceedings of the 2012 ACM
Conference on Computer and Communications Security. 2012.
[15] Daniel Arp, Michael Spreitzenbarth, Malte Hübner, Hugo Gascon and Kon-
rad Rieck. ‘Drebin: Effective and Explainable Detection of Android Mal-
ware in Your Pocket’. In: Proceedings 2014 Network and Distributed System
Security Symposium. Reston, VA: Internet Society, 2014, pp. 23–26. isbn:
1-891562-35-5. doi: 10 . 14722 / ndss . 2014 . 23247. url: https : / / www .
ndss - symposium . org / ndss2014 / programme / drebin - effective - and -
explainable-detection-android-malware-your-pocket/.
[16] Sen Chen, Minhui Xue, Zhushou Tang, Lihua Xu and Haojin Zhu. ‘Storm-
Droid’. In: Proceedings of the 11th ACM on Asia Conference on Computer
and Communications Security - ASIA CCS ’16. ASIA CCS ’16. New York,
New York, USA: ACM Press, May 2016, pp. 377–388. isbn: 9781450342339.
doi: 10.1145/2897845.2897860.
[17] Ambra Demontis, Marco Melis, Battista Biggio, Davide Maiorca, Daniel Arp,
Konrad Rieck, Igino Corona, Giorgio Giacinto and Fabio Roli. ‘Yes, Machine
Learning Can Be More Secure! A Case Study on Android Malware Detection’.
In: IEEE Transactions on Dependable and Secure Computing 16.4 (2017),
pp. 1–1. issn: 1545-5971. doi: 10.1109/TDSC.2017.2700270. url: http:
//ieeexplore.ieee.org/document/7917369/.
[18] Michele Scalas, Davide Maiorca, Francesco Mercaldo, Corrado Aaron Visag-
gio, Fabio Martinelli and Giorgio Giacinto. ‘On the effectiveness of system
API-related information for Android ransomware detection’. In: Computers
& Security 86 (Sept. 2019), pp. 168–182. issn: 01674048. doi: 10.1016/j.
cose.2019.06.004. url: https://linkinghub.elsevier.com/retrieve/
pii/S0167404819301178%20http://arxiv.org/abs/1805.09563.
[19] Daniel Arp, Erwin Quiring, Feargus Pendlebury, Alexander Warnecke, Fabio
Pierazzi, Christian Wressnegger, Lorenzo Cavallaro and Konrad Rieck. ‘Dos
and Don’ts of Machine Learning in Computer Security’. In: (Oct. 2020). url:
http://arxiv.org/abs/2010.09470.
[20] Battista Biggio and Fabio Roli. ‘Wild patterns: Ten years after the rise of
adversarial machine learning’. In: Pattern Recognition 84 (2018), pp. 317–
331. issn: 0031-3203. doi: 10.1016/J.PATCOG.2018.07.023. url: https:
//www.sciencedirect.com/science/article/pii/S0031320318302565.
. 83
[21] Nilesh Dalvi, Pedro Domingos, Mausam, Sumit Sanghai and Deepak Verma.
‘Adversarial classification’. In: Tenth ACM SIGKDD International Confer-
ence on Knowledge Discovery and Data Mining (KDD). Seattle, 2004, pp. 99–
108.
[22] Daniel Lowd and Christopher Meek. ‘Adversarial Learning’. In: Proc. 11th
ACM SIGKDD International Conference on Knowledge Discovery and Data
Mining (KDD). Chicago, IL, USA: ACM Press, 2005, pp. 641–647.
[23] Marco Barreno, Blaine Nelson, Russell Sears, Anthony D Joseph and J D
Tygar. ‘Can machine learning be secure?’ In: Proc. ACM Symp. Information,
Computer and Comm. Sec. ASIACCS ’06. New York, NY, USA: ACM, 2006,
pp. 16–25.
[24] Marco Barreno, Blaine Nelson, Anthony Joseph and J Tygar. ‘The security
of machine learning’. In: Machine Learning 81.2 (2010), pp. 121–148.
[25] Battista Biggio, Giorgio Fumera and Fabio Roli. ‘Security Evaluation of Pat-
tern Classifiers Under Attack’. In: IEEE Transactions on Knowledge and
Data Engineering 26.4 (Apr. 2014), pp. 984–996. issn: 1041-4347.
[26] Battista Biggio, Blaine Nelson and Pavel Laskov. ‘Poisoning attacks against
support vector machines’. In: 29th Int{\textquoteright}l Conf. on M. Learning
(ICML). Ed. by John Langford and Joelle Pineau. Omnipress. Omnipress,
2012.
[27] Battista Biggio, Igino Corona, Davide Maiorca, Blaine Nelson, Nedim Šrndić,
Pavel Laskov, Giorgio Giacinto and Fabio Roli. ‘Evasion Attacks against
Machine Learning at Test Time’. In: Joint European conference on machine
learning and knowledge discovery in databases. Vol. 8190. Lecture Notes in
Computer Science. Springer Berlin Heidelberg, 2013, pp. 387–402. doi: 10.
1007/978-3-642-40994-3{\_}25. url: http://link.springer.com/10.
1007/978-3-642-40994-3_25.
[28] Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru
Erhan, Ian Goodfellow and Rob Fergus. ‘Intriguing properties of neural net-
works’. In: International Conference on Learning Representations. 2014. url:
http://arxiv.org/abs/1312.6199.
[29] Ian J Goodfellow, Jonathon Shlens and Christian Szegedy. ‘Explaining and
Harnessing Adversarial Examples’. In: International Conference on Learning
Representations. 2015.
[30] Davide Maiorca, Battista Biggio and Giorgio Giacinto. ‘Towards adversarial
malware detection: Lessons learned from PDF-based attacks’. In: ACM Com-
puting Surveys (CSUR) 52.4 (2019), pp. 1–36.
[31] Nedim Šrndic and Pavel Laskov. ‘Practical Evasion of a Learning-Based Clas-
sifier: A Case Study’. In: Proc. 2014 IEEE Symp. Security and Privacy. SP
’14. Washington, DC, USA: IEEE CS, 2014, pp. 197–211.
84 6. Bibliography
[32] Kathrin Grosse, Nicolas Papernot, Praveen Manoharan, Michael Backes and
Patrick McDaniel. ‘Adversarial Examples for Malware Detection’. In: European
Symposium on Research in Computer Security (ESORICS). Vol. 10493 LNCS.
Springer Verlag, 2017, pp. 62–79. isbn: 9783319663982. doi: 10.1007/978-
3-319-66399-9{\_}4. url: http://link.springer.com/10.1007/978-3-
319-66399-9_4.
[33] Amina Adadi and Mohammed Berrada. ‘Peeking Inside the Black-Box: A Sur-
vey on Explainable Artificial Intelligence (XAI)’. In: IEEE Access 6 (2018),
pp. 52138–52160. issn: 2169-3536. doi: 10.1109/ACCESS.2018.2870052.
[34] Alejandro Barredo Arrieta, Natalia Díaz-Rodríguez, Javier Del Ser, Adrien
Bennetot, Siham Tabik, Alberto Barbado, Salvador Garcia, Sergio Gil-Lopez,
Daniel Molina, Richard Benjamins, Raja Chatila and Francisco Herrera. ‘Ex-
plainable Artificial Intelligence (XAI): Concepts, taxonomies, opportunities
and challenges toward responsible AI’. In: Information Fusion 58.October
2019 (June 2020), pp. 82–115. issn: 15662535. doi: 10 . 1016 / j . inffus .
2019.12.012.
[35] Finale Doshi-Velez and Been Kim. ‘Towards A Rigorous Science of Inter-
pretable Machine Learning’. In: arXiv preprint arXiv:1702.08608 (2017).
[36] Alun Preece, Dan Harborne, Dave Braines, Richard Tomsett and Supriyo
Chakraborty. ‘Stakeholders in Explainable AI’. In: AAAI Fall Symposium on
Artificial Intelligence in Government and Public Sector. Arlington, Virginia,
USA, 2018.
[37] Michele Scalas and Giorgio Giacinto. ‘Automotive Cybersecurity: Founda-
tions for Next-Generation Vehicles’. In: 2019 2nd International Conference
on new Trends in Computing Sciences (ICTCS). IEEE, Oct. 2019, pp. 1–6.
isbn: 978-1-7281-2882-5. doi: 10.1109/ICTCS.2019.8923077. url: https:
//ieeexplore.ieee.org/document/8923077/.
[38] Cynthia Rudin. ‘Stop explaining black box machine learning models for high
stakes decisions and use interpretable models instead’. In: Nature Machine
Intelligence 1.5 (May 2019), pp. 206–215. issn: 2522-5839. doi: 10.1038/
s42256-019-0048-x. url: http://www.nature.com/articles/s42256-
019-0048-x.
[39] Jon Arne Glomsrud, André Ødegårdstuen, Asun Lera St. Clair and OYvind
Smogeli. ‘Trustworthy versus Explainable AI in Autonomous Vessels’. In:
Proceedings of the International Seminar on Safety and Security of Autonom-
ous Vessels (ISSAV) and European STAMP Workshop and Conference (ESWC)
2019. September. Sciendo, Dec. 2020, pp. 37–47. doi: 10.2478/9788395669606-
004.
[40] Been Kim, Martin Wattenberg, Justin Gilmer, Carrie Cai, James Wexler,
Fernanda Viegas and Rory Sayres. ‘Interpretability Beyond Feature Attri-
bution: Quantitative Testing with Concept Activation Vectors (TCAV)’. In:
35th International Conference on Machine Learning (ICML 2018). Vol. 80.
Stockholm, July 2018, pp. 2668–2677. isbn: 9781510867963.
. 85
[41] Amirata Ghorbani, James Wexler, James Zou and Been Kim. ‘Towards Auto-
matic Concept-based Explanations’. In: Advances in Neural Information Pro-
cessing Systems. Vancouver: Curran Associates, Inc., Feb. 2019, pp. 9273–
9282.
[42] Marco Tulio Ribeiro, Sameer Singh and Carlos Guestrin. ‘"Why Should I
Trust You?"’ In: Proceedings of the 22nd ACM SIGKDD International Con-
ference on Knowledge Discovery and Data Mining - KDD ’16. KDD ’16. New
York, NY, USA: ACM Press, Aug. 2016, pp. 1135–1144. isbn: 9781450342322.
doi: 10.1145/2939672.2939778. url: http://dl.acm.org/citation.
cfm?doid=2939672.2939778.
[43] Scott M. Lundberg, Su-In Lee, Paul G Allen and Su-In Lee. ‘A Unified Ap-
proach to Interpreting Model Predictions’. In: Advances in Neural Informa-
tion Processing Systems 30. Curran Associates, Inc., 2017, pp. 4765–4774.
[44] Pang Wei Koh and Percy Liang. ‘Understanding Black-box Predictions via
Influence Functions’. In: Proceedings of the 34th International Conference on
Machine Learning - Volume 70 (Mar. 2017), pp. 1885–1894.
[45] Wenbo Guo, Dongliang Mu, Jun Xu, Purui Su, Gang Wang and Xinyu Xing.
‘LEMNA’. In: Proceedings of the 2018 ACM SIGSAC Conference on Com-
puter and Communications Security. New York, NY, USA: ACM, Jan. 2018,
pp. 364–379. isbn: 9781450356930. doi: 10.1145/3243734.3243792. url:
http://dl.acm.org/citation.cfm?doid=3243734.3243792%20https:
//dl.acm.org/doi/10.1145/3243734.3243792.
[46] David Baehrens, Timon Schroeter, Stefan Harmeling, Motoaki Kawanabe,
Katja Hansen and Klaus-Robert Müller. ‘How to Explain Individual Classi-
fication Decisions’. In: J. Mach. Learn. Res. 11 (2010), pp. 1803–1831.
[47] Avanti Shrikumar, Peyton Greenside, Anna Shcherbina and Anshul Kundaje.
Not Just a Black Box: Learning Important Features Through Propagating
Activation Differences. 2016.
[48] Mukund Sundararajan, Ankur Taly and Qiqi Yan. ‘Axiomatic Attribution
for Deep Networks’. In: Proceedings of the 34th International Conference on
Machine Learning. Sidney: JMLR.org, Mar. 2017, pp. 3319–3328. url: http:
//arxiv.org/abs/1703.01365.
[49] Kaspersky. Mobile Malware Evolution 2019. 2020. url: https://securelist.
com/mobile-malware-evolution-2019/96280/.
[50] Trend Micro. The 2019 Mobile Threat Landscape - Security Roundup. url:
https : / / www . trendmicro . com / vinfo / us / security / research - and -
analysis/threat-reports/roundup/review-refocus-and-recalibrate-
the-2019-mobile-threat-landscape.
[51] Kaspersky. IT threat evolution Q2 2020. Mobile statistics. 2020. url: https:
//securelist.com/it-threat-evolution-q2-2020-mobile-statistics/
98337/.
[52] Kaspersky. ‘Mobile Malware Evolution 2016’. 2017. url: https://securelist.
com/mobile-malware-evolution-2016/77681/.
[53] Kaspersky. Mobile Malware Evolution 2017. 2018. url: https://securelist.
com/mobile-malware-review-2017/84139/.
86 6. Bibliography
[63] Wei Yang, Xusheng Xiao, Benjamin Andow, Sihan Li, Tao Xie and William
Enck. ‘AppContext: Differentiating Malicious and Benign Mobile App Beha-
viors Using Context’. In: 2015 IEEE/ACM 37th IEEE International Confer-
ence on Software Engineering. Vol. 1. ICSE ’15. Piscataway, NJ, USA: IEEE,
May 2015, pp. 303–313. isbn: 978-1-4799-1934-5. doi: 10.1109/ICSE.2015.
50.
[64] Vitalii Avdiienko, Konstantin Kuznetsov, Alessandra Gorla, Andreas Zeller,
Steven Arzt, Siegfried Rasthofer and Eric Bodden. ‘Mining Apps for Ab-
normal Usage of Sensitive Data’. In: Proceedings of the 37th International
Conference on Software Engineering - Volume 1. ICSE ’15. Piscataway, NJ,
USA: IEEE Press, 2015, pp. 426–436. isbn: 978-1-4799-1934-5.
[65] Hao Zhang, Danfeng Daphne Yao and Naren Ramakrishnan. ‘Detection of
Stealthy Malware Activities with Traffic Causality and Scalable Triggering
Relation Discovery’. In: Proceedings of the 9th ACM Symposium on Inform-
ation, Computer and Communications Security. ASIA CCS ’14. New York,
NY, USA: ACM, 2014, pp. 39–50. isbn: 978-1-4503-2800-5. doi: 10.1145/
2590296.2590309.
[66] Hao Zhang, Danfeng (Daphne) Yao and Naren Ramakrishnan. ‘Causality-
based Sensemaking of Network Traffic for Android Application Security’.
In: Proceedings of the 2016 ACM Workshop on Artificial Intelligence and
Security. AISec ’16. New York, NY, USA: ACM, 2016, pp. 47–58. isbn: 978-
1-4503-4573-6. doi: 10.1145/2996758.2996760.
[67] Kevin Sun. Google Play Apps Drop Anubis, Use Motion-based Evasion. url:
https://www.trendmicro.com/en_us/research/19/a/google- play-
apps - drop - anubis - banking - malware - use - motion - based - evasion -
tactics.html?_ga=2.125935757.1289840044.1606563087- 979093796.
1605611851.
[68] Michele Scalas, Konrad Rieck and Giorgio Giacinto. ‘Explanation-driven Char-
acterisation of Android Ransomware’. In: ICPR’2020 Workshop on Explain-
able Deep Learning - AI. 2020.
[69] Nicoló Andronio, Stefano Zanero and Federico Maggi. ‘HelDroid: Dissecting
and Detecting Mobile Ransomware’. In: Recent Advances in Intrusion Detec-
tion (RAID). Vol. 9404. Springer, 2015, pp. 382–404. isbn: 9783319263618.
doi: 10.1007/978-3-319-26362-5{\_}18. url: http://link.springer.
com/10.1007/978-3-319-26362-5_18.
[70] Chengyu Zheng, Nicola Dellarocca, Niccolò Andronio, Stefano Zanero and
Federico Maggi. ‘GreatEatlon: Fast, Static Detection of Mobile Ransom-
ware’. In: SecureComm. Vol. 198. Lecture Notes of the Institute for Computer
Sciences, Social Informatics and Telecommunications Engineering. Springer,
Oct. 2017, pp. 617–636. isbn: 9783319596075. doi: 10.1007/978- 3- 319-
59608-2{\_}34.
[71] Davide Maiorca, Davide Ariu, Igino Corona, Marco Aresu and Giorgio Giacinto.
‘Stealth Attacks: An Extended Insight into the Obfuscation Effects on An-
droid Malware’. In: Computers & Security 51.C (2015), pp. 16–31. issn: 0167-
4048. doi: 10.1016/j.cose.2015.02.007.
88 6. Bibliography
[81] Marco Melis, Davide Maiorca, Battista Biggio, Giorgio Giacinto and Fa-
bio Roli. ‘Explaining Black-box Android Malware Detection’. In: 2018 26th
European Signal Processing Conference (EUSIPCO). IEEE, Sept. 2018, pp. 524–
528. isbn: 978-9-0827-9701-5. doi: 10.23919/EUSIPCO.2018.8553598. url:
https://ieeexplore.ieee.org/document/8553598/.
[82] Battista Biggio, Giorgio Fumera and Fabio Roli. ‘Pattern Recognition Sys-
tems under Attack: Design Issues and Research Challenges’. In: IJPRAI 28.7
(2014).
[83] Alexander Warnecke, Daniel Arp, Christian Wressnegger and Konrad Rieck.
‘Evaluating Explanation Methods for Deep Learning in Security’. In: 5th
IEEE European Symposium on Security and Privacy (Euro S&P 2020). Gen-
ova, Sept. 2020.
[84] Julius Adebayo, Justin Gilmer, Michael Muelly, Ian Goodfellow, Moritz Hardt
and Been Kim. ‘Sanity Checks for Saliency Maps’. In: Advances in Neural In-
formation Processing Systems 31. Curran Associates, Inc., Oct. 2018, pp. 9505–
9515.
[85] Isaac Lage, Emily Chen, Jeffrey He, Menaka Narayanan, Been Kim, Samuel J
Gershman and Finale Doshi-Velez. ‘An Evaluation of the Human-Interpretability
of Explanation’. In: Proceedings of the AAAI Conference on Human Compu-
tation and Crowdsourcing. Vol. 7. Honolulu: AAAI Press, Jan. 2019, pp. 59–
67.
[86] Android API Reference. url: https://developer.android.com/reference/
packages.
[87] Marco Melis, Ambra Demontis, Maura Pintor, Angelo Sotgiu and Battista
Biggio. ‘secml: A Python Library for Secure and Explainable Machine Learn-
ing’. In: arXiv preprint arXiv:1912.10013 (Dec. 2019). url: http://arxiv.
org/abs/1912.10013.
[88] Marco Ancona. DeepExplain. url: https : / / github . com / marcoancona /
DeepExplain.
[89] Maximilian Alber, Sebastian Lapuschkin, Philipp Seegerer, Miriam Hägele,
Kristof T. Schütt, Grégoire Montavon, Wojciech Samek, Klaus-Robert Müller,
Sven Dähne and Pieter-Jan Kindermans. iNNvestigate neural networks! Aug.
2018. url: http://arxiv.org/abs/1808.04260.
[90] Feargus Pendlebury, Fabio Pierazzi, Roberto Jordaney, Johannes Kinder and
Lorenzo Cavallaro. ‘TESSERACT: Eliminating Experimental Bias in Mal-
ware Classification across Space and Time’. In: 28th USENIX Security Sym-
posium (USENIX Security 19). Santa Clara, CA, USA: USENIX Association,
Aug. 2019, pp. 729–746.
[91] Alejandro Calleja, Alejandro Martin, Hector D Menendez, Juan Tapiador
and David Clark. ‘Picking on the family: Disrupting android malware triage
by forcing misclassification’. In: Expert Systems with Applications 95 (2018),
pp. 113–126.
90 6. Bibliography
[92] Marco Melis, Michele Scalas, Ambra Demontis, Davide Maiorca, Battista
Biggio, Giorgio Giacinto and Fabio Roli. ‘Do Gradient-based Explanations
Tell Anything About Adversarial Robustness to Android Malware?’ In: arXiv
preprint arXiv:2005.01452 (May 2020). url: http://arxiv.org/abs/2005.
01452.
[93] Fabrizio Cara, Michele Scalas, Giorgio Giacinto and Davide Maiorca. ‘On
the Feasibility of Adversarial Sample Creation Using the Android System
API’. In: Information 2020, Vol. 11, Page 433 11.9 (Sept. 2020), p. 433. doi:
10.3390/info11090433. url: www.mdpi.com/journal/information.
[94] Aleksander Kolcz and Choon Hui Teo. ‘Feature Weighting for Improved Clas-
sifier Robustness’. In: Sixth Conference on Email and Anti-Spam (CEAS).
Mountain View, CA, USA, 2009.
[95] Battista Biggio, Giorgio Fumera and Fabio Roli. ‘Multiple Classifier Systems
for Robust Classifier Design in Adversarial Environments’. In: Int’l J. Mach.
Learn. and Cybernetics 1.1 (2010), pp. 27–41.
[96] Ambra Demontis, Paolo Russu, Battista Biggio, Giorgio Fumera and Fabio
Roli. ‘On Security and Sparsity of Linear Classifiers for Adversarial Settings’.
In: Joint IAPR Int’l Workshop on Structural, Syntactic, and Statistical Pat-
tern Recognition. Ed. by Antonio Robles-Kelly, Marco Loog, Battista Biggio,
Francisco Escolano and Richard Wilson. Vol. 10029. LNCS. Cham: Springer
International Publishing, 2016, pp. 322–332.
[97] Ambra Demontis, Marco Melis, Maura Pintor, Matthew Jagielski, Battista
Biggio, Alina Oprea, Cristina Nita-Rotaru and Fabio Roli. ‘Why Do Ad-
versarial Attacks Transfer? Explaining Transferability of Evasion and Poison-
ing Attacks’. In: 28th {USENIX} Security Symposium ({USENIX} Security
19). Santa Clara, CA, USA: {USENIX} Association, Aug. 2019, pp. 321–338.
isbn: 978-1-939133-06-9.
[98] Jiefeng Chen, Xi Wu, Vaibhav Rastogi, Yingyu Liang and Somesh Jha. ‘Ro-
bust Attribution Regularization’. In: Advances in Neural Information Pro-
cessing Systems. 2019, pp. 14300–14310.
[99] Martina Lindorfer, Matthias Neugschwandtner and Christian Platzer. ‘MAR-
VIN: Efficient and Comprehensive Mobile App Classification through Static
and Dynamic Analysis’. In: 2015 IEEE 39th Annual Computer Software and
Applications Conference. Vol. 2. IEEE, July 2015, pp. 422–433. isbn: 978-1-
4673-6564-2. doi: 10.1109/COMPSAC.2015.103. url: http://ieeexplore.
ieee.org/document/7273650/.
[100] Haipeng Cai, Na Meng, Barbara Ryder and Daphne Yao. ‘Droidcat: Effect-
ive android malware detection and categorization via app-level profiling’.
In: IEEE Transactions on Information Forensics and Security 14.6 (2018),
pp. 1455–1470.
[101] Marco Melis, Ambra Demontis, Battista Biggio, Gavin Brown, Giorgio Fumera
and Fabio Roli. ‘Is Deep Learning Safe for Robot Vision? Adversarial Ex-
amples against the iCub Humanoid’. In: ICCV Workshop on Vision in Prac-
tice on Autonomous Robots ({ViPAR}). 2017.
. 91
[102] Davide Maiorca, Igino Corona and Giorgio Giacinto. ‘Looking at the bag
is not enough to find the bomb: An evasion of structural methods for ma-
licious PDF files detection’. In: ASIA CCS 2013 - Proceedings of the 8th
ACM SIGSAC Symposium on Information, Computer and Communications
Security. New York, New York, USA: ACM Press, 2013, pp. 119–129. isbn:
9781450317672. doi: 10.1145/2484313.2484327.
[103] Erwin Quiring, Alwin Maier and Konrad Rieck. ‘Misleading Authorship At-
tribution of Source Code using Adversarial Learning | USENIX’. In: 28th
USENIX Security Symposium (USENIX Security 19). Santa Clara, CA: USENIX
Association, Aug. 2019, pp. 479–496. isbn: 978-1-939133-06-9. url: https://
www.usenix.org/conference/usenixsecurity19/presentation/quiring.
[104] Fabio Pierazzi, Feargus Pendlebury, Jacopo Cortellazzi and Lorenzo Caval-
laro. ‘Intriguing Properties of Adversarial ML Attacks in the Problem Space’.
In: 2020 IEEE Symposium on Security and Privacy (SP). IEEE. IEEE, May
2020, pp. 1332–1349. isbn: 978-1-7281-3497-0. doi: 10.1109/SP40000.2020.
00073. url: https://ieeexplore.ieee.org/document/9152781/.
[105] Wei Song, Xuezixiang Li, Sadia Afroz, Deepali Garg, Dmitry Kuznetsov and
Heng Yin. ‘Automatic Generation of Adversarial Examples for Interpreting
Malware Classifiers’. In: (Mar. 2020). url: http://arxiv.org/abs/2003.
03100.
[106] Smali. url: https://github.com/JesusFreke/smali.
[107] ApkTool. url: https://ibotpeaches.github.io/Apktool.
[108] Mila Dalla Preda, Matias Madou, Koen De Bosschere and Roberto Giaco-
bazzi. ‘Opaque Predicates Detection by Abstract Interpretation’. In: Algeb-
raic {Methodology} and {Software} {Technology}. Vol. 4019. Springer Berlin
Heidelberg, 2006, pp. 81–95. doi: 10 . 1007 / 11784180{\ _ }9. url: http :
//link.springer.com/10.1007/11784180_9.
[109] Jiang Ming, Dongpeng Xu, Li Wang and Dinghao Wu. ‘LOOP: Logic-Oriented
Opaque Predicate Detection in Obfuscated Binary Code’. In: Proceedings of
the 22nd ACM SIGSAC Conference on Computer and Communications Se-
curity - CCS ’15. New York, New York, USA: ACM Press, 2015, pp. 757–
768. isbn: 9781450338325. doi: 10 . 1145 / 2810103 . 2813617. url: http :
//dl.acm.org/citation.cfm?doid=2810103.2813617.
[110] Wei Yang, Deguang Kong, Tao Xie and Carl A. Gunter. ‘Malware Detec-
tion in Adversarial Settings’. In: Proceedings of the 33rd Annual Computer
Security Applications Conference. Vol. Part F1325. New York, NY, USA:
ACM, Dec. 2017, pp. 288–302. isbn: 9781450353458. doi: 10.1145/3134600.
3134642. url: https://dl.acm.org/doi/10.1145/3134600.3134642.
[111] Inigo Incer, Michael Theodorides, Sadia Afroz and David Wagner. ‘Adversari-
ally Robust Malware Detection Using Monotonic Classification’. In: Proceed-
ings of the Fourth ACM International Workshop on Security and Privacy
Analytics. Vol. 10. New York, NY, USA: ACM, 2018. isbn: 9781450356343.
url: https://doi.org/10.1145/3180445.3180449.
92 6. Bibliography
[112] Nicolas Papernot, Patrick McDaniel, Xi Wu, Somesh Jha and Ananthram
Swami. ‘Distillation as a Defense to Adversarial Perturbations Against Deep
Neural Networks’. In: 2016 IEEE Symposium on Security and Privacy (SP).
IEEE, May 2016, pp. 582–597. isbn: 978-1-5090-0824-7. doi: 10.1109/SP.
2016.41. url: http://ieeexplore.ieee.org/document/7546524/.
[113] Ishai Rosenberg, Asaf Shabtai, Lior Rokach and Yuval Elovici. ‘Generic black-
box end-to-end attack against state of the art API call based malware classifi-
ers’. In: Lecture Notes in Computer Science (including subseries Lecture Notes
in Artificial Intelligence and Lecture Notes in Bioinformatics). Vol. 11050
LNCS. Springer Verlag, Sept. 2018, pp. 490–510. isbn: 9783030004699. doi:
10.1007/978-3-030-00470-5{\_}23.
[114] Weiwei Hu and Ying Tan. ‘Generating {Adversarial} {Malware} {Examples}
for {Black}-{Box} {Attacks} {Based} on {GAN}’. In: arXiv:1702.05983 [cs]
(Feb. 2017). url: http://arxiv.org/abs/1702.05983.
[115] Jerry Li, Aleksander Madry, John Peebles and Ludwig Schmidt. ‘On the Lim-
itations of First-Order Approximation in GAN Dynamics’. In: arXiv preprint
arXiv:1706.09884 (June 2017), p. 9. url: http://arxiv.org/abs/1706.
09884.