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
{{ message }}
Repository navigation
Linux CheckX509IpAddress processes IP literals in CN on Linux when SAN is also present #131734
Traditionally, one can put IP address to CN and have that validated agains actual IP address.
However, when SubjectAlternativeName is present it should take precedence:
changed the title [-]X509Chain process IP literals in CN on Linux when SAN is also present[/-][+]Linux CheckX509IpAddress processes IP literals in CN on Linux when SAN is also present[/+]on Aug 14, 2026
IP address matching with CN and SAN on Windows and Linux
I ran the same 45-case certificate/target-IP matrix through actual SslStream TLS connections on both platforms. The main difference is how DNS SANs affect IP-name validation: Windows suppresses CN fallback in the tested DNS-SAN cases, while Linux can still match the IP literal in CN. Both platforms also exhibit legacy CN fallback when SAN contains only conflicting IP addresses.
Observed rules
The 12 rows with different Windows/Linux results fall into three scenarios:
CN matches the target IP, but SAN contains an unrelated DNS name or a different numeric DNS name, with no matching IP SAN. Windows: Mismatch; Linux: Match through CN fallback. This occurs with both IPv4 and IPv6, including a DNS SAN plus a conflicting IP SAN (rows 5-6, 19-20, 22-23 and 43).
#
CN
SAN contents
Target IP
Windows
Linux
5
192.0.2.1
DNS:example.test
192.0.2.1
Mismatch
⚠️Match
CN matches the target IPv4 address, but SAN contains DNS wildcard *.0.2.1 or *.2.1, with no IP SAN. Windows: Mismatch; Linux: Match. The control cases support CN fallback, not wildcard-based IP matching (rows 14 and 26).
#
CN
SAN contents
Target IP
Windows
Linux
14
192.0.2.1
DNS:*.0.2.1
192.0.2.1
Mismatch
⚠️Match
CN is unrelated to the target IP, but a numeric DNS SAN exactly matches the target IP string, with no matching IP SAN. Windows: Match; Linux: Mismatch. This occurs with both IPv4 and IPv6 (rows 13, 17 and 44).
#
CN
SAN contents
Target IP
Windows
Linux
13
other.test
DNS:192.0.2.1
192.0.2.1
Match
⚠️Mismatch
Windows CN × SAN matrix
Windows name-matching results when the client's TargetHost is an IP literal and no IP SAN matches that address. “Matching CN” means the same IP text; “Nonmatching CN” means an unrelated name or a different IP.
✅ Match · ❌ Mismatch · — Not tested
SAN contents
Matching CN
Nonmatching CN
Key observation
IP SAN(s), none matching; no DNS SAN
✅
❌
A nonmatching IP SAN does not prevent CN fallback.
DNS SAN with an unrelated name or a different IP text
❌
—
A nonmatching DNS SAN does prevent CN fallback.
DNS SAN with exactly the target IP text; no IP SAN
✅
✅
An IP literal can match a DNS SAN, even with an unrelated CN.
DNS SAN with a wildcard; no IP SAN
❌
❌
The tested wildcards neither match the IP nor allow CN fallback.
The wildcard cases are IPv4-only. The last three combinations account for the Windows/Linux differences described above.
Three distinct CN / DNS SAN / IP SAN addresses
As requested in the PR review, fix CN=192.168.2.1 and SAN=DNS:192.168.2.2, IP:192.168.2.3, then try all three target addresses. The results below were measured on installed .NET 10.0.14 runtimes, not the PR-built runtime.
TargetHost
Windows
Linux before fix
192.168.2.1
Mismatch
Match
192.168.2.2
Match
Mismatch
192.168.2.3
Match
Match
Windows matches both SAN entries independently, while the DNS SAN suppresses CN fallback. The reproduction harness now includes these as rows 43-45, and the PR theory includes the three Windows-compatible expectations (false, true, true).
These are installed runtimes, not locally built runtime binaries. The harness was built for net10.0; the same managed DLL ran on both platforms.
Each case used a self-signed certificate and a loopback TLS 1.2 connection with the listed target IP as TargetHost. Match means no RemoteCertificateNameMismatch; Mismatch means it was reported. The diagnostic callback allowed certificate errors, so these results do not indicate default certificate acceptance. Absent means no CN.
All 90 TLS handshakes and payload checks completed, with zero harness assertion failures.
TLS name-validation results
⚠️ in the Linux column marks a result that differs from Windows
Rows 33-34 test a numeric IPv6 DNS SAN against a different textual representation of the same address, in both directions. Both platforms report a name mismatch. Unlike an iPAddress SAN, the tested numeric DNS SAN does not match merely because the IPv6 address bytes are equal.
Windows reported 22 name mismatches; Linux reported 16. Platform differences occurred in 12 rows: 5, 6, 13, 14, 17, 19, 20, 22, 23, 26, 43, 44.
Note
This report and its test harness were generated with GitHub Copilot. The results were obtained by executing all 45 cases on Windows and Ubuntu WSL2.
Activity
dotnet-policy-service commentedon Aug 3, 2026
Tagging subscribers to this area: @bartonjs, @vcsjones, @dotnet/area-system-security
See info in area-owners.md if you want to be subscribed.
[-]X509Chain process IP literals in CN on Linux when SAN is also present[/-][+]Linux CheckX509IpAddress processes IP literals in CN on Linux when SAN is also present[/+]makazeu commentedon Oct 10, 2026
IP address matching with CN and SAN on Windows and Linux
I ran the same 45-case certificate/target-IP matrix through actual
SslStreamTLS connections on both platforms. The main difference is how DNS SANs affect IP-name validation: Windows suppresses CN fallback in the tested DNS-SAN cases, while Linux can still match the IP literal in CN. Both platforms also exhibit legacy CN fallback when SAN contains only conflicting IP addresses.Observed rules
The 12 rows with different Windows/Linux results fall into three scenarios:
192.0.2.1DNS:example.test192.0.2.1*.0.2.1or*.2.1, with no IP SAN. Windows: Mismatch; Linux: Match. The control cases support CN fallback, not wildcard-based IP matching (rows 14 and 26).192.0.2.1DNS:*.0.2.1192.0.2.1other.testDNS:192.0.2.1192.0.2.1Windows CN × SAN matrix
Windows name-matching results when the client's
TargetHostis an IP literal and no IP SAN matches that address. “Matching CN” means the same IP text; “Nonmatching CN” means an unrelated name or a different IP.✅ Match · ❌ Mismatch · — Not tested
The wildcard cases are IPv4-only. The last three combinations account for the Windows/Linux differences described above.
Three distinct CN / DNS SAN / IP SAN addresses
As requested in the PR review, fix
CN=192.168.2.1andSAN=DNS:192.168.2.2, IP:192.168.2.3, then try all three target addresses. The results below were measured on installed .NET 10.0.14 runtimes, not the PR-built runtime.192.168.2.1192.168.2.2192.168.2.3Windows matches both SAN entries independently, while the DNS SAN suppresses CN fallback. The reproduction harness now includes these as rows 43-45, and the PR theory includes the three Windows-compatible expectations (
false,true,true).Environment and method
Reproduction code: IP address certificate-matching test harness.
10.0.26300; .NET runtime10.0.1426.04.1 LTS(ARM64) in WSL2; .NET runtime10.0.14; OpenSSL3.5.5These are installed runtimes, not locally built runtime binaries. The harness was built for
net10.0; the same managed DLL ran on both platforms.Each case used a self-signed certificate and a loopback TLS 1.2 connection with the listed target IP as
TargetHost.Matchmeans noRemoteCertificateNameMismatch;Mismatchmeans it was reported. The diagnostic callback allowed certificate errors, so these results do not indicate default certificate acceptance.Absentmeans no CN.All 90 TLS handshakes and payload checks completed, with zero harness assertion failures.
TLS name-validation results
192.0.2.1192.0.2.1192.0.2.1IP:192.0.2.2192.0.2.1192.0.2.1IP:192.0.2.2192.0.2.2192.0.2.1IP:192.0.2.2192.0.2.3192.0.2.1DNS:example.test192.0.2.1192.0.2.1DNS:example.test; IP:192.0.2.2192.0.2.1192.0.2.1DNS:example.test; IP:192.0.2.2192.0.2.2192.0.2.1192.0.2.22001:db8::12001:db8::12001:db8::1IP:2001:db8::22001:db8::12001:db8::1IP:2001:db8::22001:db8::2192.0.2.1DNS:192.0.2.1192.0.2.1other.testDNS:192.0.2.1192.0.2.1192.0.2.1DNS:*.0.2.1192.0.2.1*.0.2.1192.0.2.12001:db8::1DNS:2001:db8::12001:db8::1other.testDNS:2001:db8::12001:db8::12001:db8::12001:db8::22001:db8::1DNS:example.test2001:db8::12001:db8::1DNS:example.test; IP:2001:db8::22001:db8::12001:db8::1DNS:example.test; IP:2001:db8::22001:db8::2192.0.2.1DNS:192.0.2.2192.0.2.12001:db8::1DNS:2001:db8::22001:db8::1other.testDNS:*.0.2.1192.0.2.1other.testDNS:*.2.1192.0.2.1192.0.2.1DNS:*.2.1192.0.2.1*.2.1192.0.2.1other.testIP:192.0.2.1; IP:192.0.2.2192.0.2.1other.testIP:192.0.2.2; IP:192.0.2.1192.0.2.1other.testIP:2001:db8::2; IP:192.0.2.1192.0.2.1other.testIP:192.0.2.2; IP:2001:db8::12001:db8::1other.testIP:192.0.2.2; IP:2001:db8::2192.0.2.1other.testDNS:2001:0db8:0:0:0:0:0:12001:db8::1other.testDNS:2001:db8::12001:0db8:0:0:0:0:0:12001:0db8:0:0:0:0:0:12001:db8::12001:db8::12001:0db8:0:0:0:0:0:12001:DB8::12001:db8::1other.testIP:2001:db8::12001:0db8:0:0:0:0:0:1192.0.2.1URI:https://example.test/192.0.2.1192.0.2.1EMAIL:[email protected]192.0.2.1IP:192.0.2.1192.0.2.1IP:192.0.2.2192.0.2.1192.168.2.1DNS:192.168.2.2; IP:192.168.2.3192.168.2.1192.168.2.1DNS:192.168.2.2; IP:192.168.2.3192.168.2.2192.168.2.1DNS:192.168.2.2; IP:192.168.2.3192.168.2.3Rows 33-34 test a numeric IPv6 DNS SAN against a different textual representation of the same address, in both directions. Both platforms report a name mismatch. Unlike an
iPAddressSAN, the tested numeric DNS SAN does not match merely because the IPv6 address bytes are equal.Windows reported 22 name mismatches; Linux reported 16. Platform differences occurred in 12 rows: 5, 6, 13, 14, 17, 19, 20, 22, 23, 26, 43, 44.
Note
This report and its test harness were generated with GitHub Copilot. The results were obtained by executing all 45 cases on Windows and Ubuntu WSL2.