mirror of
https://github.com/ProxymanApp/Proxyman.git
synced 2026-04-26 16:45:57 +03:00
[GH-ISSUE #1581] Proxyman does not use SNI when generating certificates for use with SSL Proxying #1574
Labels
No labels
Discussion
Feature request
In Progress...
Plugins
Waiting response
Windows
Windows
bug
duplicate
enhancement
feature
good first issue
iOS
macOS 10.11
question
wontfix
✅ Done
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/Proxyman#1574
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @meermanr on GitHub (Mar 22, 2023).
Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/1581
Originally assigned to: @NghiaTranUIT on GitHub.
Description
Proxyman does not appear to use to Server Name Indication (SNI) to determine the Common Name (or Subject Alternate Names (SANs)) of the certificate it generates when performing SSL Proxying.
I'm attempting to debug a legacy application which does not use system roots of trust, but instead uses a baked-in self-signed certificate for which I have the CA and private key. The application is unusual in that always sends a fixed SNI, irrespective of the server's address.
Steps to Reproduce
I've replicated this using standard tools:
proxychains4installed viabrew install proxychains-ng(version: stable 4.16 (bottled), HEAD)socatinstalled viabrew install socat(version: stable 1.7.4.4 (bottled))127.0.0.1:9090in my case~/.proxychains.confand populate it with:proxychains4 -f ~/.proxychains.conf socat -d -d FILE:/dev/null OPENSSL:192.168.111.30:443,snihost=example.com192.168.111.30, and not the SNIexample.comFor completeness, you can verify that socat is indeed emitting an SNI request:
socat -d TCP-LISTEN:11223,fork,reuseaddr SYSTEM:'xxd >&2', which will listen for traffic on TCP port 11223 and write it to a subprocess,xxd >&2, effectively dumping the request on STDERR.socat -d -d FILE:/dev/null OPENSSL:127.0.0.1:11223,snihost=example.comto make a requestexample.com, appears in the output fromxxdCurrent Behavior
Auto-generated certificate's common name is set to network address (i.e.
192.168.111.30) specified by CONNECTExpected Behavior
Auto-generated certificate's common name should be set to the value given by the request's Server Name Indication (SNI), i.e.
example.com.Environment
@NghiaTranUIT commented on GitHub (Mar 23, 2023):
Hey @meermanr thanks for the detailed reproducible test.
It's hard to say, but I would explain how Proxyman constructs the self-signed certificate.
commonNameandalternative_namesFor example: Connect to https://www.producthunt.com/
commonNameandalternative_names) and signs by Proxyman self-signed Root Certificate.If Proxyman could not connect to the destination server (in the 1st step), Proxyman would generates a fake certificate, with the SNI is the host name, or the IP address.
From what I see, you're using the
IP, soNIOSSLClientHandlerdoesn't accept it -> Proxyman generates a fake certificate with your IP instead of the real SNI.Code:
github.com/apple/swift-nio-ssl@845a97cbd5/Sources/NIOSSL/NIOSSLClientHandler.swift (L39)I suppose that we can fix it using a real new hostname.