learning_results.tex 9.53 KB
 Paul Fiterau Brostean committed Feb 06, 2017 1 2 3 \section{Learning results} \label{sec:result} \newcommand{\dk}{\emph{k}} We use the setup described in Section~\ref{sec:setup} to learn models for OpenSSH, BitVise and DropBear SSH server implementations.  Paul Fiterau Brostean committed Feb 08, 2017 4 OpenSSH represents the focal point, as it is the most popular implementation of SSH (with over 80 percent of market share in 2008~\cite{Albrecht2009Plaintext})  Erik Poll committed Feb 17, 2017 5 6 and the default server for many UNIX-based systems. DropBear is an alternative to OpenSSH designed for low resource systems. BitVise is a well-known proprietary Windows-only SSH implementation.  Paul Fiterau Brostean committed Feb 06, 2017 7   Erik Poll committed Feb 17, 2017 8 In our experimental setup, {\dlearner} and {\dmapper} ran inside a Linux Virtual Machine. OpenSSH and DropBear were  Paul Fiterau Brostean committed Feb 06, 2017 9 learned over a localhost connection, whereas BitVise was learned over a virtual connection with the Windows host machine.  Paul Fiterau Brostean committed Feb 17, 2017 10 We have adapted the setting off timing parameters to each implementation.  Paul Fiterau Brostean committed Feb 06, 2017 11   12 13 \begin{figure*} \centering  Paul Fiterau Brostean committed Feb 18, 2017 14  \includegraphics[scale=0.29]{ssh-server_cropped}  Erik Poll committed Feb 16, 2017 15  \caption{Model of the OpenSSH server. {\normalfont States are collected in 3 clusters,  Erik Poll committed Feb 15, 2017 16 17  indicated by the rectangles, where each cluster corresponds to one of the protocol layers.  Erik Poll committed Feb 17, 2017 18  We eliminate redundant states and information induced by the {\dmapper}, as well as states present in successful rekeying sequences. Wherever rekeying was permitted, we replaced the rekeying states and transitions by a single \textsl{REKEY SEQUENCE} transition. We also factor out edges common to states within a cluster. We replace common disconnecting edges, by one edge from the cluster to the disconnect state. Common self loop edges are colored, and the actual i/o information only appears on one edge. Transitions with similar start and end states are joined together on the same edge. Transition labels are kept short by regular expressions(UA\_* stands for all inputs starting with UA\_) or by factoring out common start strings. Green edges highlight the happy flow. }}  19 20 21  \label{fig:sshserver} \end{figure*}  Paul Fiterau Brostean committed Feb 17, 2017 22 OpenSSH was learned using a full alphabet, whereas DropBear and BitVise were learned using a restricted alphabet (as defined in Subsection~\ref{subsec:alphabet}). The primary reason for using a restricted alphabet was to speed up learning. Most inputs excluded were inputs that either didn't change behavior (like \textsc{debug} or \textsc{unimpl}), or that proved costly time-wise,  Paul Fiterau Brostean committed Feb 08, 2017 23 and were not critical to penetrating all layers. A concrete example is the user/password based authentication inputs (\textsc{ua\_pw\_ok} and  Erik Poll committed Feb 17, 2017 24 \textsc{ua\_pw\_nok}). It would take the system 2-3 seconds to respond to an invalid password, a typical countermeasure to slow down  25 brute force attacks. By contrast, public key authentication resulted in quick responses. The \textsc{disconnect} input presented similar  Paul Fiterau Brostean committed Feb 14, 2017 26 challenges, as it would take a varying amount of time until the system responded. This was particularly problematic for BitVise.  Paul Fiterau Brostean committed Feb 08, 2017 27 28 29 30 31 32 33  %Not only that, but failed password authentication %attempts are also likely to trigger security mechanisms that would block subsequent authentication attempts. While this is %As an example, \textsl{ua\_pw\_ok} contours the same behavior as \textsl{ua\_pk\_ok}. But while authenticating %with a public key was done quickly, authenticating with a username/password proved time consuming (it would take the system 2-3 seconds to respond to %invalid credentials \textsl{ua\_pw\_ok}). The \textsl{disconnect} proved expensive in a similar way.  Paul Fiterau Brostean committed Feb 06, 2017 34   Erik Poll committed Feb 17, 2017 35 For the test queries we used random and exhaustive variants of the testing algorithm described in  Paul Fiterau Brostean committed Feb 06, 2017 36 \cite{SMJV15}, which generate efficient test suites. Tests generated comprise an access sequence, a middle section of length {\dk} and a  Erik Poll committed Feb 17, 2017 37 distinguishing sequence. The exhaustive variant for a set {\dk} generates tests for all possible middle sections and all states. Passing all tests then provides some notion of confidence,  Paul Fiterau Brostean committed Feb 17, 2017 38 namely, that the learned model is correct unless the (unknown) model of the implementation has at least {\dk} more states than the learned hypothesis. The random variant produces tests  Paul Fiterau Brostean committed Feb 06, 2017 39 40 with randomly generated middle sections. No formal confidence is provided, but past experience shows this to be more effective at finding counterexamples since {\dk} can be set to higher values. We executed a random test suite with {\dk} of 4 comprising 40000 tests for OpenSSH, and 20000 tests for BitVise and DropBear.  Erik Poll committed Feb 15, 2017 41 We then ran an exhaustive test suite with {\dk} of 2 for all implementations.  Paul Fiterau Brostean committed Feb 06, 2017 42   43   Paul Fiterau Brostean committed Feb 06, 2017 44 Table~\ref{tab:experiments} describes the exact versions of the systems analyzed together with statistics on learning and testing, namely:  Frits Vaandrager committed Feb 17, 2017 45 (1) the number of states in the learned model, (2) the number of hypotheses built during the learning process and (3) the total number of learning and test queries run. For test queries, we only consider those run on the last hypothesis. All learned models along with the specifications checked can be found at \url{https://gitlab.science.ru.nl/pfiteraubrostean/Learning-SSH-Paper/tree/master/models}.  Paul Fiterau Brostean committed Feb 10, 2017 46 47 48 %BitVise: MemQ: 24996 TestQ: 58423 %Dropbear: MemQ: 3561 TestQ: 30629 %OpenSSH: MemQ: 19836 TestQ: 76418  Paul Fiterau Brostean committed Feb 06, 2017 49   Paul Fiterau Brostean committed Feb 17, 2017 50 \begin{table}[h] % was !ht  Paul Fiterau Brostean committed Feb 06, 2017 51 \centering  Paul Fiterau Brostean committed Feb 10, 2017 52 \small  Paul Fiterau Brostean committed Feb 06, 2017 53 54 \begin{tabular}{|l|l|l|l|l|l|l|} \hline  Paul Fiterau Brostean committed Feb 10, 2017 55 56 57 58 {\centering{\textbf{SUT}}} & \textbf{States} & \textbf{Hypotheses } & \textbf{Mem. Q.} & \textbf{Test Q.}\\ \hline %& \textbf{Tests to last Hyp.} & \textbf{Tests on last Hyp.} \\ \hline OpenSSH 6.9p1-2 & 31 & 4 & 19836 & 76418 \\ %& 1322 & 50243 \\ BitVise 7.23 & 65 & 15 & 24996 & 58423 \\ %& 9549 & 65040 \\ DropBear v2014.65 & 17 & 2 & 19863 & 76418 \\ \hline %& 15268 & 56174 \\  Paul Fiterau Brostean committed Feb 06, 2017 59 60 61 \end{tabular} \caption{Statistics for learning experiments} \label{tab:experiments}  Paul Fiterau Brostean committed Feb 17, 2017 62 %\vspace{-25mm}  Paul Fiterau Brostean committed Feb 06, 2017 63 64 65 \end{table} The large number of states is down to several reasons. First of all, some systems exhibited buffering behavior. In particular, BitVise would queue  Erik Poll committed Feb 17, 2017 66 responses for higher layer inputs sent during key re-exchange, and would deliver them all at once after rekeying was done. Rekeying was also  Erik Poll committed Feb 15, 2017 67 68 a major contributor to the number of states. For each state where rekeying is possible, the sequence of transitions constituting the complete  Erik Poll committed Feb 17, 2017 69 rekeying process should lead back to that state. This  Erik Poll committed Feb 15, 2017 70 leads to two additional rekeying states for each state where rekeying  Erik Poll committed Feb 17, 2017 71 is possible. Many states were also added due to {\dmapper} generated outputs such as \textsc{ch\_none} or \textsc{ch\_max}, outputs which signal that no channel is open or that the maximum number of channels have been opened.  72   Paul Fiterau Brostean committed Feb 18, 2017 73 Figure~\ref{fig:sshserver} shows the model learned for OpenSSH, with some edits to improve readability. The happy flow, in green, is fully explored in the model and mostly matches our earlier description of it\footnote{The only exception is in the Transport layer, where unlike in our happy flow definition, the server is the first to send the \textsc{newkeys} message. This is also accepted behavior, as the protocol does not specify which side should send \textsc{newkeys} first.}. Also explored is what happens when a rekeying sequence is attempted. We notice that rekeying is only allowed in states of the Connection layer. Strangely, for these states, rekeying is not state preserving, as the generated output on receiving a \textsc{sr\_auth}, \textsc{sr\_conn} or \textsc{kex30} changes from \textsc{unimpl} to \textsc{no\_resp}. This leads to two sub-clusters of states, one before the first rekey, the other afterward. In all other states, the first step of a  Erik Poll committed Feb 17, 2017 74 rekeying (\textsc{kexinit}) yields (\textsc{unimpl}), while the last step (\textsc{newkeys}) causes the system to disconnect.  75   Paul Fiterau Brostean committed Feb 18, 2017 76 77 We were puzzled by how systems reacted to \textsc{sr\_conn}, the request for services of the Connection layer. These services can be accessed once the user had authenticated, without the need of a prior service request. That in itself was not strange, as authentication messages already mention that connection services should start after authentication \footnote{This is a technical detail, the message format of authentication messages requires a field which says the service started after authentication. The only option is to start Connection layer services. }. Unexpected was that an explicit request either lead to \textsc{unimpl}/\textsc{no\_resp} with no state change, as in the case of OpenSSH, or termination of the connection, as in the case of BitVise. The latter was particularly strange, as in theory, once authenticated, the user should always have access to the service, and not be disconnected on requesting this service. Only DropBear seems to respond positively (\textsc{sr\_accept}) to \textsc{sr\_conn} after authentication.  Paul Fiterau Brostean committed Feb 14, 2017 78   Erik Poll committed Feb 17, 2017 79 80 We also notice the intricate authentication behavior: after an unsuccessful authentication attempt the only authentication method still allowed is password authentication. Finally, only BitVise allowed multiple terminals to be requested over the same channel. As depicted in the model, OpenSSH abruptly terminates on requesting a second terminal. DropBear exhibits a similar behavior.  81 82 83   Paul Fiterau Brostean committed Feb 08, 2017 84 85   Paul Fiterau Brostean committed Feb 07, 2017 86 87 88 89 %To give a concrete example, the {\dmapper} on every \textsl{ch\_open} saves a channel identifier and sends %a corresponding message to the {\dsut}. If \textsl{ch\_open} is called again, the {\dmapper} responds with a \textsl{ch\_max}. The channel identifier is removed %by a \textsl{ch\_close} input leading to pairs of identical states with and without the channel identifier, even in states where channels are not relevant (like for example states prior to authentication).  Paul Fiterau Brostean committed Feb 06, 2017 90