Skip to content

Ability to check TLS contexts, servernames, altnames #24095

Closed
@coolaj86

Description

@coolaj86

We have server.addContext(hostname, context), but we don't have a server.getContext(hostname).

Why?

Now, that might seem rather silly, but let me explain why it would be important to have this:

There's a type of spoofing known as Domain Fronting where the attacker creates a TLS session with one SNI, but once connected they send a different HTTP Host header (more info on a bug I created including this at #22389).

There's an RFC that specifically prohibits this behavior, which many cloud platforms follow, but node does not currently follow.

However, there's a catch. Another RFC in relation to HTTP/2 contradicts the former and suggests reusing the same TLS connection for a different servername when the certificate in the session includes the new servername (more info at https://www.ietf.org/mail-archive/web/httpbisa/current/msg28781.html).

Current versions of Firefox actually follow the second spec presently.

I want to block domain fronting, but not to the exclusion of allowing Firefox to reuse tls sessions.

Currently I'm checking that the Host header matches the tlsSocket.servername (when it exists), but in order to support Firefox I need to know the altnames (SAN) as well, but I haven't been able to figure out a way to get that information from the socket.

I'm looking for another workaround, but this seems like something that node could reasonably expose in a future version to make such checks easier.

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestIssues that request new features to be added to Node.js.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions