You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[crypto] TLS client authenticates nothing: no cert/SKE signature checks, server Finished accepted blind #1061
The TLS 1.2 client (lib/std/tls.w, 832 lines) performs no
authentication at any step: it never verifies the certificate chain
or signatures, never checks the ServerKeyExchange signature, and
accepts the server Finished without comparing verify_data. A
network MITM can substitute keys and handshake content undetected;
the result is encryption without authentication. Reachable today
via lib/std/http.w:174 (tls_connect on the https path).
Evidence (complete 832-line read at 450733e; omission is total)
Zero calls to x509_verify_signature, rsa_pkcs1_sha256_verify, ecdsa_p256_verify, or any signature check exist in tls.w
(grep-verified). tls_recv_server_handshake (:536-619)
extracts the EC point (:592-601) and ECDHE point (:603-613)
from wire bytes with no signature validation; RSA suites never
even load the cert key.
tls_recv_server_finish (:747-774): // Could verify server's verify_data here, but for MVP just accept (:773) — returns 0
after type/length checks only. This is precisely the check that
detects handshake tampering/downgrade.
What DOES work (executed, so this is not a broken-crypto
report): PRF verified byte-exact over 100 bytes against an
independent python P_SHA256 oracle (.audit/probes/tls/prf.w);
AES-GCM/SHA-256/HMAC/ECDSA-verify paths verified in their own
module audits. The primitives are correct; they are just never
asked to authenticate the peer.
Notes (not applied; audit is read-only)
Verify the chain (x509_verify_signature against a trust store),
verify the ServerKeyExchange signature with the cert key before
using the ECDHE point, and compare server verify_data. Until
then, any user of the https path should treat the connection as
unauthenticated. Suggested regression: handshake against a local
TLS stub that tampers SKE/Finished must fail.
Verdict. Established by exhaustive source reading and grep: the TLS 1.2 client performs no peer authentication. It parses the server certificate but never verifies the chain or any signature, never checks the ServerKeyExchange signature before using the server's EC/ECDHE point, and accepts the server Finished without comparing verify_data. The result is encryption without authentication — a network MITM can substitute keys and tamper handshake content undetected. Reachable today from the pub https path. This is a documentation-of-absence security claim; the absence of every verification call is grep-provable and the "just accept" is an explicit source comment, so source evidence is authoritative and a live MITM is not required to establish it.
Tested.
Source
main @ 5809ac1 (2026-09-14); lib/std/tls.w (832 lines) and http.w unchanged since the reported revision 450733e
Compiler
with v0.15.2.1 built from 5809ac1 (staging worktree)
Platform
macOS Darwin 25.6.0 arm64
Evidence.
tls.w imports std.crypto.x509 and std.crypto.ecdsa (:12-13), but the only call into either is x509_parse at :590 — a parse that extracts the key/point. Grep for x509_verify_signature, rsa_pkcs1_sha256_verify, ecdsa_p256_verify, or any _verify/check_pkcs call in tls.w returns nothing. So the certificate is parsed and its key used, never validated against a trust store, and the ServerKeyExchange signature over the EC/ECDHE parameters is never checked before the point is consumed.
tls_recv_server_finish (:747-774) checks only the record type, length, and that byte 0 is HS_FINISHED, then: // Could verify server's verify_data here, but for MVP just accept and return 0 (:773-774). That comparison is exactly the check that detects handshake tampering and downgrade.
Reachability: http_get/https calls tls_connect(parsed.host, parsed.port) at lib/std/http.w:174, so any https fetch uses this unauthenticated handshake.
On the primitives. This is not a broken-crypto report — the client's own Finished verify_data is computed via tls_prf_sha256 (:709-727), and AES-GCM/SHA-256/HMAC exist and work. My separate reviews of the verification primitives found them present but individually defective (#1056 x509 DER bounds, #1057 ecdsa DoS, #1051/#1052 RSA sizing), and here they are simply never invoked to authenticate the peer. So even the primitives that would be called need repair first.
Root cause. Deliberate MVP scope: the code comments mark the Finished check as skipped "for MVP." That intent does not make it safe to ship: a pub https client that authenticates nothing is a security defect, because callers of http_get over https:// reasonably assume authentication. No compiler involvement.
Severity. Critical for anyone using the https path against an untrusted network: TLS without peer authentication is equivalent to plaintext against an active attacker. It should be treated as urgent and likely warrants a maintainer decision on gating the path.
Validator gap. No test drives the handshake against a tampering server, so the omission is invisible in CI (and, per #1053/#1055, the crypto suites do not run anyway).
Related.#1056/#1057/#1051/#1052 (the verification primitives this client should call, each with its own defect). No open PR adds TLS authentication.
Recommendation — champion, urgent. Until authentication lands, the https path should fail closed or emit a prominent unauthenticated-connection warning rather than silently returning an encrypted-but-unauthenticated channel. The full fix: (1) verify the certificate chain to a trust store via x509_verify_signature (after #1056 is fixed); (2) verify the ServerKeyExchange signature with the cert key before using the ECDHE point; (3) compare the server Finished verify_data against the locally computed PRF output. Acceptance criteria:
A handshake against a stub server that tampers the ServerKeyExchange or the Finished must fail.
A handshake presenting a cert not chaining to the trust store must fail.
A regression test exercises all three failures and a clean success against a known-good local server.
Blockers / not tested. I did not stand up a live MITM/tampering TLS server; the defect is the provable absence of any verification call plus the explicit skip comment, which is conclusive from source. The verification functions this client would call are themselves defective per the linked issues. Linux/Windows not exercised.
Triage 2026-10-25, with v0.15.3.0 (main a261b65): reproduced in source. lib/std/tls.w and lib/std/http.w contain no call to any certificate, chain or signature verifier (no x509_verify, ecdsa_verify, rsa_*verify or server-Finished comparison); the client computes its own verify_data (tls.w:708-726) and never checks the server's.
pre-release: every https request through std.http is unauthenticated with no warning. If verification is too large for the release, the loud alternative is for tls_connect to refuse until it lands.
Fix campaign 2026-10-25: flagged human attn needed. The fix needs a trust-anchor decision and spans several changes.
What is proved. The primitives exist: x509_verify_signature (lib/std/crypto/x509.w:359; RSA PKCS#1 SHA-256 and ECDSA P-256), rsa_pkcs1_sha256_verify and ecdsa_p256_verify. lib/std/tls.w calls none of them. It skips chain validation, skips the ServerKeyExchange signature check, and does not compare the server's Finished verify_data (tls_recv_server_finish: "for MVP just accept"). The Finished and SKE checks are mechanical. Chain validation is not: a chain verifies to some root, and std has no roots.
Brief.
Others. Go: crypto/x509 reads the platform store (root_darwin.go uses the Security framework; Linux reads the distro bundle files; Windows uses CryptoAPI). Zig: std.crypto.Certificate.Bundle rescans the OS store at run time (Bundle/macos.zig parses the keychain files directly; Linux bundle paths). Rust: rustls takes the trust store from the caller, webpki-roots (a compiled-in Mozilla list) or rustls-native-certs (the OS store).
Spec.libstd-spec.md lists tls with no word on authentication or trust anchors. Nothing rules which roots std trusts.
Mission fit. "Exactly as safe as Rust": an https client that authenticates nothing is below that bar. The With-y default verifies against the OS store with no configuration, the way with get verifies archives without asking. Zero dependencies favors reading the store as Zig does (no foreign library) over linking the platform's TLS stack.
Prediction (75%). Eric rules that the OS trust store is read in With, as Zig does, and that hostname and chain checks are always on. An explicit opt-in remains for a pinned or self-signed peer, and no silent fallback to unauthenticated is allowed.
Narrowest question. Which trust anchors does std.tls verify against: the OS store read by std (per-platform parsers), a compiled-in Mozilla bundle (an update cadence), or roots the caller supplies?
Work once that is answered: (1) verify the server Finished, (2) verify the SKE signature with the leaf key, (3) the chain plus hostname (SAN) against the ruled anchors, (4) a local stub peer that tampers each step and must fail. Left on do-before-release.
Phase-3 fix campaign, 2026-10-26: re-verified in source on current main (dee141b79) — lib/std/tls.w still calls no certificate, chain, SKE-signature or server-Finished verifier; tls_recv_server_finish still ends "for MVP just accept". It stays human attn needed on do-before-release. What the phase-3 assessment adds:
Even the mechanical half (server Finished, SKE signature) is not safely landable today: no fixture in the tree completes a real TLS 1.2 handshake (behav_1062's stub dies at ServerHello; the https UATs ride libcurl, not std.tls), so a handshake change here is unverifiable without first building a TLS server stub lane. A wrong change breaks every https fetch, with get included, in ways only a real peer shows.
SKE verification must cover both offered suites or refuse the unverifiable one; the ECDSA cert point is extracted, the RSA cert key is not yet plumbed out of the x509 parse.
Chain + hostname still need the trust-anchor ruling from the 2026-10-25 brief (prediction 75%: the OS store, read by std as Zig does).
Narrowest next step once anchors are ruled: build the local TLS stub peer fixture first (tamper Finished, SKE signature, chain and hostname, each must fail), then land all four checks behind it.
TLS now authenticates the peer: trust anchors read from the OS store in With (Security.framework on macOS, system CA paths on Linux, crypt32 ROOT store on Windows), chain building to an anchor (incl. mid-flight cross-signs), hostname verification, ServerKeyExchange signature and Finished verification, SHA-384/512 + P-384 suites. The stub TLS peer tampers each step in tests.
Live evidence: example.com returns 200; badssl wrong-host, self-signed and expired are refused. with get first-download now rides an authenticated channel.
Noted limits: Windows live run is blocked by #2759 (win10 bootstrap, pre-existing); RSA-PSS/Ed25519 certificates refuse loudly; path-length/AKI-SKI constraints not yet enforced.
Activity
ehartford commentedon Sep 16, 2026
Review: reproduced
Verdict. Established by exhaustive source reading and grep: the TLS 1.2 client performs no peer authentication. It parses the server certificate but never verifies the chain or any signature, never checks the ServerKeyExchange signature before using the server's EC/ECDHE point, and accepts the server Finished without comparing
verify_data. The result is encryption without authentication — a network MITM can substitute keys and tamper handshake content undetected. Reachable today from thepubhttps path. This is a documentation-of-absence security claim; the absence of every verification call is grep-provable and the "just accept" is an explicit source comment, so source evidence is authoritative and a live MITM is not required to establish it.Tested.
main@ 5809ac1 (2026-09-14);lib/std/tls.w(832 lines) andhttp.wunchanged since the reported revision 450733ewith v0.15.2.1built from 5809ac1 (staging worktree)Evidence.
tls.wimportsstd.crypto.x509andstd.crypto.ecdsa(:12-13), but the only call into either isx509_parseat:590— a parse that extracts the key/point. Grep forx509_verify_signature,rsa_pkcs1_sha256_verify,ecdsa_p256_verify, or any_verify/check_pkcscall intls.wreturns nothing. So the certificate is parsed and its key used, never validated against a trust store, and the ServerKeyExchange signature over the EC/ECDHE parameters is never checked before the point is consumed.tls_recv_server_finish(:747-774) checks only the record type, length, and that byte 0 isHS_FINISHED, then:// Could verify server's verify_data here, but for MVP just acceptandreturn 0(:773-774). That comparison is exactly the check that detects handshake tampering and downgrade.http_get/https callstls_connect(parsed.host, parsed.port)atlib/std/http.w:174, so any https fetch uses this unauthenticated handshake.On the primitives. This is not a broken-crypto report — the client's own Finished
verify_datais computed viatls_prf_sha256(:709-727), and AES-GCM/SHA-256/HMAC exist and work. My separate reviews of the verification primitives found them present but individually defective (#1056 x509 DER bounds, #1057 ecdsa DoS, #1051/#1052 RSA sizing), and here they are simply never invoked to authenticate the peer. So even the primitives that would be called need repair first.Root cause. Deliberate MVP scope: the code comments mark the Finished check as skipped "for MVP." That intent does not make it safe to ship: a
pubhttps client that authenticates nothing is a security defect, because callers ofhttp_getoverhttps://reasonably assume authentication. No compiler involvement.Severity. Critical for anyone using the https path against an untrusted network: TLS without peer authentication is equivalent to plaintext against an active attacker. It should be treated as urgent and likely warrants a maintainer decision on gating the path.
Validator gap. No test drives the handshake against a tampering server, so the omission is invisible in CI (and, per #1053/#1055, the crypto suites do not run anyway).
Related. #1056/#1057/#1051/#1052 (the verification primitives this client should call, each with its own defect). No open PR adds TLS authentication.
Recommendation — champion, urgent. Until authentication lands, the https path should fail closed or emit a prominent unauthenticated-connection warning rather than silently returning an encrypted-but-unauthenticated channel. The full fix: (1) verify the certificate chain to a trust store via
x509_verify_signature(after #1056 is fixed); (2) verify the ServerKeyExchange signature with the cert key before using the ECDHE point; (3) compare the server Finishedverify_dataagainst the locally computed PRF output. Acceptance criteria:Blockers / not tested. I did not stand up a live MITM/tampering TLS server; the defect is the provable absence of any verification call plus the explicit skip comment, which is conclusive from source. The verification functions this client would call are themselves defective per the linked issues. Linux/Windows not exercised.
ehartford commentedon Oct 25, 2026
Triage 2026-10-25,
with v0.15.3.0(main a261b65): reproduced in source.lib/std/tls.wandlib/std/http.wcontain no call to any certificate, chain or signature verifier (nox509_verify,ecdsa_verify,rsa_*verifyor server-Finished comparison); the client computes its ownverify_data(tls.w:708-726) and never checks the server's.pre-release: every
httpsrequest throughstd.httpis unauthenticated with no warning. If verification is too large for the release, the loud alternative is fortls_connectto refuse until it lands.ehartford commentedon Oct 25, 2026
Fix campaign 2026-10-25: flagged
human attn needed. The fix needs a trust-anchor decision and spans several changes.What is proved. The primitives exist:
x509_verify_signature(lib/std/crypto/x509.w:359; RSA PKCS#1 SHA-256 and ECDSA P-256),rsa_pkcs1_sha256_verifyandecdsa_p256_verify.lib/std/tls.wcalls none of them. It skips chain validation, skips the ServerKeyExchange signature check, and does not compare the server's Finishedverify_data(tls_recv_server_finish: "for MVP just accept"). The Finished and SKE checks are mechanical. Chain validation is not: a chain verifies to some root, and std has no roots.Brief.
crypto/x509reads the platform store (root_darwin.gouses the Security framework; Linux reads the distro bundle files; Windows uses CryptoAPI). Zig:std.crypto.Certificate.Bundlerescans the OS store at run time (Bundle/macos.zigparses the keychain files directly; Linux bundle paths). Rust: rustls takes the trust store from the caller,webpki-roots(a compiled-in Mozilla list) orrustls-native-certs(the OS store).libstd-spec.mdliststlswith no word on authentication or trust anchors. Nothing rules which roots std trusts.with getverifies archives without asking. Zero dependencies favors reading the store as Zig does (no foreign library) over linking the platform's TLS stack.Narrowest question. Which trust anchors does
std.tlsverify against: the OS store read by std (per-platform parsers), a compiled-in Mozilla bundle (an update cadence), or roots the caller supplies?Work once that is answered: (1) verify the server Finished, (2) verify the SKE signature with the leaf key, (3) the chain plus hostname (SAN) against the ruled anchors, (4) a local stub peer that tampers each step and must fail. Left on
do-before-release.std.crypto.x509: an ECDSA r or s longer than 32 bytes is not a signat…
ehartford commentedon Oct 27, 2026
Phase-3 fix campaign, 2026-10-26: re-verified in source on current main (
dee141b79) —lib/std/tls.wstill calls no certificate, chain, SKE-signature or server-Finished verifier;tls_recv_server_finishstill ends "for MVP just accept". It stayshuman attn neededondo-before-release. What the phase-3 assessment adds:with getincluded, in ways only a real peer shows.Narrowest next step once anchors are ruled: build the local TLS stub peer fixture first (tamper Finished, SKE signature, chain and hostname, each must fail), then land all four checks behind it.
fix 1061 (#2762)
ehartford commentedon Oct 28, 2026
Fixed by #2762 (9b802fb), battery-green on 4062c27 and merged.
TLS now authenticates the peer: trust anchors read from the OS store in With (Security.framework on macOS, system CA paths on Linux, crypt32 ROOT store on Windows), chain building to an anchor (incl. mid-flight cross-signs), hostname verification, ServerKeyExchange signature and Finished verification, SHA-384/512 + P-384 suites. The stub TLS peer tampers each step in tests.
Live evidence: example.com returns 200; badssl wrong-host, self-signed and expired are refused.
with getfirst-download now rides an authenticated channel.Noted limits: Windows live run is blocked by #2759 (win10 bootstrap, pre-existing); RSA-PSS/Ed25519 certificates refuse loudly; path-length/AKI-SKI constraints not yet enforced.
Windows battery fixes; the root module keeps its spelling (#2788, #809,