public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kernel: make /proc/kallsyms mode 400 to reduce ease of attacking
@ 2010-11-16 10:46 Marcus Meissner
  2010-11-17  5:07 ` Kyle McMartin
                   ` (3 more replies)
  0 siblings, 4 replies; 54+ messages in thread
From: Marcus Meissner @ 2010-11-16 10:46 UTC (permalink / raw)
  To: torvalds, linux-kernel, tj, akpm, hpa, mingo, w, alan

Hi,

Making /proc/kallsyms readable only for root makes it harder
for attackers to write generic kernel exploits by removing
one source of knowledge where things are in the kernel.

This is the second submit, discussion happened on this on first submit
and mostly concerned that this is just one hole of the sieve ... but
one of the bigger ones.

Changing the permissions of at least System.map and vmlinux is
also required to fix the same set, but a packaging issue.

Target of this starter patch and follow ups is removing any kind of
kernel space address information leak from the kernel.

Ciao, Marcus

Signed-off-by: Marcus Meissner <meissner@suse.de>
Acked-by: Tejun Heo <tj@kernel.org>
Acked-by: Eugene Teo <eugeneteo@kernel.org>
Reviewed-by: Jesper Juhl <jj@chaosbits.net>
---
 kernel/kallsyms.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c
index 6f6d091..a8db257 100644
--- a/kernel/kallsyms.c
+++ b/kernel/kallsyms.c
@@ -546,7 +546,7 @@ static const struct file_operations kallsyms_operations = {
 
 static int __init kallsyms_init(void)
 {
-	proc_create("kallsyms", 0444, NULL, &kallsyms_operations);
+	proc_create("kallsyms", 0400, NULL, &kallsyms_operations);
 	return 0;
 }
 device_initcall(kallsyms_init);
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 54+ messages in thread
* Re: [PATCH] kernel: make /proc/kallsyms mode 400 to reduce ease of attacking
@ 2010-11-19 21:12 Andy Walls
  2010-11-19 23:22 ` Linus Torvalds
  0 siblings, 1 reply; 54+ messages in thread
From: Andy Walls @ 2010-11-19 21:12 UTC (permalink / raw)
  To: linux-kernel; +Cc: sarah.a.sharp, torvalds


> On Fri, Nov 19, 2010 at 11:19 AM, Sarah Sharp
> <sarah.a.sharp@linux.intel.com> wrote:
> >
> > .config and dmesg are attached.  The box is running klogd 1.5.5ubuntu3
> > (from Jaunty).  Yes, I know that's old.  I read the bit in the commit
> > about changing the permissions of kallsyms after boot, but if I can't
> > boot that doesn't help.  Perhaps this can be made a configuration
> > option?
> 
> It's not worth a config option.
> 
> If it actually breaks user-space, I think we should just revert it.

User space klogd is what's broken in this case:

        ksyms = fopen(KSYMS, "r");

        if ( ksyms == NULL )
        {
                if ( errno == ENOENT )
                        Syslog(LOG_INFO, "No module symbols loaded - "
                               "kernel modules not enabled.\n");
                else
                        Syslog(LOG_ERR, "Error loading kernel symbols " \
                               "- %s\n", strerror(errno));
                fclose(ksyms);
                return(0);
        }

The fclose(NULL) is a bug, as I don't think the standards require
that to be handled gracefully.


> It's kind of sad to default to the world-visible thing,

klogd also gets symbols from System.map, so /proc/kallsyms access
is not a strict requirement.

I haven't checked to see if klogd can work without a symbol source
at all, but I'll wager it can.

Regards,
Andy



^ permalink raw reply	[flat|nested] 54+ messages in thread
* [PATCH] kernel: make /proc/kallsyms mode 400 to reduce ease of attacking
@ 2010-11-04 10:09 Marcus Meissner
  2010-11-04 10:11 ` Tejun Heo
                   ` (2 more replies)
  0 siblings, 3 replies; 54+ messages in thread
From: Marcus Meissner @ 2010-11-04 10:09 UTC (permalink / raw)
  To: linux-kernel, jason.wessel, fweisbec, tj, mort, akpm; +Cc: security


Hi,

Making /proc/kallsyms readable only for root makes it harder
for attackers to write generic kernel exploits by removing
one source of knowledge where things are in the kernel.

Signed-off-by: Marcus Meissner <meissner@suse.de>
---
 kernel/kallsyms.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c
index 6f6d091..a8db257 100644
--- a/kernel/kallsyms.c
+++ b/kernel/kallsyms.c
@@ -546,7 +546,7 @@ static const struct file_operations kallsyms_operations = {
 
 static int __init kallsyms_init(void)
 {
-	proc_create("kallsyms", 0444, NULL, &kallsyms_operations);
+	proc_create("kallsyms", 0400, NULL, &kallsyms_operations);
 	return 0;
 }
 device_initcall(kallsyms_init);
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 54+ messages in thread

end of thread, other threads:[~2010-11-30 11:59 UTC | newest]

Thread overview: 54+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-16 10:46 [PATCH] kernel: make /proc/kallsyms mode 400 to reduce ease of attacking Marcus Meissner
2010-11-17  5:07 ` Kyle McMartin
2010-11-18  7:48   ` Ingo Molnar
2010-11-20  3:18     ` Kees Cook
2010-11-26  7:51       ` Ingo Molnar
2010-11-17  5:40 ` Kyle Moffett
2010-11-17  5:41   ` Kyle Moffett
2010-11-17  5:58   ` Linus Torvalds
2010-11-17  6:19     ` Willy Tarreau
2010-11-18  7:31   ` Ingo Molnar
2010-11-23 17:24     ` Pavel Machek
2010-11-26  7:38       ` Ingo Molnar
2010-11-29 19:03         ` H. Peter Anvin
2010-11-20 11:32   ` Avi Kivity
2010-11-19 19:19 ` Sarah Sharp
2010-11-19 19:54   ` Linus Torvalds
2010-11-19 19:58     ` david
2010-11-19 20:04       ` Linus Torvalds
2010-11-19 20:16         ` Willy Tarreau
2010-11-19 20:55           ` david
2010-11-26  7:48     ` Ingo Molnar
2010-11-29 16:33       ` Sarah Sharp
2010-11-29 18:04         ` Ingo Molnar
2010-11-29 19:05           ` H. Peter Anvin
2010-11-29 19:21             ` Eric Paris
2010-11-29 19:38               ` H. Peter Anvin
2010-11-29 21:49             ` Willy Tarreau
2010-11-29 23:31         ` Alan Cox
2010-11-30 11:58           ` Ingo Molnar
2010-11-20 11:05 ` Richard W.M. Jones
  -- strict thread matches above, loose matches on Subject: below --
2010-11-19 21:12 Andy Walls
2010-11-19 23:22 ` Linus Torvalds
2010-11-20  2:40   ` Kees Cook
2010-11-20 19:47     ` Henrique de Moraes Holschuh
2010-11-29 22:58       ` Kevin Easton
2010-11-04 10:09 Marcus Meissner
2010-11-04 10:11 ` Tejun Heo
2010-11-04 11:46 ` Ingo Molnar
2010-11-04 12:29   ` Marcus Meissner
2010-11-04 13:58     ` Ingo Molnar
2010-11-04 14:11       ` Ingo Molnar
2010-11-04 14:33         ` Marcus Meissner
2010-11-04 14:38           ` Tejun Heo
2010-11-04 14:43             ` H. Peter Anvin
2010-11-04 14:48               ` Tejun Heo
2010-11-04 19:08           ` Ingo Molnar
2010-11-07 18:02           ` Andi Kleen
2010-11-07 18:32             ` H. Peter Anvin
2010-11-10  8:53               ` Ingo Molnar
2010-11-11  2:51                 ` H. Peter Anvin
2010-11-11  7:05                   ` Ingo Molnar
2010-11-05  2:38     ` Frank Rowand
2010-11-10 20:58       ` Jesper Juhl
2010-11-05  0:20 ` Jesper Juhl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox