All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
Cc: dhowells@redhat.com, Jakub Kicinski <kuba@kernel.org>,
	netdev@vger.kernel.org, Marc Dionne <marc.dionne@auristor.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
	linux-afs@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net v7 00/11] rxrpc: Fix CHALLENGE packet handling
Date: Tue, 18 Aug 2026 15:49:08 +0100	[thread overview]
Message-ID: <2088510.1787064548@warthog.procyon.org.uk> (raw)
In-Reply-To: <2038699.1787058233@warthog.procyon.org.uk>

David Howells <dhowells@redhat.com> wrote:

> 
>  (2) I should probably require READ permission on the key holding the appdata
>      provided by usespace through RXRPC_RESPONSE_APPDATA rather than SEARCH
>      permission to prevent this being used to pull the data out of keys that
>      can't otherwise read directly with keyctl().
> 
> I can fix both of these with follow-up single line fix patches or (2) could
> be fixed in place at the point of application:
> 
> --- a/net/rxrpc/sendmsg.c
> +++ b/net/rxrpc/sendmsg.c
> @@ -640,7 +640,7 @@ static int rxrpc_sendmsg_cmsg(struct msghdr *msg, struct rxrpc_send_params *p)
>  			if (p->call.app_data)
>  				return -EINVAL;
>  			key_id = *(key_serial_t *)CMSG_DATA(cmsg);
> -			key = lookup_user_key(key_id, 0, KEY_NEED_SEARCH);
> +			key = lookup_user_key(key_id, 0, KEY_NEED_READ);
>  			if (IS_ERR(key))
>  				return PTR_ERR(key);
>  			if (key_ref_to_ptr(key)->type != &key_type_user &&

Actually, there's a better way to do this, and that's to check the prefix on
the key description.  See attached patch.

David
---
commit 6d456b373d5c7cf2c1c9f5ead0e563c75e739442
Author: David Howells <dhowells@redhat.com>
Date:   Tue Aug 18 14:30:37 2026 +0100

    rxrpc: Fix user appdata key check
    
    The check made by rxrpc_sendmsg_cmsg() for RXRPC_RESPONSE_APPDATA on the
    key it retrieves allows keys to be accessed by generating
    CHALLENGE/RESPONSE exchange.  Currently, any user or logon key can be
    accessed in this manner.  Fix this by restricting the patch description to
    require a prefix of "rxrpc-appdata:".
    
    Fixes: xxxxxxxxxxxx ("rxrpc: Fix CHALLENGE packet overqueuing and simplify RESPONSE generation")
    Link: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260812110129.979970-6-dhowells@redhat.com
    Signed-off-by: David Howells <dhowells@redhat.com>
    cc: Marc Dionne <marc.dionne@auristor.com>
    cc: Jeffrey Altman <jaltman@auristor.com>
    cc: Eric Dumazet <edumazet@google.com>
    cc: "David S. Miller" <davem@davemloft.net>
    cc: Jakub Kicinski <kuba@kernel.org>
    cc: Paolo Abeni <pabeni@redhat.com>
    cc: Simon Horman <horms@kernel.org>
    cc: Jarkko Sakkinen <jarkko@kernel.org>
    cc: linux-afs@lists.infradead.org
    cc: keyrings@vger.kernel.org
    cc: stable@kernel.org

diff --git a/net/rxrpc/sendmsg.c b/net/rxrpc/sendmsg.c
index 4755fc76d8f3..eb3dc352684e 100644
--- a/net/rxrpc/sendmsg.c
+++ b/net/rxrpc/sendmsg.c
@@ -648,6 +648,13 @@ static int rxrpc_sendmsg_cmsg(struct msghdr *msg, struct rxrpc_send_params *p)
 				key_ref_put(key);
 				return -EINVAL;
 			}
+			if (!key_ref_to_ptr(key)->description ||
+			    strncmp(key_ref_to_ptr(key)->description,
+				    "rxrpc-appdata:", 14) != 0) {
+				key_ref_put(key);
+				return -EINVAL;
+			}
+				
 			p->call.app_data = key_ref_to_ptr(key);
 			break;
 

  reply	other threads:[~2026-08-18 14:49 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-12 11:01 [PATCH net v7 00/11] rxrpc: Fix CHALLENGE packet handling David Howells
2026-08-12 11:01 ` [PATCH net v7 01/11] rxrpc: Fix sendmsg to not return an error if last packet queued David Howells
2026-08-12 11:01 ` [PATCH net v7 02/11] rxrpc: Fix sendmsg length David Howells
2026-08-12 11:01 ` [PATCH net v7 03/11] rxrpc: Fix packet encryption error handling David Howells
2026-08-12 11:01 ` [PATCH net v7 04/11] rxrpc: Fix update of call->tx_pending without holding lock David Howells
2026-08-12 11:01 ` [PATCH net v7 05/11] rxrpc: Fix generation of notifications after call completion David Howells
2026-08-12 11:01 ` [PATCH net v7 06/11] rxrpc: Expand abort trace enum David Howells
2026-08-12 11:01 ` [PATCH net v7 07/11] keys: Add refcounting to user-defined key type payload David Howells
2026-08-12 11:01 ` [PATCH net v7 08/11] afs: Create a server appdata key David Howells
2026-08-12 11:01 ` [PATCH net v7 09/11] rxrpc: Pass appdata key to rxrpc_call and thence to rxrpc_bundle David Howells
2026-08-12 11:01 ` [PATCH net v7 10/11] rxrpc: Fix CHALLENGE packet overqueuing and simplify RESPONSE generation David Howells
2026-08-12 11:01 ` [PATCH net v7 11/11] rxrpc: Remove OOB challenge/response code David Howells
2026-08-18  1:58 ` [PATCH net v7 00/11] rxrpc: Fix CHALLENGE packet handling Jakub Kicinski
2026-08-18 13:03   ` David Howells
2026-08-18 14:49     ` David Howells [this message]
2026-08-18 14:49     ` Jakub Kicinski
2026-08-18 15:05       ` David Howells
2026-08-18 14:58     ` David Howells

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2088510.1787064548@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-afs@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marc.dionne@auristor.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.