MITM certificates carry no SAN for ordinary hostnames #4

Closed
opened 2026-10-26 20:23:15 +00:00 by mikluko · 0 comments
Owner

certForRequest in pkg/handlers/handler_mitm.go inverts the error check on publicsuffix.EffectiveTLDPlusOne:

tldplus, err := publicsuffix.EffectiveTLDPlusOne(hostname)
if err != nil {
    cn = tldplus
    dnsnames = append(dnsnames, tldplus, "."+tldplus)
} else {
    cn = hostname
}

For any ordinary hostname the lookup succeeds, so the issued certificate has a CN and no DNSNames. Go clients refuse it:

x509: certificate relies on legacy Common Name field, use SANs instead

curl accepts it, which is why it goes unnoticed. The requested hostname should always be in DNSNames (an IP in IPAddresses); a wildcard for the eTLD+1 can be added on top.

`certForRequest` in `pkg/handlers/handler_mitm.go` inverts the error check on `publicsuffix.EffectiveTLDPlusOne`: ```go tldplus, err := publicsuffix.EffectiveTLDPlusOne(hostname) if err != nil { cn = tldplus dnsnames = append(dnsnames, tldplus, "."+tldplus) } else { cn = hostname } ``` For any ordinary hostname the lookup succeeds, so the issued certificate has a CN and no `DNSNames`. Go clients refuse it: ``` x509: certificate relies on legacy Common Name field, use SANs instead ``` curl accepts it, which is why it goes unnoticed. The requested hostname should always be in `DNSNames` (an IP in `IPAddresses`); a wildcard for the eTLD+1 can be added on top.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
mikluko/multiproxy#4
No description provided.