Skip to content

Commit 7303515

Browse files
keesJonathan Corbet
authored andcommitted
Documentation: Clarify f_cred vs current_cred() use
When making access control choices from a file-based context, f_cred must be used instead of current_cred() to avoid confused deputy attacks where an open file may get passed to a more privileged process. Add a short paragraph to explicitly state the rationale. Cc: Jonathan Corbet <corbet@lwn.net> Cc: linux-doc@vger.kernel.org Signed-off-by: Kees Cook <keescook@chromium.org> Link: https://lore.kernel.org/r/202007031038.8833A35DE4@keescook Signed-off-by: Jonathan Corbet <corbet@lwn.net>
1 parent 559394d commit 7303515

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

‎Documentation/security/credentials.rst‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,10 @@ pointer will not change over the lifetime of the file struct, and nor will the
548548
contents of the cred struct pointed to, barring the exceptions listed above
549549
(see the Task Credentials section).
550550

551+
To avoid "confused deputy" privilege escalation attacks, access control checks
552+
during subsequent operations on an opened file should use these credentials
553+
instead of "current"'s credentials, as the file may have been passed to a more
554+
privileged process.
551555

552556
Overriding the VFS's Use of Credentials
553557
=======================================

0 commit comments

Comments
 (0)