Skip to content

[Go 1.18] CVE-2026-39832: ssh/agent: reject keys with unsupported confirm constraint - #14

Open
Atharva-Shinde wants to merge 1 commit into
openshift-sustaining:sustaining-v0.24.0from
Atharva-Shinde:sustaining-v0.24.0
Open

[Go 1.18] CVE-2026-39832: ssh/agent: reject keys with unsupported confirm constraint#14
Atharva-Shinde wants to merge 1 commit into
openshift-sustaining:sustaining-v0.24.0from
Atharva-Shinde:sustaining-v0.24.0

Conversation

@Atharva-Shinde

@Atharva-Shinde Atharva-Shinde commented Jul 31, 2026

Copy link
Copy Markdown

Process

# branch_setup.py — checked out upstream/sustaining-v0.24.0
# git am failed — patch context mismatch, user resolved manually

Conflicts

  • ssh/agent/keyring.go: Patch expected ConstraintExtensions rejection check to already exist — v0.24.0 does not have it. User applied ConfirmBeforeUse check manually.
  • ssh/agent/keyring_test.go: Patch expected TestAddKeyWithConstraintExtensions test — not present in v0.24.0. User added new test manually.
  • ssh/test/agent_unix_test.go: Context mismatch at line 24 — user resolved manually.

Patch Source

https://go-review.googlesource.com/changes/crypto~778642/revisions/3/patch?download&raw

v0.24.0-GO-2026-5006-0.patch

Verification

Runtime gates: none

Unit tests output
crypto git:(sustaining-v0.24.0) go test ./...
# golang.org/x/crypto/ssh
ssh/server_test.go:12:2: package slices is not in GOROOT (/Users/atharva/.gvm/gos/go1.18/src/slices)
FAIL    golang.org/x/crypto/ssh [setup failed]
# golang.org/x/crypto/internal/testenv
internal/testenv/exec.go:96:30: undefined: Sigquit
# golang.org/x/crypto/sha3 [golang.org/x/crypto/sha3.test]
sha3/xor.go:25:10: undefined: subtle.XORBytes
ok      golang.org/x/crypto/acme        14.340s
ok      golang.org/x/crypto/acme/autocert       5.980s
?       golang.org/x/crypto/acme/autocert/internal/acmetest  [no test files]
?       golang.org/x/crypto/acme/internal/acmeprobe [no test files]
ok      golang.org/x/crypto/argon2      0.561s
ok      golang.org/x/crypto/bcrypt      2.314s
ok      golang.org/x/crypto/blake2b     3.153s
ok      golang.org/x/crypto/blake2s     2.721s
ok      golang.org/x/crypto/blowfish    1.418s
ok      golang.org/x/crypto/bn256       3.664s
ok      golang.org/x/crypto/cast5       2.478s
ok      golang.org/x/crypto/chacha20    2.281s
ok      golang.org/x/crypto/chacha20poly1305    4.018s
ok      golang.org/x/crypto/cryptobyte  4.469s
?       golang.org/x/crypto/cryptobyte/asn1     [no test files]
ok      golang.org/x/crypto/curve25519  4.912s
ok      golang.org/x/crypto/curve25519/internal/field6.738s
ok      golang.org/x/crypto/ed25519     6.181s
ok      golang.org/x/crypto/hkdf        5.746s
ok      golang.org/x/crypto/internal/alias      5.345s
ok      golang.org/x/crypto/internal/poly1305   5.754s
ok      golang.org/x/crypto/internal/wycheproof 7.662s
ok      golang.org/x/crypto/md4 6.164s
ok      golang.org/x/crypto/nacl/auth   6.745s
ok      golang.org/x/crypto/nacl/box    6.079s
ok      golang.org/x/crypto/nacl/secretbox      6.124s
ok      golang.org/x/crypto/nacl/sign   6.127s
ok      golang.org/x/crypto/ocsp        6.146s
ok      golang.org/x/crypto/openpgp     6.747s
ok      golang.org/x/crypto/openpgp/armor       5.230s
ok      golang.org/x/crypto/openpgp/clearsign   10.474s
ok      golang.org/x/crypto/openpgp/elgamal     5.761s
ok      golang.org/x/crypto/openpgp/packet      5.714s
ok      golang.org/x/crypto/openpgp/s2k 7.039s
ok      golang.org/x/crypto/otr 5.360s
ok      golang.org/x/crypto/pbkdf2      4.987s
ok      golang.org/x/crypto/pkcs12      5.235s
ok      golang.org/x/crypto/pkcs12/internal/rc2 5.439s
ok      golang.org/x/crypto/ripemd160   5.804s
ok      golang.org/x/crypto/salsa20     5.749s
ok      golang.org/x/crypto/salsa20/salsa       5.658s
ok      golang.org/x/crypto/scrypt      5.336s
FAIL    golang.org/x/crypto/sha3 [build failed]
--- FAIL: TestAgent (0.03s)
    client_test.go:150: insert(*dsa.PrivateKey): agent: failure
--- FAIL: TestLockOpenSSHAgent (0.02s)
    client_test.go:461: Add: agent: failure
    client_test.go:466: Want 2 keys, got [ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCe6jMoy1xCQgiZkZJ7gi6NLj4uRqz2OaUGK/OJYZTfBqK+SlS9iymAluHu9K+cc4+0qxx0gn7dRTJWINSgzvca6ayYe995EKgD1hE5krh9BH0bRrXB+hGqyslcZOgLNO+v8jYojClQbRtET2tS+xb4k33GCuL5wgla2790ZgOQgs7huQUjG0S8c1W+EYt6fI4cWE/DeEBnv9sqryS8rOb0PbM6WUd7XBadwySFWYQUX0ei56GNt12Z4gADEGlFQV/OnV0PvnTcAMGUl0rfToPgJ4jgogWKoTVWuZ9wyA/x+2LRLRvgm2a969ig937/AH0i0Wq+FzqfK7EXQ99Yf5K/ comment 1]
    client_test.go:507: Want 1 keys, got []
2026/07/31 11:43:42 agent 23: agent: incorrect passphrase
2026/07/31 11:43:42 agent 25: agent: confirm before use constraint is not supported
FAIL
FAIL    golang.org/x/crypto/ssh/agent   4.935s
ok      golang.org/x/crypto/ssh/internal/bcrypt_pbkdf5.219s
ok      golang.org/x/crypto/ssh/knownhosts      5.078s
FAIL    golang.org/x/crypto/ssh/test [build failed]
ok      golang.org/x/crypto/tea 4.627s
ok      golang.org/x/crypto/twofish     5.001s
ok      golang.org/x/crypto/x509roots/nss       4.987s
ok      golang.org/x/crypto/xtea        5.091s
ok      golang.org/x/crypto/xts 5.439s

The in-memory keyring supports the "lifetime" constraint but does not
implement the "confirm" constraint. Previously, keyring.Add silently
ignored ConfirmBeforeUse: the key was stored, advertised through List,
and used for signing without any interactive confirmation, potentially
misleading callers into believing this security measure was enforced.

Return an error when ConfirmBeforeUse is set instead of silently
downgrading the caller's security expectations. Implementing real
confirm-before-use in an in-memory library keyring is infeasible (there
is no UI or confirmation callback), so failing closed is the correct
behavior; adding actual confirm support would require an API addition
and is out of scope.

This is a deliberate behavior change: keyring.Add previously accepted
and ignored ConfirmBeforeUse and now returns an error. This change also
updates the keyring doc comments to document the supported constraints.

This issue was found during a security audit by NCC Group Cryptography
Services, sponsored by Teleport.

Fixes CVE-2026-39833
Updates golang/go#47533
Fixes golang/go#79436

Change-Id: I1b3a286f0c1e4a4e08ac37109f7e491692ca90ae
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/778642
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Neal Patel <nealpatel@google.com>
Reviewed-by: Neal Patel <neal@golang.org>
Auto-Submit: Neal Patel <nealpatel@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants