[openssh-commits] [openssh] 11/18: upstream: clear state if do_exec fails on a subsystem request, as
git+noreply at mindrot.org
git+noreply at mindrot.org
Wed Nov 25 19:56:06 AEDT 2026
This is an automated email from the git hooks/post-receive script.
djm pushed a commit to branch master
in repository openssh.
commit 70be2fd8358ce13759e5239f04522efea0ab5a55
Author: djm at openbsd.org <djm at openbsd.org>
AuthorDate: Wed Nov 25 07:57:58 2026 +0000
upstream: clear state if do_exec fails on a subsystem request, as
the channel is still in a larval state and could reattempt the operation. In
very unlikely situations (e.g. no login shell, no ForceCommand and the
attacker having the ability to make execve() or fd allocation fail on the
server), the old subsystem state could persist and allow the attacker to
remove arguments from an internal-sftp subsystem
Anthropic ANT-2026-E9OLPWUJ
OpenBSD-Commit-ID: a7ec259505ca71ec274ead28fe25fff5cf27a37c
---
session.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/session.c b/session.c
index dca2304d2..8acb261d6 100644
--- a/session.c
+++ b/session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: session.c,v 1.354 2026/10/30 02:31:36 djm Exp $ */
+/* $OpenBSD: session.c,v 1.355 2026/11/25 07:57:58 djm Exp $ */
/*
* Copyright (c) 1995 Tatu Ylonen <ylo at cs.hut.fi>, Espoo, Finland
* All rights reserved
@@ -1947,6 +1947,14 @@ session_subsystem_req(struct ssh *ssh, Session *s)
logit("subsystem request for %.100s by user %s failed, %s",
s->subsys, s->pw->pw_name,
found ? "execution failed" : "subsystem not found");
+ /*
+ * The channel is still larval and may receive a shell, exec
+ * or another subsystem request; don't leave it marked as a
+ * subsystem.
+ */
+ s->is_subsystem = SUBSYSTEM_NONE;
+ free(s->subsys);
+ s->subsys = NULL;
}
return success;
--
To stop receiving notification emails like this one, please contact
djm at mindrot.org.
More information about the openssh-commits
mailing list