Skip to content

Commit d73c4ed

Browse files
added some introduction and reorderd fingerprint chapters
1 parent 3afe12f commit d73c4ed

File tree

2 files changed

+58
-45
lines changed

2 files changed

+58
-45
lines changed

doc/authentication.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
Authentication
22
==============
33

4+
The choice of the right authentication method against SSH-MITM can have a decisive influence on the success of a Man in the Middle attack.
5+
6+
The most popular authentication methods are "password" and "publickey" authentication. However, there are others, such as "none" and "keyboard-interactive".
7+
8+
To log in to an SSH server it is necessary to specify an existing user. There are systems that use a default username.
9+
This is most common with Git repositories. Examples of this are GitLab and GitHub, which use the username "git" and distinguish which
10+
resources a user is allowed to access based on the public key at login.
11+
412

513
none Authentication
614
-------------------

doc/fingerprint.rst

Lines changed: 50 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,6 @@ In most cases, a new key is automatically generated during installation. When a
1414
For this reason, the fingerprint must always be compared against a trusted source.
1515

1616

17-
There are SSH clients that have a flawed fingerprint check and are thus vulnerable to man in the middle attacks. An example of this is the SFTP implementation of Midnight Commander.
18-
This vulnerability was discovered and fixed only after 9 years. See ref:`CVE-2021-36370`
19-
20-
However, most programs do not have fingerprint verification vulnerabilities. As long as the fingerprint is checked, it is not possible to connect to an unknown server.
21-
22-
In many cases, the vulnerability is not the program, but the user who does not properly check the fingerprint against a known value. There can be many reasons for this.
23-
24-
Many users do not know what the fingerprint means. There are tutorials on the Internet that do not describe what the fingerprint is, but only write that you simply have to confirm this query with "yes" to establish the connection.
25-
26-
It also often happens that the fingerprint is not known and cannot be checked against a trusted source. These could be new systems that generate a random key on first launch.
27-
28-
Systems such as a development server may have it reinstalled frequently. This causes the fingerprints to change which leads to users being used to accepting unknown fingerprints.
29-
30-
However, previous studies (Peter Gutmann, Do Users Verify SSH Keys? / Konrad Rieck (Fuzzy Fingerprints Attacking Vulnerabilities in the Human Brain, 2002) ) have shown that users verify a fingerprint in very few cases. In the study by Peter Gutmann, IT departments were asked how often the user asked the IT department for the new fingerprint after a new installation. The study showed that this was almost never the case.
31-
32-
In cases where the fingerprint is checked, it is very efficient to generate an SSH key with a similar hash value as the one of the target computer. The longer and more complex a fingerprint becomes, the more likely it is that only parts of the fingerprint are compared. This results in a fingerprint that is actually wrong being considered correct. This technique is known as fuzzy fingerprinting.
3317

3418

3519
Checking the fingerprint
@@ -99,9 +83,6 @@ So in the above example
9983
ssh-keygen -f "/home/tux/.ssh/known_hosts" -R 172.217.22.227
10084
10185
102-
103-
104-
10586
Determine fingerprint of the server
10687
-----------------------------------
10788

@@ -187,43 +168,30 @@ In this case, the fingerprint must still be checked against a trusted source.
187168

188169
However, the fingerprint stored in the DNS is no longer considered trustworthy in this case. The reason for this is that the integrity of the DNS zone is no longer guaranteed due to an incorrect DNSSEC configuration.
189170

190-
Recognizing clients with known fingerprints
191-
-------------------------------------------
192171

193-
If the client is already in possession of a fingerprint, the received fingerprint is compared with it. If the fingerprints do not match, a warning is issued and the connection is terminated.
172+
SSH-MITM - attacks on the fingerprint verification
173+
--------------------------------------------------
194174

195-
However, a Man in the Middle attack should remain undetected for as long as possible. For this reason, it is necessary to prevent the warnings generated by the client.
175+
There are SSH clients that have a flawed fingerprint check and are thus vulnerable to man in the middle attacks. An example of this is the SFTP implementation of Midnight Commander.
176+
This vulnerability was discovered and fixed only after 9 years. See :ref:`CVE-2021-36370`
196177

197-
RFC-4253 defines how the key exchange works. A list of supported algorithms is sent to the server. The first entry defines the preferred algorithm.
178+
However, most programs do not have fingerprint verification vulnerabilities. As long as the fingerprint is checked, it is not possible to connect to an unknown server.
198179

199-
This behavior can be used to find out whether a client has already stored a fingerprint for the current connection or not.
180+
In many cases, the vulnerability is not the program, but the user who does not properly check the fingerprint against a known value. There can be many reasons for this.
200181

201-
In a Man in the Middle attack, this knowledge can be used to not intercept clients that would issue a warning or to pass the connection through to the actual destination server.
182+
Many users do not know what the fingerprint means. There are tutorials on the Internet that do not describe what the fingerprint is, but only write that you simply have to confirm this query with "yes" to establish the connection.
202183

203-
An exemplary key exchange with and without a known fingerprint could look as follows:
184+
It also often happens that the fingerprint is not known and cannot be checked against a trusted source. These could be new systems that generate a random key on first launch.
204185

186+
Systems such as a development server may have it reinstalled frequently. This causes the fingerprints to change which leads to users being used to accepting unknown fingerprints.
205187

206-
+------------------------+------------------------+
207-
| New Fingerprint | Known Fingerprint |
208-
+========================+========================+
209-
| ssh-ed25519 | ssh-rsa |
210-
+------------------------+------------------------+
211-
| ecdsa-sha2-nistp256 | ssh-ed25519 |
212-
+------------------------+------------------------+
213-
| ecdsa-sha2-nistp384 | ecdsa-sha2-nistp256 |
214-
+------------------------+------------------------+
215-
| ecdsa-sha2-nistp521 | ecdsa-sha2-nistp384 |
216-
+------------------------+------------------------+
217-
| ssh-rsa | ecdsa-sha2-nistp521 |
218-
+------------------------+------------------------+
219-
| ssh-dss | ssh-dss |
220-
+------------------------+------------------------+
188+
However, previous studies (Peter Gutmann, Do Users Verify SSH Keys? / Konrad Rieck (Fuzzy Fingerprints Attacking Vulnerabilities in the Human Brain, 2002) ) have shown that users verify a fingerprint in very few cases. In the study by Peter Gutmann, IT departments were asked how often the user asked the IT department for the new fingerprint after a new installation. The study showed that this was almost never the case.
189+
190+
In cases where the fingerprint is checked, it is very efficient to generate an SSH key with a similar hash value as the one of the target computer. The longer and more complex a fingerprint becomes, the more likely it is that only parts of the fingerprint are compared. This results in a fingerprint that is actually wrong being considered correct. This technique is known as fuzzy fingerprinting.
221191

222-
If the fingerprint is not known, the list is sent to the server with a predefined sequence.
223-
However, if the client has already saved a fingerprint for the server, the last used algorithm used is put first.
224192

225193
Fuzzy Fingerprints
226-
------------------
194+
""""""""""""""""""
227195

228196
.. note::
229197

@@ -276,6 +244,43 @@ Base64, which is used for SHA256 fingerprints, was not evaluated in this work, w
276244

277245

278246

247+
248+
Recognizing clients with known fingerprints
249+
"""""""""""""""""""""""""""""""""""""""""""
250+
251+
If the client is already in possession of a fingerprint, the received fingerprint is compared with it. If the fingerprints do not match, a warning is issued and the connection is terminated.
252+
253+
However, a Man in the Middle attack should remain undetected for as long as possible. For this reason, it is necessary to prevent the warnings generated by the client.
254+
255+
RFC-4253 defines how the key exchange works. A list of supported algorithms is sent to the server. The first entry defines the preferred algorithm.
256+
257+
This behavior can be used to find out whether a client has already stored a fingerprint for the current connection or not.
258+
259+
In a Man in the Middle attack, this knowledge can be used to not intercept clients that would issue a warning or to pass the connection through to the actual destination server.
260+
261+
An exemplary key exchange with and without a known fingerprint could look as follows:
262+
263+
264+
+------------------------+------------------------+
265+
| New Fingerprint | Known Fingerprint |
266+
+========================+========================+
267+
| ssh-ed25519 | ssh-rsa |
268+
+------------------------+------------------------+
269+
| ecdsa-sha2-nistp256 | ssh-ed25519 |
270+
+------------------------+------------------------+
271+
| ecdsa-sha2-nistp384 | ecdsa-sha2-nistp256 |
272+
+------------------------+------------------------+
273+
| ecdsa-sha2-nistp521 | ecdsa-sha2-nistp384 |
274+
+------------------------+------------------------+
275+
| ssh-rsa | ecdsa-sha2-nistp521 |
276+
+------------------------+------------------------+
277+
| ssh-dss | ssh-dss |
278+
+------------------------+------------------------+
279+
280+
If the fingerprint is not known, the list is sent to the server with a predefined sequence.
281+
However, if the client has already saved a fingerprint for the server, the last used algorithm used is put first.
282+
283+
279284
Testing with SSH-MITM
280285
"""""""""""""""""""""
281286

0 commit comments

Comments
 (0)