From: Vasiliy Kulikov <segoon@openwall.com>
To: Greg KH <gregkh@suse.de>
Cc: Andrew Morton <akpm@linux-foundation.org>,
James Morris <jmorris@namei.org>, Ingo Molnar <mingo@elte.hu>,
Namhyung Kim <namhyung@gmail.com>,
kernel-hardening@lists.openwall.com,
linux-kernel@vger.kernel.org, security@kernel.org
Subject: [kernel-hardening] Re: [PATCH] kernel: escape non-ASCII and control characters in printk()
Date: Wed, 22 Jun 2011 20:13:02 +0400 [thread overview]
Message-ID: <20110622161302.GB10365@albatros> (raw)
In-Reply-To: <20110622153742.GA18983@suse.de>
Hi Greg,
On Wed, Jun 22, 2011 at 08:37 -0700, Greg KH wrote:
> On Wed, Jun 22, 2011 at 01:53:41PM +0400, Vasiliy Kulikov wrote:
> > This patch escapes all characters outside of allowed '\n' plus 0x20-0x7E
> > charset passed to printk().
> >
> > There are numerous printk() instances with user supplied input as "%s"
> > data, and unprivileged user may craft log messages with substrings
> > containing control characters via these printk()s. Control characters
> > might fool root viewing the logs via tty.
>
> There are "numerous" places this could happen?
>From where I'm working now: warn_setuid_and_fcaps_mixed(),
get_file_caps(). task->comm is not filtered and sometimes it is used in
log entries related to the process. I don't know a global policy of
filtering such user supplied strings and didn't spot such filtering
(however, maybe I've missed it somewhere). It's MUCH simplier to filter
it in one place rather than hunt after the callers all over the kernel.
> Shouldn't this be
> handled by the viewers of the log file and not the kernel itself?
What viewers? Do you mean syslog implementation? IMO it's not its
duty, it logs what it was fed. It should be entiely app's care to
maintain consisten logs, syslog might not know precise log structure.
What should syslog do if app's log structure changes?
> And what could these control characters cause to be "fooled"?
E.g. line up:
ALERT!
^[1AUseless line.
TTY will interpret it as a single line "Useless line", ALERT will be
fully losen.
Thanks,
--
Vasiliy Kulikov
http://www.openwall.com - bringing security into open computing environments
next prev parent reply other threads:[~2011-06-22 16:13 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-22 9:53 [kernel-hardening] [PATCH] kernel: escape non-ASCII and control characters in printk() Vasiliy Kulikov
2011-06-22 15:37 ` [kernel-hardening] " Greg KH
2011-06-22 16:13 ` Vasiliy Kulikov [this message]
2011-06-23 13:36 ` Matthew Garrett
2011-06-23 21:44 ` Greg KH
2011-07-11 6:37 ` Pavel Machek
2011-06-22 16:38 ` Joe Perches
2011-06-22 16:53 ` Vasiliy Kulikov
2011-06-22 17:14 ` Joe Perches
2011-06-22 17:48 ` Vasiliy Kulikov
2011-06-22 18:10 ` Alan Cox
2011-06-22 19:07 ` Vasiliy Kulikov
2011-06-23 18:11 ` Geert Uytterhoeven
2011-06-25 20:52 ` [kernel-hardening] Re: [Security] " Willy Tarreau
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110622161302.GB10365@albatros \
--to=segoon@openwall.com \
--cc=akpm@linux-foundation.org \
--cc=gregkh@suse.de \
--cc=jmorris@namei.org \
--cc=kernel-hardening@lists.openwall.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=namhyung@gmail.com \
--cc=security@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox