xydac

The weak TLS in my house lives in the smart plugs

5 min read

tldrThe NSA wants a post-quantum move now and certificates are shrinking to 47 days. I put a DPI agent on my OpenWrt router to see what the house really negotiates: one line per handshake, nc and jq on the router, a dashboard on the Mac.

TLS had a loud week. This week the NSA told operators of national security systems to speed up their move to post-quantum cryptography now, after frontier AI labs privately disclosed discoveries affecting some cryptography in use today; the agencies added that this is not an immediate, widespread threat. Meanwhile public certificates already max out at 200 days and drop to 100 next year and 47 in 2029.

All of that is about servers. I wanted the other side: what do the devices in my house actually negotiate?

Terminal-style dashboard: about 10,000 TLS connections, 517 sites, 90% on TLS 1.3, a TLS version bar, connections per hour, a per-device table, findings and certificate problems, with site and device names dotted out
The first night. Site and device names dotted out for this post.

Install the agent

netifyd is an open-source (GPLv3) DPI agent. It reads the first packets of every connection to work out what it is, and for TLS that means the ClientHello and ServerHello: the hostname asked for (SNI), the cipher, ALPN, a JA4 fingerprint of the client, and a list of risk flags (expired certificate, hostname mismatch, self-signed, weak cipher and so on). It never decrypts anything; it sees what any router on the path sees.

You want version 5 and two of its plugins: the core processor, which turns each flow into a JSON record, and the socket sink, which serves those records. OpenWrt’s own feed carries an older netifyd, so use Netify’s feed. On OpenWrt 24.10 (swap in your release; 25.12 uses apk):

wget https://download.netify.ai/5/openwrt/key-build.pub -O /etc/opkg/keys/b18c240cb821dad2
echo 'src/gz netify https://download.netify.ai/5/openwrt/24.10/x86' >> /etc/opkg/customfeeds.conf
opkg update
opkg install netifyd netify-proc-core netify-sink-socket jq

# flow records to a socket on 127.0.0.1 only: nothing new on the LAN, nothing to the cloud
cat > /etc/netifyd/netify-sink-socket.json <<'EOF'
{ "channels": { "tls": { "enable": true, "bind_address": "tcp://127.0.0.1:1790" } } }
EOF
cat > /etc/netifyd/netify-proc-core.json <<'EOF'
{ "format": "json", "compressor": "none",
  "sinks": { "sink-socket": { "tls": { "enable": true, "types": ["stream-flows"] } } } }
EOF

netifyd --enable-plugin proc-core
netifyd --enable-plugin sink-socket
/etc/init.d/netifyd enable && /etc/init.d/netifyd restart

Netify’s public v5 packages are x86_64 only; for an ARM or MIPS router you need a build from Netify. Peek at the stream with nc 127.0.0.1 1790 | head -c 2000: each connection produces three messages, and the last one, flow_dpi_complete, carries the ssl block and the risk IDs (netifyd --dump-risks names them).

One line per handshake

The logger is a shell script, nc and jq, nothing else on the router:

#!/bin/sh
DIR=/tmp/tlsaudit; mkdir -p "$DIR"
[ -p "$DIR/.in" ] || mkfifo "$DIR/.in"
exec 3<>"$DIR/.in"          # BusyBox nc quits when stdin closes: feed it a FIFO we hold open

FILTER='select(.type == "flow_dpi_complete" and .flow.ssl != null)
  | .flow as $f | $f.ssl as $s
  | { t: ($f.first_seen_at / 1000 | floor), mac: $f.local_mac, ip: $f.local_ip,
      sni: $s.client_sni, server: $f.other_ip, cipher: $s.cipher_suite,
      alpn: $s.alpn, ja4: $s.client_ja4, risks: ($f.risks.risks // []) }
  | "\(.t | localtime | strftime("%Y%m%d-%H")) \(tojson)"'

while true; do
  nc 127.0.0.1 1790 <&3 | jq -r --unbuffered "$FILTER" | while read -r hour line; do
    echo "$line" >> "$DIR/tls-$hour.jsonl"
  done
  sleep 10                  # agent restarted: reconnect
done

One file per hour, roughly 250 bytes a connection, in RAM. I run it as a procd service.

Once an hour, cron uploads the finished file with curl to an FTP server on my Mac that my cameras already upload snapshots to, and deletes anything older than two days.

The dashboard

On the Mac, the files are just JSON lines, so the dashboard is standard-library Python. This is the heart of it: read every hour, work out the real TLS version, roll it up per device, serve it as JSON on localhost.

import glob, json
from collections import Counter, defaultdict
from http.server import BaseHTTPRequestHandler, HTTPServer

INBOX = "ftp-incoming/router-tls"

def tls_version(r):
    c = r.get("cipher", "0x0000")
    if c.startswith("0x13"):
        return "TLS 1.3"      # these suites only exist in 1.3
    return "not seen" if c == "0x0000" else "TLS 1.2 or older"

def insights():
    rows = [json.loads(l) for f in glob.glob(f"{INBOX}/tls-*.jsonl") for l in open(f)]
    devices = defaultdict(Counter)
    for r in rows:
        devices[r["mac"]][tls_version(r)] += 1
    return {
        "connections": len(rows),
        "versions": Counter(tls_version(r) for r in rows),
        "devices": devices,
        "findings": Counter(x for r in rows for x in r.get("risks", [])),
    }

class Page(BaseHTTPRequestHandler):
    def do_GET(self):
        body = json.dumps(insights()).encode()
        self.send_response(200)
        self.send_header("Content-Type", "application/json")
        self.end_headers()
        self.wfile.write(body)

HTTPServer(("127.0.0.1", 2298), Page).serve_forever()

Everything (logger, push script, procd service, dashboard) is in this gist.

What the first night said

About 10,000 TLS connections from 16 devices to 517 sites, between midnight and 9 a.m.

  • TLS 1.3 almost everywhere it could be seen. 90% of visible handshakes. Most of the TLS 1.2 remainder used modern ECDHE ciphers; the exceptions were all smart-home gadgets.
  • A lot of the traffic was invisible. 43% of connections showed no ServerHello at all: QUIC, where even the handshake is encrypted, or handshakes that never finished. Another 992 used Encrypted Client Hello, so the router could not see the hostname either.
  • The certificate problems all live in the IoT corner. TLS 1.3 encrypts the server certificate, so only 416 connections (42 servers) showed one. Laptops and phones were clean. The flags went to three smart plugs talking to a legacy vendor API with an expired certificate, plus a vendor-run CA with an over-long validity; a security camera reaching its cloud by bare IP, with a certificate that doesn’t match and expires soon; and a robot vacuum that opened one TLS 1.0 connection. The plugs and the vacuum also used plain RSA key exchange, with no forward secrecy.
  • The rest of the risk flags are mostly noise. “Unidirectional traffic” and “no ALPN” fire constantly on normal background services.

One gotcha worth knowing if you read netifyd output: its version field is the legacy record version, so every TLS 1.3 connection reports 0x0303 (TLS 1.2). The real tell is the cipher: anything 0x13xx only exists in TLS 1.3.

What it can’t tell me yet

The question the NSA news actually raises, how many of these connections already use a post-quantum hybrid key exchange like X25519MLKEM768, is the one this setup can’t answer: netifyd doesn’t report the negotiated key-exchange group. That’s the next thing to dig into. And the passive view has a ceiling: as QUIC and ECH spread, the router sees less every month, which is good for privacy and the whole point.

A log of every site every device talks to is a surveillance tool, even at home. Mine stays on the LAN, the dashboard listens on localhost only, and the router forgets after two days.