Bitcoin Forum
December 01, 2026, 07:26:45 PM *
News: Latest Bitcoin Core release: 32.1 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: PSA: Tor nodes and Guards, upgrade OpenSSL to ≥v3.5 for post-quantum encryption!  (Read 14 times)
This is a self-moderated topic. If you do not want to be moderated by the person who started this topic, create a new topic.
nullius (OP)
Copper Member
Hero Member
*****
Offline

Activity: 686
Merit: 2974


Privacy is necessary & sufficient for fungibility.


View Profile WWW
Today at 06:00:00 PM
 #1

The following is expanded from an off-hand post that I made in the Wall Observer.  I post this enhanced PSA to Development & Technology Discussion, because (a) I hope that more technical users will see it here, and (b) I show the code below.  Given that Tor has been a Bitcoin tradition since Satoshi, and Bitcoin Core has built-in Tor support, I believe it is on-topic here.
[H]e [Satoshi] always used Tor, as far as I can tell.

hahahahahahahahgaha

might as well publish all your secrets now and at least maybe earn money from the book sales and movie rights

Add intercepted Tor traffic.  I’d presume that NSA must have many petabytes/exabytes/whatever of such intercepts saved in their mass-surveillance dragnet’s multibillion-dollar data-hoarding facilities.  Tor very quietly added an opportunistic upgrade last year that makes some of its network opaque to a future QC attacker; most people don’t even know about this.

PSA to all Tor relay operators, especially but not only Guards:  Please upgrade your OpenSSL to version ≥3.5 yesterday.  Any version greater than or equal to three point five.

If your Tor daemon uses system OpenSSL, that’s all it takes to obtain some opportunistic post-quantum encryption.  If your system’ package manager already gave you OpenSSL ^3.5.0 (any release from the v3.5, v3.6, v4.0, or v4.1 branches), you should already be good; the v3.5 branch is the current LTS, which I recommend for Tor relays—and which I’ve extensively tested for this feature.  If your Tor daemon statically links OpenSSL, then you surely know how to compile with a new OpenSSL version, anyway.  This also works with LibreSSL, but I don’t know off the top of my head for which minimum version.

With that upgrade, your relay should automagically use post-quantum key exchange to talk to any other Tor daemons (relays and clients) that have also done the upgrade.  This applies only to the TLS outermost layer of encryption, not to Tor circuits’ onion encryption.

Tor Browser bundles an OpenSSL with an adequate version.  (On desktop; I don’t know how Android works, but I guess it’s probably similar here (?).)  If you use Tor Browser’s bundled Tor, you should automagically use post-quantum TLS with Guards that have adequate OpenSSL.  This does nothing with Guards that don’t have an adequate OpenSSL version; with all such Guards, every layer of your Tor encryption can be retrospectively decrypted by a future attacker with a large quantum computer.

The threat model here is HNDL (aka SNDL) attacks, which are certainly in-scope for Tor.  As more and more Tor nodes upgrade, the Tor network will become increasingly opaque to HNDL attackers.  They’ll be “going dark”, as certain alphabet-soup agencies call it.



Technical information

Tor has multiple layers of encryption.  The outermost layer is TLS.  The TLS layer is outside of all the layered onion-routing encryption, which uses Tor’s own encryption protocol; inside of a single TLS connection between two Tor daemons, Tor circuit connections are multiplexed.

Commit a64db5ad (April 23, 2025, 01:13:04 PM) made Tor daemons use TLS 1.3 X25519MLKEM768 key exchange opportunistically—if and only if both sides support it.  This is hybrid post-quantum encryption; it is expected to be secure against HNDL attacks, including QC retrospective decryption, if either or both of x25519 (ECDH) and/or ML-KEM 768 (Kyber 768) is secure.  It is expected that ML-KEM 768 will remain secure against an attacker who has a large quantum computer—who would/will Shor ECDH, thus decyrpting it almost as easily as rot13.

Code: (git log)
commit a64db5adaf14b72b5eb84d1e097c080815e583aa
Author: Nick Mathewson <nickm@torproject.org>
Date:   Wed Apr 23 09:13:04 2025 -0400

    TLS: When possible, enable ML-KEM768.
   
    Closes ticket 41041.

The issue on TPO’s self-hosted Gitlab:  Could we eliminate or unrestrict our SSL_CTX_set1_groups_list() usage in Tor with OpenSSL? (#41041).  To view it, JavaScript is required. 😿  Their Gitlab has been giving HTTP 403 to Tor exits Roll Eyes, so you should view it on the official Tor Gitlab onion (and verify that it’s official).

AFAIK, the only significant user-facing announcement was in the ChangeLog, when this commit made it into an alpha for the v0.4.9 release branch:

Code: (ChangeLog)
Changes in version 0.4.9.3-alpha - 2025-09-16
  This is the third alpha release and likely the last before going stable.
  This release contains the new CGO circuit encryption. See proposal 359 for
  more details. Several TLS minor fixes which will strengthen the link
  security.

[...]

  o Minor features (security, TLS):
    - When we are running with OpenSSL 3.5.0 or later, support using the
      ML-KEM768 for post-quantum key agreement. Closes ticket 41041.

To understand wtf this actually does, see src/lib/tls/tortls_openssl.c:tor_tls_context_new().  Quoted in pertinent part from the main branch, as of the latest commit that changed this file, bdbd8adc (November 14, 2026, 07:33:28 PM), which fixed a relevant bug for some later OpenSSL releases:

Code: (src/lib/tls/tortls_openssl.c:tor_tls_context_new())
  {
    // We'd like to say something like:
    //    "?X25519MLKEM768:P-256:P-224"
    // to mean that we prefer X25519MLKEM768 if it is present;
    // but we do insist on the presence of  P-256 and P-224.
    //
    // Unfortunately, we support back to OpenSSL 3.0, which did not provide
    // any syntax for saying "don't worry if this group isn't supported."
    // Instead, we have to make this preference list of preference lists.
    static const struct {
      // Minimal version with which to try this syntax.
      // We have to restrict, since older versions of openssl
      // can misunderstand-but nonetheless accept!-syntaxes
      // supported by newer versions.  See #41058 for one example.
      long min_version;
      const char *groups;
    } group_lists[] = {
#if defined(LIBRESSL_VERSION_NUMBER)
      // LibreSSL only supports the old-style, ':'-separated syntax.
      {
        OPENSSL_V_SERIES(4,4,0),
        "X25519MLKEM768:P-256:X25519:P-224"
      },
#endif
      // We do use the ? syntax here, since every version of OpenSSL
      // that supports ML-KEM also supports the ? syntax.
      // We also use the * and / syntaxes:
      //   '*' indicates that the client should send these keyshares.
      //   "/" separates tuples of groups that are "comparably secure".
      //
      // Note that we tell the client to send a P-256 keyshare, since until
      // this commit, our servers didn't accept X25519.
      //
      // Also note that until the upstream LibreSSL bug from tor#41134 gets
      // fixed, the order of groups common between each preference list must
      // be the same. We can't prefer P-256 in one, and X25519 in another.
      {
        OPENSSL_V_SERIES(3,5,0),
        "?*X25519MLKEM768 / ?SecP256r1MLKEM768 / *P-256:?X25519:?P-224"
      },
      { OPENSSL_V_SERIES(3,5,0), "P-256:?X25519:?P-224" },
      { 0, "P-256:X25519:P-224" },
      { 0, "P-256:P-224" },
    };
    bool success = false;
#ifdef LIBRESSL_VERSION_NUMBER
    /* LibreSSL doesn't have an equivalent runtime check to
     * OpenSSL_version_num */
    long our_version = LIBRESSL_VERSION_NUMBER;
#else
    long our_version = tor_OpenSSL_version_num();
#endif
    for (unsigned j = 0; j < ARRAY_LENGTH(group_lists); ++j) {
      const char *list = group_lists[j].groups;
      if (group_lists[j].min_version > our_version) {
        log_info(LD_NET, "Not trying groups %s because of OpenSSL version.",
                 list);
        continue;
      }
      int r = (int) SSL_CTX_set1_groups_list(result->ctx, list);
      if (r == 1) {
        static bool have_logged_already = false;
        if (!have_logged_already) {
          /* say it only once at startup, since the answer won't change */
          log_notice(LD_NET, "Set list of supported TLS groups to: %s", list);
          have_logged_already = true;
        }
        success = true;
        break;
      } else {
        static bool have_warned_failure = false;
        int severity = have_warned_failure ? LOG_INFO : LOG_WARN;
        log_fn(severity, LD_NET, "OpenSSL didn't accept group list %s. "
               "Maybe upgrade? Or report a bug?", list);
        have_warned_failure = true;
      }
    }
    if (! success) {
      log_warn(LD_NET, "No lists of TLS groups were supported. "
               "Using library defaults");
    }
  }

I’ve very carefully, both theoretically and empirically verified what this actually does.  Thus far, however, almost all of my tests and experiments have been run on OpenSSL’s v3.5 (LTS) branch; I need to do more tests on the v4 branches, which have important features not in v3.5.  Some months ago, I did briefly observe what looked like a bug with this in v4, but I didn’t take the time verify it and to figure it out; I need to see if the latest patches fix it, or maybe if the apparent bug was in my own setup.

I run a Tor daemon with my own local patches;


Post-quantum encryption everywhere!

This is the zeroth in a series of posts I will make on various boards, promoting upgrades to post-quantum encryption to protect against HNDL attacks.  (The zeroth, because my thread about GnuPG is the first; I began to draft it on 2026-10-29.)  OpenSSH has had hybrid post-quantum encryption since 2022, GnuPG since 2024, OpenSSL since 2025...  What are you waiting for!?

▄▄████████████████████▄▄
▄███████▀▀██████▀▀███████▄
█████▀██████████████▀█████
████████▄▄██████▄▄████▀███
██████████████████████████
██▄▄██████████████▄▄██████
██▀▀██████████████████▄▄██
██████▀▀██████████████▀▀██
██████████████████████████
███▄████▀▀██████▀▀████████
█████▄██████████████▄█████
▀███████▄▄██████▄▄███████▀
▀▀████████████████████▀▀

 DΞX.fo 
▄▄██████
█████████
██████████
██████████
██████████
█████████
▀▀██████

▄███████
▄██████████
████████████
█████████████
█████████████
|███████▄███▄███▄███▄██
█████████▄▀█████▀▄████
███▄████████▀█▀████████▄
█████████▀███████▀██████
████████████████████████
█▄██▄▀▀▀▀▀██▄▀▄██▀▀▀▀▀▄▀
▄████▄▀▀▀██▀███▀██▀▀▀▄
████████████████████
▀███████████████████▄
█▀████████████████████▄▄
████████████████████████
████████████████████████
███▀███████████████████▀
|
nullius (OP)
Copper Member
Hero Member
*****
Offline

Activity: 686
Merit: 2974


Privacy is necessary & sufficient for fungibility.


View Profile WWW
Today at 06:01:25 PM
 #2

Reserved for a table of nullius-tested OpenSSL versions, etc. if/when I extensively test more than v3.5, and/or for other updated technical information.

▄▄████████████████████▄▄
▄███████▀▀██████▀▀███████▄
█████▀██████████████▀█████
████████▄▄██████▄▄████▀███
██████████████████████████
██▄▄██████████████▄▄██████
██▀▀██████████████████▄▄██
██████▀▀██████████████▀▀██
██████████████████████████
███▄████▀▀██████▀▀████████
█████▄██████████████▄█████
▀███████▄▄██████▄▄███████▀
▀▀████████████████████▀▀

 DΞX.fo 
▄▄██████
█████████
██████████
██████████
██████████
█████████
▀▀██████

▄███████
▄██████████
████████████
█████████████
█████████████
|███████▄███▄███▄███▄██
█████████▄▀█████▀▄████
███▄████████▀█▀████████▄
█████████▀███████▀██████
████████████████████████
█▄██▄▀▀▀▀▀██▄▀▄██▀▀▀▀▀▄▀
▄████▄▀▀▀██▀███▀██▀▀▀▄
████████████████████
▀███████████████████▄
█▀████████████████████▄▄
████████████████████████
████████████████████████
███▀███████████████████▀
|
nullius (OP)
Copper Member
Hero Member
*****
Offline

Activity: 686
Merit: 2974


Privacy is necessary & sufficient for fungibility.


View Profile WWW
Today at 06:02:01 PM
 #3

Reserved for more technical information.  (I’m just getting started here!)

▄▄████████████████████▄▄
▄███████▀▀██████▀▀███████▄
█████▀██████████████▀█████
████████▄▄██████▄▄████▀███
██████████████████████████
██▄▄██████████████▄▄██████
██▀▀██████████████████▄▄██
██████▀▀██████████████▀▀██
██████████████████████████
███▄████▀▀██████▀▀████████
█████▄██████████████▄█████
▀███████▄▄██████▄▄███████▀
▀▀████████████████████▀▀

 DΞX.fo 
▄▄██████
█████████
██████████
██████████
██████████
█████████
▀▀██████

▄███████
▄██████████
████████████
█████████████
█████████████
|███████▄███▄███▄███▄██
█████████▄▀█████▀▄████
███▄████████▀█▀████████▄
█████████▀███████▀██████
████████████████████████
█▄██▄▀▀▀▀▀██▄▀▄██▀▀▀▀▀▄▀
▄████▄▀▀▀██▀███▀██▀▀▀▄
████████████████████
▀███████████████████▄
█▀████████████████████▄▄
████████████████████████
████████████████████████
███▀███████████████████▀
|
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!