Skip to contentSkip to conversation

Documentation: Clarify f_cred vs current_cred() use

PATCH Applied Kees Cook 2 participants 2 messages Jul 3, 2020 – Jul 5, 2020

Subsystems (2)
lore
Share & tools
lore

Kees Cook

author
#0 lore raw

PATCH 1/1 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.

---
I forgot to include this patch in my kallsyms_show_value() f_cred series:
https://lore.kernel.org/lkml/[email protected]/
I can either take this in that series, or it can go via docs?

---
 Documentation/security/credentials.rst | 4 ++++
 1 file changed, 4 insertions(+)
Documentation/security/credentials.rst +4 -0
index 282e79feee6a..b7482f8ccf85 100644
@@ -548,6 +548,10 @@ pointer will not change over the lifetime of the file struct, and nor will the
 contents of the cred struct pointed to, barring the exceptions listed above
 (see the Task Credentials section).
 
+To avoid "confused deputy" privilege escalation attacks, access control checks
+during subsequent operations on an opened file should use these credentials
+instead of "current"'s credentials, as the file may have been passed to a more
+privileged process.
 
 Overriding the VFS's Use of Credentials
 =======================================
Signature · 5 lines
2.25.1


-- 
Kees Cook
maintainer Applied
#1 lore raw
Quoted 8 lines · On Fri, 3 Jul 2020 10:44:22 -0700 Kees Cook <[email protected]> wrote:

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.

Quoted 7 lines

---
I forgot to include this patch in my kallsyms_show_value() f_cred series:
https://lore.kernel.org/lkml/[email protected]/
I can either take this in that series, or it can go via docs?

---
 Documentation/security/credentials.rst | 4 ++++
 1 file changed, 4 insertions(+)

I've applied it, thanks.

jon