public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] Undo some of the pseudo-security madness
@ 2007-01-21 23:23 Samium Gromoff
  2007-01-21 23:34 ` David Wagner
  2007-01-22 15:20 ` Valdis.Kletnieks
  0 siblings, 2 replies; 38+ messages in thread
From: Samium Gromoff @ 2007-01-21 23:23 UTC (permalink / raw)
  To: David Wagner; +Cc: linux-kernel

David Wagner wrote:
> Samium Gromoff  wrote:
> >the core of the problem are the cores which are customarily
> >dumped by lisps during the environment generation (or modification) stage,
> >and then mapped back, every time the environment is invoked.
> >
> >at the current step of evolution, those core files are not relocatable
> >in certain natively compiling lisp systems.
> >
> >in an even smaller subset of them, these cores are placed after
> >the shared libraries and the executable.
> >
> >which obviously breaks when the latter are placed unpredictably.
> >(yes, i know, currently mmap_base() varies over a 1MB range, but who
> >says it will last indefinitely -- probably one day these people
> >from full-disclosure will prevail and it will become, like, 256MB ;-)
> >
> >so, what do you propose?
> 
> The obvious solution is: Don't make them setuid root.
> Then this issue disappears.
> 
> If there is some strong reason why they need to be setuid root, then
> you'll need to explain that reason and your requirements in more detail.
> But, based on your explanation so far, I have serious doubts about
> whether it is a good idea to make such core-dumps setuid root in the
> first place.

not "core-dumps" but "core files", in the lispspeak, but anyway.

the reason is trivial -- if i can write programs enjoying setuid
privileges in C, i want to be able to do the same in Lisp.

the only way to achieve this i see, is to directly setuid root
the lisp system executable itself -- because the lisp code
is read, compiled and executed in the process of the lisp
system executable.

there is such a thing as suid-perl -- for precise same reasons.

regards, Samium Gromoff

^ permalink raw reply	[flat|nested] 38+ messages in thread
* Re: [PATCH] Undo some of the pseudo-security madness
@ 2007-01-22  0:54 Samium Gromoff
  0 siblings, 0 replies; 38+ messages in thread
From: Samium Gromoff @ 2007-01-22  0:54 UTC (permalink / raw)
  To: David Wagner; +Cc: linux-kernel

David Wagner wrote:
> Samium Gromoff  wrote:
> >[...] directly setuid root the lisp system executable itself [...]
> 
> Like I said, that sounds like a bad idea to me.  Sounds like a recipe for
> privilege escalation vulnerabilities.  Was the lisp system executable
> really implemented to be secure even when you make it setuid root?
> Setting the setuid-root bit on programs that didn't expect to be
> setuid-root is generally not a very safe thing to do. [1]

1. Unsafe setuid programs have been written, and they doubtlessly
will continue to be written.

2. Lisp systems are written by extremely competent people.
(who make mistakes nonetheless, but still..)

3. I think that the ability to choose whether or not to shoot oneself
in the foot is an important freedom.

4. The whole issue is a little bit unfair, because the UNIX world
is inherently C-centric -- everything outside the C niche does not,
indeed, fit flawlessly in the picture..
This is where the "if you want to write system software, do it in C"
model comes from.

5. If a killer use-case is needed, an X server might do -- these
need root privileges for a certain period.

What if i decide that i want to write one in Lisp?

> The more I hear, the more unconvinced I am by this use case.
> 
> If you don't care about the security issues created by (mis)using the lisp
> interpreter in this way, then like I suggested before, you can always
  ^^^^^^^^^^^ make that a compiler -- these days, probably, there are more
native-bytecode-generating lisp compilers than interpreters.

> write a tiny setuid-root wrapper program that turns off address space
> randomization and exec()s the lisp system executable, and leave the lisp
> system executable non-setuid and don't touch the code in the Linux kernel.
> That strikes me as a better solution: those who don't mind the security
> risks can take all the risks they want, without forcing others to take
> unwanted and unnecessary risks.

This might sound as a reasonable solution.

Although it places a certain burden, which has to be considered...

I should see what the SBCL people will say about that.

> It's not that I'm wedded to address space randomization of setuid
> programs, or that I think it would be a disaster if this patch were
> accepted.  Local privilege escalation attacks aren't the end of the world;
> in all honesty, they're pretty much irrelevant to many or most users.
> It's just that the arguments I'm hearing advanced in support of this
> change seem dubious, and the change does eliminate one of the defenses
> against a certain (narrow) class of attacks.
> 
> 
> [1] In comparison, suidperl was designed to be installed setuid-root,
> and it takes special precautions to be safe in this usage.  (And even it
> has had some security vulnerabilities, despite its best efforts, which
> illustrates how tricky this business can be.)  Setting the setuid-root
> bit on a large complex interpreter that wasn't designed to be setuid-root
> seems like a pretty dubious proposition to me.

Compiler, not interpreter, careful with the insults :-)

regards, Samium Gromoff

P.S. please cc me, as i am not subscribed to the list...

^ permalink raw reply	[flat|nested] 38+ messages in thread
* [PATCH] Undo some of the pseudo-security madness
@ 2007-01-20 14:37 Samium Gromoff
  2007-01-20 16:12 ` Samium Gromoff
                   ` (2 more replies)
  0 siblings, 3 replies; 38+ messages in thread
From: Samium Gromoff @ 2007-01-20 14:37 UTC (permalink / raw)
  To: linux-kernel


This patch removes the dropping of ADDR_NO_RANDOMIZE upon execution of setuid
binaries.

Why? The answer consists of two parts:

Firstly, there are valid applications which need an unadulterated memory map.
Some of those which do their memory management, like lisp systems (like SBCL).
They try to achieve this by setting ADDR_NO_RANDOMIZE and reexecuting themselves.

Secondly, there also are valid reasons to want those applications to be setuid
root. Like poking hardware.

So, here we have a buffer-overflow protection technique, which does not
actually protect against buffer overflows[1], breaking valid applications.

I suggest getting rid of it.

--- include/linux/personality.h	2007-01-20 17:31:01.000000000 +0300
+++ include/linux-sane/personality.h	2007-01-20 17:32:50.000000000 +0300
@@ -40,7 +40,7 @@
  * Security-relevant compatibility flags that must be
  * cleared upon setuid or setgid exec:
  */
-#define PER_CLEAR_ON_SETID (READ_IMPLIES_EXEC|ADDR_NO_RANDOMIZE)
+#define PER_CLEAR_ON_SETID (READ_IMPLIES_EXEC)
 
 /*
  * Personality types.

Signed-off-by: Samium Gromoff <_deepfire@feelinfofgreen.ru>

[1]. See the excellent, 'Hackers Hut' by Andries Brouwer, which describes
how AS randomisation can be got around by the means of linux-gate.so.1

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

end of thread, other threads:[~2007-02-24 13:50 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-21 23:23 [PATCH] Undo some of the pseudo-security madness Samium Gromoff
2007-01-21 23:34 ` David Wagner
2007-01-22  0:36   ` Kyle Moffett
2007-01-22  1:53     ` Samium Gromoff
2007-02-24  9:40       ` Florian Weimer
2007-02-24 13:33         ` Samium Gromoff
2007-02-24 13:49           ` Florian Weimer
2007-01-22 15:20 ` Valdis.Kletnieks
2007-01-22 17:39   ` Samium Gromoff
2007-01-23  8:48     ` Pavel Machek
2007-01-23 14:03       ` Samium Gromoff
2007-01-23 15:41         ` Alan
2007-01-23 20:21           ` [PATCH 0/2] Mechanism to turn of ASR on a per-ELF binary basis Samium Gromoff
2007-01-23 20:28           ` [PATCH 1/2] Define the EF_AS_NO_RANDOM e_flag bit Samium Gromoff
2007-01-23 20:50             ` Jakub Jelinek
2007-01-23 21:06               ` Samium Gromoff
2007-01-23 21:16                 ` Jakub Jelinek
2007-01-23 21:54                   ` Samium Gromoff
2007-01-23 23:21                   ` Samium Gromoff
2007-01-24 17:08                     ` Pavel Machek
2007-01-29  1:18             ` Arjan van de Ven
2007-01-23 20:31           ` [PATCH 2/2] Make the EF_AS_NO_RANDOM e_flag bit disable PF_RANDOMIZE Samium Gromoff
2007-02-24  9:51           ` [PATCH] Undo some of the pseudo-security madness Florian Weimer
2007-02-24 13:36             ` Samium Gromoff
2007-01-31  9:59         ` Arjan van de Ven
2007-02-01  8:05           ` Florian Weimer
  -- strict thread matches above, loose matches on Subject: below --
2007-01-22  0:54 Samium Gromoff
2007-01-20 14:37 Samium Gromoff
2007-01-20 16:12 ` Samium Gromoff
2007-01-20 21:58 ` David Wagner
2007-01-21  2:16 ` Arjan van de Ven
2007-01-21 21:38   ` Samium Gromoff
2007-01-21 22:09   ` Samium Gromoff
2007-01-21 22:16     ` David Wagner
2007-01-22  0:35     ` Arjan van de Ven
2007-01-22  1:15       ` Samium Gromoff
2007-01-22 17:52       ` Samium Gromoff
2007-01-23  8:44         ` Pavel Machek

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