Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755646Ab3H2Hmj (ORCPT ); Thu, 29 Aug 2013 03:42:39 -0400 Received: from out01.mta.xmission.com ([166.70.13.231]:36624 "EHLO out01.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752777Ab3H2Hmh (ORCPT ); Thu, 29 Aug 2013 03:42:37 -0400 From: ebiederm@xmission.com (Eric W. Biederman) To: Kees Cook Cc: Djalal Harouni , Al Viro , Andrew Morton , Solar Designer , Vasiliy Kulikov , Linus Torvalds , Ingo Molnar , LKML , "kernel-hardening\@lists.openwall.com" References: <1377534240-13227-1-git-send-email-tixxdz@opendz.org> <871u5gqtw3.fsf@xmission.com> <20130826172054.GE27005@ZenIV.linux.org.uk> <20130827172406.GA2664@dztty> <20130828201141.GA21455@dztty> <20130828211116.GA22184@dztty> <87sixt735b.fsf@xmission.com> <87li3l5mnh.fsf@xmission.com> Date: Thu, 29 Aug 2013 00:42:26 -0700 In-Reply-To: (Kees Cook's message of "Wed, 28 Aug 2013 20:33:20 -0700") Message-ID: <87sixt3pul.fsf@xmission.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-AID: U2FsdGVkX18ch2PYHN41OF46HQvcqF6kLhQN+NdfydI= X-SA-Exim-Connect-IP: 98.207.154.105 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 1.5 XMNoVowels Alpha-numberic number with no vowels * 0.7 XMSubLong Long Subject * 0.0 T_TM2_M_HEADER_IN_MSG BODY: T_TM2_M_HEADER_IN_MSG * -0.0 BAYES_40 BODY: Bayes spam probability is 20 to 40% * [score: 0.3248] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa02 1397; Body=1 Fuz1=1 Fuz2=1] * 0.0 T_TooManySym_01 4+ unique symbols in subject * 1.0 T_XMDrugObfuBody_08 obfuscated drug references * 0.0 T_TooManySym_03 6+ unique symbols in subject * 0.0 T_TooManySym_02 5+ unique symbols in subject X-Spam-DCC: XMission; sa02 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: **;Kees Cook X-Spam-Relay-Country: Subject: Re: [PATCH 1/2] procfs: restore 0400 permissions on /proc/*/{syscall,stack,personality} X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Wed, 14 Nov 2012 14:26:46 -0700) X-SA-Exim-Scanned: Yes (on in01.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2457 Lines: 60 Kees Cook writes: > On Wed, Aug 28, 2013 at 6:08 PM, Eric W. Biederman > wrote: >> Kees Cook writes: >> >>> On Wed, Aug 28, 2013 at 5:26 PM, Eric W. Biederman >>> wrote: >>>> Can someome please state what they are worried about in simple language >>>> step by step? >>>> [...] >>>> The closest I saw in the thread was people were worried about ASLR being >>>> defeated. All I see are kernel addresses and we don't have much if any >>>> runtime or even load time randomization of where code is located in the >>>> kernel address map on x86_64. So I don't understand the concern. >>> >>> I showed the output of "syscall", since that contains user-space >>> addresses and shows a leak of ASLR from a privileged process to an >>> unprivileged process. >>> >>> The flaw as I see it is that an unprivileged process opens >>> /proc/$priv_pid/syscall and passes it to a setuid process which is >>> able to read it, and provides those contents to the unprivileged >>> process. >>> >>> The unprivileged process should not be able to the open the file in >>> the first place. >> >> I see so the complaint is that we don't give read permission but we do >> give open permission. Which is a variant of: the permissions used to >> open are not the permission used to access the file. >> >> This does seem to be a legitimate concern. >> >> I think there are several discussions that have been going on lately >> with respect to this class of problems in proc files. >> >> Given the existence of suid exec we can not in general prevent this >> class of bugs with a check at open time. > > I'm not suggesting removing the read check -- that's certainly needed. > >> I believe the solution needs to be to enhance the ptrace_may_access >> checks to verify that both the creds of the current task and the creds >> of the opening process would have allowed the access. > > As in, DAC perms are insufficient? As in any checks at open time are insufficient. Roughly what we need is to use the credentials that are present at open time (file->f_cred) in the ptrace_may_access call instead of or in addition to current_cred(). Eric -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/