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 11<!DOCTYPE qhelp PUBLIC "-//Semmle//qhelp//EN" "qhelp.dtd">
22<qhelp >
33 <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.
89 </overview >
910 <recommendation >
1011 It is recommended that all communications be done post verification of the host as well as the
2122 <references >
2223 <li > Curl Documentation:<a href =" https://curl.se/libcurl/c/CURLOPT_SSL_VERIFYHOST.html" >
2324 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 >
2932 </references >
3033</qhelp >
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ import semmle.code.cpp.dataflow.new.TaintTracking
1515private class CurlSetOptCall extends FunctionCall {
1616 CurlSetOptCall ( ) {
1717 exists ( FunctionCall fc , Function f |
18- f .hasGlobalName ( "curl_easy_setopt" ) and
18+ f .hasGlobalOrStdName ( "curl_easy_setopt" ) and
1919 fc .getTarget ( ) = f
2020 |
2121 this = fc
@@ -34,6 +34,7 @@ private class CurlVerificationConstant extends EnumConstantAccess {
3434
3535from CurlSetOptCall c
3636where
37- c .getArgument ( 1 ) = any ( CurlVerificationConstant v ) and
37+ c .getArgument ( 1 ) = any ( CurlVerificationConstant v )
38+ and
3839 c .getArgument ( 2 ) .getValue ( ) = "0"
3940select 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) {
44 std::unique_ptr<CURL, void (*)(CURL*)>(curl_easy_init (), curl_easy_cleanup);
55 curl_easy_setopt (curl.get (), CURLOPT_SSL_VERIFYPEER, 0 );
66 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 ());
99}
Original file line number Diff line number Diff line change @@ -4,6 +4,6 @@ void good(void) {
44 std::unique_ptr<CURL, void (*)(CURL*)>(curl_easy_init (), curl_easy_cleanup);
55 curl_easy_setopt (curl.get (), CURLOPT_SSL_VERIFYPEER, 2 );
66 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 ());
99}
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