[openssh-commits] [openssh] 15/18: upstream: don't run ~/.ssh/rc and co for forced command and
git+noreply at mindrot.org
git+noreply at mindrot.org
Wed Nov 25 19:56:10 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 79a1f94515f8eaeca8d88dc9728fa0b383417e44
Author: djm at openbsd.org <djm at openbsd.org>
AuthorDate: Wed Nov 25 08:37:34 2026 +0000
upstream: don't run ~/.ssh/rc and co for forced command and
internal-sftp, even if PermitUserRC is enabled, avoiding /proc based attacks
on some systems
Anthropic ANT-2026-IG416NNU
OpenBSD-Commit-ID: 4c3a7bbfe32ded2d12c58483a22409d608318ad8
---
session.c | 13 +++++++++++--
sshd.8 | 8 ++++++--
2 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/session.c b/session.c
index 8acb261d6..361a0653b 100644
--- a/session.c
+++ b/session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: session.c,v 1.355 2026/11/25 07:57:58 djm Exp $ */
+/* $OpenBSD: session.c,v 1.356 2026/11/25 08:37:34 djm Exp $ */
/*
* Copyright (c) 1995 Tatu Ylonen <ylo at cs.hut.fi>, Espoo, Finland
* All rights reserved
@@ -1595,7 +1595,16 @@ do_child(struct ssh *ssh, Session *s, const char *command)
closefrom(STDERR_FILENO + 1);
- do_rc_files(ssh, s, shell);
+ /*
+ * Don't run rc files or xauth for sessions forced to the in-process
+ * sftp server (ForceCommand/command="internal-sftp"). Such users are
+ * not supposed to execute anything: unlike internal-sftp itself, the
+ * helper processes are traceable and could be taken over via another
+ * sftp session.
+ */
+ if (!s->forced || (s->is_subsystem != SUBSYSTEM_INT_SFTP &&
+ s->is_subsystem != SUBSYSTEM_INT_SFTP_ERROR))
+ do_rc_files(ssh, s, shell);
/* restore SIGPIPE for child */
ssh_signal(SIGPIPE, SIG_DFL);
diff --git a/sshd.8 b/sshd.8
index 92842e345..b21e34732 100644
--- a/sshd.8
+++ b/sshd.8
@@ -33,8 +33,8 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $OpenBSD: sshd.8,v 1.332 2026/09/02 00:37:59 djm Exp $
-.Dd $Mdocdate: September 2 2026 $
+.\" $OpenBSD: sshd.8,v 1.333 2026/11/25 08:37:34 djm Exp $
+.Dd $Mdocdate: November 25 2026 $
.Dt SSHD 8
.Os
.Sh NAME
@@ -438,6 +438,10 @@ If this file does not exist,
.Pa /etc/ssh/sshrc
is run, and if that
does not exist either, xauth is used to add the cookie.
+.Pp
+None of these are run for sessions that are forced to use the in-process
+.Cm internal-sftp
+server.
.Sh AUTHORIZED_KEYS FILE FORMAT
.Cm AuthorizedKeysFile
specifies the files containing public keys for
--
To stop receiving notification emails like this one, please contact
djm at mindrot.org.
More information about the openssh-commits
mailing list