Bug#1134814: openssh-client: Segfault in identity_sign at sshconnect2.c:1418 when using RSA certificates

Alejandro E BM <[email protected]> Fri, 24 Apr 2026 14:09:12 +0200
Newsgroups gmane.linux.debian.devel.ssh
Message-ID <CABv869Eqd5rO28qgG9vNsXENdvO=qEE6Yn4iAwck=i9+FU+sUQ__651.867529244043$1777032686$gmane$org@mail.gmail.com>
Package: openssh-client
Version: 1:10.3p1-1
Severity: important
Tags: patch

Dear Maintainer,

I encountered a consistent segmentation fault in the ssh client when
attempting
to authenticate using RSA certificates against a server that supports
the [email protected] extension.

The crash occurs in sshconnect2.c within the identity_sign() function.
Specifically, at line 1418, the code attempts to check id->key->flags
without verifying that id->key is not NULL. In my testing with GDB,
id->key was indeed NULL at this stage, leading to a null pointer
dereference.

GDB Backtrace summary:
#0  identity_sign (id=0x55..., sigp=0x..., lenp=0x..., data=0x...,
datalen=2080,
    compat=67108864, alg=0x55... "[email protected]")
    at ../../sshconnect2.c:1418

(gdb) print *id
$1 = { ..., key = 0x0, filename = "/root/.ssh/pkey", tried = 1, ... }

Here is a patch that adds a NULL check for id->key before
dereferencing it, which resolved the issue in my environment.

Patch

--- sshconnect2.c.orig  2026-04-24 12:04:24.468317131 +0000
+++ sshconnect2.c       2026-04-24 11:22:28.606107940 +0000
@@ -1415,7 +1415,7 @@
         * PKCS#11 tokens may not support all signature algorithms,
         * so check what we get back.
         */
-       if ((id->key->flags & SSHKEY_FLAG_EXT) != 0 &&
+       if (id->key != NULL && (id->key->flags & SSHKEY_FLAG_EXT) != 0 &&
            (r = sshkey_check_sigtype(*sigp, *lenp, alg)) != 0) {
                debug_fr(r, "sshkey_check_sigtype");
                goto out;

-- System Information:
Debian Release: 14 (forky)
Architecture: amd64
Kernel: 6.19.11+deb14-amd64



Cheer Alejandro