Journal paper (1)
Journal paper (1)
Infostealers.
Abstract
This paper introduces a pragmatic and efficient approach to fortify the detection
of spyware and infostealers through the implementation of a handmade network
traffic monitoring tool. The escalating sophistication of cyber threats necessitates
innovative solutions that are resource-efficient and easily deployable, making our
tool particularly suitable for diverse network environments.
The proposed tool employs a combination of packet inspection, protocol analysis,
and anomaly detection techniques to scrutinize network traffic patterns. By
focusing on the identification of irregularities and deviations from normal
communication behavior, the tool aims to provide an effective and non-intrusive
means of detecting malicious activities associated with spyware and infostealers.
To validate the practical efficacy of the tool, extensive testing was conducted
using diverse datasets containing known spyware and infoStealer samples. Results
demonstrate a significant improvement in detection accuracy compared to
traditional methods, showcasing the tool's ability to identify subtle yet indicative
patterns of malicious behavior. Moreover, the tool exhibits a lightweight
footprint, ensuring minimal impact on network resources and operational
efficiency.
The paper discusses the tool's practical implementation, highlighting its scalability
and ease of integration into existing network security architectures. Real-world
deployment scenarios and case studies illustrate the tool's effectiveness across
various network environments, emphasizing its utility as a viable alternative for
organizations seeking a non-machine learning approach to enhance their
cybersecurity posture.
Page | 1
In conclusion, our research underscores the effectiveness of a handmade network
traffic monitoring tool in enhancing the detection of spyware and infostealers. the
tool provides a practical, resource-efficient solution for organizations aiming to
bolster their cybersecurity defenses against evolving cyber threats.
1 Introduction
The ubiquitous and ever-evolving nature of cyber threats, exemplified by the
proliferation of spyware and infostealers, demands continuous innovation in
detection mechanisms to safeguard digital assets and sensitive information. As
organizations strive to fortify their cybersecurity posture, the need for efficient
and pragmatic solutions becomes increasingly apparent. In this context, our paper
delves into a novel approach for enhancing the detection of spyware and
infostealers through the utilization of a handmade network traffic monitoring
tool, deliberately designed without the incorporation of machine learning
algorithms.
Traditional methods of threat detection often fall short in addressing the dynamic
and sophisticated nature of contemporary cyber threats. Signature-based
detection, while effective to a certain extent, struggles to keep pace with the
rapid evolution of malicious tactics. Machine learning, while powerful, introduces
complexities related to resource utilization and deployment overhead.
Recognizing these challenges, our approach aims to provide a streamlined
alternative that prioritizes efficiency and adaptability.
Page | 2
Throughout this paper, we will detail the design principles and functionalities of
our handmade tool, emphasizing its capability to identify anomalies associated
with spyware and infostealers through packet inspection, protocol analysis, and
anomaly detection techniques. Furthermore, extensive testing against diverse
datasets containing known threat samples will be presented to showcase the
tool's effectiveness in a variety of scenarios.
Now let’s start the technical talking “what are the methods that the current
antiviruses use to detect malware?”
We will start with the most common and simple way, which is detection based on
signature, its work by comparing the file signature with a known malware
signatures if a match found then they mark it as malware and start some
procedures involve put the file under quarantine, stop any processes that the
malware starts, and even remove it entirely.
Simple way but consider to be a very effective way to detect the known malwares
and exist almost in every antivirus, it is considered to be keystone and the initial
method of the antivirus’s malware detection, this method can’t detect unknown
malware since its work are based on known malware databases.
Page | 3
Figure SEQ Figure \* ARABIC 1: Signature Detection Based.
This method also involves comparing the activity of the suspected file to a
database of known malicious behaviors, which are more flexible from the
signature based detection since at can detect unknown malware by monitoring
the activity of this malware.
Behavioral detection is one of the most efficient ways to protect against advanced
threats like zero-day malware.
Page | 4
Of course, nothing is clear from defects, this method can generate what’s called
false-positive, this happens when it marks a legitimate file that does not contain
any malware as malware because they act a way similar to the malware activity.
Page | 5
2 Related Works
in this section we will mention some of the related research’s that have introduce
some modern techniques to detect malwares, these techniques later have been
adopted in several antiviruses.
Page | 6
II. Integrated Static and Dynamic Analysis for Malware Detection by Li et al.
The two phases are then combined to produce a final decision about
whether the program is malicious or not.
The system was tested on a dataset of 500 spyware and 500 legitimate
programs, and it achieved an accuracy of 98.7%.
Page | 7
The paper proposes a new approach to spyware detection using data
mining techniques.
Page | 8
It presents a new method of extracting and selecting features from
executable files, based on the uniqueness and frequency of the features
in each class type.
The features are extracted from the binary code of the executables,
without requiring any prior knowledge or analysis of the spyware
behavior.
It also demonstrates that the proposed method can detect new and
unknown spyware, as well as new versions of existing spyware.
Page | 9
New method to detect and prevent spyware attacks on user applications
using deep learning and artificial Intelligence.
The paper introduces a new framework called SPY-DL that uses deep
learning models to classify executables as spyware or benign, based on
the features extracted from the binary code and the application
permissions.
2) Capstone:
● Description: Capstone is an open-source disassembly framework that
provides a simple interface for disassembling binary code. It supports
various architectures and is used in this methodology for disassembling
executable files. Capstone aids in analyzing the assembly instructions to
understand the logic and functionality of the code.
3) PEfile:
● Description: PEfile is a Python module designed to parse Portable
Executable (PE) files, commonly used in Windows. It provides an interface
to analyze the internal structure of executable files, extracting information
such as sections, imports, and exports. PEfile is crucial for understanding
the composition of executable binaries.
4) Cryptodome (Cryptodomex):
Page | 11
● Description: Cryptodome is a comprehensive Python library for
cryptographic operations. It provides a wide range of cryptographic
algorithms, including hash functions. In this methodology, Cryptodome is
utilized for hashing operations (e.g., SHA256) to generate checksums for
executable files and data chunks.
5) Binwalk:
● Description: Binwalk is a fast, easy-to-use tool for analyzing, reverse
engineering, and extracting firmware images. It can identify and extract
various file types embedded in binary data. In this methodology, Binwalk is
employed to scan executable files for hidden or embedded files, enhancing
the analysis of potential threats.
Page | 12
This code presents a comprehensive analysis of the "RedLine" malware through a
multi-faceted approach. The analysis encompasses various aspects, including
cryptographic hashing, string extraction, VirusTotal scanning, hidden file
detection, memory mapping, imports library inspection, and disassembly. The
purpose is to gain insights into the malware's structure, behavior, and potential
threats it poses.
# Main function
- main()
● String Extraction: that extract out readable text snippets from the malware
file , like searching for clues or hints within the file's content that might
reveal its purpose or behavior.
Page | 14
● VirusTotal Scanning: this reaches out to the VirusTotal service, which acts
like a super antivirus tool , it checks the malware against a bunch of
different antivirus programs to see if any of them flag it as harmful, giving
us a sense of how
dangerous it
might be.
Page | 15
visual map of the binary data, making it easier to spot unusual patterns and
understand what's going on.
Page | 16
● Disassembly: takes apart the executable's code into human-readable
instructions , like disassembling a machine to see how it works inside ,
which helps in understanding the logic and potential harmful actions
embedded in the code.
3.4
Network packet sniffer using Scapy library
The provided Python script uses the Scapy library to sniff and analyze network
packets. It defines a packet callback function (packet_callback) that is executed
for each intercepted packet. The script prints information about various types of
network packets, including TCP, UDP, ICMP, HTTP, and raw data. Additionally, it
displays a hex dump of each packet.
function packet_callback(pkt):
now, ip_src, ip_dst = current time as string, source IP, destination IP from pkt
if IP in pkt:
if pkt has TCP, UDP, ICMP, or HTTP layer:
protocol = "TCP" if TCP in pkt else "UDP" if UDP in pkt else "ICMP" if ICMP in pkt else "HTTP"
src_port, dst_port = source and destination ports from TCP, UDP layers
print_colored_message("92", f"At {now} {protocol} pkt - Source: {ip_src}:{src_port} --> Destination: {ip_dst}:
{dst_port}")
try: Page | 17
sniff(prn=packet_callback)
except KeyboardInterrupt:
print_colored_message("91", 'Process Has Been Terminated')
By using Scapy we can capture and analyze various types of packets, providing us
with detailed information about each packet, including timestamps, IP addresses,
ports, and raw data , the script uses color-coded messages for better readability
and includes exception handling for user interruption.
By typing [sudo python3 test.py] in the kali Linux terminal it will start analyzing
the data packets going through the device network of type ( TCP, UDP, ICMP,
HTTP, HTTPRequest ) giving us the time when the traffic occur and the type of the
packet and the source IP and Destination addresses .
The term "Raw Data" refers to the payload or data content carried within the
packet. The code is using the Scapy library to sniff and analyze network packets,
and when a packet has a Raw layer, it means that it contains payload data.
● If the packet is a TCP packet and has a Raw layer, it prints the raw data
associated with that layer.
Page | 18
● If the packet is a UDP packet and has a Raw layer, it prints the raw data.
● If the packet is an ICMP packet and has a Raw layer, it prints the raw data.
● If the packet is an HTTP packet and has a Raw layer, it prints the raw data.
● If the packet is an HTTPRequest packet and has a Raw layer, it prints the
raw data.
The raw data typically represents the payload of the packet, and its interpretation
depends on the protocol and the specific application generating the packet. For
example, in the case of HTTP or HTTPRequest packets, the raw data could include
the content of an HTTP request or response.
The term "hex dump" refers to a hexadecimal representation of the binary data
within a packet or any other binary file. It is a way of displaying the contents of a
file or memory region in a format that shows the hexadecimal values of each
byte. Hex dumps are often used in networking, debugging, and reverse
engineering to analyze the structure and content of binary data.
In our code, the hexdump(pkt) function is used to display a hexadecimal dump of
the entire packet. This hex dump provides a line-by-line representation of the
binary content of the packet, where each line typically shows a specific number of
bytes in hexadecimal format.
A hex dump is like a detailed snapshot of the data inside a file or a packet, here's
what each part means:
● Offset (0000): Think of this as the address of the first byte in the data. It's
like the starting point.
● Hexadecimal Values (01 00 5E 4D 4D 4D A0 36 BC D0 E8 D7 08 00 45 00):
These are the numbers in a base-16 system (0-9 and A-F) representing each
byte in the data.
● ASCII Representation (“<ASUS_ARMOURY_CRATE>”): This is a more
human-friendly view, where printable characters are shown as they are
(like letters and symbols), and non-printable ones are replaced with dots.
Page | 19
A hex dump is like looking at the raw data in a structured way , it's super useful
for figuring out what's inside when you're dealing with things like network data,
file formats, or anything that isn't immediately readable.
References
1. "Malware Analyst's Cookbook and DVD: Tools and Techniques for Fighting
Malicious Code" by Michael Hale Ligh, Steven Adair, Blake Hartstein, and
Matthew Richard.
2. SANS Internet Storm Center White Papers
3. MITRE ATT&CK Framework
4. "Malware Analyst's Cookbook and DVD: Tools and Techniques for Fighting
Malicious Code" by Michael Ligh, Steven Adair, Blake Hartstein, and
Matthew Richard
5. "Malware Forensics: Investigating and Analyzing Malicious Code" by
Cameron H. Malin, Eoghan Casey, and James M. Aquilina
6. "The Art of Memory Forensics: Detecting Malware and Threats in
Windows, Linux,
7. https://www.bitdefender.com/files/News/CaseStudies/study/415/
Bitdefender-PR-Whitepaper-RedLine-creat6109-en-EN.pdf
8. https://medium.com/@farghly.mahmod66/redline-stealer-code-
analysis-6753583a78d4
Page | 20