Correct error code processing
Fix missing error codes set and invalid error code checks in OpenSSH. It prevents memory exhaustion attack and a MITM attack when VerifyHostKeyDNS is on (CVE-2025-26465). Resolves: RHEL-78700
This commit is contained in:
parent
0fd4a1cd57
commit
2a4cfc7fd4
69
openssh-9.9p2-error_processing.patch
Normal file
69
openssh-9.9p2-error_processing.patch
Normal file
@ -0,0 +1,69 @@
|
||||
diff --git a/krl.c b/krl.c
|
||||
index e2efdf06..0d0f6953 100644
|
||||
--- a/krl.c
|
||||
+++ b/krl.c
|
||||
@@ -674,6 +674,7 @@ revoked_certs_generate(struct revoked_certs *rc, struct sshbuf *buf)
|
||||
break;
|
||||
case KRL_SECTION_CERT_SERIAL_BITMAP:
|
||||
if (rs->lo - bitmap_start > INT_MAX) {
|
||||
+ r = SSH_ERR_INVALID_FORMAT;
|
||||
error_f("insane bitmap gap");
|
||||
goto out;
|
||||
}
|
||||
@@ -1059,6 +1060,7 @@ ssh_krl_from_blob(struct sshbuf *buf, struct ssh_krl **krlp)
|
||||
goto out;
|
||||
|
||||
if ((krl = ssh_krl_init()) == NULL) {
|
||||
+ r = SSH_ERR_ALLOC_FAIL;
|
||||
error_f("alloc failed");
|
||||
goto out;
|
||||
}
|
||||
diff --git a/sshconnect2.c b/sshconnect2.c
|
||||
index a69c4da1..1ee6000a 100644
|
||||
--- a/sshconnect2.c
|
||||
+++ b/sshconnect2.c
|
||||
@@ -99,7 +99,7 @@ verify_host_key_callback(struct sshkey *hostkey, struct ssh *ssh)
|
||||
options.required_rsa_size)) != 0)
|
||||
fatal_r(r, "Bad server host key");
|
||||
if (verify_host_key(xxx_host, xxx_hostaddr, hostkey,
|
||||
- xxx_conn_info) == -1)
|
||||
+ xxx_conn_info) != 0)
|
||||
fatal("Host key verification failed.");
|
||||
return 0;
|
||||
}
|
||||
@@ -699,6 +699,7 @@ input_userauth_pk_ok(int type, u_int32_t seq, struct ssh *ssh)
|
||||
|
||||
if ((pktype = sshkey_type_from_name(pkalg)) == KEY_UNSPEC) {
|
||||
debug_f("server sent unknown pkalg %s", pkalg);
|
||||
+ r = SSH_ERR_INVALID_FORMAT;
|
||||
goto done;
|
||||
}
|
||||
if ((r = sshkey_from_blob(pkblob, blen, &key)) != 0) {
|
||||
@@ -709,6 +710,7 @@ input_userauth_pk_ok(int type, u_int32_t seq, struct ssh *ssh)
|
||||
error("input_userauth_pk_ok: type mismatch "
|
||||
"for decoded key (received %d, expected %d)",
|
||||
key->type, pktype);
|
||||
+ r = SSH_ERR_INVALID_FORMAT;
|
||||
goto done;
|
||||
}
|
||||
|
||||
@@ -728,6 +730,7 @@ input_userauth_pk_ok(int type, u_int32_t seq, struct ssh *ssh)
|
||||
SSH_FP_DEFAULT);
|
||||
error_f("server replied with unknown key: %s %s",
|
||||
sshkey_type(key), fp == NULL ? "<ERROR>" : fp);
|
||||
+ r = SSH_ERR_INVALID_FORMAT;
|
||||
goto done;
|
||||
}
|
||||
ident = format_identity(id);
|
||||
diff --git a/sshsig.c b/sshsig.c
|
||||
index 6e03c0b0..3da005d6 100644
|
||||
--- a/sshsig.c
|
||||
+++ b/sshsig.c
|
||||
@@ -879,6 +879,7 @@ cert_filter_principals(const char *path, u_long linenum,
|
||||
}
|
||||
if ((principals = sshbuf_dup_string(nprincipals)) == NULL) {
|
||||
error_f("buffer error");
|
||||
+ r = SSH_ERR_ALLOC_FAIL;
|
||||
goto out;
|
||||
}
|
||||
/* success */
|
12
openssh.spec
12
openssh.spec
@ -47,7 +47,7 @@
|
||||
|
||||
# Do not forget to bump pam_ssh_agent_auth release if you rewind the main package release to 1
|
||||
%global openssh_ver 8.7p1
|
||||
%global openssh_rel 44
|
||||
%global openssh_rel 45
|
||||
%global pam_ssh_agent_ver 0.10.4
|
||||
%global pam_ssh_agent_rel 5
|
||||
|
||||
@ -297,6 +297,9 @@ Patch1022: openssh-8.7p1-redhat-help.patch
|
||||
Patch1023: openssh-8.7p1-openssl-log.patch
|
||||
#upstream commit 52dfe3c72d98503d8b7c6f64fc7e19d685636c0b
|
||||
Patch1024: openssh-8.7p1-allow-duplicate-subsystem.patch
|
||||
# upstream 6ce00f0c2ecbb9f75023dbe627ee6460bcec78c2
|
||||
# upstream 0832aac79517611dd4de93ad0a83577994d9c907
|
||||
Patch1025: openssh-9.9p2-error_processing.patch
|
||||
|
||||
License: BSD
|
||||
Requires: /sbin/nologin
|
||||
@ -526,6 +529,7 @@ popd
|
||||
%patch1022 -p1 -b .redhat-help
|
||||
%patch1023 -p1 -b .openssl-log
|
||||
%patch1024 -p1 -b .allow-dup-subsystem
|
||||
%patch1025 -p1 -b .errcode_set
|
||||
|
||||
autoreconf
|
||||
pushd pam_ssh_agent_auth-pam_ssh_agent_auth-%{pam_ssh_agent_ver}
|
||||
@ -813,6 +817,12 @@ test -f %{sysconfig_anaconda} && \
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Tue Feb 18 2025 Dmitry Belyavskiy <dbelyavs@redhat.com> - 8.7p1-45
|
||||
- Fix missing error codes set and invalid error code checks in OpenSSH. It
|
||||
prevents memory exhaustion attack and a MITM attack when VerifyHostKeyDNS
|
||||
is on (CVE-2025-26465).
|
||||
Resolves: RHEL-78700
|
||||
|
||||
* Mon Oct 21 2024 Dmitry Belyavskiy <dbelyavs@redhat.com> - 8.7p1-44
|
||||
- Add extra help information on ssh early failure
|
||||
Resolves: RHEL-33809
|
||||
|
Loading…
Reference in New Issue
Block a user