From nobody Wed Feb 14 06:05:57 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4TZSP21QGtz5B53f; Wed, 14 Feb 2024 06:05:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4TZSP20Sh3z4RTl; Wed, 14 Feb 2024 06:05:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1707890758; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wOk3Xerh9eJr9lSNDo49E3KtdlNxU1DToApYzCoAkLI=; b=PZEzVUT7GPW343ZVIGJdifqUxzsrtQ7M7j8GX3KilzbPyHpUCEKwzoeP5W0pzY5ZfdeF/U mmPmfQfNKC72w8Bbm/G6ubjij7hbVpSv/D0yIOnrfLSY8FNTJBRHxFbbwiir9/Fs/SeNT/ e27Wme6guvaHpdQ/vaIZOWarMFueOEfSiq1ErLIsLN4toGSgo5RTlBGB6c0ZCiPl1YAU+Q aJ29NeHmWlRH4yKz9JSMtgkUUsHqHLFaPVk4EI4QZHCbyKBteDfDI3RzZNL1IIm8I/WlwT FdA+0eTOai0B9j+YLfBmewwimFYIG7E8TBR6PXxa+ZMVvq0j51zFtWC/4r6cqQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1707890758; a=rsa-sha256; cv=none; b=ZM7Wxh8HJY63qYx7/rdEtZYG+uUXApDhrZEuHYvHLcz2qLxPxqG8VkbvmnguxRv6+mr5El AVvbrGDbGucZ/BdBT1EqWT6ulXclzIUiIBCrcXZDKL+bhLP6bOl51C/AA3BY6moSiXShQ8 WS+prC3FqSmqDV3Dm+T3XkNEcVj6yBoCWrgfYMr5Rw3zzjAleqDLpnOeKxZUG3uYnJKSqH OwJ/qLLXhEP3kTrjLh51nR6MrlTQlY7Ny9UmL3mq/0ahBebOxaLqEp+mMCUmF/18wLX6S9 wMSFXsFmZiQnuGlFRlNqThnZo5cDDF6MFARsCdX9NwiZKaH3a3YLhshBY7u48Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1707890758; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wOk3Xerh9eJr9lSNDo49E3KtdlNxU1DToApYzCoAkLI=; b=DgCF9cKgiNH3QQcysf782cFFVSjsTFJd5AoLaqapreaQbHCvSukE2jjlzFm1krc62e8cLb jpHSKZflKkm7U3ZtFyaHQsGZXt39XaLwqnQ62in8MGEg5vMG0lO+c08ckHj4Pm6cReHzET qtPP758KfskkhfncekUaYcGC8JzFYqUwDitbkbOhxQ+HpPwhKJfLIXMnYmYHl0kY53aejQ BfdEWktD7bqyUoi2YtcHZWQeRdige4eFiUpHgWcdmTx/ryo3fnJKBhmkAoM/71g2UbPO34 FlmOV3fCEaeYP/IleS6bsqQCwUGmV01Vl2X6jw/PMudf5YWqL293vuwCRYRQwQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4TZSP16dJqzmkp; Wed, 14 Feb 2024 06:05:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 41E65vCB085113; Wed, 14 Feb 2024 06:05:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 41E65vox085110; Wed, 14 Feb 2024 06:05:57 GMT (envelope-from git) Date: Wed, 14 Feb 2024 06:05:57 GMT Message-Id: <202402140605.41E65vox085110@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Tetlow Subject: git: 9deb5ca77beb - releng/13.2 - setusercontext(): Apply personal settings only on matching effective UID List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gordon X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.2 X-Git-Reftype: branch X-Git-Commit: 9deb5ca77bebd98f6b9d1f5640546dc0a15a8deb Auto-Submitted: auto-generated The branch releng/13.2 has been updated by gordon: URL: https://cgit.FreeBSD.org/src/commit/?id=9deb5ca77bebd98f6b9d1f5640546dc0a15a8deb commit 9deb5ca77bebd98f6b9d1f5640546dc0a15a8deb Author: Olivier Certner AuthorDate: 2023-05-30 16:35:08 +0000 Commit: Gordon Tetlow CommitDate: 2024-02-14 05:36:19 +0000 setusercontext(): Apply personal settings only on matching effective UID Commit 35305a8dc114 (r211393) added a check on whether 'uid' was equal to getuid() before calling setlogincontext(). Doing so still allows a setuid program to apply resource limits and priorities specified in a user-controlled configuration file ('~/.login_conf') where a non-setuid program could not. Plug the hole by checking instead that the process' effective UID is the target one (which is likely what was meant in the initial commit). PR: 271750 Reviewed by: kib, des Sponsored by: Kumacom SAS Differential Revision: https://reviews.freebsd.org/D40351 Approved by: so Security: FreeBSD-EN-24:02.libutil (cherry picked from commit 892654fe9b5a9115815c30a423b8db47185aebbd) Approved by: markj (mentor) (cherry picked from commit 9fcf54d3750e379868e51e4aa7fbf696877ab2ed) --- lib/libutil/login_class.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libutil/login_class.c b/lib/libutil/login_class.c index 38666bc8e3d3..3a4ef4ed6a55 100644 --- a/lib/libutil/login_class.c +++ b/lib/libutil/login_class.c @@ -548,7 +548,7 @@ setusercontext(login_cap_t *lc, const struct passwd *pwd, uid_t uid, unsigned in /* * Now, we repeat some of the above for the user's private entries */ - if (getuid() == uid && (lc = login_getuserclass(pwd)) != NULL) { + if (geteuid() == uid && (lc = login_getuserclass(pwd)) != NULL) { mymask = setlogincontext(lc, pwd, mymask, flags); login_close(lc); }