From ff386ef48466db2de2760649b5aebde425116d6f Mon Sep 17 00:00:00 2001 From: moparisthebest Date: Wed, 2 May 2018 23:44:18 -0400 Subject: [PATCH] HACX to route around censorship --- inbox/hacx.xml | 129 +++++++++++++++++++++++++++++++++++++++++++++++++ xep.ent | 4 ++ 2 files changed, 133 insertions(+) create mode 100644 inbox/hacx.xml diff --git a/inbox/hacx.xml b/inbox/hacx.xml new file mode 100644 index 00000000..f4c737ae --- /dev/null +++ b/inbox/hacx.xml @@ -0,0 +1,129 @@ + + +%ents; +]> + + +
+ XMPP Connections across HTTPS (HACX) + This specification defines a procedure to look up various connection methods for an XMPP server over HTTPS, with a focus on censorship resistance. + &LEGALNOTICE; + xxxx + ProtoXEP + Standards Track + Standards + Council + + XEP-0368 + RFC 5785 + + + + NOT_YET_ASSIGNED + + Travis + Burtrum + travis@burtrum.org + travis@burtrum.org + + + 0.0.1 + 2018-05-01 + tjb +

First draft.

+
+
+ +

Various methods exist to connect to XMPP servers over direct TLS, &xep0368; defines SRV records, &rfc7395; defines websocket, &xep0206; defines BOSH. HACX defines a method to retrieve all of those along with optional extra information such as SNI/ALPN requirements and pinned public keys from a &rfc5785; well-known URI over HTTPS.

+
+ +

HACX servers MUST use HTTPS. This means that + the HACX client MUST verify the certificate of the HTTPS service at + the source domain in order to securely "bootstrap" into the use of + HACX; specifically, the rules of &rfc2818; apply to this + "bootstrapping" step to provide a secure basis for all subsequent + HACX operations. HACX clients and servers MUST support and use + methods to increase the security of this HTTPS request using all available + means such as HPKP (&rfc7469;), HSTS (&rfc6797;), DANE (&rfc6698;), etc. +

+

A HACX document is retrieved over secure HTTP in the + following way:

+
    +
  1. The HACX client performs an HTTPS GET request at the source + domain to the path "/.well-known/xmpp-{client/server}.xml". The + value of "{client/server}" is either "client" or "server" depending on if you want to connect to a server providing the jabber:client or jabber:server namespace. + For example, if a client is trying to connect a user with the jid romeo@montague.tld using HACX, + then the HTTPS GET request would be as + follows: + + GET /.well-known/xmpp-client.xml HTTP/1.1 + Host: montague.tld.
  2. +
  3. If the server has a HACX document, it responds with the document like so: + + + + + + + + +]]> + The document is defined as such: +
      +
    1. ttl attribute: If missing, assume a value of 30, MUST be non-negative integer representing number of seconds to cache this document. If connectivity is blocked, you SHOULD still use this document past TTL expiration.
    2. +
    3. tls element: This connection type is &xep0368; style Direct TLS connection
    4. +
    5. websocket element: This connection type is &rfc7395; websocket connection
    6. +
    7. bosh element: This connection type is &xep0206; bosh connection
    8. +
    9. public-key-pin element: This can be on any connection type, and is a base64 hash of the DER encoding of certificate's public key, not the certificate itself, HPKP (&rfc7469;) style. Multiple of these may be provided, only one must match, and all different hash types for a single element MUST match the same key so only one hash type need be checked. If these are provided and none match, the connection MUST be considered untrusted and MUST be aborted. Attributes can be any valid registered hash name. If missing, TLS certificates MUST be validated the same way as for STARTTLS. (i.e., as specified in &xmppcore;), or another equivalent such as DANE (&rfc6698;) or POSH (&posh;)
    10. +
    11. ip attribute: MUST be provided as either an IPv4 or IPv6 address, implementors SHOULD provide both IPv4 and IPv6 options.
    12. +
    13. port attribute: MUST be provided, for maximum censorship resistance implementors are encouraged to use 443 to blend with HTTPS.
    14. +
    15. url attribute: MUST be provided for websocket/bosh elements, MUST NOT be provided for tls elements, protocol MUST be wss:// for websocket, https:// for bosh (mandatory TLS), ip and port MUST be overriden with ip/port attributes, hostname in URL MUST be sent in HTTP Host: header
    16. +
    17. sni attribute: If missing, HACX client MUST NOT use/set the SNI TLS extension at all, if set, HACX client MUST set the SNI TLS extension to this value exactly.
    18. +
    19. alpn attribute: If missing, HACX client MUST NOT use/set the ALPN (&rfc7301;) TLS extension at all, if set, HACX client MUST base64 decode this field and set the ALPN TLS extension to that value exactly. MUST NOT be provided for websocket/bosh elements so proper http protocol can be negotiated.
    20. +
    21. priority attribute: MUST be provided, same as definition in &rfc2782; SRV records
    22. +
    23. weight attribute: If missing, default to 0, same as definition in &rfc2782; SRV records
    24. +
    25. HACX clients MUST discard any connection method they don't have support for, or do not wish to try due to privacy reasons (ALPN set to xmpp-client), then SHOULD try them in proper priority/weight order until a successful connection is achieved. Any type of connection error MUST trigger a fallback to the next record. Common errors include invalid protocol (HTTP when you expect XMPP), TLS certificate validation errors, and more.
    26. +
    +
  4. +
  5. If the server knows where a HACX document can be found, it MUST respond with a HTTP status code 302 (Found) and a redirect to the correct location. The location provided in the redirect response MUST specify an HTTPS URI. To protect against circular references, it is RECOMMENDED that HACX clients follow no more than 10 redirects, although applications or + implementations can require that fewer redirects be followed.
  6. +
  7. If the server does not have or know about a HACX document, it MUST respond with HTTP status code 404 (Not Found).
  8. +
+
+ +

HACX provides a simple way to look up exactly how to connect to any given XMPP server in a simple, censorship resistant, distributed way. An attacker would have to block all A and AAAA record lookups and/or HTTPS to completely block this lookup, and even then it's easily done over something like Tor which otherwise does not support things like DNS SRV or TXT lookups. Additionally, DNS SRV records can not provide values for SNI or ALPN extensions, or a relative priority for other connections methods like BOSH and Websockets.

+
+ +

This should be trivial to implement for any program that already implements &xep0368; and &posh;, much of the same code can be reused.

+

Server operators might want to prioritize connection methods that maximize privacy, like no ALPN, domain fronting (different SNI value), or no SNI. Consider looking at everything available at an HTTP level to potentially lie to attackers, while providing correct info to users. Consider providing different sets of servers to different IP blocks or regions. Consider using any of the multitude of free or cheap HTTP hosts or CDNs to forward traffic to your real server. The possibilities are endless.

+
+ +

POSH (&posh;) already provides the ability of anyone with control of an HTTPS server to override trust of TLS certificates for the XMPP server matching that domain, HACX is slightly different in that it pins public keys like HPKP (&rfc7469;) and not certificates like POSH, but the delegation is the same.

+

HACX additionally delegates what were previously DNS lookups to the HTTPS server, since this is protected by TLS certificate validation, this should be even more secure than plain DNS, equivalent to something like DNS-over-HTTPS or DNS-over-TLS, but without trusting a 3rd party DNS server. DNSSEC delegation is preserved as well since it protects the A/AAAA record for the HTTPS host, and can also validate it with DANE (&rfc6698;).

+

This does allow anyone with write access to the /.well-known/ directory on an HTTPS host to host a XMPP server for that domain even if they don't have access to create DNS records or listen on port 5222, but this was already true due to &xep0156; (HTTP Lookup Method) and &rfc7395;

+
+ +

Well-known URIs (&rfc5785;) requires registration of new URI suffixes. This document specifies two URI suffixes:

+ +

+URI Suffix: xmpp-client.xml
+Change Controller: XSF
+Reference: [TODO: HACX LINK HERE]
+Related Information: XMPP jabber:client namespace
+

+ +

+URI Suffix: xmpp-server.xml
+Change Controller: XSF
+Reference: [TODO: HACX LINK HERE]
+Related Information: XMPP jabber:server namespace
+

+ +

The Well-known URI registry is currently located here.

+
+ +

This document requires no interaction with the ®ISTRAR;.

+
+
diff --git a/xep.ent b/xep.ent index 4a0c41e3..7a47850a 100644 --- a/xep.ent +++ b/xep.ent @@ -636,6 +636,7 @@ THE SOFTWARE. RFC 5646 RFC 5646: Tags for Identifying Languages <http://tools.ietf.org/html/rfc5646>." > RFC 5763 RFC 5763: Framework for Establishing a Secure Real-time Transport Protocol (SRTP) Security Context Using Datagram Transport Layer Security (DTLS) <http://tools.ietf.org/html/rfc5763>." > RFC 5766 RFC 5766: Traversal Using Relays around NAT (TURN): Relay Extensions to Session Traversal Utilities for NAT (STUN) <http://tools.ietf.org/html/rfc5766>." > +RFC 5785 RFC 5785: Defining Well-Known Uniform Resource Identifiers (URIs) <http://tools.ietf.org/html/rfc5785>." > RFC 5802 RFC 5802: Salted Challenge Response Authentication Mechanism (SCRAM) SASL and GSS-API Mechanisms <http://tools.ietf.org/html/rfc5802>." > RFC 5888 RFC 5888: The Session Description Protocol (SDP) Grouping Framework <http://tools.ietf.org/html/rfc5888>." > RFC 5929 RFC 5929: Channel Bindings for TLS <http://tools.ietf.org/html/rfc5929>." > @@ -663,11 +664,14 @@ THE SOFTWARE. RFC 6473 RFC 6473: vCard KIND:application <http://tools.ietf.org/html/rfc6351>." > RFC 6544 RFC 6544: TCP Candidates with Interactive Connectivity Establishment (ICE) <http://tools.ietf.org/html/rfc6544>." > RFC 6648 RFC 6648: Deprecating the X- Prefix and Similar Constructs in Application Protocols <http://tools.ietf.org/html/rfc6648>." > +RFC 6698 RFC 6698: The DNS-Based Authentication of Named Entities (DANE) Transport Layer Security (TLS) Protocol: TLSA <http://tools.ietf.org/html/rfc6698>." > RFC 6716 RFC 6716: Definition of the Opus Audio Codec <http://tools.ietf.org/html/rfc6716>." > RFC 6762 RFC 6762: Multicast DNS <http://tools.ietf.org/html/rfc6762>." > RFC 6763 RFC 6763: DNS-Based Service Discovery <http://tools.ietf.org/html/rfc6763>." > +RFC 6797 RFC 6797: HTTP Strict Transport Security (HSTS) <http://tools.ietf.org/html/rfc6797>." > RFC 6920 RFC 6920: Naming Things with Hashes <http://tools.ietf.org/html/rfc6920>." > RFC 7081 RFC 7081: CUSAX: Combined Use of the Session Initiation Protocol (SIP) and the Extensible Messaging and Presence Protocol (XMPP) <http://tools.ietf.org/html/rfc7081>." > +RFC 7469 RFC 7469: Public Key Pinning Extension for HTTP <http://tools.ietf.org/html/rfc7469>." > RFC 7519 RFC 7519: JSON Web Token (JWT) <http://tools.ietf.org/html/rfc7519>." > RFC 7572 RFC 7572: Interworking between the Session Initiation Protocol (SIP) and the Extensible Messaging and Presence Protocol (XMPP): Instant Messaging <http://tools.ietf.org/html/rfc7572>." > RFC 7590 RFC 7590: Use of Transport Layer Security (TLS) in the Extensible Messaging and Presence Protocol (XMPP) <http://tools.ietf.org/html/rfc7590>." >