From owner-freebsd-hackers@freebsd.org Mon Oct 8 22:33:42 2018 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 89A0810CE140 for ; Mon, 8 Oct 2018 22:33:42 +0000 (UTC) (envelope-from eugen@grosbein.net) Received: from hz.grosbein.net (hz.grosbein.net [IPv6:2a01:4f8:d12:604::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "hz.grosbein.net", Issuer "hz.grosbein.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id F301182AC1; Mon, 8 Oct 2018 22:33:41 +0000 (UTC) (envelope-from eugen@grosbein.net) Received: from eg.sd.rdtc.ru (eg.sd.rdtc.ru [IPv6:2a03:3100:c:13:0:0:0:5]) by hz.grosbein.net (8.15.2/8.15.2) with ESMTPS id w98MXW9C054359 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 9 Oct 2018 00:33:33 +0200 (CEST) (envelope-from eugen@grosbein.net) X-Envelope-From: eugen@grosbein.net X-Envelope-To: rpokala@freebsd.org Received: from [10.58.0.4] (dadv@[10.58.0.4]) by eg.sd.rdtc.ru (8.15.2/8.15.2) with ESMTPS id w98MXV90029831 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Tue, 9 Oct 2018 05:33:31 +0700 (+07) (envelope-from eugen@grosbein.net) Subject: Re: coredumps disallowed when creds are changed? To: Ravi Pokala , "freebsd-hackers@freebsd.org" References: From: Eugene Grosbein Message-ID: <2e5b1b34-7bd7-f1b8-4f6a-9c794402d2c4@grosbein.net> Date: Tue, 9 Oct 2018 05:33:31 +0700 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=2.5 required=5.0 tests=BAYES_00, DATE_IN_FUTURE_48_96, LOCAL_FROM,SPF_PASS autolearn=no autolearn_force=no version=3.4.1 X-Spam-Report: * -2.3 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * -0.0 SPF_PASS SPF: sender matches SPF record * 2.2 DATE_IN_FUTURE_48_96 Date: is 48 to 96 hours after Received: date * 2.6 LOCAL_FROM From my domains X-Spam-Level: ** X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on hz.grosbein.net X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Oct 2018 22:33:42 -0000 09.10.2018 4:31, Ravi Pokala wrote: > Greetings hackers. > > core(5) states: > >> By default, a process that changes user or group credentials >> whether real or effective will not create a corefile. >> This behaviour can be changed to generate a core dump by setting the sysctl(8) variable kern.sugid_coredump to 1. > > Can someone explain why? Real/effective user/group id often are changed for a process started by non-privilegied user running set[ug]id binary like csh/chpass/passwd(1) that can read sensitive system data similar to /etc/master.passwd containing password hashes. If such utility reads sensitive data and then crashes due to a bug, its coredump may leak data to unexpected places of file system like /home partition, then go to a dump/backup of file system, get uploaded offsite as part of backup etc. That should not happen by default.