File tree Expand file tree Collapse file tree 5 files changed +21
-16
lines changed
src/experimental/Security/CWE/CWE-295
test/experimental/query-tests/Security/CWE/CWE-295 Expand file tree Collapse file tree 5 files changed +21
-16
lines changed Original file line number Diff line number Diff line change 1
1
<!DOCTYPE qhelp PUBLIC "-//Semmle//qhelp//EN" "qhelp.dtd">
2
2
<qhelp >
3
3
<overview >
4
- Disabling verification of the SSL certificate allows man-in-the-middle attacks. Disabling the
5
- peer or the host's certificate verification makes the SSL communication insecure. Just having
6
- encryption on a transfer is not enough as you cannot be sure that you are communicating with the
7
- correct end-point.
4
+ Disabling verification of the SSL certificate allows man-in-the-middle attacks.
5
+ A SSL connection is vulnerable to man-in-the-middle attacks if the certification is not checked
6
+ properly.
7
+ If the peer or the host's certificate verification is not verified, the underlying SSL
8
+ communication is insecure.
8
9
</overview >
9
10
<recommendation >
10
11
It is recommended that all communications be done post verification of the host as well as the
21
22
<references >
22
23
<li > Curl Documentation:<a href =" https://curl.se/libcurl/c/CURLOPT_SSL_VERIFYHOST.html" >
23
24
CURLOPT_SSL_VERIFYHOST</a ></li >
24
- <li > Curl Documentation:<a href =" https://curl.se/libcurl/c/CURLOPT_SSL_VERIFYHOST.html" >
25
- CURLOPT_SSL_VERIFYHOST</a ></li >
26
- <li > Related CVE: <a href =" https://nvd.nist.gov/vuln/detail/CVE-2022-33684" > CVE-2022-33684</a ></li >
27
- <li > Related CVE: <a href =" https://huntr.com/bounties/42325662-6329-4e04-875a-49e2f5d69f78" >
28
- `openframeworks/openframeworks`</a ></li >
25
+ <li > Curl Documentation:<a href =" https://curl.se/libcurl/c/CURLOPT_SSL_VERIFYPEER.html" >
26
+ CURLOPT_SSL_VERIFYPEER</a ></li >
27
+ <li > Related CVE: <a href =" https://github.com/advisories/GHSA-5r3h-c3r7-9w4h" > CVE-2022-33684</a ></li >
28
+ <li > Related security advisory: <a
29
+ href =" https://huntr.com/bounties/42325662-6329-4e04-875a-49e2f5d69f78" >
30
+ <code >openframeworks/openframeworks</code >
31
+ </a ></li >
29
32
</references >
30
33
</qhelp >
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ import semmle.code.cpp.dataflow.new.TaintTracking
15
15
private class CurlSetOptCall extends FunctionCall {
16
16
CurlSetOptCall ( ) {
17
17
exists ( FunctionCall fc , Function f |
18
- f .hasGlobalName ( "curl_easy_setopt" ) and
18
+ f .hasGlobalOrStdName ( "curl_easy_setopt" ) and
19
19
fc .getTarget ( ) = f
20
20
|
21
21
this = fc
@@ -34,6 +34,7 @@ private class CurlVerificationConstant extends EnumConstantAccess {
34
34
35
35
from CurlSetOptCall c
36
36
where
37
- c .getArgument ( 1 ) = any ( CurlVerificationConstant v ) and
37
+ c .getArgument ( 1 ) = any ( CurlVerificationConstant v )
38
+ and
38
39
c .getArgument ( 2 ) .getValue ( ) = "0"
39
40
select c , "This call disables Secure Socket Layer and could potentially lead to MITM attacks"
Original file line number Diff line number Diff line change @@ -4,6 +4,6 @@ void bad(void) {
4
4
std::unique_ptr<CURL, void (*)(CURL*)>(curl_easy_init (), curl_easy_cleanup);
5
5
curl_easy_setopt (curl.get (), CURLOPT_SSL_VERIFYPEER, 0 );
6
6
curl_easy_setopt (curl.get (), CURLOPT_SSL_VERIFYHOST, 0 );
7
- curl_easy_setopt (curl.get (), CURLOPT_URL, host.c_str ());
8
- curl_easy_perform (curl.get ());
7
+ curl_easy_setopt (curl.get (), CURLOPT_URL, host.c_str ());
8
+ curl_easy_perform (curl.get ());
9
9
}
Original file line number Diff line number Diff line change @@ -4,6 +4,6 @@ void good(void) {
4
4
std::unique_ptr<CURL, void (*)(CURL*)>(curl_easy_init (), curl_easy_cleanup);
5
5
curl_easy_setopt (curl.get (), CURLOPT_SSL_VERIFYPEER, 2 );
6
6
curl_easy_setopt (curl.get (), CURLOPT_SSL_VERIFYHOST, 2 );
7
- curl_easy_setopt (curl.get (), CURLOPT_URL, host.c_str ());
8
- curl_easy_perform (curl.get ());
7
+ curl_easy_setopt (curl.get (), CURLOPT_URL, host.c_str ());
8
+ curl_easy_perform (curl.get ());
9
9
}
Original file line number Diff line number Diff line change 1
- a
1
+ | CurlSSL.cpp:25:2:25:17 | call to curl_easy_setopt | This call disables Secure Socket Layer and could potentially lead to MITM attacks |
2
+ | CurlSSL.cpp:26:2:26:17 | call to curl_easy_setopt | This call disables Secure Socket Layer and could potentially lead to MITM attacks |
You can’t perform that action at this time.
0 commit comments