Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f4b912c

Browse files
intrigus-lgtmfelicitymay
authored andcommitted
Apply suggestions from doc review
Co-authored-by: Felicity Chapman <[email protected]>
1 parent e11304a commit f4b912c

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

java/ql/src/Security/CWE/CWE-297/UnsafeHostnameVerification.qhelp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<overview>
66
<p>
77
If a <code>HostnameVerifier</code> always returns <code>true</code> it will not verify the hostname at all.
8-
This stops Transport Layer Security (TLS) providing any security and allows an attacker to perform a Man-in-the-middle attack against the application.
8+
This stops Transport Layer Security (TLS) providing any security and allows an attacker to perform a man-in-the-middle attack against the application.
99
</p>
1010

1111
<p>
@@ -14,10 +14,10 @@ An attack might look like this:
1414

1515
<ol>
1616
<li>The program connects to <code>https://example.com</code>.</li>
17-
<li>The attacker intercepts this connection and presents one of their valid certificates they control, for example one from Let's Encrypt.</li>
18-
<li>Java verifies that the certificate has been issued by a trusted certificate authority.</li>
19-
<li>Java verifies that the certificate has been issued for the host <code>example.com</code>, which will fail because the certificate has been issued for <code>malicious.domain</code>.</li>
20-
<li>Java wants to reject the certificate because the hostname does not match. Before doing this it checks whether there exists a <code>HostnameVerifier</code>.</li>
17+
<li>The attacker intercepts this connection and presents an apparently-valid certificate of their choosing.</li>
18+
<li>The `TrustManager` of the program verifies that the certificate has been issued by a trusted certificate authority.</li>
19+
<li>Java checks whether the certificate has been issued for the host <code>example.com</code>. This check fails because the certificate has been issued for a domain controlled by the attacker, for example: <code>malicious.domain</code>.</li>
20+
<li>Java wants to reject the certificate because the hostname does not match. Before doing this it checks whether a <code>HostnameVerifier</code> exists.</li>
2121
<li>Your <code>HostnameVerifier</code> is called which returns <code>true</code> for any certificate so also for this one.</li>
2222
<li>Java proceeds with the connection since your <code>HostnameVerifier</code> accepted it.</li>
2323
<li>The attacker can now read the data your program sends to <code>https://example.com</code>

0 commit comments

Comments
 (0)