Skip to content

Commit 0fbcbf1

Browse files
Merge pull request #14 from xcp-ng-rpms/lrr_fix_cve10.3
Fix multiple CVE
2 parents 253a95a + 86a5eca commit 0fbcbf1

6 files changed

Lines changed: 291 additions & 1 deletion
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
Origin: upstream, https://github.com/openssh/openssh-portable/commit/fc86875e6acb36401dfc1dfb6b628a9d1460f367
2+
Backport notes:
3+
- Only the "version identifier/RCS ID" in the header has been updated
4+
to reflect our current base file.
5+
6+
From fc86875e6acb36401dfc1dfb6b628a9d1460f367 Mon Sep 17 00:00:00 2001
7+
From: "djm@openbsd.org" <djm@openbsd.org>
8+
Date: Wed, 9 Apr 2025 07:00:03 +0000
9+
Subject: [PATCH] upstream: Fix logic error in DisableForwarding option. This
10+
option
11+
12+
was documented as disabling X11 and agent forwarding but it failed to do so.
13+
Spotted by Tim Rice.
14+
15+
OpenBSD-Commit-ID: fffc89195968f7eedd2fc57f0b1f1ef3193f5ed1
16+
Backported-by: Lucas Ravagnier <lucas.ravagnier@vates.tech>
17+
---
18+
session.c | 7 ++++---
19+
1 file changed, 4 insertions(+), 3 deletions(-)
20+
21+
diff --git a/session.c b/session.c
22+
index 52a4a3446..6444c77f3 100644
23+
--- a/session.c
24+
+++ b/session.c
25+
@@ -1,4 +1,4 @@
26+
-/* $OpenBSD: session.c,v 1.338 2024/05/17 00:30:24 djm Exp $ */
27+
+/* $OpenBSD: session.c,v 1.341 2025/04/09 07:00:03 djm Exp $ */
28+
/*
29+
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
30+
* All rights reserved
31+
@@ -2171,7 +2171,8 @@ session_auth_agent_req(struct ssh *ssh, Session *s)
32+
if ((r = sshpkt_get_end(ssh)) != 0)
33+
sshpkt_fatal(ssh, r, "%s: parse packet", __func__);
34+
if (!auth_opts->permit_agent_forwarding_flag ||
35+
- !options.allow_agent_forwarding) {
36+
+ !options.allow_agent_forwarding ||
37+
+ options.disable_forwarding) {
38+
debug_f("agent forwarding disabled");
39+
return 0;
40+
}
41+
@@ -2566,7 +2567,7 @@ session_setup_x11fwd(struct ssh *ssh, Session *s)
42+
ssh_packet_send_debug(ssh, "X11 forwarding disabled by key options.");
43+
return 0;
44+
}
45+
- if (!options.x11_forwarding) {
46+
+ if (!options.x11_forwarding || options.disable_forwarding) {
47+
debug("X11 forwarding disabled in server configuration file.");
48+
return 0;
49+
}
50+
--
51+
2.54.0
52+
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
Origin: upstream, https://github.com/openssh/openssh-portable/commit/35d5917652106aede47621bb3f64044604164043
2+
Backport notes:
3+
- This backport only keeps the valid_ruser() hardening (rejecting
4+
control characters in usernames), which is the part of the upstream
5+
fix that applies to our 9.8p1 base.
6+
- The rest of the upstream commit (tracking user_on_commandline /
7+
user_was_default / user_expanded and restricting %-expansion to
8+
usernames read from the configuration file) has been dropped: 9.8p1
9+
does not yet support %-expansion of the "User" keyword at all (that
10+
feature was introduced upstream after 9.8p1), so that attack vector
11+
does not exist in this codebase. options.user is already validated
12+
with valid_ruser() exactly once, before ssh_config is parsed, so only
13+
command-line-supplied usernames (-l, user@host, ssh:// URI) are
14+
checked, which matches upstream's end goal that config-supplied
15+
literal usernames are trusted and not re-validated.
16+
- Only the "version identifier/RCS ID" in the header has been updated
17+
to reflect our current base file.
18+
19+
From 35d5917652106aede47621bb3f64044604164043 Mon Sep 17 00:00:00 2001
20+
From: "djm@openbsd.org" <djm@openbsd.org>
21+
Date: Thu, 4 Sep 2025 00:29:09 +0000
22+
Subject: [PATCH] upstream: Improve rules for %-expansion of username.
23+
24+
Usernames passed on the commandline will no longer be subject to
25+
% expansion. Some tools invoke ssh with connection information
26+
(i.e. usernames and host names) supplied from untrusted sources.
27+
These may contain % expansion sequences which could yield
28+
unexpected results.
29+
30+
Since openssh-9.6, all usernames have been subject to validity
31+
checking. This change tightens the validity checks by refusing
32+
usernames that include control characters (again, these can cause
33+
surprises when supplied adversarially).
34+
35+
This change also relaxes the validity checks in one small way:
36+
usernames supplied via the configuration file as literals (i.e.
37+
include no % expansion characters) are not subject to these
38+
validity checks. This allows usernames that contain arbitrary
39+
characters to be used, but only via configuration files. This
40+
is done on the basis that ssh's configuration is trusted.
41+
42+
Pointed out by David Leadbeater, ok deraadt@
43+
44+
OpenBSD-Commit-ID: e2f0c871fbe664aba30607321575e7c7fc798362
45+
Backported-by: Lucas Ravagnier <lucas.ravagnier@vates.tech>
46+
---
47+
ssh.c | 2 ++
48+
1 file changed, 2 insertions(+)
49+
50+
diff --git a/ssh.c b/ssh.c
51+
index aee4cf6..bca1085 100644
52+
--- a/ssh.c
53+
+++ b/ssh.c
54+
@@ -1,4 +1,4 @@
55+
-/* $OpenBSD: ssh.c,v 1.600 2024/01/11 01:45:36 djm Exp $ */
56+
+/* $OpenBSD: ssh.c,v 1.617 2025/09/04 00:29:09 djm Exp $ */
57+
/*
58+
* Author: Tatu Ylonen <ylo@cs.hut.fi>
59+
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
60+
@@ -650,6 +650,8 @@ valid_ruser(const char *s)
61+
if (*s == '-')
62+
return 0;
63+
for (i = 0; s[i] != 0; i++) {
64+
+ if (iscntrl((u_char)s[i]))
65+
+ return 0;
66+
if (strchr("'`\";&<>|(){}", s[i]) != NULL)
67+
return 0;
68+
/* Disallow '-' after whitespace */
69+
--
70+
2.54.0
71+
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
Origin: upstream, https://github.com/openssh/openssh-portable/commit/43b3bff47bb029f2299bacb6a36057981b39fdb0
2+
Backport notes:
3+
- Only the "version identifier/RCS ID" in headers has been modified.
4+
5+
From 43b3bff47bb029f2299bacb6a36057981b39fdb0 Mon Sep 17 00:00:00 2001
6+
From: "djm@openbsd.org" <djm@openbsd.org>
7+
Date: Thu, 4 Sep 2025 00:30:06 +0000
8+
Subject: [PATCH] upstream: don't allow \0 characters in url-encoded strings.
9+
10+
Suggested by David Leadbeater, ok deraadt@
11+
12+
OpenBSD-Commit-ID: c92196cef0f970ceabc1e8007a80b01e9b7cd49c
13+
Backported-by: Lucas Ravagnier <lucas.ravagnier@vates.tech>
14+
---
15+
misc.c | 7 ++++---
16+
1 file changed, 4 insertions(+), 3 deletions(-)
17+
18+
diff --git a/misc.c b/misc.c
19+
index 5c384c63d..c80f65554 100644
20+
--- a/misc.c
21+
+++ b/misc.c
22+
@@ -1,4 +1,4 @@
23+
-/* $OpenBSD: misc.c,v 1.196 2024/06/06 17:15:25 djm Exp $ */
24+
+/* $OpenBSD: misc.c,v 1.205 2025/09/04 00:30:06 djm Exp $ */
25+
/*
26+
* Copyright (c) 2000 Markus Friedl. All rights reserved.
27+
* Copyright (c) 2005-2020 Damien Miller. All rights reserved.
28+
@@ -994,7 +994,7 @@ urldecode(const char *src)
29+
size_t srclen;
30+
31+
if ((srclen = strlen(src)) >= SIZE_MAX)
32+
- fatal_f("input too large");
33+
+ return NULL;
34+
ret = xmalloc(srclen + 1);
35+
for (dst = ret; *src != '\0'; src++) {
36+
switch (*src) {
37+
@@ -1002,9 +1002,10 @@ urldecode(const char *src)
38+
*dst++ = ' ';
39+
break;
40+
case '%':
41+
+ /* note: don't allow \0 characters */
42+
if (!isxdigit((unsigned char)src[1]) ||
43+
!isxdigit((unsigned char)src[2]) ||
44+
- (ch = hexchar(src + 1)) == -1) {
45+
+ (ch = hexchar(src + 1)) == -1 || ch == 0) {
46+
free(ret);
47+
return NULL;
48+
}
49+
--
50+
2.54.0
51+
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
Origin: upstream, https://github.com/openssh/openssh-portable/commit/487e8ac146f7d6616f65c125d5edb210519b833a
2+
Backport notes:
3+
- Only the "version identifier/RCS ID" in headers has been modified.
4+
5+
From 487e8ac146f7d6616f65c125d5edb210519b833a Mon Sep 17 00:00:00 2001
6+
From: "djm@openbsd.org" <djm@openbsd.org>
7+
Date: Thu, 2 Apr 2026 07:42:16 +0000
8+
Subject: [PATCH] upstream: when downloading files as root in legacy (-O) mode
9+
and
10+
11+
without the -p (preserve modes) flag set, clear setuid/setgid bits from
12+
downloaded files as one might expect.
13+
14+
AFAIK this bug dates back to the original Berkeley rcp program.
15+
16+
Reported by Christos Papakonstantinou of Cantina and Spearbit.
17+
18+
OpenBSD-Commit-ID: 49e902fca8dd933a92a9b547ab31f63e86729fa1
19+
Backported-by: Lucas Ravagnier <lucas.ravagnier@vates.tech>
20+
---
21+
scp.c | 6 ++++--
22+
1 file changed, 4 insertions(+), 2 deletions(-)
23+
24+
diff --git a/scp.c b/scp.c
25+
index e46daef90..1faa9a555 100644
26+
--- a/scp.c
27+
+++ b/scp.c
28+
@@ -1,4 +1,4 @@
29+
-/* $OpenBSD: scp.c,v 1.261 2024/06/26 23:14:14 deraadt Exp $ */
30+
+/* $OpenBSD: scp.c,v 1.273 2026/04/02 07:42:16 djm Exp $ */
31+
/*
32+
* scp - secure remote copy. This is basically patched BSD rcp which
33+
* uses ssh to do the data transfer (instead of using rcmd).
34+
@@ -1678,8 +1678,10 @@ sink(int argc, char **argv, const char *src)
35+
36+
setimes = targisdir = 0;
37+
mask = umask(0);
38+
- if (!pflag)
39+
+ if (!pflag) {
40+
+ mask |= 07000;
41+
(void) umask(mask);
42+
+ }
43+
if (argc != 1) {
44+
run_err("ambiguous target");
45+
exit(1);
46+
--
47+
2.54.0
48+
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
Origin: upstream, https://github.com/openssh/openssh-portable/commit/c805b97b67c774e0bf922ffb29dfbcda9d7b5add
2+
Backport notes:
3+
- Only the "version identifier/RCS ID" in headers has been modified.
4+
5+
From c805b97b67c774e0bf922ffb29dfbcda9d7b5add Mon Sep 17 00:00:00 2001
6+
From: "djm@openbsd.org" <djm@openbsd.org>
7+
Date: Thu, 2 Apr 2026 07:39:57 +0000
8+
Subject: [PATCH] upstream: add missing askpass check when using
9+
10+
ControlMaster=ask/autoask and "ssh -O proxy ..."; reported by Michalis
11+
Vasileiadis
12+
13+
OpenBSD-Commit-ID: 8dd7b9b96534e9a8726916b96d36bed466d3836a
14+
Backported-by: Lucas Ravagnier <lucas.ravagnier@vates.tech>
15+
---
16+
mux.c | 12 +++++++++++-
17+
1 file changed, 11 insertions(+), 1 deletion(-)
18+
19+
diff --git a/mux.c b/mux.c
20+
index 5e20c7760..0cd169732 100644
21+
--- a/mux.c
22+
+++ b/mux.c
23+
@@ -1,4 +1,4 @@
24+
-/* $OpenBSD: mux.c,v 1.101 2023/11/23 03:37:05 dtucker Exp $ */
25+
+/* $OpenBSD: mux.c,v 1.113 2026/04/02 07:39:57 djm Exp $ */
26+
/*
27+
* Copyright (c) 2002-2008 Damien Miller <djm@openbsd.org>
28+
*
29+
@@ -1172,6 +1172,16 @@ mux_master_process_proxy(struct ssh *ssh, u_int rid,
30+
31+
debug_f("channel %d: proxy request", c->self);
32+
33+
+ if (options.control_master == SSHCTL_MASTER_ASK ||
34+
+ options.control_master == SSHCTL_MASTER_AUTO_ASK) {
35+
+ if (!ask_permission("Allow multiplex proxy connection?")) {
36+
+ debug2_f("proxy refused by user");
37+
+ reply_error(reply, MUX_S_PERMISSION_DENIED, rid,
38+
+ "Permission denied");
39+
+ return 0;
40+
+ }
41+
+ }
42+
+
43+
c->mux_rcb = channel_proxy_downstream;
44+
if ((r = sshbuf_put_u32(reply, MUX_S_PROXY)) != 0 ||
45+
(r = sshbuf_put_u32(reply, rid)) != 0)
46+
--
47+
2.54.0
48+

SPECS/openssh.spec

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# start the release from openssh_rel as other packages requires
66

77
# XCP-ng sub release number
8-
%define xcpng_subrel 4
8+
%define xcpng_subrel 5
99

1010
%global WITH_SELINUX 0
1111

@@ -128,6 +128,11 @@ Patch1003: openssh-9.8p1-CVE-2026-35414-when-certificate-support-was-added.patch
128128
Patch1004: openssh-9.8p1-CVE-2026-35414-regression-test-for-certificates.patch
129129
Patch1005: openssh-9.8p1-upstream-correctly-match-ECDSA-signature-algorithms.patch
130130
Patch1006: openssh-9.8p1-upstream-correctly-quote-wildcard-host-certificate.patch
131+
Patch1007: openssh-9.8p1-CVE-2025-32728-Fix-logic-error-in-DisableForwarding-option.patch
132+
Patch1008: openssh-9.8p1-CVE-2025-61984-Improve-rules-for-expansion-of-username.patch
133+
Patch1009: openssh-9.8p1-CVE-2025-61985-don-t-allow-0-characters-in-url-encoded-str.patch
134+
Patch1010: openssh-9.8p1-CVE-2026-35385-when-downloading-files-as-root-in-legacy-O-.patch
135+
Patch1011: openssh-9.8p1-CVE-2026-35388-add-missing-askpass-check-when-using.patch
131136

132137
Source24: ssh_config
133138
Source25: sshd_config
@@ -513,6 +518,21 @@ cat %{_sysconfdir}/ssh/ssh_config.dup > %{_sysconfdir}/ssh/ssh_config
513518
%endif
514519

515520
%changelog
521+
* Wed Jul 15 2026 Lucas Ravagnier <lucas.ravagnier@vates.tech> - 9.8p1-1.2.5
522+
- Fix CVE-2025-32728 (X11 and agent forwarding were not disabled by the
523+
DisableForwarding option due to a logic error)
524+
- Fix CVE-2025-61984 (ssh(1) did not reject control characters in remote
525+
usernames supplied on the commandline, which could be abused to inject
526+
data into a ProxyCommand relying on %r expansion)
527+
- Fix CVE-2025-61985 ('\0' characters were not rejected in url-encoded
528+
strings such as ssh:// URIs, which could allow NUL-byte smuggling into
529+
values used by ProxyCommand, potentially leading to code execution)
530+
- Fix CVE-2026-35385 (files downloaded as root with scp's legacy -O mode
531+
but without -p did not have their setuid/setgid bits cleared, allowing
532+
privilege escalation)
533+
- Fix CVE-2026-35388 (missing askpass confirmation when using
534+
ControlMaster=ask/autoask with "ssh -O proxy ...")
535+
516536
* Wed Apr 29 2026 Vincent Michel <vincent.michel@vates.tech> - 9.8p1-1.2.4
517537
- Disable the use of ssh-rsa with SHA-1 (temporarily enabled in 9.8p1-1.2.2)
518538

0 commit comments

Comments
 (0)