Messages in this thread Patch in this message |  | | Date | Tue, 21 Oct 2014 13:21:37 -0700 | From | Kees Cook <> | Subject | [PATCH] sysctl: terminate strings also on \r |
| |
From: Paul Wise <pabs3@bonedaddy.net>
This partially mitigates a common strategy used by attackers for hiding the full contents of strings in procfs from naive sysadmins who use cat, more or sysctl to inspect the contents of strings in procfs.
References: http://www.jakoblell.com/blog/2014/05/07/hacking-contest-hiding-stuff-from-the-terminal/ Signed-off-by: Paul Wise <pabs3@bonedaddy.net> Signed-off-by: Kees Cook <keescook@chromium.org> --- kernel/sysctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 4aada6d9fe74..c34c9414caac 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -1739,7 +1739,7 @@ static int _proc_do_string(char *data, int maxlen, int write, while ((p - buffer) < *lenp && len < maxlen - 1) { if (get_user(c, p++)) return -EFAULT; - if (c == 0 || c == '\n') + if (c == 0 || c == '\n' || c == '\r') break; data[len++] = c; } -- 1.9.1
-- Kees Cook Chrome OS Security
|  |