lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1228429854.7546.6.camel@lappy.spacevs.com>
Date:	Fri, 05 Dec 2008 09:30:54 +1100
From:	Geoffrey McRae <geoff@...idhost.com>
To:	Valdis.Kletnieks@...edu
Cc:	Peter Teoh <htmldeveloper@...il.com>,
	Alan Cox <alan@...rguk.ukuu.org.uk>,
	Nick Andrew <nick@...k-andrew.net>,
	linux-kernel@...r.kernel.org
Subject: Re: New Security Features, Please Comment

On Thu, 2008-12-04 at 16:56 -0500, Valdis.Kletnieks@...edu wrote:
> On Thu, 04 Dec 2008 10:40:56 +1100, Geoffrey McRae said:
> 
> > Ok, so this is a pretty major flaw of the idea, thats why I put this
> > concept out there, any suggestions as to how to get around this?
> > Possibly add some checking to disable certain functions in the child
> > when the enable_setpresuid function has been called?.
> 
> Or just deploy SELinux instead.

SELinux is insanely complicated, and is sort of a blanket fix, it does
not fix the problem at the root, in the target application.

> 
> > Or save the signal handlers the first time setpresuid is called, and the
> > next time, restore them so if the child has changed them, they get
> > re-set back to their initial state?
> 
> It's not just signal handlers.
> 
> 	while (getpid()) msleep(1);
> 	/* malicious code here */
> 

This would only be dangerous if the parent did not wait for the child to
finish its task before changing its uid, which for a FastCGI app, it has
to as it needs the response to send back to the client. All that would
happen here is the CGI script would sleep forever, or until the HTTP
server killed the process.

> Just loop, pop up every few milliseconds and check if you're root,
> and fall out of the loop and go into attack mode if you are.
> 
> If you're using it to toggle between various non-root userids, just adjust
> the while accordingly: 'while ((me = getpid()) != 497) ...'  or whatever
> you need.

Same as above, it would just sleep forever.

> 
> And if you try to disable getpid to prevent that attack, consider something
> that does this:
> 
> 	while (open("only_creatable_by_target_uid",O_CREAT) < 0)
> 
> You can hardly take open() away from processes. ;)

I dont exactly like the idea of disabling system functions, its more of
a hack then a solution, it was just a suggestion.

> 
> > I know many people are against the idea of adding new functions at will
> > to the kernel, thats why I am trying to flesh out all the potential
> > problems and find solutions to them first.
> 
> We don't mind adding functions.  We just hate broken-by-design functions.

Thats fine, I dont want to make things less secure, bear in mind that
this is my first kernel patch, and I am still learning how things are
written in the kernel.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ