HTTPS proxy connection (p_use_ssl/proxy_use_ssl) does not verify the proxy's certificate
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 55/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- ruby
- Lĩnh vực
- networking, security
Hướng nghiên cứu
Bắt đầu trong lib/net/http.rb#connect, cụ thể là nhánh @proxy_use_ssl tạo SSLSocket của proxy. So sánh thiết lập của nó với kết nối TLS đến đích và xác định cách cấu hình riêng biệt việc xác minh chứng chỉ proxy và kiểm tra tên máy chủ. Được xem là hoàn tất khi chứng chỉ proxy được xác minh theo mặc định trước khi Proxy-Authorization được gửi, với mọi thiết lập xác minh cần thiết được bao quát.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
When connecting to a destination over TLS through a TLS proxy (an "HTTPS proxy"), enabling p_use_ssl encrypts the client→proxy hop but does not authenticate the proxy's certificate. The proxy TLS socket is built with no SSLContext and no post-connection check, so it defaults to VERIFY_NONE. This makes the proxy hop MITM-able, which matters because the Proxy-Authorization (Basic) credential is written over that socket in the CONNECT request.
Setup
Either of the documented ways to enable a TLS proxy:
proxy = Net::HTTP.Proxy('proxy.example.com', 8080, 'user', 'pass', true) # 5th arg -> @proxy_use_ssl
http = proxy.new('login.example.com', 443)
http.use_ssl = true
# ...or Net::HTTP.new(addr, port, p_addr, p_port, p_user, p_pass, p_no_proxy, true)
http.get('/')
What happens
In Net::HTTP#connect, when @proxy_use_ssl is set, the proxy socket is wrapped as:
proxy_sock = OpenSSL::SSL::SSLSocket.new(s) # no SSLContext passed
ssl_socket_connect(proxy_sock, @open_timeout)
# ... then CONNECT + "Proxy-Authorization: Basic <creds>" is written to proxy_sock
SSLSocket.new(s) with no context uses a default context (verify_mode effectively VERIFY_NONE), and there is no post_connection_check on proxy_sock— the only post_connection_check in connect targets @address (the destination). So:
- The destination cert is verified (via
@ssl_context+post_connection_check(@address)). ✅ - The proxy cert is neither verified nor hostname-checked. ❌
A MITM on the client→proxy path can therefore present any certificate, terminate the TLS, and read the Proxy-Authorization credential — the same credential exposure that enabling proxy TLS is meant to prevent.
Expected
The proxy TLS connection should verify the proxy certificate by default (use an SSLContext with VERIFY_PEER and run post_connection_check against the proxy host), consistent with how the destination connection is verified. At minimum there should be a way to supply verification settings (CA store, verify_mode, hostname) for the proxy connection distinct from the destination's.
Environment
- Ruby 4.0.5
- net-http 0.9.1
- Reproduced by reading
lib/net/http.rb#connect(theif @proxy_use_sslbranch) — the proxy SSLSocket is built without a context and gets nopost_connection_check.
Related
- jnunemaker/httparty#839 tracks a separate, complementary gap: HTTParty can't even set p_use_ssl (it passes only 6 of
Net::HTTP.new's proxy args). This net-http issue is about the flag existing but not verifying the proxy cert.
- Ngôn ngữ chính
- Ruby
- Star
- 148
- Fork
- 95
- Merge trung bình
- 10 giờ 54 phút
- Pull request đã merge (30 ngày)
- 4
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của ruby/net-http
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
-
bug documentation
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
Tất cả issue của ruby/net-http
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
-
バグ
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
-
Version bump for OpenVox 9 Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
voxpupuli/puppet-epel#186 · 1 bình luận ·
-
external_created_at is no longer used for the message timestamp since the new message UI (v4.4.0) Đang mởBug Frontend
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100