]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
handshake: Require admin permission for DONE command
authorChuck Lever <chuck.lever@oracle.com>
Tue, 9 Jun 2026 14:18:31 +0000 (10:18 -0400)
committerJakub Kicinski <kuba@kernel.org>
Fri, 12 Jun 2026 22:45:44 +0000 (15:45 -0700)
ACCEPT and DONE are the two downcalls of the handshake genl
family, both intended for use by the trusted handshake agent
(tlshd). ACCEPT already requires GENL_ADMIN_PERM; DONE has
no privilege check at all.

The fd-lookup in handshake_nl_done_doit() only confirms that
some pending handshake request exists for the supplied sockfd;
it does not authenticate the sender. An unprivileged process
that guesses or observes a valid sockfd can therefore submit
a DONE with HANDSHAKE_A_DONE_STATUS == 0, leaving the kernel
consumer to proceed as if the handshake succeeded. A non-zero
status on a forged DONE tears down a legitimate in-flight
handshake before tlshd can report its real result.

Fixes: 3b3009ea8abb ("net/handshake: Create a NETLINK service for handling handshake requests")
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: Hannes Reinecke <hare@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Link: https://patch.msgid.link/20260609141831.90694-1-cel@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Documentation/netlink/specs/handshake.yaml
net/handshake/genl.c

index 1024297b38513ac9f1554f9353327ea23cf4d90d..ffec12b467597df6e76659c14c36db26f4cbb142 100644 (file)
@@ -125,6 +125,7 @@ operations:
       name: done
       doc: Handler reports handshake completion
       attribute-set: done
+      flags: [admin-perm]
       do:
         request:
           attributes:
index 4b20cd9cdd0e096fea503c192d4fe4d6a144e88b..feac1ad063ee72524574bb4fa1c0b9a189496076 100644 (file)
@@ -38,7 +38,7 @@ static const struct genl_split_ops handshake_nl_ops[] = {
                .doit           = handshake_nl_done_doit,
                .policy         = handshake_done_nl_policy,
                .maxattr        = HANDSHAKE_A_DONE_REMOTE_AUTH,
-               .flags          = GENL_CMD_CAP_DO,
+               .flags          = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
        },
 };