[openssh-commits] [openssh] 61/87: upstream: disallow remote removal of PKCS#11 providers from

git+noreply at mindrot.org git+noreply at mindrot.org
Fri Oct 30 20:21:38 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 69ccd0ff2148fbdb36cf891efa724839a36b5c94
Author: djm at openbsd.org <djm at openbsd.org>
AuthorDate: Fri Oct 30 07:18:18 2026 +0000

    upstream: disallow remote removal of PKCS#11 providers from
    
    ssh-agent by default, as this permits an attacker with access to a forwarded
    agent a silly path-validity oracle. It's better just to be symmetric with the
    restrictions on adding providers.
    
    Note: a user of a forwarded agent can still remove a provider's _keys_
    as it is important that access to keys can be easily revoked, this just
    block removing entire providers by name.
    
    Anthropic ANT-2026-DYLIZ0VY
    
    OpenBSD-Commit-ID: 1a80510964e03bfd69336580a82a72cbb8983ea4
---
 ssh-agent.1 |  8 ++++----
 ssh-agent.c | 14 ++++++++++++--
 2 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/ssh-agent.1 b/ssh-agent.1
index 96fa85e9c..6127c701d 100644
--- a/ssh-agent.1
+++ b/ssh-agent.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: ssh-agent.1,v 1.89 2026/09/18 12:06:46 jsg Exp $
+.\" $OpenBSD: ssh-agent.1,v 1.90 2026/10/30 07:18:18 djm Exp $
 .\"
 .\" Author: Tatu Ylonen <ylo at cs.hut.fi>
 .\" Copyright (c) 1995 Tatu Ylonen <ylo at cs.hut.fi>, Espoo, Finland
@@ -34,7 +34,7 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd $Mdocdate: September 18 2026 $
+.Dd $Mdocdate: October 30 2026 $
 .Dt SSH-AGENT 1
 .Os
 .Sh NAME
@@ -144,8 +144,8 @@ The
 .Cm allow-remote-pkcs11
 option allows clients of a forwarded
 .Nm
-to load PKCS#11 or FIDO provider libraries.
-By default only local clients may perform this operation.
+to load PKCS#11 or FIDO provider libraries, and to remove PKCS#11 providers.
+By default only local clients may perform these operations.
 Note that signalling that an
 .Nm
 client is remote is performed by
diff --git a/ssh-agent.c b/ssh-agent.c
index 705731702..be0de2a91 100644
--- a/ssh-agent.c
+++ b/ssh-agent.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-agent.c,v 1.335 2026/10/30 04:22:15 djm Exp $ */
+/* $OpenBSD: ssh-agent.c,v 1.336 2026/10/30 07:18:18 djm Exp $ */
 /*
  * Author: Tatu Ylonen <ylo at cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo at cs.hut.fi>, Espoo, Finland
@@ -1709,11 +1709,21 @@ process_remove_smartcard_key(SocketEntry *e)
 	}
 	free(pin);
 
+	if (socket_is_remote(e) && !remote_add_provider) {
+		verbose("failed PKCS#11 remove of \"%.100s\": remote removal of "
+		    "providers is disabled", provider);
+		goto send;
+	}
 	if (realpath(provider, canonical_provider) == NULL) {
-		verbose("failed PKCS#11 add of \"%.100s\": realpath: %s",
+		verbose("failed PKCS#11 remove of \"%.100s\": realpath: %s",
 		    provider, strerror(errno));
 		goto send;
 	}
+	if (match_pattern_list(canonical_provider, allowed_providers, 0) != 1) {
+		verbose("refusing PKCS#11 remove of \"%.100s\": "
+		    "provider not allowed", canonical_provider);
+		goto send;
+	}
 
 	debug_f("remove %.100s", canonical_provider);
 	for (id = TAILQ_FIRST(&idtab->idlist); id; id = nxt) {

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list