masterthesis/content.tex

1117 lines
57 KiB
TeX
Raw Normal View History

2021-11-11 16:45:45 +01:00
%{{{ introduction
\section{Introduction}
2021-10-18 12:59:29 +02:00
2022-04-15 17:21:44 +02:00
TODO: problemstellung, forschungsfragen
%}}} introduction
2021-10-18 12:59:29 +02:00
2021-11-11 16:45:45 +01:00
%{{{ motivation
2022-04-15 17:21:44 +02:00
\clearpage{}
\section{Motivation}
The Internet has become an irreplaceable part of our day-to-day lives.
We are always connected via numerous \enquote{smart} and \ac{iot} devices.
We use the Internet to communicate, shop, handle financial transactions, and much more.
Many personal and professional workflows are so dependent on the Internet, that they won't work when being offline, and with the pandemic we are living through, this dependency grew even stronger.
2021-10-18 12:59:29 +02:00
2022-04-17 17:05:56 +02:00
In 2021, there were around 10 billion Internet connected \ac{iot} devices and this number is estimated to more than double over the next years up to 25 billion in 2030~\cite{bib:statista_iot_2020}.
2022-04-07 19:37:02 +02:00
Many of these devices run on outdated software, don't receive regular updates, and don't follow general security best practices.
2022-03-29 20:39:29 +02:00
While in 2016 only \SI{77}{\percent} of German households had a broadband connection with a bandwidth of \SI{50}{\mega\bit\per\second} or more, in 2020 it was already \SI{95}{\percent} with more than \SI{50}{\mega\bit\per\second} and \SI{59}{\percent} with at least \SI{1000}{\mega\bit\per\second}~\cite{bib:statista_broadband_2021}.
2022-04-15 17:21:44 +02:00
Their nature as small, always online devices---often without any direct user interaction---behind Internet connections that are getting faster and faster makes them a desirable target for botnet operators.
2022-03-15 18:14:22 +01:00
In recent years, \ac{iot} botnets have been responsible for some of the biggest \ac{ddos} attacks ever recorded---creating up to \SI{1}{\tera\bit\per\second} of traffic~\cite{bib:ars_ddos_2016}.
2021-10-18 12:59:29 +02:00
2022-04-08 18:23:44 +02:00
%}}} motivation
\clearpage{}
2022-04-15 17:21:44 +02:00
\section{Background and Related Work}
2022-04-08 18:23:44 +02:00
2022-04-15 17:21:44 +02:00
Botnets consist of infected computers, so called \emph{bots}, controlled by a \emph{botmaster}.
\emph{Centralized} and \emph{decentralized botnets} use one or more coordinating hosts, called \emph{\ac{c2} servers}, respectively.
2022-04-17 17:05:56 +02:00
These \ac{c2} servers can use any protocol from \ac{irc} over HTTP to Twitter~\cite{bib:pantic_covert_2015} as communication channel with the infected hosts.
2022-04-14 16:27:54 +02:00
The abuse of infected systems includes several activities---\ac{ddos} attacks, banking fraud, proxies to hide the attacker's identity, sending of spam emails, just to name a few.
2021-10-18 12:59:29 +02:00
2022-04-08 18:23:44 +02:00
Analyzing and shutting down a centralized or decentralized botnet is comparatively easy since the central means of communication (the \ac{c2} IP addresses or domain names, Twitter handles or \ac{irc} channels), can be extracted from the malicious binaries or determined by analyzing network traffic and can therefore be considered publicly known.
2021-10-18 12:59:29 +02:00
2022-03-29 20:39:29 +02:00
A coordinated operation with help from law enforcement, hosting providers, domain registrars, and platform providers could shut down or take over the operation by changing how requests are routed or simply shutting down the controlling servers/accounts.
2022-03-15 18:14:22 +01:00
2022-04-17 17:05:56 +02:00
To complicate take-down attempts, botnet operators came up with a number of ideas: \acp{dga} use pseudorandomly generated domain names to render simple domain blacklist-based approaches ineffective~\cite{bib:antonakakis_dga_2012} or fast-flux \ac{dns} entries, where a large pool of IP addresses is randomly assigned to the \ac{c2} domains to prevent IP based blacklisting and hide the actual \ac{c2} servers~\cite{bib:nazario_as_2008}.
2021-10-18 12:59:29 +02:00
2021-11-16 16:02:26 +01:00
%{{{ fig:c2vsp2p
\begin{figure}[h]
\centering
\begin{subfigure}[b]{.5\textwidth}
\centering
2022-04-17 17:05:56 +02:00
\includegraphics[width=.9\linewidth]{c2.drawio.pdf}
2021-11-16 16:02:26 +01:00
\caption{Topology of a \ac{c2} controlled botnet}\label{fig:c2}
\end{subfigure}%
\begin{subfigure}[b]{.5\textwidth}
\centering
2022-04-17 17:05:56 +02:00
\includegraphics[width=.9\linewidth]{p2p.drawio.pdf}
2021-11-16 16:02:26 +01:00
\caption{Topology of a \ac{p2p} botnet}\label{fig:p2p}
\end{subfigure}%
\caption{Communication paths in different types of botnets}\label{fig:c2vsp2p}
\end{figure}
%}}}fig:c2vsp2p
2022-03-29 20:39:29 +02:00
A number of botnet operations were shut down like this~\cite{bib:nadji_beheading_2013} and as the defenders upped their game, so did attackers---the concept of \ac{p2p} botnets emerged.
2022-04-08 18:23:44 +02:00
The idea is to build a distributed network without \acp{spof} in the form of \ac{c2} servers as shown in \Fref{fig:p2p}.
2022-04-14 16:27:54 +02:00
In a \ac{p2p} botnet, each node in the network knows a number of its neighbors and connects to those. Each of these neighbors has a list of neighbors on its own, and so on.
2022-04-17 17:05:56 +02:00
The botmaster only needs to join the network to send new commands or receive stolen data but there is no need for a coordinating host, that is always connected to the network.
2022-04-08 18:23:44 +02:00
Any of the nodes in \Fref{fig:p2p} could be the botmaster but they don't even have to be online all the time since the peers will stay connected autonomously.
2022-04-17 17:05:56 +02:00
In fact, there have been arrests of \ac{p2p} botnet operators but due to the autonomy offered by the distributed approach, the botnet keeps intact and continues operating~\cite{bib:netlab_mozi}.
2022-04-08 18:23:44 +02:00
Especially worm-like botnets, where each peer tries to find and infect other systems, can keep lingering for many years.
2021-10-18 12:59:29 +02:00
2022-04-08 18:23:44 +02:00
This lack of a \ac{spof} makes \ac{p2p} botnets more resilient to take-down attempts since the communication is not stopped and botmasters can easily rejoin the network and send commands.
2021-10-18 12:59:29 +02:00
2022-04-14 16:27:54 +02:00
Successful take-downs of a \ac{p2p} botnet require intricate knowledge over the network topology, protocol characteristics and participating peers.
This knowledge can be obtained by monitoring peer activity in the botnet.
2022-04-08 01:43:49 +02:00
2022-04-15 17:21:44 +02:00
Bots in a \ac{p2p} botnet can be split into two distinct groups according to their reachability: peers that are not publicly reachable (\eg{} because they are behind a \ac{nat} router or firewall) and those, that are publicly reachable, also known as \emph{superpeers}.
In contrast to centralized botnets with a fixed set of \ac{c2} servers, in a \ac{p2p} botnet, every superpeer might take the roll of a \ac{c2} server and \emph{non-superpeers} will connect to those superpeers when joining the network.
2022-04-08 01:43:49 +02:00
2022-04-17 17:05:56 +02:00
As there is no well-known server in a \ac{p2p} botnet, they have to coordinate autonomously.
2022-04-08 01:43:49 +02:00
This is achieved by connecting the bots among each other.
2022-04-15 17:21:44 +02:00
Bot \textit{B} is considered a \emph{neighbor} of bot \textit{A}, if \textit{A} knows and connects to \textit{B}.
2022-04-17 17:05:56 +02:00
Since bots can become unavailable, they have to consistently update their neighbor lists to avoid losing their connection into the botnet.
2022-04-08 01:43:49 +02:00
This is achieved by periodically querying their neighbor's neighbors.
2022-04-15 17:21:44 +02:00
This process is known as \emph{\ac{mm}}.
2022-04-08 01:43:49 +02:00
2022-04-17 17:05:56 +02:00
\Ac{mm} can be distinguished into two categories: \emph{structured} and \emph{unstructured}~\cite{bib:baileyNextGen}
Structured \ac{p2p} botnets have strict rules for a bot's neighbors based on its unique ID and often use a \ac{dht}, which allows persisting data in a distributed network.
The \ac{dht} could contain a ordered ring structure of IDs and neighborhood in the structure also means neighborhood in the network, as is the case in the Kademila botnet~\cite{bib:kademlia2002}.
In botnets that employ unstructured \ac{mm} on the other hand, bots ask any peer they know for new peers to connect to, in a process called \emph{peer discovery}.
2022-04-09 18:09:14 +02:00
To enable peers to connect to unstructured botnets, the malware binaries include hardcoded lists of superpeers for the newly infected systems to connect to.
2022-04-08 18:23:44 +02:00
2022-04-15 17:21:44 +02:00
The concept of \emph{churn} describes when a bot becomes unavailable.
2022-04-08 01:43:49 +02:00
There are two types of churn:
\begin{itemize}
2022-04-17 17:05:56 +02:00
\item \emph{IP churn}: A bot becomes unreachable because it got assigned a new IP address. The bot is still available but under another IP address.
2022-04-08 01:43:49 +02:00
2022-04-15 17:21:44 +02:00
\item \emph{Device churn}: The device is actually offline, \eg{} because the infection was cleaned, it got shut down or lost its Internet connection.
2022-04-08 01:43:49 +02:00
\end{itemize}
2022-03-15 18:14:22 +01:00
2022-04-08 18:23:44 +02:00
%{{{ formal model
\subsection{Formal Model of \Acs*{p2p} Botnets}
2022-03-15 18:14:22 +01:00
A \ac{p2p} botnet can be modelled as a digraph
2021-11-16 16:02:26 +01:00
2021-12-07 12:58:08 +01:00
\begin{align*}
G &= (V, E)
\end{align*}
2021-11-16 16:02:26 +01:00
2022-04-17 17:05:56 +02:00
With the set of nodes \(V\) describing the peers in the network and the set of edges \(E\) describing the communication flow between bots.
2022-03-15 18:14:22 +01:00
2022-04-17 17:05:56 +02:00
\(G\) is not required to be a connected graph but might consist of multiple disjoint components~\cite{bib:rossow_sok_2013}. Components consisting of peers, that are infected by the same malware, are considered part of the same graph.
2022-04-07 19:37:02 +02:00
2022-04-17 17:05:56 +02:00
For a bot \(v \in V\), the \emph{predecessors} \(\text{pred}(v)\) and \emph{successors} (neighbors) \(\text{succ}(v)\) are defined as:
2021-12-07 12:58:08 +01:00
\begin{align*}
2022-04-17 17:05:56 +02:00
\text{succ}(v) &= \{ u \in V \mid (v, u) \in E \} \\
\text{pred}(v) &= \{ u \in V \mid (u, v) \in E \}
2021-12-07 12:58:08 +01:00
\end{align*}
2022-04-17 17:05:56 +02:00
The set of nodes \(\text{succ}(v)\) is also called the \emph{peer list} of \(v\).
2022-04-07 19:37:02 +02:00
Those are the nodes, a peer will connect to, to request new commands and other peers.
2022-04-17 17:05:56 +02:00
For a node \(v \in V\), the in and out degree \(\deg^{+}\) and \(\deg^{-}\) describe how many bots know \(v\) or are known by \(v\) respectively.
2021-11-16 16:02:26 +01:00
2022-03-15 18:14:22 +01:00
\begin{align*}
\deg^{+}(v) &= \abs{\text{pred}(v)} \\
\deg^{-}(v) &= \abs{\text{succ}(v)}
\end{align*}
2021-10-18 12:59:29 +02:00
2022-04-07 19:37:02 +02:00
\todo{more details}
2022-03-15 18:14:22 +01:00
%}}} formal model
2021-11-16 16:02:26 +01:00
2021-11-11 16:45:45 +01:00
%{{{ detection techniques
2022-04-08 01:43:49 +02:00
\subsection{Monitoring Techniques for \Acs*{p2p} Botnets}
2021-10-18 12:59:29 +02:00
2021-11-11 16:45:45 +01:00
There are two distinct methods to map and get an overview of the network topology of a \ac{p2p} botnet:
2021-10-18 12:59:29 +02:00
2021-11-11 16:45:45 +01:00
%{{{ passive detection
2022-04-08 01:43:49 +02:00
\subsubsection{Passive Monitoring}
2021-10-18 12:59:29 +02:00
2022-04-17 17:05:56 +02:00
For passive detection, traffic flows in large amounts of collected network traffic often obtained from \acp{isp} or network telescopes~\cite{bib:carnaNetworkTelescope2014} are analysed.
This has some advantages: \eg{} it is not possible for botmasters to detect or prevent data collection of that kind, though it is not trivial to distinguish valid \ac{p2p} application traffic (\eg{} BitTorrent, Skype, cryptocurrencies, \ldots) from \ac{p2p} bots.
2022-03-15 18:14:22 +01:00
\citeauthor{bib:zhang_building_2014} propose a system of statistical analysis to solve some of these problems in~\cite{bib:zhang_building_2014}.
2021-11-11 16:45:45 +01:00
Also getting access to the required datasets might not be possible for everyone.
2021-10-18 12:59:29 +02:00
2022-04-17 17:05:56 +02:00
As most botnet detection mechanisms, also the passive ones work by building communication graphs and finding tightly coupled subgraphs that might be indicative of a botnet~\cite{bib:botgrep2010}. An advantage of passive detection is, that it is independent of protocol details, specific binaries, or the structure of the network (\ac{p2p} vs.\ centralized/decentralized)~\cite{bib:botminer2008}.
2022-03-29 20:39:29 +02:00
2021-11-16 16:02:26 +01:00
\begin{itemize}
2022-03-15 18:14:22 +01:00
\item Large scale network analysis (hard to differentiate from legitimate \ac{p2p} traffic (\eg{} BitTorrent), hard to get data, knowledge of some known bots required)~\cite{bib:zhang_building_2014}
2021-11-16 16:02:26 +01:00
\item Heuristics: Same traffic patterns, same malicious behaviour
\end{itemize}
2022-03-29 20:39:29 +02:00
\todo{no context}
2021-11-16 16:02:26 +01:00
2022-04-17 17:05:56 +02:00
Passive monitoring is only mentioned for completeness and not further discussed in this thesis.
2022-04-08 01:43:49 +02:00
2021-11-11 16:45:45 +01:00
%}}} passive detection
2021-10-18 12:59:29 +02:00
2021-11-11 16:45:45 +01:00
%{{{ active detection
2022-04-08 01:43:49 +02:00
\subsubsection{Active Monitoring}
2021-10-18 12:59:29 +02:00
2022-04-17 17:05:56 +02:00
For active detection, a subset of the botnet protocol and behavior is reimplemented to participate in the network.
2022-04-08 01:43:49 +02:00
To do so, samples of the malware are reverse engineered to unterstand and recreate the protocol.
This partial implementation includes the communication part of the botnet but ignores the malicious functionality as to not support and take part in illicit activity.
2022-04-08 18:23:44 +02:00
% The difference in behaviour from the reference implementation and conspicuous graph properties (\eg{} high \(\deg^{+}\) vs.\ low \(\deg^{-}\)) of these sensors allows botmasters to detect and block the sensor nodes.
2021-10-18 12:59:29 +02:00
2022-04-15 17:21:44 +02:00
There are two subtypes of active detection: \emph{sensors} wait to be contacted by other peers, while \emph{crawlers} actively query known bots and recursively ask for their neighbors~\cite{bib:karuppayah_sensorbuster_2017}.
2022-04-08 01:43:49 +02:00
Obviously crawlers can only detect superpeers and therefore only see a small subset of the network, while sensors are also contacted by peers in private networks and behind firewalls.
To accurately monitor a \ac{p2p} botnet, a hybrid approach of crawlers and sensors is required.
2021-10-18 12:59:29 +02:00
2022-04-08 01:43:49 +02:00
A crawler starts with a predefined list of known bots, connects to those and uses the peer exchange mechanism to request other bots.
Each found bot is crawled again, slowly building the graph of superpeers on the way.
Every entry \textit{E} in the peer exchange response received from bot \textit{A} represents an edge from \textit{A} to \textit{E} in the graph.
2022-04-17 17:05:56 +02:00
\citetitle{bib:andriesse_reliable_2015} describes disinformation attacks, in which bots will include invalid entries in their peer list replies~\cite{bib:andriesse_reliable_2015}.
Therefore, edges should only be considered valid, if at least one crawler or sensor was able to contact or contacted by peer \textit{E}, thereby confirming, that \textit{E} is an existing participant in the botnet.
2021-10-18 12:59:29 +02:00
2022-04-08 01:43:49 +02:00
A sensor implements the passive part of the botnet's \ac{mm}.
2022-04-17 17:05:56 +02:00
They cannot be used to create the botnet graph (only edges into the sensor node) or find new peers, but are required to enumerate the whole network, including non-superpeers.
2021-10-18 12:59:29 +02:00
2022-04-08 01:43:49 +02:00
%}}} active detection
2021-10-18 12:59:29 +02:00
2022-04-08 18:23:44 +02:00
%{{{ monitoring prevention
2022-04-17 17:05:56 +02:00
\subsubsection{Anti-Monitoring Techniques}
2021-11-11 16:45:45 +01:00
2022-04-08 01:43:49 +02:00
The constantly growing damage produced by botnets has many researchers and law enforcement agencies trying to shut down these operations~\cite{bib:nadji_beheading_2013, bib:nadji_still_2017, bib:dittrich_takeover_2012, bib:fbiTakedown2014}.
2022-04-08 18:23:44 +02:00
The monetary value of these botnets directly correlates with the amount of effort botmasters are willing to put into implementing defense mechanisms against take-down attempts.
2021-11-16 16:02:26 +01:00
2022-04-17 17:05:56 +02:00
Some of these countermeasures are explored by \citeauthor{bib:andriesse_reliable_2015} in \citetitle{bib:andriesse_reliable_2015} and include deterrence, which limits the number of bots per IP address or subnet; blacklisting, where known crawlers and sensors are blocked from communicating with other bots in the network (mostly IP based); disinformation, when fake bots are placed in the peer lists, to invalidate the data collected by crawlers; and active retaliation like \ac{ddos} attacks against sensors or crawlers~\cite{bib:andriesse_reliable_2015}.
2022-04-08 01:43:49 +02:00
2022-04-17 17:05:56 +02:00
In this work, we try to find ways to make the monitoring and information gathering phase more efficient and resilient to detection.
2022-04-08 01:43:49 +02:00
2022-04-08 18:23:44 +02:00
%}}} monitoring prevention
2021-11-16 16:02:26 +01:00
%}}} detection techniques
2021-10-18 12:59:29 +02:00
2022-03-29 20:39:29 +02:00
%%{{{ detection criteria
%\subsection{Detection Criteria}
2021-11-09 13:33:05 +01:00
2022-03-29 20:39:29 +02:00
%\begin{itemize}
2021-11-09 13:33:05 +01:00
2022-03-29 20:39:29 +02:00
% \item \ac{p2p} online time vs host online time
2021-11-09 13:33:05 +01:00
2022-03-29 20:39:29 +02:00
% \item neighbourhood lists
2021-11-11 16:45:45 +01:00
2022-03-29 20:39:29 +02:00
% \item no/few \ac{dns} lookups; instead direct lookups from routing tables
2021-11-09 13:33:05 +01:00
2022-03-29 20:39:29 +02:00
%\end{itemize}
%%}}} detection criteria
2021-11-09 13:33:05 +01:00
2021-11-16 16:02:26 +01:00
%{{{ methodology
2022-04-08 18:23:44 +02:00
\clearpage{}
2021-12-07 17:42:39 +01:00
\section{Methodology}
2021-11-16 16:02:26 +01:00
2022-04-07 19:37:02 +02:00
The implementation of the concepts of this work will be done as part of \ac{bms}\footnotemark, a monitoring platform for \ac{p2p} botnets described by \citeauthor{bib:bock_poster_2019} in \citetitle{bib:bock_poster_2019}.
2021-11-16 16:02:26 +01:00
\footnotetext{\url{https://github.com/Telecooperation/BMS}}
2022-04-09 18:09:14 +02:00
\Ac{bms} is intended for a hybrid active approach of crawlers and sensors (reimplementations of the \ac{p2p} protocol of a botnet, that won't perform malicious actions) to collect live data from active botnets.
2021-11-16 16:02:26 +01:00
2022-04-17 17:05:56 +02:00
In an earlier project, we implemented different node ranking algorithms---among others \emph{PageRank}~\cite{bib:page_pagerank_1998} and \emph{SensorRank}---to detect sensor candidates in a botnet, as described in \citetitle{bib:karuppayah_sensorbuster_2017}.
Both ranking algorithms exploit the differences in a sensor's or crawler's \(\deg^+\) and \(\deg^-\) to weight the nodes.
2022-04-08 18:23:44 +02:00
Sensors will have few to none outgoing edges, since they don't participate actively in the botnet, while crawlers have only outgoing edges.
2022-04-17 17:05:56 +02:00
Another way to enumerate candidates for sensors in a \ac{p2p} botnet is to find \acp{wcc} in the graph.
\citeauthor{bib:karuppayah_sensorbuster_2017} call this method \emph{SensorBuster}.
2021-11-30 20:00:15 +01:00
2022-04-17 17:05:56 +02:00
The goal of this work is to complicate detection mechanisms like this for botmasters by coordinating the work of the system's crawlers and sensors, thereby reducing the node's rank for specific graph metrics.
2022-04-08 18:23:44 +02:00
The coordinated work distribution also helps in efficiently monitoring large botnets where one crawler is not enough to track all peers.
2022-04-17 17:05:56 +02:00
The changes should allow the current \ac{bms} crawlers and sensors to use the new abstraction with as few changes as possible to the existing code.
2021-11-30 20:00:15 +01:00
2022-04-17 17:05:56 +02:00
We will explore how cooperative monitoring of a \ac{p2p} botnet can help with the following problems:
2022-04-09 18:09:14 +02:00
\begin{itemize}
\item Impede detection of monitoring attempts by reducing the impact of aforementioned graph metrics
\item Circumvent anti-monitoring techniques
\item Make crawling more efficient
\end{itemize}
2022-04-17 17:05:56 +02:00
The final results should be as general as possible and not depend on any botnet's specific behaviour (except for the mentioned anti-monitoring techniques which might be unique to some botnets), but we assume, that every \ac{p2p} botnet has some way of querying a bot's neighbors for the concept of crawlers and sensors to be applicable.
2021-11-30 20:00:15 +01:00
2022-03-29 20:39:29 +02:00
In the current implementation, each crawler will itself visit and monitor each new node it finds.
2022-04-17 17:05:56 +02:00
The general idea for the implementation of the concepts in this thesis is to report newfound nodes back to the \ac{bms} backend first, where the graph of the known network is created, and a fitting worker is selected to achieve the goal of the according coordination strategy.
2022-04-09 18:09:14 +02:00
That worker will be responsible to monitor the new node.
2021-11-30 20:00:15 +01:00
2022-04-17 17:05:56 +02:00
If it is not possible, to select a sensor so that the monitoring activity stays inconspicuous, the coordinator can do a complete shuffle of all nodes between the sensors to restore the wanted graph properties or warn if more sensors are required to fulfill the goal defined by the strategy.
2021-11-30 20:00:15 +01:00
2022-04-09 18:09:14 +02:00
The improved crawler system should allow new crawlers to register themselves and their capabilities (\eg{} bandwidth, geolocation), so the amount of work can be scaled accordingly between hosts.
2021-12-10 10:18:58 +01:00
%}}} methodology
2021-11-16 16:02:26 +01:00
2021-12-07 17:42:39 +01:00
%{{{ primitives
2022-04-08 18:23:44 +02:00
\subsection{Protocol Primitives}\label{sec:protPrim}
2021-12-07 17:42:39 +01:00
The coordination protocol must allow the following operations:
2022-04-09 18:09:14 +02:00
\begin{description}
2021-12-10 10:18:58 +01:00
2022-04-17 17:05:56 +02:00
\item[Register Worker] Register a new worker with capabilities (which botnet, available bandwidth and processing power, if it is a crawler or sensor, \dots{}).
2022-04-09 18:09:14 +02:00
This is called periodically and used to determine which worker is still active, when assigning new tasks.
2021-12-07 17:42:39 +01:00
2022-04-09 18:09:14 +02:00
\item[Report Peer] Report found peers.
Both successful and failed attempts are reported, to detect churned peers, and blacklisted crawlers as soon as possible.
2021-12-07 17:42:39 +01:00
2022-04-09 18:09:14 +02:00
\item[Report Edge] Report found edges.
Edges are created by querying the peer list of a bot.
This is how new peers are detected.
2021-12-07 17:42:39 +01:00
2022-04-09 18:09:14 +02:00
\item[Request Tasks] Receive a batch of crawl tasks from the coordinator.
The tasks consist of the target peer, if the worker should start or stop monitoring the peer, when the monitoring should start and stop and at which frequency the peer should be contacted.
2021-12-07 17:42:39 +01:00
2022-04-09 18:09:14 +02:00
\item[Request Neighbors] Sensors can request a list of candidate peers to return when their peer list is queried.
2022-02-27 21:19:38 +01:00
2022-04-09 18:09:14 +02:00
\end{description}
2022-03-29 20:39:29 +02:00
2022-04-09 18:09:14 +02:00
\begin{listing}[H]
2022-02-27 21:19:38 +01:00
\begin{minted}{go}
type Peer struct {
BotID string
IP string
Port uint16
}
type PeerTask struct {
Peer Peer
StartAt *Time
StopAt *Time
Frequency uint
StopCrawling bool
}
\end{minted}
2022-04-08 18:23:44 +02:00
\caption{Relevant Fields for Peers and Tasks}\label{lst:peerFields}
\end{listing}
2022-04-09 18:09:14 +02:00
\Fref{lst:peerFields} shows the Go structures used for crawl tasks.
2022-02-27 21:19:38 +01:00
2021-12-07 17:42:39 +01:00
%}}} primitives
%}}} methodology
2021-11-16 16:02:26 +01:00
2022-02-27 21:19:38 +01:00
%{{{ strategies
2022-04-08 18:23:44 +02:00
\clearpage{}
2022-02-27 21:19:38 +01:00
\section{Coordination Strategies}
2022-03-15 18:14:22 +01:00
Let \(C\) be the set of available crawlers.
2022-04-08 18:23:44 +02:00
Without loss of generality, if not stated otherwise, we assume that \(C\) is known when \ac{bms} is started and will not change afterward.
2022-03-18 18:25:54 +01:00
There will be no joining or leaving crawlers.
2022-03-24 19:48:46 +01:00
This assumption greatly simplifies the implementation due to the lack of changing state that has to be tracked while still exploring the described strategies.
A production-ready implementation of the described techniques can drop this assumption but might have to recalculate the work distribution once a crawler joins or leaves.
2022-04-08 18:23:44 +02:00
The protocol primitives described in \Fref{sec:protPrim} already allow for this to be implemented by first creating tasks with the \mintinline{go}{StopCrawling} flag set to true for all active tasks, run the strategy again and create the according tasks to start crawling again.
2022-03-15 18:14:22 +01:00
%{{{ load balancing
2022-03-24 19:48:46 +01:00
\subsection{Load Balancing}\label{sec:loadBalancing}
2022-03-15 18:14:22 +01:00
2022-04-09 18:09:14 +02:00
Depending on a botnet's size, a single crawler is not enough to monitor all superpeers.
2022-04-17 17:05:56 +02:00
While it is possible to run multiple, uncoordinated crawlers, two or more of them can find and monitor the same peer, making the approach inefficient with regard to the computing resources at hand.
2022-04-09 18:09:14 +02:00
The load balancing strategy solves this problem by systematically splitting the crawl tasks into chunks and distributes them among the available crawlers.
2022-04-08 18:23:44 +02:00
The following load balancing strategies will be investigated:
2022-03-15 18:14:22 +01:00
2022-04-14 16:27:54 +02:00
\begin{description}
\item[Round Robin] Evenly distribute the peers between crawlers in the order they are found
2022-03-24 19:48:46 +01:00
2022-04-14 16:27:54 +02:00
\item[IP-based partitioning] Use the uniform distribution of cryptographic hash functions to assign peers to crawlers in a random manner but still evenly distributed
\end{description}
2022-03-15 18:14:22 +01:00
2022-03-17 19:20:38 +01:00
Load balancing in itself does not help prevent the detection of crawlers but it allows better usage of available resources.
2022-04-08 18:23:44 +02:00
It prevents unintentionally crawling the same peer with multiple crawlers and allows crawling of bigger botnets where the uncoordinated approach would reach its limit and could only be worked around by scaling up the machine where the crawler is executed.
2022-03-17 19:20:38 +01:00
Load balancing allows scaling out, which can be more cost-effective.
2022-03-18 18:25:54 +01:00
\subsubsection{Round Robin Distribution}\label{sec:rr}
2022-04-08 18:23:44 +02:00
This strategy distributes work evenly among crawlers by either naively assigning tasks to the crawlers rotationally or weighted according to their capabilities\todo{1 -- 2 sentences about naive rr?}.
To keep the distribution as even as possible, we keep track of the last crawler a task was assigned to and start with the next in line in the subsequent round of assignments.
For the sake of simplicity, only the bandwidth will be considered as capability but it can be extended by any shared property between the crawlers, \eg{} available memory or processing power.
For a given crawler \(c_i \in C\) let \(cap(c_i)\) be the capability of the crawler.
The total available capability is \(B = \sum\limits_{c \in C} cap(c)\).
With \(G\) being the greatest common divisor of all the crawler's capabilities, the weight \(W(c_i) = \frac{cap(c_i)}{G}\).
\(\frac{cap(c_i)}{B}\) gives us the percentage of the work a crawler is assigned.
% The set of target peers \(P = <p_0, p_1, \ldots, p_{n-1}>\), is partitioned into \(|C|\) subsets according to \(W(c_i)\) and each subset is assigned to its crawler \(c_i\).
% The mapping \mintinline{go}{gcd(C)} is the greatest common divisor of all peers in \mintinline{go}{C}, \(\text{maxWeight}(C) = \max \{ \forall c \in C : W(c) \}\).
2022-04-14 16:27:54 +02:00
The algorithm in \Fref{lst:wrr} distributes the work according to the crawler's capabilities.
2022-04-08 18:23:44 +02:00
2022-04-17 17:05:56 +02:00
\begin{listing}[H]
2022-03-31 18:30:41 +02:00
\begin{minted}{go}
func WeightCrawlers(crawlers ...Crawler) map[string]uint {
weights := []int{}
totalWeight := 0
for _, crawler := range crawlers {
totalWeight += crawler.Bandwith
weights = append(weights, crawler.Bandwith)
}
gcd := Fold(Gcd, weights...)
weightMap := map[string]uint{}
for _, crawler := range crawlers {
weightMap[crawler.ID] = uint(crawler.Bandwith / gcd)
}
return weightMap
}
func WeightedCrawlerList(crawlers ...Crawler) []string {
weightMap := WeightCrawlers(crawlers...)
didSomething := true
crawlerIds := []string{}
for didSomething {
didSomething = false
for k, v := range weightMap {
if v != 0 {
didSomething = true
crawlerIds = append(crawlerIds, k)
weightMap[k] -= 1
}
}
}
return crawlerIds
}
2022-04-01 10:31:21 +02:00
\end{minted}
2022-04-08 18:23:44 +02:00
\caption{Pseudocode for weighted round robin}\label{lst:wrr}
\end{listing}
2022-03-31 18:30:41 +02:00
This creates a list of crawlers where a crawler can occur more than once, depending on its capabilities.
2022-04-15 17:21:44 +02:00
To ensure better distribution, first every crawler is assigned one task, then, according to the capabilities, every crawler with a weight of 2 or more is assigned a task, repeating this process until all tasks are assigned.
2022-04-08 18:23:44 +02:00
The set of crawlers \(\{a, b, c\}\) with the capabilities \(cap(a) = 3\), \(cap(b) = 2\), \(cap(c) = 1\) would produce \(<a, b, c, a, b, a>\), allocating two and three times the work to crawlers \(b\) and \(a\) respectively.
2022-03-18 18:25:54 +01:00
2022-04-08 01:43:49 +02:00
\subsubsection{IP-based Partitioning}\label{sec:ipPart}
2022-03-18 18:25:54 +01:00
2022-04-17 17:05:56 +02:00
The output of cryptographic hash functions is uniformly distributed.
Given the hash function \(H\), calculating the hash of an IP address and distributing the work with regard to \(H(\text{IP}) \mod \abs{C}\) creates about evenly sized buckets for each worker to handle.
This gives us the mapping \(m(i) = H(i) \mod \abs{C}\) to sort peers into buckets.
2022-03-29 20:39:29 +02:00
Any hash function can be used but since it must be calculated often, a fast function should be used.
2022-04-17 17:05:56 +02:00
While the \ac{md5} hash function must be considered broken for cryptographic use~\cite{bib:stevensCollision}, it is faster to calculate than hash functions with longer output.\todo{md5 crypto broken, distribution not?}
2022-03-29 20:39:29 +02:00
For the use case at hand, only the uniform distribution property is required so \ac{md5} can be used without scarifying any kind of security.
2022-03-31 18:30:41 +02:00
This strategy can also be weighted using the crawlers capabilities by modifying the list of available workers so that a worker can appear multiple times according to its weight.
2022-04-08 18:23:44 +02:00
The weighting algorithm from \Fref{lst:wrr} is used to create the weighted multiset of crawlers \(C_W\) and the mapping changes to \(m(i) = H(i) \mod \abs{C_W}\).
2022-03-31 18:30:41 +02:00
2022-04-14 16:27:54 +02:00
% \begin{figure}[H]
% \centering
% \includegraphics[width=1\linewidth]{./md5_ip_dist.png}
% \caption{Distribution of the lowest byte of \ac{md5} hashes over IPv4}\label{fig:md5IPDist}
% \end{figure}
% \todo{remove this?}
2022-03-29 20:39:29 +02:00
2022-04-08 01:43:49 +02:00
\ac{md5} returns a \SI{128}{\bit} hash value.
The Go standard library includes helpers for arbitrarily sized integers\footnote{\url{https://pkg.go.dev/math/big\#Int}}.
This helps us in implementing the mapping \(m\) from above.
2022-03-29 20:39:29 +02:00
2022-04-17 17:05:56 +02:00
By exploiting the even distribution offered by hashing, the work of each crawler is also about evenly distributed over all IP subnets, \acp{as} and geolocations.
2022-03-29 20:39:29 +02:00
This ensures neighboring peers (\eg{} in the same \ac{as}, geolocation or IP subnet) get visited by different crawlers.
2022-04-08 18:23:44 +02:00
It also allows us to get rid of the state in our strategy since we don't have to keep track of the last crawler we assigned a task to, making it easier to implement and reason about.
2022-03-18 18:25:54 +01:00
2022-03-15 18:14:22 +01:00
%}}} load balancing
2022-02-27 21:19:38 +01:00
%{{{ frequency reduction
\subsection{Reduction of Request Frequency}
2022-04-17 17:05:56 +02:00
The GameOver Zeus botnet limited the amount of requests a peer was allowed to perform, and blacklisted peers, that exceeded the limit, as an anti-monitoring mechanism~\cite{bib:andriesse_goz_2013}.
In a uncoordinated crawler approach, the crawl frequency has to be limited to prevent hitting the request limit.
2022-03-08 20:15:29 +01:00
%{{{ fig:old_crawler_timeline
\begin{figure}[h]
\centering
2022-04-17 17:05:56 +02:00
\begin{chronology}[10]{0}{60}{0.9\textwidth}
2022-03-08 20:15:29 +01:00
\event{0}{\(C_0\)}
\event{20}{\(C_0\)}
\event{40}{\(C_0\)}
\event{60}{\(C_0\)}
\end{chronology}
2022-04-17 17:05:56 +02:00
\caption{Timeline of requests as received by a peer when crawled by a single crawler}\label{fig:old_crawler_timeline}
2022-03-08 20:15:29 +01:00
\end{figure}
%}}} fig:old_crawler_timeline
2022-02-27 21:19:38 +01:00
Using collaborative crawlers, an arbitrarily fast frequency can be achieved without being blacklisted.
2022-04-17 17:05:56 +02:00
With \(l \in \mathbb{N}\) being the maximum allowed frequency as defined by the botnet's protocol, \(f \in \mathbb{N}\) being the crawl frequency that should be achieved.
The amount of crawlers \(n\) required to achieve the frequency \(f\) without being blacklisted and the offset \(o\) between crawlers are defined as
2022-02-27 21:19:38 +01:00
\begin{align*}
2022-04-17 17:05:56 +02:00
n &= \left\lceil \frac{f}{l} \right\rceil \\
o &= \frac{\SI{1}{\request}}{f}
2022-02-27 21:19:38 +01:00
\end{align*}
2022-04-17 17:05:56 +02:00
Taking advantage of the \mintinline{go}{StartAt} field from the \mintinline{go}{PeerTask} returned by the \mintinline{go}{requestTasks} primitive above, the crawlers can be scheduled offset by \(o\) at a frequency \(l\) to ensure, the overall requests to each peer are evenly distributed over time.
2022-02-27 21:19:38 +01:00
2022-04-17 17:05:56 +02:00
Given a limit \(l = \SI{6}{\request\per\minute}\), crawling a botnet at \(f = \SI{24}{\request\per\minute}\) requires \(n = \left\lceil \frac{\SI{24}{\request\per\minute}}{\SI{6}{\request\per\minute}} \right\rceil = 4\) crawlers.
Those crawlers must be scheduled \(o = \frac{\SI{1}{\request}}{\SI{24}{\request\per\minute}} = \SI{2.5}{\second}\) apart at a frequency of \(l\) to evenly distribute the requests over time.
2022-02-27 21:19:38 +01:00
%{{{ fig:crawler_timeline
\begin{figure}[h]
\centering
2022-04-14 16:27:54 +02:00
\begin{chronology}[10]{0}{60}{0.9\textwidth}
2022-02-27 21:19:38 +01:00
\event{0}{\(C_0\)}
2022-04-14 16:27:54 +02:00
\event{10}{\(C_0\)}
2022-02-27 21:19:38 +01:00
\event{20}{\(C_0\)}
2022-04-14 16:27:54 +02:00
\event{30}{\(C_0\)}
2022-02-27 21:19:38 +01:00
\event{40}{\(C_0\)}
2022-04-14 16:27:54 +02:00
\event{50}{\(C_0\)}
2022-02-27 21:19:38 +01:00
\event{60}{\(C_0\)}
2022-04-14 16:27:54 +02:00
\event{2.5}{\(C_1\)}
\event{12.5}{\(C_1\)}
\event{22.5}{\(C_1\)}
\event{32.5}{\(C_1\)}
\event{42.5}{\(C_1\)}
\event{52.5}{\(C_1\)}
\event{5}{\(C_2\)}
\event{15}{\(C_2\)}
\event{25}{\(C_2\)}
\event{35}{\(C_2\)}
\event{45}{\(C_2\)}
\event{55}{\(C_2\)}
\event{7.5}{\(C_3\)}
\event{17.5}{\(C_3\)}
\event{27.5}{\(C_3\)}
\event{37.5}{\(C_3\)}
\event{47.5}{\(C_3\)}
\event{57.5}{\(C_3\)}
2022-02-27 21:19:38 +01:00
\end{chronology}
2022-04-14 16:27:54 +02:00
\caption{Timeline of crawler events when optimized for effective frequency}\label{fig:crawlerTimelineEffective}
2022-02-27 21:19:38 +01:00
\end{figure}
%}}} fig:crawler_timeline
2022-04-17 17:05:56 +02:00
As can be seen in~\Fref{fig:crawlerTimelineEffective}, each crawler \(C_0\) to \(C_3\) performs only \SI{6}{\request\per\minute} while overall achieving \(\SI{24}{\request\per\minute}\).
2022-02-27 21:19:38 +01:00
2022-04-17 17:05:56 +02:00
Vice versa given an amount of crawlers \(n\) and a request limit \(l\), the effective frequency \(f\) can be maximized to \(f = n \times l\) without hitting the limit \(l\) and being blocked.
2022-02-27 21:19:38 +01:00
2022-04-17 17:05:56 +02:00
Using the example from above with \(l = \SI{6}{\request\per\minute}\) but now only two crawlers \(n = 2\), it is still possible to achieve an effective frequency of \(f = 2 \times \SI{6}{\request\per\minute} = \SI{12}{\request\per\minute}\) with \(o = \frac{\SI{1}{\request}}{\SI{12}{\request\per\minute}} = \SI{5}{s}\):
2022-02-27 21:19:38 +01:00
%TODO: name
%{{{ fig:crawler_timeline
\begin{figure}[h]
\centering
2022-04-14 16:27:54 +02:00
\begin{chronology}[10]{0}{60}{0.9\textwidth}
2022-02-27 21:19:38 +01:00
\event{0}{\(C_0\)}
2022-04-14 16:27:54 +02:00
\event{10}{\(C_0\)}
2022-02-27 21:19:38 +01:00
\event{20}{\(C_0\)}
2022-04-14 16:27:54 +02:00
\event{30}{\(C_0\)}
2022-02-27 21:19:38 +01:00
\event{40}{\(C_0\)}
2022-04-14 16:27:54 +02:00
\event{50}{\(C_0\)}
2022-02-27 21:19:38 +01:00
\event{60}{\(C_0\)}
2022-04-14 16:27:54 +02:00
\event{5}{\(C_1\)}
\event{15}{\(C_1\)}
\event{25}{\(C_1\)}
\event{35}{\(C_1\)}
\event{45}{\(C_1\)}
\event{55}{\(C_1\)}
2022-02-27 21:19:38 +01:00
\end{chronology}
2022-04-14 16:27:54 +02:00
\caption{Timeline of crawler events when optimized over the number of crawlers}\label{fig:crawlerTimelineAmount}
2022-02-27 21:19:38 +01:00
\end{figure}
%}}} fig:crawler_timeline
2022-04-14 16:27:54 +02:00
While the effective frequency of the whole system is halved compared to~\Fref{fig:crawlerTimelineEffective}, it is still possible to double the effective frequency over the limit.
2022-02-27 21:19:38 +01:00
%}}} frequency reduction
%{{{ against graph metrics
2022-04-08 18:23:44 +02:00
\subsection{Creating Edges for Crawlers and Sensors}
2022-02-27 21:19:38 +01:00
2022-03-15 18:14:22 +01:00
\citetitle*{bib:karuppayah_sensorbuster_2017} describes different graph metrics to find sensors in \ac{p2p} botnets.
2022-03-22 20:15:30 +01:00
These metrics depend on the uneven ratio between incoming and outgoing edges for crawlers.
2022-04-17 17:05:56 +02:00
The \emph{SensorBuster} metric uses \acp{wcc} since naive sensors don't have any edges back to the main network in the graph.
2022-03-08 20:15:29 +01:00
2022-04-17 17:05:56 +02:00
Building a complete graph \(G_C = K_{\abs{C}}\) between the sensors and crawlers by making them return the other known worker on peer list requests would still produce a disconnected component and while being bigger and maybe not as obvious at first glance, it is still easily detectable since there is no path from \(G_C\) back to the main network (see~\Fref{fig:sensorbuster2} and~\Fref{tab:metricsTable}).
2022-03-08 20:15:29 +01:00
2022-04-17 17:05:56 +02:00
With \(v \in V\), \(\text{succ}(v)\) being the set of successors of \(v\) and \(\text{pred}(v)\) being the set of predecessors of \(v\), \emph{PageRank} is recursively defined as~\cite{bib:page_pagerank_1998}:
2022-03-08 20:15:29 +01:00
2022-04-07 19:37:02 +02:00
\begin{align*}
\text{PR}_0(v) &= \text{initialRank} \\
\text{PR}_{n+1}(v) &= \text{dampingFactor} \times \sum\limits_{p \in \text{pred}(v)} \frac{\text{PR}_n(p)}{\abs{\text{succ}(p)}} + \frac{1 - \text{dampingFactor}}{\abs{V}}
\end{align*}
2022-03-08 20:15:29 +01:00
2022-04-08 18:23:44 +02:00
For the first iteration, the PageRank of all nodes is set to the same initial value. \citeauthor{bib:page_pagerank_1998} argue that when iterating often enough, any value can be chosen~\cite{bib:page_pagerank_1998}.
2022-03-15 19:32:19 +01:00
2022-03-08 20:15:29 +01:00
The dampingFactor describes the probability of a person visiting links on the web to continue doing so, when using PageRank to rank websites in search results.
2022-03-15 19:32:19 +01:00
For simplicity---and since it is not required to model human behaviour for automated crawling and ranking---a dampingFactor of \(1.0\) will be used, which simplifies the formula to
2022-03-08 20:15:29 +01:00
\[
2022-04-07 19:37:02 +02:00
\text{PR}_{n+1}(v) = \sum\limits_{p \in \text{pred}(v)} \frac{\text{PR}_n(p)}{\abs{\text{succ}(p)}}
2022-03-08 20:15:29 +01:00
\]
2022-04-17 17:05:56 +02:00
Based on this, \emph{SensorRank} is defined as
2022-03-08 20:15:29 +01:00
\[
\text{SR}(v) = \frac{\text{PR}(v)}{\abs{\text{succ}(v)}} \times \frac{\abs{\text{pred}(v)}}{|V|}
\]
2022-04-15 17:21:44 +02:00
Since crawlers never respond to peer list requests, they will always be detectable by the described approach but sensors might benefit from the following technique.
2022-04-17 17:05:56 +02:00
By responding to peer list requests with plausible data and thereby producing valid outgoing edges from the sensors, we will try to make those metrics less suspicious.
2022-04-15 17:21:44 +02:00
The challenge here is deciding which peers can be returned without actually supporting the network.
The following candidates to place into the neighbor list will be investigated:
\begin{itemize}
\item Return the other known sensors, effectively building an complete graph \(K_{\abs{C}}\) containing all sensors
\item Detect churned peers from \ac{as} with dynamic IP allocation
\item Detect peers behind carrier-grade \ac{nat} that rotate IP addresses very often and pick random IP addresses from the IP range
\end{itemize}
2022-04-17 17:05:56 +02:00
% Knowledge of only \num{90} peers leaving due to IP rotation would be enough to make a crawler look average in Sality\todo{repeat analysis, actual number}.
% This number will differ between different botnets, depending on implementation details and size of the network\todo{upper limit for NL size as impl detail}.
2022-04-15 17:21:44 +02:00
2022-04-17 17:05:56 +02:00
\subsubsection{Other Sensors or Crawlers}
2022-04-15 17:21:44 +02:00
2022-04-17 17:05:56 +02:00
Returning all the other sensors when responding to peer list requests, thereby effectively creating a complete graph \(K_\abs{C}\) among the workers, creates valid outgoing edges.
The resulting graph will still form a \ac{wcc} with now edges back into the main network.
Also this would leak the information about all known sensors to the botmasters.
2022-04-15 17:21:44 +02:00
%{{{ churned peers
2022-04-17 17:05:56 +02:00
\subsubsection{Churned Peers After IP Rotation}
2022-04-15 17:21:44 +02:00
Churn describes the dynamics of peer participation of \ac{p2p} systems, \eg{} join and leave events~\cite{bib:stutzbach_churn_2006}.\todo{übergang}
Detecting if a peer just left the system, in combination with knowledge about \acp{as}, peers that just left and came from an \ac{as} with dynamic IP allocation (\eg{} many consumer broadband providers in the US and Europe), can be placed into the crawler's peer list.\todo{what is an AS}
If the timing of the churn event correlates with IP rotation in the \ac{as}, it can be assumed, that the peer left due to being assigned a new IP address---not due to connectivity issues or going offline---and will not return using the same IP address.
These peers, when placed in the peer list of the crawlers, will introduce paths back into the main network and defeat the \ac{wcc} metric.
It also helps with the PageRank and SensorRank metrics since the crawlers start to look like regular peers without actually supporting the network by relaying messages or propagating active peers.
%}}} churned peers
%{{{ cg nat
\subsubsection{Peers Behind Carrier-Grade \acs*{nat}}
Some peers show behaviour, where their IP address changes almost after every request.
2022-04-17 17:05:56 +02:00
Those peers can be used as fake neighbors and create valid looking outgoing edges for the sensor.
2022-04-15 17:21:44 +02:00
%}}} cg nat
%}}} against graph metrics
%}}} strategies
%{{{ evaluation
\clearpage{}
\section{Evaluation}
To evaluate the strategies from above, we took a snapshot of the Sality~\cite{bib:falliere_sality_2011} botnet obtained from \ac{bms} over the span of \daterange{2021-04-21}{2021-04-28}.
%{{{ eval load balancing
\subsection{Load Balancing}
To evaluate the real-world applicability of IP based partitioning, we will partition the dataset containing \num{1595} distinct IP addresses among \num{2}, \num{4}, \num{6} and \num{10} crawlers and verify if the work is about evenly distributed between crawlers.
2022-04-17 17:05:56 +02:00
We will compare the variance \(\sigma^2\) and standard derivation \(\sigma\) to evaluate the applicability of this method.
2022-04-15 17:21:44 +02:00
%{{{ fig:ipPartC02
2022-04-17 17:05:56 +02:00
\begin{figure}[H]
2022-04-15 17:21:44 +02:00
\centering
2022-04-17 17:05:56 +02:00
\includegraphics[width=.7\linewidth]{ip_part_c02.png}
2022-04-15 17:21:44 +02:00
\caption{IP based partitioning for 2 crawlers}\label{fig:ipPartC02}
\end{figure}
%}}}fig:ipPartC02
2022-04-17 17:05:56 +02:00
\begin{align*}
n &= 2 \\
\mu &= 1595 / n = 797.5 \\
s &= \sum\limits_{i=1}^{n} {(x_i - \mu)}^2 \\
&= {(808 - 797.5)}^2 + {(787 - 797.5)}^2 \\
&= 220.5 \\
\sigma^2 &= \frac{s}{n} = 110.2 \\
\sigma &= \sqrt{\sigma^2} = 10.5
\end{align*}
2022-04-15 17:21:44 +02:00
%{{{ fig:ipPartC04
2022-04-17 17:05:56 +02:00
\begin{figure}[H]
2022-04-15 17:21:44 +02:00
\centering
2022-04-17 17:05:56 +02:00
\includegraphics[width=.7\linewidth]{ip_part_c04.png}
2022-04-15 17:21:44 +02:00
\caption{IP based partitioning for 4 crawlers}\label{fig:ipPartC04}
\end{figure}
%}}}fig:ipPartC04
2022-04-17 17:05:56 +02:00
\begin{align*}
n &= 4 \\
\mu &= 1595 / n = 398.8 \\
s &= \sum\limits_{i=1}^{n} {(x_i - \mu)}^2 \\
&= {(403 - 398.8)}^2 + {(369 - 398.8)}^2 + {(405 - 398.8)}^2 \\
&+ {(418 - 398.8)}^2 \\
&= 1312.8 \\
\sigma^2 &= \frac{s}{n} = 328.2 \\
\sigma &= \sqrt{\sigma^2} = 18.1
\end{align*}
2022-04-15 17:21:44 +02:00
%{{{ fig:ipPartC06
2022-04-17 17:05:56 +02:00
\begin{figure}[H]
2022-04-15 17:21:44 +02:00
\centering
2022-04-17 17:05:56 +02:00
\includegraphics[width=.7\linewidth]{ip_part_c06.png}
2022-04-15 17:21:44 +02:00
\caption{IP based partitioning for 6 crawlers}\label{fig:ipPartC06}
\end{figure}
%}}}fig:ipPartC06
2022-04-17 17:05:56 +02:00
\begin{align*}
n &= 6 \\
\mu &= 1595 / n = 265.8 \\
s &= \sum\limits_{i=1}^{n} {(x_i - \mu)}^2 \\
&= {(258 - 265.8)}^2 + {(273 - 265.8)}^2 + {(257 - 265.8)}^2 \\
&+ {(264 - 265.8)}^2 + {(293 - 265.8)}^2 + {(250 - 265.8)}^2 \\
&= 1182.8 \\
\sigma^2 &= \frac{s}{n} = 197.1 \\
\sigma &= \sqrt{\sigma^2} = 14.0
\end{align*}
2022-04-15 17:21:44 +02:00
%{{{ fig:ipPartC10
2022-04-17 17:05:56 +02:00
\begin{figure}[H]
2022-04-15 17:21:44 +02:00
\centering
2022-04-17 17:05:56 +02:00
\includegraphics[width=.7\linewidth]{ip_part_c10.png}
2022-04-15 17:21:44 +02:00
\caption{IP based partitioning for 10 crawlers}\label{fig:ipPartC10}
\end{figure}
%}}}fig:ipPartC10
2022-04-17 17:05:56 +02:00
\begin{align*}
n &= 10 \\
\mu &= 1595 / n = 159.5 \\
s &= \sum\limits_{i=1}^{n} {(x_i - \mu)}^2 \\
&= {(140 - 159.5)}^2 + {(175 - 159.5)}^2 + {(186 - 159.5)}^2 \\
&+ {(166 - 159.5)}^2 + {(159 - 159.5)}^2 + {(152 - 159.5)}^2 \\
&+ {(172 - 159.5)}^2 + {(148 - 159.5)}^2 + {(151 - 159.5)}^2 \\
&+ {(146 - 159.5)}^2 \\
&= 1964.5 \\
\sigma^2 &= \frac{s}{n} = 196.4 \\
\sigma &= \sqrt{\sigma^2} = 14.0
\end{align*}
\begin{table}[H]
\centering
\begin{tabular}{rSSSS}
\(n\) & \(\mu\) & \(\sigma^{2}\) & \(\sigma\) & \(\frac{\sigma}{\mu}\) \\
\num{2} & 797.5 & 110.2 & 10.5 & 1.3\% \\
\num{4} & 398.8 & 328.2 & 18.1 & 4.5\% \\
\num{6} & 265.8 & 197.1 & 14.0 & 5.3\% \\
\num{10} & 159.5 & 196.4 & 14.0 & 8.8\% \\
\end{tabular}
\caption{Variance and standard derivation for IP-based partitioning on \num{1595} IP addresses}\label{tab:varSmall}
\end{table}
\Fref{tab:varSmall} shows that the derivation from the expected even distribution is within \SI{10}{\percent}.
Since the used sample is not very big, according to the law of big numbers we would expect the derivation to get smaller, the bigger the sample gets.
2022-04-15 17:21:44 +02:00
Therefore, we simulated the partitioning on a bigger sample of \num{1000000} random IP addresses.
%{{{ fig:randIpPartC02
2022-04-17 17:05:56 +02:00
\begin{figure}[H]
2022-04-15 17:21:44 +02:00
\centering
2022-04-17 17:05:56 +02:00
\includegraphics[width=.8\linewidth]{rand_ip_part_c02.png}
2022-04-15 17:21:44 +02:00
\caption{IP based partitioning for 2 crawlers on generated dataset}\label{fig:randIpPartC02}
\end{figure}
%}}}fig:randIpPartC02
2022-04-17 17:05:56 +02:00
\begin{align*}
n &= 2 \\
\mu &= \frac{1000000}{n} = 500000.0 \\
s &= \sum\limits_{i=1}^{n} {(x_i - \mu)}^2 \\
&= {(499322 - 500000.0)}^2 + {(500678 - 500000.0)}^2 \\
&= 919368.0 \\
\sigma^2 &= \frac{s}{n} = 459684.0 \\
\sigma &= \sqrt{\sigma^2} = 678.0
\end{align*}
2022-04-15 17:21:44 +02:00
%{{{ fig:randIpPartC04
2022-04-17 17:05:56 +02:00
\begin{figure}[H]
2022-04-15 17:21:44 +02:00
\centering
2022-04-17 17:05:56 +02:00
\includegraphics[width=.8\linewidth]{rand_ip_part_c04.png}
2022-04-15 17:21:44 +02:00
\caption{IP based partitioning for 4 crawlers on generated dataset}\label{fig:randIpPartC04}
\end{figure}
%}}}fig:randIpPartC04
2022-04-17 17:05:56 +02:00
\begin{align*}
n &= 4 \\
\mu &= \frac{1000000}{n} = 250000.0 \\
s &= \sum\limits_{i=1}^{n} {(x_i - \mu)}^2 \\
&= {(249504 - 250000.0)}^2 + {(250451 - 250000.0)}^2 + {(249818 - 250000.0)}^2 \\
&+ {(250227 - 250000.0)}^2 \\
&= 534070.0 \\
\sigma^2 &= \frac{s}{n} = 133517.5 \\
\sigma &= \sqrt{\sigma^2} = 365.4
\end{align*}
2022-04-15 17:21:44 +02:00
%{{{ fig:randIpPartC06
2022-04-17 17:05:56 +02:00
\begin{figure}[H]
2022-04-15 17:21:44 +02:00
\centering
2022-04-17 17:05:56 +02:00
\includegraphics[width=.8\linewidth]{rand_ip_part_c06.png}
2022-04-15 17:21:44 +02:00
\caption{IP based partitioning for 6 crawlers on generated dataset}\label{fig:randIpPartC06}
\end{figure}
%}}}fig:randIpPartC06
2022-04-17 17:05:56 +02:00
\begin{align*}
n &= 6 \\
\mu &= \frac{1000000}{n} = 166666.7 \\
s &= \sum\limits_{i=1}^{n} {(x_i - \mu)}^2 \\
&= {(166430 - 166666.7)}^2 + {(166861 - 166666.7)}^2 + {(166269 - 166666.7)}^2 \\
&+ {(166937 - 166666.7)}^2 + {(166623 - 166666.7)}^2 + {(166880 - 166666.7)}^2 \\
&= 372413.3 \\
\sigma^2 &= \frac{s}{n} = 62068.9 \\
\sigma &= \sqrt{\sigma^2} = 249.1
\end{align*}
2022-04-15 17:21:44 +02:00
%{{{ fig:randIpPartC10
2022-04-17 17:05:56 +02:00
\begin{figure}[H]
2022-04-15 17:21:44 +02:00
\centering
\includegraphics[width=1\linewidth]{rand_ip_part_c10.png}
\caption{IP based partitioning for 10 crawlers on generated dataset}\label{fig:randIpPartC10}
\end{figure}
%}}}fig:randIpPartC10
2022-04-17 17:05:56 +02:00
\begin{align*}
n &= 10 \\
\mu &= \frac{1000000}{n} = 100000.0 \\
s &= \sum\limits_{i=1}^{n} {(x_i - \mu)}^2 \\
&= {(100424 - 100000.0)}^2 + {(99650 - 100000.0)}^2 + {(99307 - 100000.0)}^2 \\
&+ {(100305 - 100000.0)}^2 + {(99403 - 100000.0)}^2 + {(100562 - 100000.0)}^2 \\
&+ {(100277 - 100000.0)}^2 + {(99875 - 100000.0)}^2 + {(99911 - 100000.0)}^2 \\
&+ {(100286 - 100000.0)}^2 \\
&= 1729874.0 \\
\sigma^2 &= \frac{s}{n} = 172987.4 \\
\sigma &= \sqrt{\sigma^2} = 415.9
\end{align*}
\begin{table}[H]
\centering
\begin{tabular}{rSSSS}
\(n\) & \(\mu\) & \(\sigma^{2}\) & \(\sigma\) & \(\frac{\sigma}{\mu}\) \\
\num{2} & 500000.0 & 459684.0 & 678.0 & 0.14\% \\
\num{4} & 250000.0 & 133517.5 & 365.4 & 0.15\% \\
\num{6} & 166666.7 & 62069.9 & 249.1 & 0.15\% \\
\num{10} & 100000.0 & 172987.4 & 415.9 & 0.42\% \\
\end{tabular}
\caption{Variance and standard derivation for IP-based partitioning on \num{1000000} IP addresses}\label{tab:varBig}
\end{table}
As expected, the work is still not perfectly distributed among the crawlers but evenly enough for our use case.
The derivation for larger botnets is within \SI{0.5}{\percent} of the even distribution.
This is good enough for balancing the work among workers.
2022-04-15 17:21:44 +02:00
%}}} eval load balancing
%{{{ eval creating edges
\subsection{Impact of Additional Edges on Graph Metrics}
2022-03-22 20:15:30 +01:00
2022-04-17 17:05:56 +02:00
%{{{ other sensors
\subsubsection{Use Other Known Sensors}
By connecting the known sensors and effectively building a complete graph \(K_{\abs{C}}\) between them creates \(\abs{C} - 1\) outgoing edges per sensor.
In most cases this won't be enough to reach the amount of edges that would be needed.
Also this does not help against the \ac{wcc} metric since this would create a bigger but still disconnected component.
% TODO: caption, label
\begin{figure}[H]
\centering
\begin{subfigure}[b]{.5\textwidth}
\centering
\includegraphics[width=1\linewidth]{sensorbuster1.drawio.pdf}
\caption{\acp{wcc} for independent crawlers}\label{fig:sensorbuster1}
\end{subfigure}%
\begin{subfigure}[b]{.5\textwidth}
\centering
\includegraphics[width=1\linewidth]{sensorbuster2.drawio.pdf}
\caption{\acp{wcc} for collaborated crawlers}\label{fig:sensorbuster2}
\end{subfigure}%
\caption{Differences in graph metrics}\label{fig:sensorbuster}
\end{figure}
Applying PageRank once with an initial rank of \(0.25\) once on the example graphs in \Fref{fig:sensorbuster} results in:
\begin{table}[H]
\centering
\begin{tabular}{llllll}
Node & \(\deg^{+}\) & \(\deg^{-}\) & In \ac{wcc}? & PageRank & SensorRank \\
n0 & 0/0 & 4/4 & no & 0.75/0.5625 & 0.3125/0.2344 \\
n1 & 1/1 & 3/3 & no & 0.25/0.1875 & 0.0417/0.0313 \\
n2 & 2/2 & 2/2 & no & 0.5/0.375 & 0.3333/0.25 \\
c0 & 3/5 & 0/2 & yes (1/3) & 0.0/0.125 & 0.0/0.0104 \\
c1 & 1/3 & 0/2 & yes (1/3) & 0.0/0.125 & 0.0/0.0104 \\
c2 & 2/4 & 0/2 & yes (1/3) & 0.0/0.125 & 0.0/0.0104 \\
\end{tabular}
\caption{Values for metrics from~\Fref{fig:sensorbuster} (a/b)}\label{tab:metricsTable}
\end{table}
While this works for small networks, the crawlers must account for a significant amount of peers in the network for this change to be noticeable.
The generated \(K_n\) needs to be at least as big as the smallest regular component in the botnet, which is not feasible.
%}}} other sensors
2022-03-22 20:15:30 +01:00
\begin{table}[H]
\centering
\begin{tabular}{lllll}
\textbf{Iteration} & \textbf{Avg. PR} & \textbf{Crawler PR} & \textbf{Avg. SR} & \textbf{Crawler SR} \\
1 & 0.24854932 & 0.63277194 & 0.15393478 & 0.56545578 \\
2 & 0.24854932 & 0.63277194 & 0.15393478 & 0.56545578 \\
3 & 0.24501068 & 0.46486353 & 0.13810930 & 0.41540997 \\
4 & 0.24501068 & 0.46486353 & 0.13810930 & 0.41540997 \\
5 & 0.24233737 & 0.50602884 & 0.14101354 & 0.45219598 \\
\end{tabular}
2022-04-08 18:23:44 +02:00
\caption{Values for PageRank iterations with initial rank \(\forall v \in V : \text{PR}(v) = 0.25\)}\label{tab:pr_iter_table_25}
2022-03-22 20:15:30 +01:00
\end{table}
\begin{figure}[H]
\centering
\begin{subfigure}[b]{.5\textwidth}
\centering
\includegraphics[width=1\linewidth]{0.25_1_sr.png}
\caption{Distribution after 1 iteration}\label{fig:dist_sr_25_1}
\end{subfigure}%
\begin{subfigure}[b]{.5\textwidth}
\centering
\includegraphics[width=1\linewidth]{0.25_5_sr.png}
\caption{Distribution after 5 iterations}\label{fig:dist_sr_25_5}
\end{subfigure}%
\caption{SensorRank distribution with initial rank \(\forall v \in V : \text{PR}(v) = 0.25\)}\label{fig:dist_sr_25}
\end{figure}
2022-03-08 20:15:29 +01:00
2022-03-22 20:15:30 +01:00
\begin{table}[H]
\centering
\begin{tabular}{lllll}
\textbf{Iteration} & \textbf{Avg. PR} & \textbf{Crawler PR} & \textbf{Avg. SR} & \textbf{Crawler SR} \\
1 & 0.49709865 & 1.26554389 & 0.30786955 & 1.13091156 \\
2 & 0.49709865 & 1.26554389 & 0.30786955 & 1.13091156 \\
3 & 0.49002136 & 0.92972707 & 0.27621861 & 0.83081993 \\
4 & 0.49002136 & 0.92972707 & 0.27621861 & 0.83081993 \\
5 & 0.48467474 & 1.01205767 & 0.28202708 & 0.90439196 \\
\end{tabular}
2022-04-08 18:23:44 +02:00
\caption{Values for PageRank iterations with initial rank \(\forall v \in V : \text{PR}(v) = 0.5\)}\label{tab:pr_iter_table_5}
2022-03-22 20:15:30 +01:00
\end{table}
\begin{figure}[H]
\centering
\begin{subfigure}[b]{.5\textwidth}
\centering
\includegraphics[width=1\linewidth]{0.50_1_sr.png}
\caption{Distribution after 1 iteration}\label{fig:dist_sr_50_1}
\end{subfigure}%
\begin{subfigure}[b]{.5\textwidth}
\centering
\includegraphics[width=1\linewidth]{0.50_5_sr.png}
\caption{Distribution after 5 iterations}\label{fig:dist_sr_50_5}
\end{subfigure}%
\caption{SensorRank distribution with initial rank \(\forall v \in V : \text{PR}(v) = 0.5\)}\label{fig:dist_sr_50}
\end{figure}
\begin{table}[H]
\centering
\begin{tabular}{lllll}
\textbf{Iteration} & \textbf{Avg. PR} & \textbf{Crawler PR} & \textbf{Avg. SR} & \textbf{Crawler SR} \\
1 & 0.74564797 & 1.89831583 & 0.46180433 & 1.69636734 \\
2 & 0.74564797 & 1.89831583 & 0.46180433 & 1.69636734 \\
3 & 0.73503203 & 1.39459060 & 0.41432791 & 1.24622990 \\
4 & 0.73503203 & 1.39459060 & 0.41432791 & 1.24622990 \\
5 & 0.72701212 & 1.51808651 & 0.42304062 & 1.35658794 \\
\end{tabular}
2022-04-08 18:23:44 +02:00
\caption{Values for PageRank iterations with initial rank \(\forall v \in V : \text{PR}(v) = 0.75\)}\label{tab:pr_iter_table_75}
2022-03-22 20:15:30 +01:00
\end{table}
\begin{figure}[H]
\centering
\begin{subfigure}[b]{.5\textwidth}
\centering
\includegraphics[width=1\linewidth]{0.75_1_sr.png}
\caption{Distribution after 1 iteration}\label{fig:dist_sr_75_1}
\end{subfigure}%
\begin{subfigure}[b]{.5\textwidth}
\centering
\includegraphics[width=1\linewidth]{0.75_5_sr.png}
\caption{Distribution after 5 iterations}\label{fig:dist_sr_75_5}
\end{subfigure}%
\caption{SensorRank distribution with initial rank \(\forall v \in V : \text{PR}(v) = 0.75\)}\label{fig:dist_sr_75}
\end{figure}
2022-04-08 18:23:44 +02:00
The distribution graphs in \Fref{fig:dist_sr_25}, \Fref{fig:dist_sr_50} and \Fref{fig:dist_sr_75} show that the initial rank has no effect on the distribution, only on the actual numeric rank values.
2022-03-22 20:15:30 +01:00
2022-04-17 17:05:56 +02:00
For all combinations of initial value and PageRank iterations, the rank for a well-known crawler is in the \nth{95} percentile, so for our use case, those parameters do not matter.
2022-03-22 20:15:30 +01:00
On average, peers in the analyzed dataset have \num{223} successors over the whole week.
2022-03-24 19:48:46 +01:00
Looking at the data in smaller buckets of one hour each, the average number of successors per peer is \num{90}.\todo{timeline with peers per bucket}
%{{{ fig:avg_out_edges
\begin{figure}[h]
\centering
\includegraphics[width=1\linewidth]{./avg_out_edges.png}
\caption{Average outgoing edges per peer per hour}\label{fig:avg_out_edges}
\end{figure}
\todo{use better data?}
%}}}fig:avg_out_edges
2022-03-22 20:15:30 +01:00
2022-04-15 17:42:47 +02:00
Experiments were performed, in which a percentage of random outgoing edges were added to the known sensor, based on the amount of incoming edges:
2022-03-25 22:46:44 +01:00
\begin{figure}[H]
\centering
2022-04-15 17:21:44 +02:00
\begin{subfigure}[b]{.75\textwidth}
\centering
\includegraphics[width=1\linewidth]{ranks/pr_75.png}
\caption{PageRank after adding \(0.75 \times \abs{\text{pred}(v)}\) edges}\label{fig:pr75}
2022-03-25 22:46:44 +01:00
\end{subfigure}%
2022-04-15 17:21:44 +02:00
\hfill
\begin{subfigure}[b]{.75\textwidth}
2022-03-25 22:46:44 +01:00
\centering
2022-04-15 17:21:44 +02:00
\includegraphics[width=1\linewidth]{ranks/sr_75.png}
\caption{SensorRank after adding \(0.75 \times \abs{\text{pred}(v)}\) edges}\label{fig:sr75}
2022-03-25 22:46:44 +01:00
\end{subfigure}%
2022-04-15 17:21:44 +02:00
% \caption{SensorRank distribution with initial rank \(\forall v \in V : \text{PR}(v) = 0.75\)}\label{fig:dist_sr_75}
2022-03-25 22:46:44 +01:00
\end{figure}
2022-04-07 10:33:46 +02:00
\begin{figure}[H]
2022-04-15 17:21:44 +02:00
\centering
\begin{subfigure}[b]{.75\textwidth}
\centering
\includegraphics[width=1\linewidth]{ranks/pr_100.png}
\caption{PageRank after adding \(1.0 \times \abs{\text{pred}(v)}\) edges}\label{fig:pr100}
\end{subfigure}%
\hfill
\begin{subfigure}[b]{.75\textwidth}
\centering
\includegraphics[width=1\linewidth]{ranks/sr_100.png}
\caption{SensorRank after adding \(1.0 \times \abs{\text{pred}(v)}\) edges}\label{fig:sr100}
\end{subfigure}%
% \caption{SensorRank distribution with initial rank \(\forall v \in V : \text{PR}(v) = 0.75\)}\label{fig:dist_sr_75}
2022-04-07 10:33:46 +02:00
\end{figure}
\begin{figure}[H]
2022-04-15 17:21:44 +02:00
\centering
\begin{subfigure}[b]{.75\textwidth}
\centering
\includegraphics[width=1\linewidth]{ranks/pr_150.png}
\caption{PageRank after adding \(1.5 \times \abs{\text{pred}(v)}\) edges}\label{fig:pr150}
\end{subfigure}%
\hfill
\begin{subfigure}[b]{.75\textwidth}
\centering
\includegraphics[width=1\linewidth]{ranks/sr_150.png}
\caption{SensorRank after adding \(1.5 \times \abs{\text{pred}(v)}\) edges}\label{fig:sr150}
\end{subfigure}%
% \caption{SensorRank distribution with initial rank \(\forall v \in V : \text{PR}(v) = 0.75\)}\label{fig:dist_sr_75}
2022-04-07 10:33:46 +02:00
\end{figure}
2022-04-15 17:42:47 +02:00
These results showed, that simply adding new edges is not enough and we need to limit the incoming edges to improve the Page- and SensorRank metrics.
For the \ac{wcc} metric, it is obvious that even a single edge back into the main network is enough to connect the sensor back to the main graph and therefore beat this metric.
2022-03-22 20:15:30 +01:00
2022-04-15 17:21:44 +02:00
%}}} eval creating edges
2022-02-27 21:19:38 +01:00
2022-04-15 17:21:44 +02:00
%}}} evaluation
2021-10-18 12:59:29 +02:00
2022-03-08 20:15:29 +01:00
%{{{ implementation
2022-04-08 18:23:44 +02:00
\clearpage{}
2022-03-08 20:15:29 +01:00
\section{Implementation}
Crawlers in \ac{bms} report to the backend using \acp{grpc}\footnote{\url{https://www.grpc.io}}.
Both crawlers and the backend \ac{grpc} server are implemented using the Go\footnote{\url{https://go.dev/}} programming language, so to make use of existing know-how and to allow others to use the implementation in the future, the coordinator backend and crawler abstraction were also implemented in Go.
\Ac{bms} already has an existing abstraction for crawlers.
This implementation is highly optimized but also tightly coupled and grown over time.
The abstraction became leaky and extending it proved to be complicated.
A new crawler abstraction was created with testability, extensibility and most features of the existing implementation in mind, which can be ported back to be used by the existing crawlers.
2022-03-15 11:49:20 +01:00
%{{{ fig:crawler_arch
\begin{figure}[h]
\centering
\includegraphics[width=1\linewidth]{architecture.drawio.pdf}
\caption{Architecture of the new crawler}\label{fig:crawler_arch}
\end{figure}
%}}}fig:crawler_arch
The new implementation consists of three main interfaces:
\begin{itemize}
2022-03-15 18:14:22 +01:00
\item \mintinline{go}{FindPeer}, to receive new crawl tasks from any source
2022-03-15 11:49:20 +01:00
2022-03-15 18:14:22 +01:00
\item \mintinline{go}{ReportPeer}, to report newly found peers
2022-03-15 11:49:20 +01:00
2022-04-07 19:37:02 +02:00
\item \mintinline{go}{Protocol}, the actual botnet protocol implementation used to ping a peer and request its peer list
2022-03-15 11:49:20 +01:00
\end{itemize}
2022-03-15 18:14:22 +01:00
Currently there are two sources \mintinline{go}{FindPeer} can use: read peers from a file on disk or request them from the \ac{grpc} BMS coordinator.
The \mintinline{go}{ExactlyOnceFinder} delegate can wrap another \mintinline{go}{FindPeer} instance and ensures the source is only requested once.
2022-03-15 11:49:20 +01:00
This is used to implement the bootstrapping mechanism of the old crawler, where once, when the crawler is started, the list of bootstrap nodes is loaded from a textfile.
2022-03-15 18:14:22 +01:00
\mintinline{go}{CombinedFinder} can combine any amount of \mintinline{go}{FindPeer} instances and will return the sum of requesting all the sources.
2022-03-15 11:49:20 +01:00
2022-03-15 18:14:22 +01:00
The \mintinline{go}{PeerTask} instances returned by \mintinline{go}{FindPeer} contain the IP address and port of the peer, if the crawler should start or stop the operation, when to start and stop crawling and in which interval the peer should be crawled.
For each task, a \mintinline{go}{CrawlPeer} and \mintinline{go}{PingPeer} worker is started or stopped as specified in the received \mintinline{go}{PeerTask}.
These tasks use the \mintinline{go}{ReportPeer} interface to report any new peer that is found.
2022-03-15 11:49:20 +01:00
2022-03-15 18:14:22 +01:00
Current report possibilities are \mintinline{go}{LoggingReport} to simply log new peers to get feedback from the crawler at runtime, and \mintinline{go}{BMSReport} which reports back to \ac{bms}.
\mintinline{go}{BatchedReport} delegates a \mintinline{go}{ReportPeer} instance and batch newly found peers up to a specified batch size and only then flush and actually report.
\mintinline{go}{AutoCommitReport} will automatically flush a delegated \mintinline{go}{ReportPeer} instance after a fixed amount of time and is used in combination with \mintinline{go}{BatchedReport} to ensure the batches are written regularly, even if the batch limit is not reached yet.
\mintinline{go}{CombinedReport} works analogous to \mintinline{go}{CombinedFinder} and combines many \mintinline{go}{ReportPeer} instances into one.
2022-03-15 11:49:20 +01:00
2022-03-15 18:14:22 +01:00
\mintinline{go}{PingPeer} and \mintinline{go}{CrawlPeer} use the implementation of the botnet \mintinline{go}{Protocol} to perform the actual crawling in predefined intervals, which can be overwritten on a per \mintinline{go}{PeerTask} basis.
2022-03-15 11:49:20 +01:00
2022-03-24 19:48:46 +01:00
The server-side part of the system consists of a \ac{grpc} server to handle the client requests, a scheduler to assign new peers, and a \mintinline{go}{Strategy} interface for modularity over how work is assigned to crawlers.
2022-03-31 18:30:41 +02:00
%{{{ fig:bachend_arch
\begin{figure}[h]
\centering
\includegraphics[width=1\linewidth]{backend_architecture.drawio.pdf}
\caption{Architecture of the \ac{grpc} backend}\label{fig:bachend_arch}
\end{figure}
%}}}fig:bachend_arch
2022-03-08 20:15:29 +01:00
%}}} implementation
2022-03-24 19:48:46 +01:00
%{{{ conclusion
2022-04-08 18:23:44 +02:00
\clearpage{}
2022-03-24 19:48:46 +01:00
\section{Conclusion, Lessons Learned}\todo{decide}
2022-03-31 18:30:41 +02:00
Collaborative monitoring of \ac{p2p} botnets allows circumventing some anti-monitoring efforts.
It also enables more effective monitoring systems for larger botnets, since each peer can be visited by only one crawler.
The current concept of independent crawlers in \ac{bms} can also use multiple workers but there is no way to ensure a peer is not watched by multiple crawlers thereby using unnecessary resources.
2022-03-24 19:48:46 +01:00
2022-03-31 18:30:41 +02:00
%}}} conclusion
2022-03-24 19:48:46 +01:00
2022-03-15 19:32:19 +01:00
%{{{ further work
2022-04-08 18:23:44 +02:00
\clearpage{}
2022-03-15 19:32:19 +01:00
\section{Further Work}
2022-04-08 18:23:44 +02:00
Following this work, it should be possible to rewrite the existing crawlers using the new abstraction.
2022-03-17 19:20:38 +01:00
This might bring some performance issues to light which can be solved by investigating the optimizations from the old implementation and applying them to the new one.
Another way to expand on this work is automatically scaling the available crawlers up and down, depending on the botnet size and the number of concurrently online peers.
Doing so would allow a constant crawl interval for even highly volatile botnets.
2022-03-15 19:32:19 +01:00
2022-04-08 18:23:44 +02:00
Placing churned peers or peers with suspicious network activity (those behind carrier-grade \acp{nat}) might just offer another characteristic to flag sensors in a botnet.
This should be investigated and maybe there are ways to mitigate this problem.
2022-04-09 18:09:14 +02:00
Autoscaling features offered by many cloud-computing providers should be evaluated to automatically add or remove crawlers based on the monitoring load, a botnet's size and number of active peers.
This should also allow create workers with new IP addresses in different geolocations fast and easy.
2022-04-17 17:05:56 +02:00
The current implementation assumes a immutable set of crawlers.
For autoscaling to work, efficient reassignment of peers has to be implemented to account for added or removed workers.
2022-04-09 18:09:14 +02:00
2022-03-15 19:32:19 +01:00
%}}} further work
2022-03-15 18:14:22 +01:00
%{{{ acknowledgments
2022-04-08 18:23:44 +02:00
\clearpage{}
2022-03-15 18:14:22 +01:00
\section*{Acknowledgments}
In the end, I would like to thank
\begin{itemize}
2022-03-24 19:48:46 +01:00
\item Prof.\ Dr.\ Christoph Skornia for being a helpful supervisor in this and many earlier works of mine
2022-03-15 18:14:22 +01:00
\item Leon Böck for offering the possibility to work on this research project, regular feedback and technical expertise
2022-03-24 19:48:46 +01:00
\item Valentin Sundermann for being available for insightful ad hoc discussions at any time of day for many years
\item Friends and family who pushed me into continuing this path
2022-03-15 18:14:22 +01:00
\end{itemize}
%}}} acknowledgments
2022-03-18 18:25:54 +01:00
% vim: set filetype=tex ts=2 sw=2 tw=0 et foldmethod=marker spell :