Skip to content

Commit 0e149f0

Browse files
committed
Move from experimental
1 parent 40d98ad commit 0e149f0

File tree

11 files changed

+29
-38
lines changed

11 files changed

+29
-38
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<!DOCTYPE qhelp PUBLIC "-//Semmle//qhelp//EN" "qhelp.dtd">
2+
<qhelp>
3+
4+
<overview>
5+
<p>JavaMail is commonly used in Java applications to send emails. There are popular third-party libraries like Apache Commons Email which are built on JavaMail and facilitate integration. Authenticated mail sessions require user credentials and mail sessions can require SSL/TLS authentication. It is a common security vulnerability that host-specific certificate data is not validated or is incorrectly validated. Failing to validate the certificate makes the SSL session susceptible to a man-in-the-middle attack.</p>
6+
<p>This query checks whether SSL certificate is validated when username/password is sent in authenticator and when SSL is enabled.</p>
7+
<p>The query has code for both plain JavaMail invocation and mailing through Apache SimpleMail to make it more comprehensive.</p>
8+
</overview>
9+
10+
<recommendation>
11+
<p>Validate SSL certificate when sensitive information is sent in email communications.</p>
12+
</recommendation>
13+
14+
<example>
15+
<p>The following two examples show two ways of configuring secure emails through JavaMail or Apache SimpleMail. In the 'BAD' case,
16+
credentials are sent in an SSL session without certificate validation. In the 'GOOD' case, the certificate is validated.</p>
17+
<sample src="JavaMail.java" />
18+
<sample src="SimpleMail.java" />
19+
</example>
20+
21+
<references>
22+
<li>
23+
Log4j2:
24+
<a href="https://issues.apache.org/jira/browse/LOG4J2-2819">Add support for specifying an SSL configuration for SmtpAppender (CVE-2020-9488)</a>
25+
</li>
26+
</references>
27+
</qhelp>

java/ql/src/experimental/Security/CWE/CWE-297/InsecureJavaMail.qhelp

Lines changed: 0 additions & 36 deletions
This file was deleted.

java/ql/test/experimental/query-tests/security/CWE-297/InsecureJavaMail.qlref

Lines changed: 0 additions & 1 deletion
This file was deleted.

java/ql/test/experimental/query-tests/security/CWE-297/options

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Security/CWE/CWE-297/InsecureJavaMail.ql

0 commit comments

Comments
 (0)