new file mode 100644
@@ -0,0 +1,769 @@
+From a0374bc1ac436b76be172506c48485b3d32e019e Mon Sep 17 00:00:00 2001
+From: Jeff Forcier <jeff@bitprophet.org>
+Date: Sun, 15 Feb 2026 16:11:44 -0500
+Subject: [PATCH] Remove SHA1 support from RSA key handling
+
+CVE: CVE-2026-44405
+Upstream-Status: Backport [https://github.com/paramiko/paramiko/commit/a4489456b6f65281e172380cc4826cee5e851dbb]
+
+Backport Changes:
+- Omit the sites/www/changelog.rst hunk because the file is absent from
+ the Paramiko 4.0.0 PyPI source archive.
+
+Signed-off-by: Ashishkumar Parmar <asparmar@cisco.com>
+---
+ paramiko/auth_handler.py | 6 ++++
+ paramiko/client.py | 26 ++++++++++++++++
+ paramiko/config.py | 1 +
+ paramiko/rsakey.py | 15 ++++++----
+ paramiko/sftp_server.py | 4 +++
+ paramiko/transport.py | 34 +++++++++++++++------
+ tests/_util.py | 39 ++----------------------
+ tests/auth.py | 41 +++++++++++++++----------
+ tests/test_client.py | 65 +++++++++++++---------------------------
+ tests/test_pkey.py | 8 ++---
+ tests/test_transport.py | 28 ++++++-----------
+ 11 files changed, 131 insertions(+), 136 deletions(-)
+
+diff --git a/paramiko/auth_handler.py b/paramiko/auth_handler.py
+index bc7f298f..c197cc7c 100644
+--- a/paramiko/auth_handler.py
++++ b/paramiko/auth_handler.py
+@@ -614,7 +614,13 @@ Error Message: {}
+ # NOTE: server never wants to guess a client's algo, they're
+ # telling us directly. No need for _finalize_pubkey_algorithm
+ # anywhere in this flow.
++ # TODO: ok is this a spot where it can say a SHA2 dealie in some
++ # fields but still ssh-rsa within the pubkey blob part?
++ # TODO: ok so this would be rsa-sha2-256 or w/e, if this field says
++ # ssh-rsa the request can get stuffed.
+ algorithm = m.get_text()
++ # TODO: This part would, if deconstructed, still be allowed to have
++ # "ssh-rsa" in its first field.
+ keyblob = m.get_binary()
+ try:
+ key = self._generate_key_from_request(algorithm, keyblob)
+diff --git a/paramiko/client.py b/paramiko/client.py
+index 1f674a92..73acfc67 100644
+--- a/paramiko/client.py
++++ b/paramiko/client.py
+@@ -439,10 +439,32 @@ class SSHClient(ClosingContextManager):
+
+ our_server_keys = self._system_host_keys.get(server_hostkey_name)
+ if our_server_keys is None:
++ # TODO: this is getting us the test suite _test_connection host key
++ # setup by virtue of that code doing tc.get_host_keys().add() (that
++ # method wraps self._host_keys)
++ # TODO: it should be analogous to running paramiko w/ a
++ # ~/.ssh/known_hosts file
+ our_server_keys = self._host_keys.get(server_hostkey_name)
+ if our_server_keys is not None:
++ # TODO: keytype needs to turn into one of the rsa-sha2 keys if it's
++ # an RSAKey.
++ # TODO: where is the equivalent on our server-side? hopefully the
++ # tests exercise that lol
++ # TODO: also, is it just me or does this [0] mean we literally do
++ # not actually implement real HostKeyAlgorithms agreement like
++ # ssh.c does?! eesh
+ keytype = our_server_keys.keys()[0]
+ sec_opts = t.get_security_options()
++ # TODO: clean this up a bit, but it does help some tests pass!
++ if keytype == "ssh-rsa":
++ if "rsa-sha2-512" in sec_opts.key_types:
++ keytype = "rsa-sha2-512"
++ elif "rsa-sha2-256" in sec_opts.key_types:
++ keytype = "rsa-sha2-256"
++ else:
++ raise Exception(
++ "TODO: REPLACEME with appropriate exception for 'what even is this key type in your known_hosts files?'"
++ )
+ other_types = [x for x in sec_opts.key_types if x != keytype]
+ sec_opts.key_types = [keytype] + other_types
+
+@@ -459,6 +481,10 @@ class SSHClient(ClosingContextManager):
+ self, server_hostkey_name, server_key
+ )
+ else:
++ # TODO: this should 'just work' but dblcheck (HostKeys will be
++ # offering an ssh-rsa-via-sha2 key as "ssh-rsa" still, and the
++ # key would be RSAKey whose .get_name would still say
++ # "ssh-rsa")
+ our_key = our_server_keys.get(server_key.get_name())
+ if our_key != server_key:
+ if our_key is None:
+diff --git a/paramiko/config.py b/paramiko/config.py
+index 8ab55c64..95e84052 100644
+--- a/paramiko/config.py
++++ b/paramiko/config.py
+@@ -446,6 +446,7 @@ class SSHConfig:
+ # The actual tokens!
+ replacements = {
+ # TODO: %%???
++ # TODO: sha1 bad / this is offspec from rfc/openssh
+ "%C": sha1(tohash.encode()).hexdigest(),
+ "%d": homedir,
+ "%h": configured_hostname,
+diff --git a/paramiko/rsakey.py b/paramiko/rsakey.py
+index b7ad3ce2..a254b81e 100644
+--- a/paramiko/rsakey.py
++++ b/paramiko/rsakey.py
+@@ -38,8 +38,6 @@ class RSAKey(PKey):
+
+ name = "ssh-rsa"
+ HASHES = {
+- "ssh-rsa": hashes.SHA1,
+- "ssh-rsa-cert-v01@openssh.com": hashes.SHA1,
+ "rsa-sha2-256": hashes.SHA256,
+ "rsa-sha2-256-cert-v01@openssh.com": hashes.SHA256,
+ "rsa-sha2-512": hashes.SHA512,
+@@ -81,7 +79,14 @@ class RSAKey(PKey):
+
+ @classmethod
+ def identifiers(cls):
+- return list(cls.HASHES.keys())
++ # NOTE: we no longer want to have ssh-rsa+SHA1 in HASHES but we still
++ # need to advertise we can be used to read ssh-rsa keys (w/ assumption
++ # other parts of system will enforce the use of SHA2 signing algos).
++ # Thus, just say so here.
++ return list(cls.HASHES.keys()) + [
++ "ssh-rsa",
++ "ssh-rsa-cert-v01@openssh.com",
++ ]
+
+ @property
+ def size(self):
+@@ -125,8 +130,8 @@ class RSAKey(PKey):
+ sig = self.key.sign(
+ data,
+ padding=padding.PKCS1v15(),
+- # HASHES being just a map from long identifier to either SHA1 or
+- # SHA256 - cert'ness is not truly relevant.
++ # HASHES being just a map from long identifier to algo; cert'ness
++ # is not truly relevant.
+ algorithm=self.HASHES[algorithm](),
+ )
+ m = Message()
+diff --git a/paramiko/sftp_server.py b/paramiko/sftp_server.py
+index cd3910dc..e1cfc02a 100644
+--- a/paramiko/sftp_server.py
++++ b/paramiko/sftp_server.py
+@@ -82,6 +82,7 @@ from paramiko.sftp import (
+ SFTP_OP_UNSUPPORTED,
+ )
+
++# TODO: nuke or update w/ newer algs, see below
+ _hash_class = {"sha1": sha1, "md5": md5}
+
+
+@@ -305,6 +306,9 @@ class SFTPServer(BaseSFTP, SubsystemHandler):
+ return
+ f = self.file_table[handle]
+ for x in alg_list:
++ # TODO: this only contains sha1 and md5 so uh, is this extension
++ # actually supported anymore? do we need to update the map for
++ # newer algos instead? other?
+ if x in _hash_class:
+ algname = x
+ alg = _hash_class[x]
+diff --git a/paramiko/transport.py b/paramiko/transport.py
+index 472ec6c8..09ecf3cc 100644
+--- a/paramiko/transport.py
++++ b/paramiko/transport.py
+@@ -204,7 +204,6 @@ class Transport(threading.Thread, ClosingContextManager):
+ "ecdsa-sha2-nistp521",
+ "rsa-sha2-512",
+ "rsa-sha2-256",
+- "ssh-rsa",
+ )
+ # ~= PubKeyAcceptedAlgorithms
+ _preferred_pubkeys = (
+@@ -214,7 +213,6 @@ class Transport(threading.Thread, ClosingContextManager):
+ "ecdsa-sha2-nistp521",
+ "rsa-sha2-512",
+ "rsa-sha2-256",
+- "ssh-rsa",
+ )
+ _preferred_kex = (
+ "ecdh-sha2-nistp256",
+@@ -307,12 +305,18 @@ class Transport(threading.Thread, ClosingContextManager):
+ }
+
+ _key_info = {
+- # TODO: at some point we will want to drop this as it's no longer
+- # considered secure due to using SHA-1 for signatures. OpenSSH 8.8 no
+- # longer supports it. Question becomes at what point do we want to
+- # prevent users with older setups from using this?
+- "ssh-rsa": RSAKey,
+- "ssh-rsa-cert-v01@openssh.com": RSAKey,
++ # TODO: do some downstream uses of this need to be able to 'see'
++ # ssh-rsa in not-using-SHA1 contexts?
++ # TODO: NO!!! good.
++ # TODO: it's used in:
++ # - Transport._verify_key - verification - do not want ssh-rsa
++ # - SecurityOptions - only really uses this as a filter for what's
++ # allowed to be overwritten into its .key_types (which ==
++ # transport._preferred_keys), and since the latter doesn't want ssh-rsa
++ # in it, this use case doesn't require that string in here either.
++ # - AuthHandler._generate_key_from_request - server-side auth
++ # support - is looking at the 'algorithm' field in the request when it
++ # references this structure, so yup, do not want ssh-rsa
+ "rsa-sha2-256": RSAKey,
+ "rsa-sha2-256-cert-v01@openssh.com": RSAKey,
+ "rsa-sha2-512": RSAKey,
+@@ -1396,11 +1400,13 @@ class Transport(threading.Thread, ClosingContextManager):
+ # TODO: a more robust implementation would be to ask each key class
+ # for its nameS plural, and just use that.
+ # TODO: that could be used in a bunch of other spots too
++ # TODO: don't we have that now, lol
++ # TODO: either way this is ~= like using SecurityOptions.key_types
++ # = xxx, but different, which sucks sigh
+ if isinstance(hostkey, RSAKey):
+ self._preferred_keys = [
+ "rsa-sha2-512",
+ "rsa-sha2-256",
+- "ssh-rsa",
+ ]
+ else:
+ self._preferred_keys = [hostkey.get_name()]
+@@ -2002,6 +2008,8 @@ class Transport(threading.Thread, ClosingContextManager):
+ key = self._key_info[self.host_key_type](Message(host_key))
+ if key is None:
+ raise SSHException("Unknown host key type")
++ # TODO: like, here, can a host offer "ssh-rsa" but request SHA2, or are
++ # those baked in?
+ if not key.verify_ssh_sig(self.H, Message(sig)):
+ raise SSHException(
+ "Signature verification ({}) failed.".format(
+@@ -3232,6 +3240,14 @@ class SecurityOptions:
+
+ @key_types.setter
+ def key_types(self, x):
++ # TODO: so this reads Transport._key_info.keys(), yells if any values
++ # in `x` /aren't/ in that list, then overwrites
++ # Transport._preferred_keys with `x`...
++ # TODO: so you can read this pretty simply as "replace
++ # transport._preferred_keys with x".
++ # TODO: which is...bad...in cases where SSHClient is trying to simply
++ # load up known_hosts or system known hosts, and use those to determine
++ # which hostkey /algorithms/ it is willing to accept
+ self._set("_preferred_keys", "_key_info", x)
+
+ @property
+diff --git a/tests/_util.py b/tests/_util.py
+index db5a1e99..295143b2 100644
+--- a/tests/_util.py
++++ b/tests/_util.py
+@@ -168,42 +168,9 @@ def is_low_entropy():
+ return is_32bit and os.environ.get("PYTHONHASHSEED", None) == "0"
+
+
+-def sha1_signing_unsupported():
+- """
+- This is used to skip tests in environments where SHA-1 signing is
+- not supported by the backend.
+- """
+- private_key = rsa.generate_private_key(
+- public_exponent=65537, key_size=2048, backend=default_backend()
+- )
+- message = b"Some dummy text"
+- try:
+- private_key.sign(
+- message,
+- padding.PSS(
+- mgf=padding.MGF1(hashes.SHA1()),
+- salt_length=padding.PSS.MAX_LENGTH,
+- ),
+- hashes.SHA1(),
+- )
+- return False
+- except UnsupportedAlgorithm as e:
+- return e._reason == _Reasons.UNSUPPORTED_HASH
+-
+-
+-requires_sha1_signing = unittest.skipIf(
+- sha1_signing_unsupported(), "SHA-1 signing not supported"
+-)
+-
+-_disable_sha2 = dict(
+- disabled_algorithms=dict(keys=["rsa-sha2-256", "rsa-sha2-512"])
+-)
+-_disable_sha1 = dict(disabled_algorithms=dict(keys=["ssh-rsa"]))
+-_disable_sha2_pubkey = dict(
+- disabled_algorithms=dict(pubkeys=["rsa-sha2-256", "rsa-sha2-512"])
+-)
+-_disable_sha1_pubkey = dict(disabled_algorithms=dict(pubkeys=["ssh-rsa"]))
+-
++# TODO: doublecheck where _disable_xxx helpers were in use; disabling sha1 no
++# longer makes any sense, and presumably neither does en/dis abling sha2 but
++# that's the question innit
+
+ unicodey = "\u2022"
+
+diff --git a/tests/auth.py b/tests/auth.py
+index 7341de38..5f6c154d 100644
+--- a/tests/auth.py
++++ b/tests/auth.py
+@@ -31,11 +31,7 @@ from paramiko import (
+ )
+
+ from ._util import (
+- _disable_sha1_pubkey,
+- _disable_sha2,
+- _disable_sha2_pubkey,
+ _support,
+- requires_sha1_signing,
+ server,
+ unicodey,
+ )
+@@ -134,8 +130,9 @@ class AuthHandler_:
+ verify that we catch a server disconnecting during auth, and report
+ it as an auth failure.
+ """
+- with server(defer=True, skip_verify=True) as (tc, ts), raises(
+- AuthenticationException
++ with (
++ server(defer=True, skip_verify=True) as (tc, ts),
++ raises(AuthenticationException),
+ ):
+ tc.auth_password("bad-server", "hello")
+
+@@ -144,9 +141,10 @@ class AuthHandler_:
+ verify that authentication times out if server takes to long to
+ respond (or never responds).
+ """
+- with server(defer=True, skip_verify=True) as (tc, ts), raises(
+- AuthenticationException
+- ) as info:
++ with (
++ server(defer=True, skip_verify=True) as (tc, ts),
++ raises(AuthenticationException) as info,
++ ):
+ tc.auth_timeout = 1 # 1 second, to speed up test
+ tc.auth_password("unresponsive-server", "hello")
+ assert "Authentication timeout" in str(info.value)
+@@ -158,7 +156,6 @@ class AuthOnlyHandler_:
+ return server(*args, **kwargs)
+
+ class fallback_pubkey_algorithm:
+- @requires_sha1_signing
+ def key_type_algo_selected_when_no_server_sig_algs(self):
+ privkey = RSAKey.from_private_key_file(_support("rsa.key"))
+ # Server pretending to be an apparently common setup:
+@@ -167,6 +164,10 @@ class AuthOnlyHandler_:
+ # This is the scenario in which Paramiko has to guess-the-algo, and
+ # where servers that don't support sha2 or server-sig-algs can give
+ # us trouble.
++ # TODO: ok maybe I need to reinstate _disable_sha2_pubkey, but it
++ # _might_ make sense to choose some other key type to disable, if
++ # it's more sensible now - surely the modern version of this
++ # scenario would be disabling like, ecdsa or something?
+ server_init = dict(_disable_sha2_pubkey, server_sig_algs=False)
+ with self._server(
+ pubkeys=[privkey],
+@@ -177,9 +178,11 @@ class AuthOnlyHandler_:
+ # Auth did work
+ assert tc.is_authenticated()
+ # Selected ssh-rsa, instead of first-in-the-list (rsa-sha2-512)
++ # TODO: this needs to be selecting some other fallback now,
++ # presumably whatever is now first in one of our attribute
++ # lists
+ assert tc._agreed_pubkey_algorithm == "ssh-rsa"
+
+- @requires_sha1_signing
+ def key_type_algo_selection_is_cert_suffix_aware(self):
+ # This key has a cert next to it, which should trigger cert-aware
+ # loading within key classes.
+@@ -197,10 +200,10 @@ class AuthOnlyHandler_:
+ # Selected expected cert type
+ assert (
+ tc._agreed_pubkey_algorithm
++ # TODO: this needs to be choosing a sha2 or w/e now
+ == "ssh-rsa-cert-v01@openssh.com"
+ )
+
+- @requires_sha1_signing
+ def uses_first_preferred_algo_if_key_type_not_in_list(self):
+ # This is functionally the same as legacy AuthHandler, just
+ # arriving at the same place in a different manner.
+@@ -210,6 +213,8 @@ class AuthOnlyHandler_:
+ pubkeys=[privkey],
+ connect=dict(pkey=privkey),
+ server_init=server_init,
++ # TODO: this is outdated now, disable something else, probably
++ # whatever is /now/ first in the list instead of ssh-rsa
+ client_init=_disable_sha1_pubkey, # no ssh-rsa
+ catch_error=True,
+ ) as (tc, ts, err):
+@@ -226,7 +231,7 @@ class SHA2SignaturePubkeys:
+ connect=dict(pkey=privkey),
+ init=dict(
+ disabled_algorithms=dict(
+- pubkeys=["ssh-rsa", "rsa-sha2-256", "rsa-sha2-512"]
++ pubkeys=["rsa-sha2-256", "rsa-sha2-512"]
+ )
+ ),
+ catch_error=True,
+@@ -239,6 +244,7 @@ class SHA2SignaturePubkeys:
+ with server(
+ pubkeys=[privkey],
+ connect=dict(pkey=privkey),
++ # TODO: update or maybe just nuke this test now
+ client_init=_disable_sha2_pubkey,
+ server_init=_disable_sha1_pubkey,
+ catch_error=True,
+@@ -250,24 +256,27 @@ class SHA2SignaturePubkeys:
+ with server(
+ pubkeys=[privkey],
+ connect=dict(pkey=privkey),
++ # TODO: update or maybe just nuke this test now
+ client_init=_disable_sha1_pubkey,
+ server_init=_disable_sha2_pubkey,
+ catch_error=True,
+ ) as (tc, ts, err):
+ assert isinstance(err, AuthenticationException)
+
+- @requires_sha1_signing
+ def ssh_rsa_still_used_when_sha2_disabled(self):
+ privkey = RSAKey.from_private_key_file(_support("rsa.key"))
+ # NOTE: this works because key obj comparison uses public bytes
+ # TODO: would be nice for PKey to grow a legit "give me another obj of
+ # same class but just the public bits" using asbytes()
+ with server(
+- pubkeys=[privkey], connect=dict(pkey=privkey), init=_disable_sha2
++ # TODO: update
++ pubkeys=[privkey],
++ connect=dict(pkey=privkey),
++ init=_disable_sha2,
+ ) as (tc, _):
+ assert tc.is_authenticated()
+
+- @requires_sha1_signing
++ # TODO: isn't this duplicating some of the earlier tests? if not, update it
+ def first_client_preferred_algo_used_when_no_server_sig_algs(self):
+ privkey = RSAKey.from_private_key_file(_support("rsa.key"))
+ # Server pretending to be an apparently common setup:
+diff --git a/tests/test_client.py b/tests/test_client.py
+index ed5f6c85..1ee9892f 100644
+--- a/tests/test_client.py
++++ b/tests/test_client.py
+@@ -41,7 +41,7 @@ from paramiko import SSHClient
+ from paramiko.pkey import PublicBlob
+ from paramiko.ssh_exception import SSHException, AuthenticationException
+
+-from ._util import _support, requires_sha1_signing, slow
++from ._util import _support, slow
+
+
+ requires_gss_auth = unittest.skipUnless(
+@@ -49,6 +49,8 @@ requires_gss_auth = unittest.skipUnless(
+ )
+
+ FINGERPRINTS = {
++ # TODO: this should still be ok as it's specifically re: key
++ # type/identity.
+ "ssh-rsa": b"\x60\x73\x38\x44\xcb\x51\x86\x65\x7f\xde\xda\xa2\x2b\x5a\x57\xd5", # noqa
+ "ecdsa-sha2-nistp256": b"\x25\x19\xeb\x55\xe6\xa1\x47\xff\x4f\x38\xd2\x75\x6f\xa5\xd5\x60", # noqa
+ "ssh-ed25519": b'\xb3\xd5"\xaa\xf9u^\xe8\xcd\x0e\xea\x02\xb9)\xa2\x80',
+@@ -199,7 +201,13 @@ class ClientTest(unittest.TestCase):
+ # Client setup
+ self.tc = SSHClient()
+ self.tc.get_host_keys().add(
+- f"[{self.addr}]:{self.port}", "ssh-rsa", public_host_key
++ f"[{self.addr}]:{self.port}",
++ # TODO: so, this is 'keytype', which is still allowed to be
++ # ssh-rsa, as it "comes from the key itself" per `man sshd`.
++ # TODO: but q is, is part of our pipeline still conflating keytype
++ # with signature algorithm? seems likely?
++ "ssh-rsa",
++ public_host_key,
+ )
+
+ # Actual connection
+@@ -241,38 +249,34 @@ class ClientTest(unittest.TestCase):
+
+
+ class SSHClientTest(ClientTest):
+- @requires_sha1_signing
+ def test_client(self):
+ """
+ verify that the SSHClient stuff works too.
+ """
+ self._test_connection(password="pygmalion")
+
+- @requires_sha1_signing
+ def test_client_rsa(self):
+ """
+ verify that SSHClient works with an RSA key.
+ """
+ self._test_connection(key_filename=_support("rsa.key"))
+
+- @requires_sha1_signing
+ def test_client_ecdsa(self):
+ """
+ verify that SSHClient works with an ECDSA key.
+ """
+ self._test_connection(key_filename=_support("ecdsa-256.key"))
+
+- @requires_sha1_signing
+ def test_client_ed25519(self):
+ self._test_connection(key_filename=_support("ed25519.key"))
+
+- @requires_sha1_signing
+ def test_multiple_key_files(self):
+ """
+ verify that SSHClient accepts and tries multiple key files.
+ """
+ # This is dumb :(
+ types_ = {
++ # TODO: this is just about key identity so should be ok
+ "rsa": "ssh-rsa",
+ "ed25519": "ssh-ed25519",
+ "ecdsa": "ecdsa-sha2-nistp256",
+@@ -308,7 +312,6 @@ class SSHClientTest(ClientTest):
+ self.tearDown()
+ self.setUp()
+
+- @requires_sha1_signing
+ def test_multiple_key_files_failure(self):
+ """
+ Expect failure when multiple keys in play and none are accepted
+@@ -322,7 +325,6 @@ class SSHClientTest(ClientTest):
+ allowed_keys=["ecdsa-sha2-nistp256"],
+ )
+
+- @requires_sha1_signing
+ def test_certs_allowed_as_key_filename_values(self):
+ # NOTE: giving cert path here, not key path. (Key path test is below.
+ # They're similar except for which path is given; the expected auth and
+@@ -335,7 +337,6 @@ class SSHClientTest(ClientTest):
+ public_blob=PublicBlob.from_file(f"{key_path}-cert.pub"),
+ )
+
+- @requires_sha1_signing
+ def test_certs_implicitly_loaded_alongside_key_filename_keys(self):
+ # NOTE: a regular test_connection() w/ rsa.key would incidentally
+ # test this (because test_xxx.key-cert.pub exists) but incidental tests
+@@ -350,29 +351,6 @@ class SSHClientTest(ClientTest):
+ public_blob=PublicBlob.from_file(f"{key_path}-cert.pub"),
+ )
+
+- def _cert_algo_test(self, ver, alg):
+- # Issue #2017; see auth_handler.py
+- self.connect_kwargs["username"] = "somecertuser" # neuter pw auth
+- self._test_connection(
+- # NOTE: SSHClient is able to take either the key or the cert & will
+- # set up its internals as needed
+- key_filename=_support("rsa.key-cert.pub"),
+- server_name="SSH-2.0-OpenSSH_{}".format(ver),
+- )
+- assert (
+- self.tc._transport._agreed_pubkey_algorithm
+- == "{}-cert-v01@openssh.com".format(alg)
+- )
+-
+- @requires_sha1_signing
+- def test_old_openssh_needs_ssh_rsa_for_certs_not_rsa_sha2(self):
+- self._cert_algo_test(ver="7.7", alg="ssh-rsa")
+-
+- @requires_sha1_signing
+- def test_newer_openssh_uses_rsa_sha2_for_certs_not_ssh_rsa(self):
+- # NOTE: 512 happens to be first in our list and is thus chosen
+- self._cert_algo_test(ver="7.8", alg="rsa-sha2-512")
+-
+ def test_default_key_locations_trigger_cert_loads_if_found(self):
+ # TODO: what it says on the tin: ~/.ssh/id_rsa tries to load
+ # ~/.ssh/id_rsa-cert.pub. Right now no other tests actually test that
+@@ -418,6 +396,8 @@ class SSHClientTest(ClientTest):
+
+ host_id = f"[{self.addr}]:{self.port}"
+
++ # TODO: this should still be okay, host keys -> keytype -> is not
++ # directly tied to algo -> but need to see if guts do that
+ client.get_host_keys().add(host_id, "ssh-rsa", public_host_key)
+ assert len(client.get_host_keys()) == 1
+ assert public_host_key == client.get_host_keys()[host_id]["ssh-rsa"]
+@@ -513,13 +493,15 @@ class SSHClientTest(ClientTest):
+
+ self.tc = SSHClient()
+ self.tc.get_host_keys().add(
+- f"[{self.addr}]:{self.port}", "ssh-rsa", public_host_key
++ f"[{self.addr}]:{self.port}",
++ # TODO: hostkey keytype == ok-ish
++ "ssh-rsa",
++ public_host_key,
+ )
+ # Connect with a half second banner timeout.
+ kwargs = dict(self.connect_kwargs, banner_timeout=0.5)
+ self.assertRaises(paramiko.SSHException, self.tc.connect, **kwargs)
+
+- @requires_sha1_signing
+ def test_auth_trickledown(self):
+ """
+ Failed key auth doesn't prevent subsequent pw auth from succeeding
+@@ -540,7 +522,6 @@ class SSHClientTest(ClientTest):
+ )
+ self._test_connection(**kwargs)
+
+- @requires_sha1_signing
+ @slow
+ def test_auth_timeout(self):
+ """
+@@ -667,15 +648,14 @@ class SSHClientTest(ClientTest):
+ host_key = paramiko.ECDSAKey.generate()
+ self._client_host_key_bad(host_key)
+
+- @requires_sha1_signing
+ def test_host_key_negotiation_2(self):
++ # TODO: this may now be too small for audit recco, dlbcheck
+ host_key = paramiko.RSAKey.generate(2048)
+ self._client_host_key_bad(host_key)
+
+ def test_host_key_negotiation_3(self):
+ self._client_host_key_good(paramiko.ECDSAKey, "ecdsa-256.key")
+
+- @requires_sha1_signing
+ def test_host_key_negotiation_4(self):
+ self._client_host_key_good(paramiko.RSAKey, "rsa.key")
+
+@@ -747,10 +727,10 @@ class SSHClientTest(ClientTest):
+ "host",
+ sock=Mock(),
+ password="no",
+- disabled_algorithms={"keys": ["ssh-rsa"]},
++ disabled_algorithms={"keys": ["ed25519"]},
+ )
+ call_arg = Transport.call_args[1]["disabled_algorithms"]
+- assert call_arg == {"keys": ["ssh-rsa"]}
++ assert call_arg == {"keys": ["ed25519"]}
+
+ @patch("paramiko.client.Transport")
+ def test_transport_factory_defaults_to_Transport(self, Transport):
+@@ -793,7 +773,6 @@ class PasswordPassphraseTests(ClientTest):
+ # instead of suffering a real connection cycle.
+ # TODO: in that case, move the below to be part of an integration suite?
+
+- @requires_sha1_signing
+ def test_password_kwarg_works_for_password_auth(self):
+ # Straightforward / duplicate of earlier basic password test.
+ self._test_connection(password="pygmalion")
+@@ -801,12 +780,10 @@ class PasswordPassphraseTests(ClientTest):
+ # TODO: more granular exception pending #387; should be signaling "no auth
+ # methods available" because no key and no password
+ @raises(SSHException)
+- @requires_sha1_signing
+ def test_passphrase_kwarg_not_used_for_password_auth(self):
+ # Using the "right" password in the "wrong" field shouldn't work.
+ self._test_connection(passphrase="pygmalion")
+
+- @requires_sha1_signing
+ def test_passphrase_kwarg_used_for_key_passphrase(self):
+ # Straightforward again, with new passphrase kwarg.
+ self._test_connection(
+@@ -814,7 +791,6 @@ class PasswordPassphraseTests(ClientTest):
+ passphrase="television",
+ )
+
+- @requires_sha1_signing
+ def test_password_kwarg_used_for_passphrase_when_no_passphrase_kwarg_given(
+ self,
+ ): # noqa
+@@ -825,7 +801,6 @@ class PasswordPassphraseTests(ClientTest):
+ )
+
+ @raises(AuthenticationException) # TODO: more granular
+- @requires_sha1_signing
+ def test_password_kwarg_not_used_for_passphrase_when_passphrase_kwarg_given( # noqa
+ self,
+ ):
+diff --git a/tests/test_pkey.py b/tests/test_pkey.py
+index 92b4b270..331bfb24 100644
+--- a/tests/test_pkey.py
++++ b/tests/test_pkey.py
+@@ -44,7 +44,7 @@ from cryptography.hazmat.primitives.asymmetric.rsa import RSAPrivateNumbers
+ from unittest.mock import patch, Mock
+ import pytest
+
+-from ._util import _support, is_low_entropy, requires_sha1_signing
++from ._util import _support, is_low_entropy
+
+
+ # from openssh's ssh-keygen
+@@ -199,18 +199,14 @@ class KeyTest(unittest.TestCase):
+ pub = RSAKey(data=key.asbytes())
+ self.assertTrue(pub.verify_ssh_sig(b"ice weasels", msg))
+
+- @requires_sha1_signing
+- def test_sign_and_verify_ssh_rsa(self):
+- self._sign_and_verify_rsa("ssh-rsa", SIGNED_RSA)
+-
+ def test_sign_and_verify_rsa_sha2_512(self):
+ self._sign_and_verify_rsa("rsa-sha2-512", SIGNED_RSA_512)
+
+ def test_sign_and_verify_rsa_sha2_256(self):
+ self._sign_and_verify_rsa("rsa-sha2-256", SIGNED_RSA_256)
+
+- @requires_sha1_signing
+ def test_generate_rsa(self):
++ # TODO: this probs needs to be larger number now
+ key = RSAKey.generate(1024)
+ msg = key.sign_ssh_data(b"jerri blank")
+ msg.rewind()
+diff --git a/tests/test_transport.py b/tests/test_transport.py
+index 623dff00..bf1d770c 100644
+--- a/tests/test_transport.py
++++ b/tests/test_transport.py
+@@ -66,11 +66,8 @@ from paramiko.message import Message
+ from ._util import (
+ needs_builtin,
+ _support,
+- requires_sha1_signing,
+ slow,
+ server,
+- _disable_sha2,
+- _disable_sha1,
+ TestServer as NullServer,
+ )
+ from ._loop import LoopSocket
+@@ -1170,14 +1167,6 @@ class TestSHA2SignatureKeyExchange(unittest.TestCase):
+ # are new tests in test_pkey.py which use known signature blobs to prove
+ # the SHA2 family was in fact used!
+
+- @requires_sha1_signing
+- def test_base_case_ssh_rsa_still_used_as_fallback(self):
+- # Prove that ssh-rsa is used if either, or both, participants have SHA2
+- # algorithms disabled
+- for which in ("init", "client_init", "server_init"):
+- with server(**{which: _disable_sha2}) as (tc, _):
+- assert tc.host_key_type == "ssh-rsa"
+-
+ def test_kex_with_sha2_512(self):
+ # It's the default!
+ with server() as (tc, _):
+@@ -1209,15 +1198,16 @@ class TestSHA2SignatureKeyExchange(unittest.TestCase):
+ else:
+ raise err
+
+- def test_client_sha2_disabled_server_sha1_disabled_no_match(self):
+- self._incompatible_peers(
+- client_init=_disable_sha2, server_init=_disable_sha1
+- )
++ # TODO: update these couple the same way we did under test_client...
++ # def test_client_sha2_disabled_server_sha1_disabled_no_match(self):
++ # self._incompatible_peers(
++ # client_init=_disable_sha2, server_init=_disable_sha1
++ # )
+
+- def test_client_sha1_disabled_server_sha2_disabled_no_match(self):
+- self._incompatible_peers(
+- client_init=_disable_sha1, server_init=_disable_sha2
+- )
++ # def test_client_sha1_disabled_server_sha2_disabled_no_match(self):
++ # self._incompatible_peers(
++ # client_init=_disable_sha1, server_init=_disable_sha2
++ # )
+
+ def test_explicit_client_hostkey_not_limited(self):
+ # Be very explicit about the hostkey on BOTH ends,
+--
+2.35.6
+
new file mode 100644
@@ -0,0 +1,187 @@
+From 4a492204664f12063a9447c0b9cd83d3742cbb8f Mon Sep 17 00:00:00 2001
+From: Jeff Forcier <jeff@bitprophet.org>
+Date: Sat, 21 Feb 2026 21:13:03 -0500
+Subject: [PATCH] Fold smarter _choose_fallback_pubkey_algorithm into base
+ AuthHandler
+
+having it in the 'new' subclass was mostly a way of sneaking it out w/o
+backwards incompat, IIRC, but next release will be backwards incompat,
+so.
+
+This also means we can do away with some of the special/duplicated test
+cases around same.
+
+CVE: CVE-2026-44405
+Upstream-Status: Backport [https://github.com/paramiko/paramiko/commit/d99939c27ad8e35ec278d11581d155c309757182]
+
+Signed-off-by: Ashishkumar Parmar <asparmar@cisco.com>
+---
+ paramiko/auth_handler.py | 36 ++++++------------
+ tests/auth.py | 79 ++--------------------------------------
+ 2 files changed, 16 insertions(+), 99 deletions(-)
+
+diff --git a/paramiko/auth_handler.py b/paramiko/auth_handler.py
+index c197cc7c..7fe398af 100644
+--- a/paramiko/auth_handler.py
++++ b/paramiko/auth_handler.py
+@@ -294,15 +294,18 @@ class AuthHandler:
+ return self.transport._key_info[algorithm](Message(keyblob))
+
+ def _choose_fallback_pubkey_algorithm(self, key_type, my_algos):
+- # Fallback: first one in our (possibly tweaked by caller) list
+- pubkey_algo = my_algos[0]
+- msg = "Server did not send a server-sig-algs list; defaulting to our first preferred algo ({!r})" # noqa
+- self._log(DEBUG, msg.format(pubkey_algo))
+- self._log(
+- DEBUG,
+- "NOTE: you may use the 'disabled_algorithms' SSHClient/Transport init kwarg to disable that or other algorithms if your server does not support them!", # noqa
+- )
+- return pubkey_algo
++ msg = "Server did not send a server-sig-algs list; defaulting to something in our preferred algorithms list" # noqa
++ self._log(DEBUG, msg)
++ noncert_key_type = key_type.replace("-cert-v01@openssh.com", "")
++ if key_type in my_algos or noncert_key_type in my_algos:
++ actual = key_type if key_type in my_algos else noncert_key_type
++ msg = f"Current key type, {actual!r}, is in our preferred list; using that" # noqa
++ algo = actual
++ else:
++ algo = my_algos[0]
++ msg = f"{key_type!r} not in our list - trying first list item instead, {algo!r}" # noqa
++ self._log(DEBUG, msg)
++ return algo
+
+ def _finalize_pubkey_algorithm(self, key_type):
+ # Short-circuit for non-RSA keys
+@@ -1081,18 +1084,3 @@ class AuthOnlyHandler(AuthHandler):
+ m.add_string(submethods)
+
+ return self.send_auth_request(username, "keyboard-interactive", finish)
+-
+- # NOTE: not strictly 'auth only' related, but allows users to opt-in.
+- def _choose_fallback_pubkey_algorithm(self, key_type, my_algos):
+- msg = "Server did not send a server-sig-algs list; defaulting to something in our preferred algorithms list" # noqa
+- self._log(DEBUG, msg)
+- noncert_key_type = key_type.replace("-cert-v01@openssh.com", "")
+- if key_type in my_algos or noncert_key_type in my_algos:
+- actual = key_type if key_type in my_algos else noncert_key_type
+- msg = f"Current key type, {actual!r}, is in our preferred list; using that" # noqa
+- algo = actual
+- else:
+- algo = my_algos[0]
+- msg = f"{key_type!r} not in our list - trying first list item instead, {algo!r}" # noqa
+- self._log(DEBUG, msg)
+- return algo
+diff --git a/tests/auth.py b/tests/auth.py
+index 5f6c154d..1267ebfc 100644
+--- a/tests/auth.py
++++ b/tests/auth.py
+@@ -26,7 +26,6 @@ from paramiko import (
+ PKey,
+ RSAKey,
+ SSHException,
+- ServiceRequestingTransport,
+ SourceResult,
+ )
+
+@@ -150,79 +149,6 @@ class AuthHandler_:
+ assert "Authentication timeout" in str(info.value)
+
+
+-class AuthOnlyHandler_:
+- def _server(self, *args, **kwargs):
+- kwargs.setdefault("transport_factory", ServiceRequestingTransport)
+- return server(*args, **kwargs)
+-
+- class fallback_pubkey_algorithm:
+- def key_type_algo_selected_when_no_server_sig_algs(self):
+- privkey = RSAKey.from_private_key_file(_support("rsa.key"))
+- # Server pretending to be an apparently common setup:
+- # - doesn't support (or have enabled) sha2
+- # - also doesn't support (or have enabled) server-sig-algs/ext-info
+- # This is the scenario in which Paramiko has to guess-the-algo, and
+- # where servers that don't support sha2 or server-sig-algs can give
+- # us trouble.
+- # TODO: ok maybe I need to reinstate _disable_sha2_pubkey, but it
+- # _might_ make sense to choose some other key type to disable, if
+- # it's more sensible now - surely the modern version of this
+- # scenario would be disabling like, ecdsa or something?
+- server_init = dict(_disable_sha2_pubkey, server_sig_algs=False)
+- with self._server(
+- pubkeys=[privkey],
+- connect=dict(pkey=privkey),
+- server_init=server_init,
+- catch_error=True,
+- ) as (tc, ts, err):
+- # Auth did work
+- assert tc.is_authenticated()
+- # Selected ssh-rsa, instead of first-in-the-list (rsa-sha2-512)
+- # TODO: this needs to be selecting some other fallback now,
+- # presumably whatever is now first in one of our attribute
+- # lists
+- assert tc._agreed_pubkey_algorithm == "ssh-rsa"
+-
+- def key_type_algo_selection_is_cert_suffix_aware(self):
+- # This key has a cert next to it, which should trigger cert-aware
+- # loading within key classes.
+- privkey = PKey.from_path(_support("rsa.key"))
+- server_init = dict(_disable_sha2_pubkey, server_sig_algs=False)
+- with self._server(
+- pubkeys=[privkey],
+- connect=dict(pkey=privkey),
+- server_init=server_init,
+- catch_error=True,
+- ) as (tc, ts, err):
+- assert not err
+- # Auth did work
+- assert tc.is_authenticated()
+- # Selected expected cert type
+- assert (
+- tc._agreed_pubkey_algorithm
+- # TODO: this needs to be choosing a sha2 or w/e now
+- == "ssh-rsa-cert-v01@openssh.com"
+- )
+-
+- def uses_first_preferred_algo_if_key_type_not_in_list(self):
+- # This is functionally the same as legacy AuthHandler, just
+- # arriving at the same place in a different manner.
+- privkey = RSAKey.from_private_key_file(_support("rsa.key"))
+- server_init = dict(_disable_sha2_pubkey, server_sig_algs=False)
+- with self._server(
+- pubkeys=[privkey],
+- connect=dict(pkey=privkey),
+- server_init=server_init,
+- # TODO: this is outdated now, disable something else, probably
+- # whatever is /now/ first in the list instead of ssh-rsa
+- client_init=_disable_sha1_pubkey, # no ssh-rsa
+- catch_error=True,
+- ) as (tc, ts, err):
+- assert not tc.is_authenticated()
+- assert isinstance(err, AuthenticationException)
+- assert tc._agreed_pubkey_algorithm == "rsa-sha2-512"
+-
+-
+ class SHA2SignaturePubkeys:
+ def pubkey_auth_honors_disabled_algorithms(self):
+ privkey = RSAKey.from_private_key_file(_support("rsa.key"))
+@@ -276,7 +202,6 @@ class SHA2SignaturePubkeys:
+ ) as (tc, _):
+ assert tc.is_authenticated()
+
+- # TODO: isn't this duplicating some of the earlier tests? if not, update it
+ def first_client_preferred_algo_used_when_no_server_sig_algs(self):
+ privkey = RSAKey.from_private_key_file(_support("rsa.key"))
+ # Server pretending to be an apparently common setup:
+@@ -285,6 +210,10 @@ class SHA2SignaturePubkeys:
+ # This is the scenario in which Paramiko has to guess-the-algo, and
+ # where servers that don't support sha2 or server-sig-algs give us
+ # trouble.
++ # TODO: disabling sha2 _in this case_ might be ok, _as long as_ we
++ # update to account for the client's new first preference being
++ # something besides ssh-rsa (and where the client also has that
++ # disabled?)
+ server_init = dict(_disable_sha2_pubkey, server_sig_algs=False)
+ with server(
+ pubkeys=[privkey],
+--
+2.35.6
+
new file mode 100644
@@ -0,0 +1,108 @@
+From 534b6961da185a125bc5f55ed014a674233629c2 Mon Sep 17 00:00:00 2001
+From: Jeff Forcier <jeff@bitprophet.org>
+Date: Sat, 21 Feb 2026 21:23:23 -0500
+Subject: [PATCH] Streamline RSA pubkey algorithm handling now that SHA1 is
+ gone
+
+- no more need for old 'force ssh-rsa' corner case handling
+- fallback pubkey guessing wasn't actually very sensible even in the
+SHA1+SHA2 transition period - the code handling it was more general than
+it deserved and it can certainly now be much simpler
+- some extra comments in related bits
+
+CVE: CVE-2026-44405
+Upstream-Status: Backport [https://github.com/paramiko/paramiko/commit/6f02c1e3a4a453fba13d40fc7e2cec9c321cdcfc]
+
+Signed-off-by: Ashishkumar Parmar <asparmar@cisco.com>
+---
+ paramiko/auth_handler.py | 51 ++++++++++++++--------------------------
+ 1 file changed, 17 insertions(+), 34 deletions(-)
+
+diff --git a/paramiko/auth_handler.py b/paramiko/auth_handler.py
+index 7fe398af..39c68a51 100644
+--- a/paramiko/auth_handler.py
++++ b/paramiko/auth_handler.py
+@@ -293,21 +293,15 @@ class AuthHandler:
+ return None
+ return self.transport._key_info[algorithm](Message(keyblob))
+
+- def _choose_fallback_pubkey_algorithm(self, key_type, my_algos):
+- msg = "Server did not send a server-sig-algs list; defaulting to something in our preferred algorithms list" # noqa
+- self._log(DEBUG, msg)
+- noncert_key_type = key_type.replace("-cert-v01@openssh.com", "")
+- if key_type in my_algos or noncert_key_type in my_algos:
+- actual = key_type if key_type in my_algos else noncert_key_type
+- msg = f"Current key type, {actual!r}, is in our preferred list; using that" # noqa
+- algo = actual
+- else:
+- algo = my_algos[0]
+- msg = f"{key_type!r} not in our list - trying first list item instead, {algo!r}" # noqa
+- self._log(DEBUG, msg)
+- return algo
+-
+ def _finalize_pubkey_algorithm(self, key_type):
++ """
++ Given a key type, decide which pubkey algorithm to use with it.
++
++ In most cases this is simply "that key type, again".
++
++ For RSA, this will be one of the SHA2 algorithms, depending on our
++ (transport's) configured pubkey algorithms list.
++ """
+ # Short-circuit for non-RSA keys
+ if "rsa" not in key_type:
+ return key_type
+@@ -317,22 +311,6 @@ class AuthHandler:
+ key_type
+ ),
+ )
+- # NOTE re #2017: When the key is an RSA cert and the remote server is
+- # OpenSSH 7.7 or earlier, always use ssh-rsa-cert-v01@openssh.com.
+- # Those versions of the server won't support rsa-sha2 family sig algos
+- # for certs specifically, and in tandem with various server bugs
+- # regarding server-sig-algs, it's impossible to fit this into the rest
+- # of the logic here.
+- if key_type.endswith("-cert-v01@openssh.com") and re.search(
+- r"-OpenSSH_(?:[1-6]|7\.[0-7])", self.transport.remote_version
+- ):
+- pubkey_algo = "ssh-rsa-cert-v01@openssh.com"
+- self.transport._agreed_pubkey_algorithm = pubkey_algo
+- self._log(DEBUG, "OpenSSH<7.8 + RSA cert = forcing ssh-rsa!")
+- self._log(
+- DEBUG, "Agreed upon {!r} pubkey algorithm".format(pubkey_algo)
+- )
+- return pubkey_algo
+ # Normal attempts to handshake follow from here.
+ # Only consider RSA algos from our list, lest we agree on another!
+ my_algos = [x for x in self.transport.preferred_pubkeys if "rsa" in x]
+@@ -369,11 +347,14 @@ class AuthHandler:
+ # technically for initial key exchange, not pubkey auth.
+ err = "Unable to agree on a pubkey algorithm for signing a {!r} key!" # noqa
+ raise AuthenticationException(err.format(key_type))
+- # Fallback to something based purely on the key & our configuration
++ # Fallback to first item in our preferred algorithm list (which won't
++ # be empty due to guardrail above)
+ else:
+- pubkey_algo = self._choose_fallback_pubkey_algorithm(
+- key_type, my_algos
+- )
++ pubkey_algo = my_algos[0]
++ msg = f"Server did not send a server-sig-algs list; defaulting to first RSA algorithm in our list: {pubkey_algo}" # noqa
++ self._log(DEBUG, msg)
++ # If we had loaded a cert-type key, tack that on to the algorithm name
++ # to get the final correct result.
+ if key_type.endswith("-cert-v01@openssh.com"):
+ pubkey_algo += "-cert-v01@openssh.com"
+ self.transport._agreed_pubkey_algorithm = pubkey_algo
+@@ -1036,6 +1017,8 @@ class AuthOnlyHandler(AuthHandler):
+ return self.send_auth_request(username, "none")
+
+ def auth_publickey(self, username, key):
++ # NOTE: key_type here may be just key type ("rsa-sha2-256") or may be
++ # the cert form if cert was loaded ("ssh-rsa-cert-v01@openssh.com")
+ key_type, bits = self._get_key_type_and_bits(key)
+ algorithm = self._finalize_pubkey_algorithm(key_type)
+ blob = self._get_session_blob(
+--
+2.35.6
+
new file mode 100644
@@ -0,0 +1,250 @@
+From 2a28ed09a7fd7bd0385e4ff0c0d167127cbe4ece Mon Sep 17 00:00:00 2001
+From: Jeff Forcier <jeff@bitprophet.org>
+Date: Sat, 21 Feb 2026 21:33:49 -0500
+Subject: [PATCH] Fix or remove last few ssh-rsa related tests
+
+CVE: CVE-2026-44405
+Upstream-Status: Backport [https://github.com/paramiko/paramiko/commit/6ba63924763a0ed5b9c277f02922cdd2ac53a354]
+
+Signed-off-by: Ashishkumar Parmar <asparmar@cisco.com>
+---
+ tests/auth.py | 92 ++++++++++-------------------------------
+ tests/pkey.py | 6 ++-
+ tests/test_pkey.py | 2 +-
+ tests/test_transport.py | 26 ++++--------
+ 4 files changed, 35 insertions(+), 91 deletions(-)
+
+diff --git a/tests/auth.py b/tests/auth.py
+index 1267ebfc..53db2d47 100644
+--- a/tests/auth.py
++++ b/tests/auth.py
+@@ -165,75 +165,42 @@ class SHA2SignaturePubkeys:
+ assert isinstance(err, SSHException)
+ assert "no RSA pubkey algorithms" in str(err)
+
+- def client_sha2_disabled_server_sha1_disabled_no_match(self):
+- privkey = RSAKey.from_private_key_file(_support("rsa.key"))
+- with server(
+- pubkeys=[privkey],
+- connect=dict(pkey=privkey),
+- # TODO: update or maybe just nuke this test now
+- client_init=_disable_sha2_pubkey,
+- server_init=_disable_sha1_pubkey,
+- catch_error=True,
+- ) as (tc, ts, err):
+- assert isinstance(err, AuthenticationException)
+-
+- def client_sha1_disabled_server_sha2_disabled_no_match(self):
+- privkey = RSAKey.from_private_key_file(_support("rsa.key"))
+- with server(
+- pubkeys=[privkey],
+- connect=dict(pkey=privkey),
+- # TODO: update or maybe just nuke this test now
+- client_init=_disable_sha1_pubkey,
+- server_init=_disable_sha2_pubkey,
+- catch_error=True,
+- ) as (tc, ts, err):
+- assert isinstance(err, AuthenticationException)
+-
+- def ssh_rsa_still_used_when_sha2_disabled(self):
+- privkey = RSAKey.from_private_key_file(_support("rsa.key"))
+- # NOTE: this works because key obj comparison uses public bytes
+- # TODO: would be nice for PKey to grow a legit "give me another obj of
+- # same class but just the public bits" using asbytes()
+- with server(
+- # TODO: update
+- pubkeys=[privkey],
+- connect=dict(pkey=privkey),
+- init=_disable_sha2,
+- ) as (tc, _):
+- assert tc.is_authenticated()
+-
+ def first_client_preferred_algo_used_when_no_server_sig_algs(self):
+ privkey = RSAKey.from_private_key_file(_support("rsa.key"))
+- # Server pretending to be an apparently common setup:
+- # - doesn't support (or have enabled) sha2
+- # - also doesn't support (or have enabled) server-sig-algs/ext-info
+- # This is the scenario in which Paramiko has to guess-the-algo, and
+- # where servers that don't support sha2 or server-sig-algs give us
+- # trouble.
+- # TODO: disabling sha2 _in this case_ might be ok, _as long as_ we
+- # update to account for the client's new first preference being
+- # something besides ssh-rsa (and where the client also has that
+- # disabled?)
+- server_init = dict(_disable_sha2_pubkey, server_sig_algs=False)
+ with server(
+ pubkeys=[privkey],
+ connect=dict(username="slowdive", pkey=privkey),
+- server_init=server_init,
++ server_init=dict(
++ disabled_algorithms=dict(
++ # Disable both SHA2 just to keep previous theme of this
++ # test alive (auth failure but w/ proof we tried offering
++ # something)
++ pubkeys=["rsa-sha2-256", "rsa-sha2-512"]
++ ),
++ # Don't publish server-sig-algs, forcing use of fallback on the
++ # client side
++ server_sig_algs=False,
++ ),
++ # Incidentally prove we're using the filtered algorithm list on the
++ # client side - taking out 512 means we should offer 256
++ client_init=dict(
++ disabled_algorithms=dict(pubkeys=["rsa-sha2-512"])
++ ),
+ catch_error=True,
+ ) as (tc, ts, err):
++ # There was no agreement, we threw an exception...
+ assert not tc.is_authenticated()
+ assert isinstance(err, AuthenticationException)
+- # Oh no! this isn't ssh-rsa, and our server doesn't support sha2!
+- assert tc._agreed_pubkey_algorithm == "rsa-sha2-512"
++ # ...but we can observe the client did their best guess at what an
++ # agreement /could/ have been, and it was 256
++ assert tc._agreed_pubkey_algorithm == "rsa-sha2-256"
+
+ def sha2_512(self):
+ privkey = RSAKey.from_private_key_file(_support("rsa.key"))
+ with server(
+ pubkeys=[privkey],
+ connect=dict(pkey=privkey),
+- init=dict(
+- disabled_algorithms=dict(pubkeys=["ssh-rsa", "rsa-sha2-256"])
+- ),
++ init=dict(disabled_algorithms=dict(pubkeys=["rsa-sha2-256"])),
+ ) as (tc, ts):
+ assert tc.is_authenticated()
+ assert tc._agreed_pubkey_algorithm == "rsa-sha2-512"
+@@ -243,22 +210,7 @@ class SHA2SignaturePubkeys:
+ with server(
+ pubkeys=[privkey],
+ connect=dict(pkey=privkey),
+- init=dict(
+- disabled_algorithms=dict(pubkeys=["ssh-rsa", "rsa-sha2-512"])
+- ),
+- ) as (tc, ts):
+- assert tc.is_authenticated()
+- assert tc._agreed_pubkey_algorithm == "rsa-sha2-256"
+-
+- def sha2_256_when_client_only_enables_256(self):
+- privkey = RSAKey.from_private_key_file(_support("rsa.key"))
+- with server(
+- pubkeys=[privkey],
+- connect=dict(pkey=privkey),
+- # Client-side only; server still accepts all 3.
+- client_init=dict(
+- disabled_algorithms=dict(pubkeys=["ssh-rsa", "rsa-sha2-512"])
+- ),
++ init=dict(disabled_algorithms=dict(pubkeys=["rsa-sha2-512"])),
+ ) as (tc, ts):
+ assert tc.is_authenticated()
+ assert tc._agreed_pubkey_algorithm == "rsa-sha2-256"
+diff --git a/tests/pkey.py b/tests/pkey.py
+index fdd657ae..2d65ab30 100644
+--- a/tests/pkey.py
++++ b/tests/pkey.py
+@@ -204,12 +204,14 @@ class PKey_:
+
+ def rsa_is_all_combos_of_cert_and_sha_type(self):
+ assert RSAKey.identifiers() == [
+- "ssh-rsa",
+- "ssh-rsa-cert-v01@openssh.com",
+ "rsa-sha2-256",
+ "rsa-sha2-256-cert-v01@openssh.com",
+ "rsa-sha2-512",
+ "rsa-sha2-512-cert-v01@openssh.com",
++ # Still required for identifying keys-not-algorithms! But now
++ # they come last.
++ "ssh-rsa",
++ "ssh-rsa-cert-v01@openssh.com",
+ ]
+
+ def ed25519_is_protocol_name(self):
+diff --git a/tests/test_pkey.py b/tests/test_pkey.py
+index 331bfb24..e783fbd3 100644
+--- a/tests/test_pkey.py
++++ b/tests/test_pkey.py
+@@ -208,7 +208,7 @@ class KeyTest(unittest.TestCase):
+ def test_generate_rsa(self):
+ # TODO: this probs needs to be larger number now
+ key = RSAKey.generate(1024)
+- msg = key.sign_ssh_data(b"jerri blank")
++ msg = key.sign_ssh_data(b"jerri blank", algorithm="rsa-sha2-256")
+ msg.rewind()
+ self.assertTrue(key.verify_ssh_sig(b"jerri blank", msg))
+
+diff --git a/tests/test_transport.py b/tests/test_transport.py
+index bf1d770c..02f8c4b4 100644
+--- a/tests/test_transport.py
++++ b/tests/test_transport.py
+@@ -1105,7 +1105,7 @@ class AlgorithmDisablingTests(unittest.TestCase):
+ disabled_algorithms={
+ "ciphers": ["aes128-cbc"],
+ "macs": ["hmac-md5"],
+- "keys": ["ssh-rsa"],
++ "keys": ["rsa-sha2-512"],
+ "kex": ["diffie-hellman-group14-sha256"],
+ },
+ )
+@@ -1113,9 +1113,10 @@ class AlgorithmDisablingTests(unittest.TestCase):
+ assert "aes128-cbc" not in t.preferred_ciphers
+ assert "hmac-md5" in t._preferred_macs
+ assert "hmac-md5" not in t.preferred_macs
+- assert "ssh-rsa" in t._preferred_keys
+- assert "ssh-rsa" not in t.preferred_keys
+- assert "ssh-rsa-cert-v01@openssh.com" not in t.preferred_keys
++ assert "rsa-sha2-512" in t._preferred_keys
++ assert "rsa-sha2-512" not in t.preferred_keys
++ # Filtering also accounts for cert forms
++ assert "rsa-sha2-512-cert-v01@openssh.com" not in t.preferred_keys
+ assert "diffie-hellman-group14-sha256" in t._preferred_kex
+ assert "diffie-hellman-group14-sha256" not in t.preferred_kex
+
+@@ -1125,7 +1126,7 @@ class AlgorithmDisablingTests(unittest.TestCase):
+ disabled_algorithms={
+ "ciphers": ["aes128-cbc"],
+ "macs": ["hmac-md5"],
+- "keys": ["ssh-rsa"],
++ "keys": ["rsa-sha2-256"],
+ "kex": ["diffie-hellman-group14-sha256"],
+ "compression": ["zlib"],
+ },
+@@ -1154,7 +1155,7 @@ class AlgorithmDisablingTests(unittest.TestCase):
+ # included (as this message includes the full lists)
+ assert "aes128-cbc" not in ciphers
+ assert "hmac-md5" not in macs
+- assert "ssh-rsa" not in server_keys
++ assert "rsa-sha2-256" not in server_keys
+ assert "diffie-hellman-group14-sha256" not in kexen
+ assert "zlib" not in compressions
+
+@@ -1198,17 +1199,6 @@ class TestSHA2SignatureKeyExchange(unittest.TestCase):
+ else:
+ raise err
+
+- # TODO: update these couple the same way we did under test_client...
+- # def test_client_sha2_disabled_server_sha1_disabled_no_match(self):
+- # self._incompatible_peers(
+- # client_init=_disable_sha2, server_init=_disable_sha1
+- # )
+-
+- # def test_client_sha1_disabled_server_sha2_disabled_no_match(self):
+- # self._incompatible_peers(
+- # client_init=_disable_sha1, server_init=_disable_sha2
+- # )
+-
+ def test_explicit_client_hostkey_not_limited(self):
+ # Be very explicit about the hostkey on BOTH ends,
+ # and ensure it still ends up choosing sha2-512.
+@@ -1233,7 +1223,7 @@ class TestExtInfo(unittest.TestCase):
+ # data stored on Transport after hearing back from a compatible
+ # server (such as ourselves in server mode)
+ assert tc.server_extensions == {
+- "server-sig-algs": b"ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,rsa-sha2-512,rsa-sha2-256,ssh-rsa" # noqa
++ "server-sig-algs": b"ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,rsa-sha2-512,rsa-sha2-256" # noqa
+ }
+
+ def test_client_uses_server_sig_algs_for_pubkey_auth(self):
+--
+2.35.6
+
new file mode 100644
@@ -0,0 +1,60 @@
+From 007d18822985c05c786d4f4fd43d51427e71faed Mon Sep 17 00:00:00 2001
+From: Jeff Forcier <jeff@bitprophet.org>
+Date: Sat, 21 Feb 2026 22:10:42 -0500
+Subject: [PATCH] Lintin' ain't easy
+
+CVE: CVE-2026-44405
+Upstream-Status: Backport [https://github.com/paramiko/paramiko/commit/b8f75c7cd19d5c26220737c66498e5066af239b7]
+
+Signed-off-by: Ashishkumar Parmar <asparmar@cisco.com>
+---
+ paramiko/auth_handler.py | 1 -
+ paramiko/client.py | 3 ++-
+ tests/_util.py | 4 ----
+ 3 files changed, 2 insertions(+), 6 deletions(-)
+
+diff --git a/paramiko/auth_handler.py b/paramiko/auth_handler.py
+index 39c68a51..88fd86cb 100644
+--- a/paramiko/auth_handler.py
++++ b/paramiko/auth_handler.py
+@@ -23,7 +23,6 @@
+ import weakref
+ import threading
+ import time
+-import re
+
+ from paramiko.common import (
+ cMSG_SERVICE_REQUEST,
+diff --git a/paramiko/client.py b/paramiko/client.py
+index 73acfc67..075b294d 100644
+--- a/paramiko/client.py
++++ b/paramiko/client.py
+@@ -462,8 +462,9 @@ class SSHClient(ClosingContextManager):
+ elif "rsa-sha2-256" in sec_opts.key_types:
+ keytype = "rsa-sha2-256"
+ else:
++ # TODO: vvv
+ raise Exception(
+- "TODO: REPLACEME with appropriate exception for 'what even is this key type in your known_hosts files?'"
++ "TODO: REPLACEME with appropriate exception for 'what even is this key type in your known_hosts files?'" # noqa
+ )
+ other_types = [x for x in sec_opts.key_types if x != keytype]
+ sec_opts.key_types = [keytype] + other_types
+diff --git a/tests/_util.py b/tests/_util.py
+index 295143b2..857d7752 100644
+--- a/tests/_util.py
++++ b/tests/_util.py
+@@ -26,10 +26,6 @@ from paramiko import (
+ )
+ from paramiko.ssh_gss import GSS_AUTH_AVAILABLE
+
+-from cryptography.exceptions import UnsupportedAlgorithm, _Reasons
+-from cryptography.hazmat.backends import default_backend
+-from cryptography.hazmat.primitives import hashes
+-from cryptography.hazmat.primitives.asymmetric import padding, rsa
+
+ tests_dir = dirname(realpath(__file__))
+
+--
+2.35.6
+
new file mode 100644
@@ -0,0 +1,60 @@
+From ae38356e6316723d252232d951aef31a28b6a225 Mon Sep 17 00:00:00 2001
+From: Jeff Forcier <jeff@bitprophet.org>
+Date: Sat, 10 Oct 2026 17:16:27 -0400
+Subject: [PATCH] Fix #2628: update default of RSAKey.sign_ssh_data
+
+CVE: CVE-2026-44405
+Upstream-Status: Backport [https://github.com/paramiko/paramiko/commit/11f98404a799d6367550fb4144eeb44290cfd7fe]
+
+Backport Changes:
+- Omit the sites/www/changelog.rst hunk because the file is absent from
+ the Paramiko 4.0.0 PyPI source archive.
+
+Signed-off-by: Ashishkumar Parmar <asparmar@cisco.com>
+---
+ paramiko/rsakey.py | 6 +++++-
+ tests/test_pkey.py | 8 +++++---
+ 2 files changed, 10 insertions(+), 4 deletions(-)
+
+diff --git a/paramiko/rsakey.py b/paramiko/rsakey.py
+index a254b81e..47b528c2 100644
+--- a/paramiko/rsakey.py
++++ b/paramiko/rsakey.py
+@@ -125,8 +125,12 @@ class RSAKey(PKey):
+ return isinstance(self.key, rsa.RSAPrivateKey)
+
+ def sign_ssh_data(self, data, algorithm=None):
++ # Default to strongest implemented algorithm when unspecified. (We used
++ # to have an 'obvious' default prior to the SHA2 era, but that's no
++ # longer the case, but here it's better to guess and default to
++ # best-possible, than to just blow up.
+ if algorithm is None:
+- algorithm = self.name
++ algorithm = "rsa-sha2-512"
+ sig = self.key.sign(
+ data,
+ padding=padding.PKCS1v15(),
+diff --git a/tests/test_pkey.py b/tests/test_pkey.py
+index e783fbd3..422b7653 100644
+--- a/tests/test_pkey.py
++++ b/tests/test_pkey.py
+@@ -206,11 +206,13 @@ class KeyTest(unittest.TestCase):
+ self._sign_and_verify_rsa("rsa-sha2-256", SIGNED_RSA_256)
+
+ def test_generate_rsa(self):
+- # TODO: this probs needs to be larger number now
+- key = RSAKey.generate(1024)
+- msg = key.sign_ssh_data(b"jerri blank", algorithm="rsa-sha2-256")
++ key = RSAKey.generate(4096)
++ msg = key.sign_ssh_data(b"jerri blank", algorithm=None)
+ msg.rewind()
+ self.assertTrue(key.verify_ssh_sig(b"jerri blank", msg))
++ # Safety check: confirm algorithm used defaulted to sha2-512
++ msg.rewind()
++ assert msg.get_text() == "rsa-sha2-512"
+
+ def test_generate_ecdsa(self):
+ key = ECDSAKey.generate()
+--
+2.35.6
+
@@ -9,6 +9,15 @@ PYPI_PACKAGE = "paramiko"
inherit pypi python_setuptools_build_meta
+SRC_URI += " \
+ file://CVE-2026-44405_p1.patch \
+ file://CVE-2026-44405_p2.patch \
+ file://CVE-2026-44405_p3.patch \
+ file://CVE-2026-44405_p4.patch \
+ file://CVE-2026-44405_p5.patch \
+ file://CVE-2026-44405_p6.patch \
+"
+
CLEANBROKEN = "1"
RDEPENDS:${PN} += " \