You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While auditing some of the dependencies that we use in our applications, I noticed that ruby-http-client does not verify TLS certificates. When requesting HTTPS resources using the SendGrid::Client class, presented TLS certificates are not validated at all. It accepts invalid certificates without throwing errors. This makes it trivially easy to launch a man-in-the-middle attack.
Net::HTTP's verify_mode flag should be set to OpenSSL::SSL::VERIFY_PEER (which is the default).
It's only a one-line change, unless you want to allow users to override this secure default setting (OpenSSL::SSL::VERIFY_PEER). Nevertheless, I'm happy to send over the signed CLA, and submit a PR.
Issue Summary
While auditing some of the dependencies that we use in our applications, I noticed that
ruby-http-client
does not verify TLS certificates. When requesting HTTPS resources using theSendGrid::Client
class, presented TLS certificates are not validated at all. It accepts invalid certificates without throwing errors. This makes it trivially easy to launch a man-in-the-middle attack.Net::HTTP
'sverify_mode
flag should be set toOpenSSL::SSL::VERIFY_PEER
(which is the default).Affected line:
ruby-http-client/lib/ruby_http_client.rb
Line 184 in bcc23e2
Steps to Reproduce
irb
require 'ruby_http_client'
SendGrid::Client.new(host: 'https://wrong.host.badssl.com/').get
.You will see that the request is executed without verifying whether the presented certificate matches the DNS name of the requested resource.
Technical details:
master
(latest commit: bcc23e2)The text was updated successfully, but these errors were encountered: