From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752046AbbKJUkA (ORCPT ); Tue, 10 Nov 2015 15:40:00 -0500 Received: from mail-io0-f173.google.com ([209.85.223.173]:36121 "EHLO mail-io0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751535AbbKJUj6 (ORCPT ); Tue, 10 Nov 2015 15:39:58 -0500 Subject: Re: [KERNEL] Re: [KERNEL] [PATCH] Kernel 4.3 breaks security in systems using capabilities To: "Theodore Ts'o" , Andy Lutomirski , Serge Hallyn , Kees Cook , Christoph Lameter , "Serge E. Hallyn" , Andrew Morton , Richard Weinberger , LKML , Linus Torvalds References: <20151107110246.GA7230@ikki.ethgen.ch> <5640C999.5050807@gmail.com> <20151109172340.GF3714@ikki.ethgen.ch> <5640EDB4.70407@gmail.com> <20151109212937.GA17624@ikki.ethgen.ch> <20151110115526.GA2958@ikki.ethgen.ch> <20151110124043.GC3717@thunk.org> <20151110131907.GB2958@ikki.ethgen.ch> <5641F2B7.9050408@gmail.com> <20151110175849.GB26726@ikki.ethgen.ch> From: Austin S Hemmelgarn Message-ID: <56425618.6060703@gmail.com> Date: Tue, 10 Nov 2015 15:39:52 -0500 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <20151110175849.GB26726@ikki.ethgen.ch> Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg=sha-512; boundary="------------ms070503000101020509070609" X-Antivirus: avast! (VPS 151110-0, 2015-11-10), Outbound message X-Antivirus-Status: Clean Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is a cryptographically signed message in MIME format. --------------ms070503000101020509070609 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: quoted-printable On 2015-11-10 12:58, Klaus Ethgen wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA512 > > Am Di den 10. Nov 2015 um 14:35 schrieb Austin S Hemmelgarn: >> On 2015-11-10 08:19, Klaus Ethgen wrote: >>> Hi Ted, hy others in this discussion, >>> >>> Am Di den 10. Nov 2015 um 13:40 schrieb Theodore Ts'o: >>>> Whether or not that will be acceptable upstream, I don't know, mainl= y >>>> because I think a strong case can be made that such a patch has an >>>> audience of one, and adding more complexity here for an idea which h= as >>>> been time-tested over decades to be a failure is just not a good ide= a. >>> >>> I wouldn't tell the implementation until now to be a failure. It help= ed >>> a lot to keep a system sane. It is true that all distributions ignore= d >>> capabilities completely but I don't think that is due the design. >> I think it's mostly due to the fact that there are a lot of potential >> security issues in using capabilities as implemented in Linux (and oth= er >> POSIX systems), > > Well, of course. If you give a process capabilities, it can use it. Tha= t > is in the nature of the problem. But in comparison to SUID, it is > selective rights. That makes it much more troublesome to exploit. Why > the hell is, for example, ping installed SUID root? There is only one > privileged right that is needed instead of all or nothing. FWIW, on Hardened Gentoo, ping is installed without the SUID bit set,=20 and has the appropriate fscaps attribute to give it CAP_NET_RAW. Sadly,=20 that's about the only tool that is set to use capabilities (the only=20 other one I know of is arping). Ping is however very purpose specific=20 and short of someone re-writing the binary, there really isn't much that = could be done to use it for privilege escalation. OTOH even when you use = capabilities, it's pretty easy for someone with a little shell scripting = knowledge to preform a DOS attack on a network just using ping. > >> and unlike chroot(), it's not as easy to protect against stuff trying >> to bypass them while still keeping them useful. > > It is the same, you have to be aware of the problem and need to mitigat= e > it. > > chroot addresses different thinks than capabilities. And also chroot is= > exploitable and you can break out in some cases. You have to do it > right... Again, this depends, there really isn't any way to make it impossible to = break out of a chroot without significant changes to the kernel, even=20 when using stuff like namespaces. > >> If you do a web search you can relatively easily find info on how to >> use many of the defined capabilities to get root-equivalent access >> (CAP_SYS_ADMIN and CAP_SYS_MODULE are obvious, but many of the others >> can be used also if you know what you are doing, for example >> CAP_DAC_OVERRIDE+CAP_SYS_BOOT can be used on non-SecureBoot systems to= >> force the system to reboot into an arbitrary kernel). > > Well, that is like it should be. If you give an exploitable application= > rights that it should not have, it can get exploited. But this decision= > is in the responsibility of the admin. The big problem here is stuff like CAP_SYS_ADMIN and CAP_NET_ADMIN,=20 which group together a bunch of things that are only loosely related.=20 For example, both CAP_NET_ADMIN and CAP_NET_RAW include the ability to=20 bind to non-local addresses, but none of the stuff that I've ever seen=20 that uses CAP_NET_RAW instead of running as root uses that at all.=20 CAP_SYS_ADMIN includes a list of 24 different things that it allows,=20 many of which are themselves lists of other operations. I'll try and dig up one of the better articles on this and post a link,=20 essentially, there are about a dozen capabilities that can be exploited=20 pretty easily to get root-equivalent access. > > With ambient capabilities, you transfer that responsibilities to all th= e > different developers that once in a while wrote a SUID tool (or tool > with raised capabilities). So, tell me, where does the ambient > capabilities raise the security? Unless you're personally auditing every single piece of code being run=20 on your system, you are inherently trusting the developers anyway. --------------ms070503000101020509070609 Content-Type: application/pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" Content-Description: S/MIME Cryptographic Signature MIAGCSqGSIb3DQEHAqCAMIACAQExDzANBglghkgBZQMEAgMFADCABgkqhkiG9w0BBwEAAKCC Brgwgga0MIIEnKADAgECAgMRLfgwDQYJKoZIhvcNAQENBQAweTEQMA4GA1UEChMHUm9vdCBD QTEeMBwGA1UECxMVaHR0cDovL3d3dy5jYWNlcnQub3JnMSIwIAYDVQQDExlDQSBDZXJ0IFNp Z25pbmcgQXV0aG9yaXR5MSEwHwYJKoZIhvcNAQkBFhJzdXBwb3J0QGNhY2VydC5vcmcwHhcN MTUwOTIxMTEzNTEzWhcNMTYwMzE5MTEzNTEzWjBjMRgwFgYDVQQDEw9DQWNlcnQgV29UIFVz ZXIxIzAhBgkqhkiG9w0BCQEWFGFoZmVycm9pbjdAZ21haWwuY29tMSIwIAYJKoZIhvcNAQkB FhNhaGVtbWVsZ0BvaGlvZ3QuY29tMIICIjANBgkqhkiG9w0BAQEFAAOCAg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