summaryrefslogtreecommitdiffstats
path: root/Documentation/sysctl
diff options
context:
space:
mode:
authorSalvatore Mesoraca <s.mesoraca16@gmail.com>2018-08-23 20:00:35 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-08-23 21:48:43 -0400
commit30aba6656f61ed44cba445a3c0d38b296fa9e8f5 (patch)
tree6c10f9e466500d7ede78400bb7b58896dd66016a /Documentation/sysctl
parentdc2572791d3a41bab94400af2b6bca9d71ccd303 (diff)
namei: allow restricted O_CREAT of FIFOs and regular files
Disallows open of FIFOs or regular files not owned by the user in world writable sticky directories, unless the owner is the same as that of the directory or the file is opened without the O_CREAT flag. The purpose is to make data spoofing attacks harder. This protection can be turned on and off separately for FIFOs and regular files via sysctl, just like the symlinks/hardlinks protection. This patch is based on Openwall's "HARDEN_FIFO" feature by Solar Designer. This is a brief list of old vulnerabilities that could have been prevented by this feature, some of them even allow for privilege escalation: CVE-2000-1134 CVE-2007-3852 CVE-2008-0525 CVE-2009-0416 CVE-2011-4834 CVE-2015-1838 CVE-2015-7442 CVE-2016-7489 This list is not meant to be complete. It's difficult to track down all vulnerabilities of this kind because they were often reported without any mention of this particular attack vector. In fact, before hardlinks/symlinks restrictions, fifos/regular files weren't the favorite vehicle to exploit them. [s.mesoraca16@gmail.com: fix bug reported by Dan Carpenter] Link: https://lkml.kernel.org/r/20180426081456.GA7060@mwanda Link: http://lkml.kernel.org/r/1524829819-11275-1-git-send-email-s.mesoraca16@gmail.com [keescook@chromium.org: drop pr_warn_ratelimited() in favor of audit changes in the future] [keescook@chromium.org: adjust commit subjet] Link: http://lkml.kernel.org/r/20180416175918.GA13494@beast Signed-off-by: Salvatore Mesoraca <s.mesoraca16@gmail.com> Signed-off-by: Kees Cook <keescook@chromium.org> Suggested-by: Solar Designer <solar@openwall.com> Suggested-by: Kees Cook <keescook@chromium.org> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'Documentation/sysctl')
-rw-r--r--Documentation/sysctl/fs.txt36
1 files changed, 36 insertions, 0 deletions
diff --git a/Documentation/sysctl/fs.txt b/Documentation/sysctl/fs.txt
index 6c00c1e2743f..819caf8ca05f 100644
--- a/Documentation/sysctl/fs.txt
+++ b/Documentation/sysctl/fs.txt
@@ -34,7 +34,9 @@ Currently, these files are in /proc/sys/fs:
34- overflowgid 34- overflowgid
35- pipe-user-pages-hard 35- pipe-user-pages-hard
36- pipe-user-pages-soft 36- pipe-user-pages-soft
37- protected_fifos
37- protected_hardlinks 38- protected_hardlinks
39- protected_regular
38- protected_symlinks 40- protected_symlinks
39- suid_dumpable 41- suid_dumpable
40- super-max 42- super-max
@@ -182,6 +184,24 @@ applied.
182 184
183============================================================== 185==============================================================
184 186
187protected_fifos:
188
189The intent of this protection is to avoid unintentional writes to
190an attacker-controlled FIFO, where a program expected to create a regular
191file.
192
193When set to "0", writing to FIFOs is unrestricted.
194
195When set to "1" don't allow O_CREAT open on FIFOs that we don't own
196in world writable sticky directories, unless they are owned by the
197owner of the directory.
198
199When set to "2" it also applies to group writable sticky directories.
200
201This protection is based on the restrictions in Openwall.
202
203==============================================================
204
185protected_hardlinks: 205protected_hardlinks:
186 206
187A long-standing class of security issues is the hardlink-based 207A long-standing class of security issues is the hardlink-based
@@ -202,6 +222,22 @@ This protection is based on the restrictions in Openwall and grsecurity.
202 222
203============================================================== 223==============================================================
204 224
225protected_regular:
226
227This protection is similar to protected_fifos, but it
228avoids writes to an attacker-controlled regular file, where a program
229expected to create one.
230
231When set to "0", writing to regular files is unrestricted.
232
233When set to "1" don't allow O_CREAT open on regular files that we
234don't own in world writable sticky directories, unless they are
235owned by the owner of the directory.
236
237When set to "2" it also applies to group writable sticky directories.
238
239==============================================================
240
205protected_symlinks: 241protected_symlinks:
206 242
207A long-standing class of security issues is the symlink-based 243A long-standing class of security issues is the symlink-based