Early Detection of Remote Access Trojan by Software Network Behavior
Early Detection of Remote Access Trojan by Software Network Behavior
Early Detection of Remote Access Trojan by Software Network Behavior
1 Introduction
2 Related Work
early detection for many situations. Furthermore, only several specific benign
software selected by the authors were used for the evaluation experiments. As a
result, it incorrectly detects the communication of system related software and
antivirus software as RAT. Thus, these methods [1,3] are not practical.
The existing methods [1,3] of RAT do not become early detection in some
circumstances, since the early stage does not finish as long as the packets are
transmitted in the existing methods. In other words, the early stage finishes
when the observed packets are not transmitted for a fixed period of time. Thus,
much time may be required for RAT detection. On the other hand, in our new
mechanism of early detection, the early stage inevitably finishes after a fixed
period of time.
3 Proposed Method
From the viewpoint of countermeasures against information leakage, detection
of RAT should be realized as early as possible after infection. We propose a
detection method of RAT based on the new mechanism of early detection. The
mechanism is different from the existing methods [1,3]. While the early stage
may get longer in the existing methods, our early stage finishes after a fixed
period of time. Thanks to this improvement, it achieves true early detection.
Our proposed method consists of two stages: learning phase and detection
phase. In both stages, feature extraction is a main of processing. In this section,
we first describe the details of the feature extraction processing and then explain
the each stage. For simplicity, the detection engine running on the host is
assumed to be trustworthy.
For feature extraction, the first few early stage of connections in each process
are used. Specifically, for each process, the early stage of connections initiated
during the early stage of the first connection of the process are monitored. Thus,
the monitoring time in each process is 2t seconds at maximum. In the case of the
example of Fig. 1, the system monitors the early stage of Connection 1, which is
the first connection of the process, and Connection 2 and Connection 3, which
are the connections started during the early stage of Connection 1.
From the early stage of monitoring connections, eleven types of features
shown in Table 1 are extracted. Then, after obtaining features from all mon-
itoring early stage connections of the process, “Mean”, “Standard Deviation
(SD)”, “Maximum value (Man)”, “Minimum value (Min)”, and “Range” of each
connection features, and also, “Sum” of “PacNum”, “OutPac”, “InPac”, “Out-
Byte” and “InByte” are calculated. Further,“Number of Connections (Conn)”
and “Number of Destination IP addresses (DstIP)” are counted. Finally, a 62
dimensional vector is outputted as a feature vector of the process. A specific
calculation procedure of feature vectors is as follows.
Early Detection of Remote Access Trojan by Software Network Behavior 663
Feature Explanation
PacNum Total number of packets
OutPac Number of outbound packets
InPac Number of inbound packets
OutByte Data size of outbound packets
InByte Data size of inbound packets
OutByteSD Standard deviation of data size of outbound packets
InByteSD Standard deviation of data size of outbound packets
O/Ipac Rate of OutPac to InPac
O/Ibyte Rate of OutByte to InByte
OB/OP Average data size per one outbound packet
IB/IP Average data size per one inbound packet
1. Read a packet.
2. Judge whether the packet is TCP and the destination is toward the outside
of the network.
3. Identify the connection from the set of source IP address, destination IP
address, source port number, and destination port number.
4. If it is a new connection, identify the process ID, the process name, and the
path of the executable file from the source port number, and store them in a
correspondence table, otherwise, refer the correspondence table and identify
the process.
5. Judge whether the packet is monitoring target.
6. If it is a monitoring target, update connection features (PacNum, OutPac,
InPac, OutByte, InByte).
7. When all monitoring connections of a process are captured, calculate remain-
ing connection features (OutByteSD, InByteSD, O/Ipac, O/Ibyte, OB/OP,
IB/IP).
8. Calculate Mean, SD, Max, Min, Range of each connection feature and Sum
of PacNum, OutPac, InPac, OutByte, InByte.
9. Calculate “Conn” and “DstIP”.
10. Output a feature vector of the process.
Our proposed method differs greatly from existing researches in the point
that the feature vector of a process is generated based on the multiple early
stage connections of the process. Therefore, the diversity of connection, such
as differences and variations in communication sizes for each connection, by
the same process can be captured as features. RAT communication is often
single session and single connection, and due to its characteristics, there is a
time lag between the establishment of the connection to the C&C server and
the attacker who confirms the connection starts attacks. Thus, we can guess
that RAT communication in the early stage is monotonous. On the other hand,
664 M. Oya and K. Omote
benign software will generate a wide variety of connections even in the early
stage. Therefore, we expect that the difference between RAT and benign software
become clear.
In this phase, at first, feature vectors of processes of benign software and RATs
are collected, and then the detection model of RAT is learned using those data.
Feature vectors of benign software are gathered by performing the feature extrac-
tion processing described in the previous section on computers which can be
guaranteed that they are not infected with malware. Also, feature vectors of
RAT are collected by running prepared RAT samples. After that, for each col-
lected feature vector, 0 is assigned if the feature vector is for benign software,
and 1 if it is RAT as a label. Finally, the detection model of RAT is generated
by applying supervised learning algorithm of machine learning for this dataset.
4 Evaluation Experiments
4.1 Overview
feature vectors of benign software. In the case that many false detections are
created by the system, the cost for examining alerts increases during operation,
which increases the burden on the system administrators, so that the system
is not practical. Therefore, in the second experiment, the practicality of the
proposed system is evaluated from the viewpoint of the amount of false detection.
Before these experiments, we perform a preliminary experiment to deter-
mine the parameter t of the early stage of communication and the combination
of the features to use in the experiments. In all experiments, we use seven type
of machine learning classification algorithms: Decision Tree (DT), Random For-
est (RF), Support Vector Machine (SVM), Naive Bayes (NB), Gradient Tree
Boosting (GTB), AdaBoost (AB), and Multi-layer Perceptron (MLP).
4.3 Dataset
As a benign dataset, we use daily communications including system related soft-
ware and anti-virus software from active PCs to generate new dataset. The fea-
ture vectors of benign software used in the experiments are generated by collect-
ing logs of communication and processes from seven computers in the campus
network of JAIST and then by executing the feature extraction program. We
acquired about 24 h (weekday) of communication logs from each computer. The
usage purpose of each computer is creation of documents, browsing of emails
and Web sites, and access to file servers, so it has no big difference from the
usage of most organizations.
Feature vectors of RAT are collected by running RAT samples in a isolated
network environment, and executing the feature extraction program. We use 25
kinds of RATs for evaluation. Table 2 shows the list of RAT samples used in
experiments.
666 M. Oya and K. Omote
When t becomes smaller, the earlier detection is possible, but the amount of
features is smaller. So we first set the values from 1 to 10 as candidate values of t.
For each candidate value, we evaluate the detection performance using 15 useful
features determined by F value in analysis of variance. At this time, we consider t
at which the evaluation result is the best as the optimum value. Next, we fix t is to
the optimum value and find the best combination of features by brute force.
As a result of the above processing, the optimum value of t became 4, and
the optimum combination of features became “InByteSDMin + IB/IPMean +
IB/IPMax + IB/IPMin + OutByteSDMax + OutByteSDMean + OB/OPMin
+ IB/IPRange”. In the subsequent experiments, we use the value of t and the
combination of features obtained.
4.5 Experiment 1
In this experiment, we evaluate the detection performance of the proposed
method using collected benign communication and RAT communication. We
use feature vectors extracted from each computer and feature vectors of RAT as
one dataset, and calculate performance indices by 5-fold cross validation. Table 3
shows the results of this experiment. In evaluation experiments using the method
of Adachi et al. [1], the performance was the best on average when SVM was
used as a learning algorithm1 In the proposed method of this research, the best
performance was obtained when GTB was used. Note that we implemented the
method of Adachi et al. [1] by ourselves for comparison.
1
Naive Bayes was the best algorithm in [1]. But, as a result of our code and feature
refining, the result by SVM was the best in our experiment.
Early Detection of Remote Access Trojan by Software Network Behavior 667
Comparing the results, our method is better than the method by Adachi
et al. for all evaluation indices. The detection rate (RCL) of RAT in the proposed
method is 0.920 as a whole, and it becomes clear that most RAT can be detected.
On the other hand, the detection rate by Adachi et al. method is 0.823, indicating
that the detection performance of our method is high by about 0.1. As for FPR,
the proposed method was 0.022 as a whole, while that of Adachi et al. was 0.115.
In PRC which is an index of reliability of RAT detection, the proposed method
is about 0.3 better than the method by Adachi et al.
4.6 Experiment 2
5 Discussion
5.1 False Detection
In the previous section, we show that the proposed method can detect infec-
tion of RAT with high accuracy, and also the possibility of false detection of
benign software is greatly improved compared to existing research. However, in
a large organization that owns a large number of computers, even if there are few
false detection alerts on one computer, the burden on the system administrators
becomes large since the number of alerts as a whole increases.
Table 5 shows processes that are erroneously detected as RAT many times by
our method. From the results, many erroneous detections occurred for Windows
system related processes, antivirus software related processes, software update
related processes, and cloud storage services. We consider that the characteris-
tics of these processes are similar to RAT since they do not perform vigorous
communication at the early stage compared with other benign processes.
We assume that it is possible to avoid false detection by pre-registering pro-
cesses often judged as RAT in the whitelist. In the proposed method, when
an alert occurs, the location of the executable file of the process can be easily
specified, so the whitelist can be realized by confirming the digital signature
of executable files. Table 6 shows the FPR and the FP, which are calculated
based on the experiment in the previous section, depending on the presence
Early Detection of Remote Access Trojan by Software Network Behavior 669
of the whitelist. Note that the FP is the estimated average value on 1-PC for
7 days. The results indicates that it is possible to reduce the number of false
detections by about 90% by registering digital signatures of Microsoft, McAfee,
Avira, Dropbox in the whitelist. Also, the FPR decreases to 0.003 when eight
publishers, which are Microsoft, McAfee, Avira, Dropbox, TeamViewer, Opera,
Oracle, ASUS, are registered in the whitelist.
5.2 Evasion
We discuss whether our method can be avoided by attackers. As a detection
avoidance, it is conceivable that attackers make RAT to generate communication
similar to the features of a benign process. In this case, RAT needs to establish
some connections with different traffic amounts and make each packet size widely
varied. However, artificially generating unnecessary communication leads to an
increase in the possibility that RAT communication will be detected by another
attack detection system. In particular, mechanically generated communication
is expected to be regarded as communication of Bots. Also, unnecessary commu-
nication increases the amount of traces of the attack. In APT attacks, attackers
need to complete tasks without noticing the targets, therefore, we consider that
attackers are not willing to attempt such means. Furthermore, since this method
learns the detection model by machine learning, the detection criterion is not
clear compared with signature based detection methods. Thus, it is extremely
difficult to analyze and generate communication that the detection model misses.
From the above viewpoint, we conclude that the risk that attackers intentionally
avoid the detection model by such a method is low.
As another detection avoidance method, injecting RAT into a running benign
process (e.g., cross-process injection) is conceivable. If the RAT program is
injected into a process under execution, the RAT apparently functions as the
benign process, so it may be excluded from detection by the whitelist. Also, if the
injection process already communicates and the monitoring time of the proposed
method has passed, the proposed method cannot detect RAT infection. There-
fore, it is necessary to detect RAT infected by injection by another method. In
this case, since the occurrence of code injection itself can be regarded as suspi-
cious activity, a system that can detect injection can be effective. As measures
against injection, there is a method that previously records the address where
Windows API call instructions on the software executable file are described, and
detects the injection by checking the record when the API is actually called [8].
670 M. Oya and K. Omote
6 Conclusion
We proposed a detection method of RAT based on the new mechanism of early
detection. The mechanism is different from the existing methods [1,3]. While
the early stage may get longer in the existing methods, our early stage finishes
after a fixed period of time. Thanks to this improvement, it achieves true early
detection. This makes it possible for the proposed method to more clearly distin-
guish between RAT and the RAT-like healthy software communication including
system related one. Evaluation experiments show that the proposed method can
detect RAT in early stage of post-infection activity with a detection rate of
92%, FPR of 2.2% and FNR of 8.0%. Therefore, we conclude that the proposed
method is sufficiently practical as an early detection system of RAT. As a future
work, we will conduct the experimental evaluation using new RATs in various
networks.
References
1. Adachi, D., Omote, K.: A host-based detection method of remote access trojan in
the early stage. In: Bao, F., Chen, L., Deng, R.H., Wang, G. (eds.) ISPEC 2016.
LNCS, vol. 10060, pp. 110–121. Springer, Cham (2016). https://doi.org/10.1007/
978-3-319-49151-6 8
2. Bekerman, D., Shapira, B., Rokach, L., Bar, A.: Unknown malware detection using
network traffic classification. In: CNS 2015, pp. 134–142. IEEE (2015)
3. Jiang, D., Omote, K.: A RAT detection method based on network behavior of the
communication’s early stage. IEICE Trans. Fundam. E99.A(1), 145–153 (2016)
4. Khasawneh, K.N., Ozsoy, M., Donovick, C., Abu-Ghazaleh, N., Ponomarev, D.:
Ensemble learning for low-level hardware-supported malware detection. In: Bos,
H., Monrose, F., Blanc, G. (eds.) RAID 2015. LNCS, vol. 9404, pp. 3–25. Springer,
Cham (2015). https://doi.org/10.1007/978-3-319-26362-5 1
5. Li, S., Yun, X., Zhang, Y., Xiao, J., Wang, Y.: A general framework of trojan
communication detection based on network traces. In: NAS 2012, pp. 49–58. IEEE
(2012)
6. Liang, Y., Peng, G., Zhang, H., Wang, Y.: An unknown trojan detection method
based on software network behavior. Wuhan Univ. J. Nat. Sci, 18(5), 369–376
(2013)
7. Moser, A., Kruegel, C., Kirda, E.: Limits of static analysis for malware detection.
In: ACSAC 2007, pp. 421–430. IEEE (2007)
8. Rabek, J.C., Khazan, R.I., Lewandowski, S.M., Cunningham, R.K.: Detection of
injected, dynamically generated, and obfuscated malicious code. In: ACM work-
shop on Rapid Malcode, pp. 76–82. ACM (2003)
9. Sangkatsanee, P., Wattanapongsakrn, N., Charnsripinyo, C.: Practical real-time
intrusion detection using machine learning approaches. Comput. Commun. 34(18),
2227–2235 (2011)
Early Detection of Remote Access Trojan by Software Network Behavior 671
10. Tang, A., Sethumadhavan, S., Stolfo, S.J.: Unsupervised anomaly-based malware
detection using hardware features. In: Stavrou, A., Bos, H., Portokalidis, G. (eds.)
RAID 2014. LNCS, vol. 8688, pp. 109–129. Springer, Cham (2014). https://doi.
org/10.1007/978-3-319-11379-1 6
11. Tankard, C.: Advanced persistent threats and how to monitor and deter them.
Netw. Secur. 2011(8), 16–19 (2011)
12. Check Point Software Technologies Ltd., Grobal Cyber Attack Treands Report
(2017)
13. Wu, S., Liu, S., Lin, W., Zhao, X., Chen, S.: Detecting remote access trojans
through external control at area network borders. In: ANCS 2017, pp. 131–141.
ACM/IEEE (2017)
14. Yamada, M., Morinaga, M., Unno, Y., Torii, S., Takenaka, M.: RAT-based mali-
cious activities detection on enterprise internal networks. In: ICITST 2015, pp.
321–325. IEEE (2015)