From nobody Tue May 09 15:16:38 2023 X-Original-To: ports@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 4QG1w90wckz4BJQ4 for ; Tue, 9 May 2023 15:16:41 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qk1-x72c.google.com (mail-qk1-x72c.google.com [IPv6:2607:f8b0:4864:20::72c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4QG1w86B6sz3p5s for ; Tue, 9 May 2023 15:16:40 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Authentication-Results: mx1.freebsd.org; none Received: by mail-qk1-x72c.google.com with SMTP id af79cd13be357-757742c2e5fso238078285a.1 for ; Tue, 09 May 2023 08:16:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd.org; s=google; t=1683645400; x=1686237400; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=zn7pSsOveHoxINbmqyxKh5ZK9YkHIaWO7nea6VpsAJI=; b=PxhFPGehKGwGoSP5qsRKVE5HZzoyURRnZmZgVZ/DaPtOAqVM0UlFBRHBrCGBbGR7Ck 5CAYuISA1a5dgM0JlTZ3y4+K7tE5re8tnsG15DuLVQjPv7VnjZHekSFj7rBvKGpX4TOk qZpz0p1pnt9ysvbcKJJNKN0tCmsKTE/b5hpzXSHwPgpxfp8fxL6TpojmE5SgdCi1ncmJ gjvJQMdGKxh19qydx0UUJO0VXXFLTtNJRj64DxX0IDuvh+lwdgC1P6rW9+8dxwy6VK50 Kr11fIOzr3Q/avUqNfh1YDatvzvq3B+YZ7yw8SoRaQ5GxbjW0Uw9YLms+nXHI2X2kNiP XlGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683645400; x=1686237400; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=zn7pSsOveHoxINbmqyxKh5ZK9YkHIaWO7nea6VpsAJI=; b=LkiJ8mYBUrgYj3b0yTleIGTBIbt4fkMzMugYrcWS62O3NxPhBt2Gpkn8nkqhaqwRpl iH23UZ3o8b2OxTf5nykm3SANyAL3xfywtXrpJO34arEnItZHtFf+4ORIK10+o+xOMy17 yBKHJ8D5bzKhLyhoJ+Rigq5eOJT0hvi1OkOYPT916Hw4gQAnnNx5B9BNILgZr9BtmVyk kb2RLJ/zfLESra105Ml61Qgc22NHWsmvSMFqT46y+vSSNXdJeiCy6cDdN6353Q0gOCPs qPa/uI1nd5Hcv9IdQatg5zL5guFKeZiBFPyGcISqv7Ujc1/ngFO7au21kVC/+lw2q1zW b/lg== X-Gm-Message-State: AC+VfDwdYd7s6yHEYFksL3hVwWqzYzsY897oh9mI3zWH83335YmNRD7Z v57z9uY1lCCHGUoA+cxfC4YrJRcGumpwzKvxvS4= X-Google-Smtp-Source: ACHHUZ5C5V8IFMrJN5pAqZULeZTuGNMC00g6geqpL4z3IZP8krtLOKM0Cr6iCKDt5fZdmELiX0b3bQ== X-Received: by 2002:ac8:5b8f:0:b0:3f3:7e3b:d96a with SMTP id a15-20020ac85b8f000000b003f37e3bd96amr19862447qta.56.1683645399766; Tue, 09 May 2023 08:16:39 -0700 (PDT) Received: from mutt-hbsd (pool-100-16-219-215.bltmmd.fios.verizon.net. [100.16.219.215]) by smtp.gmail.com with ESMTPSA id i10-20020a05620a150a00b007579ed46c21sm182506qkk.45.2023.05.09.08.16.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 May 2023 08:16:38 -0700 (PDT) Date: Tue, 9 May 2023 11:16:38 -0400 From: Shawn Webb To: Felix Palmen Cc: ports@freebsd.org Subject: Re: Unprivileged default user for "tiny" daemons? Message-ID: <20230509151638.a7oc4os62lilhlkr@mutt-hbsd> X-Operating-System: FreeBSD mutt-hbsd 14.0-CURRENT-HBSD FreeBSD 14.0-CURRENT-HBSD X-PGP-Key: https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/blob/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc References: <7pvzx7x54djblto5nvepsbz5c76xhv2j6zssq7s7pvsjmvypde@jxxnzexifuvo> List-Id: Porting software to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-ports List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-ports@freebsd.org X-BeenThere: freebsd-ports@freebsd.org MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="sh3spq3733dx24sr" Content-Disposition: inline In-Reply-To: <7pvzx7x54djblto5nvepsbz5c76xhv2j6zssq7s7pvsjmvypde@jxxnzexifuvo> X-Rspamd-Queue-Id: 4QG1w86B6sz3p5s X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-ThisMailContainsUnwantedMimeParts: N --sh3spq3733dx24sr Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, May 09, 2023 at 10:26:27AM +0200, Felix Palmen wrote: > * Brooks Davis [20230509 08:11]: > > On Tue, May 09, 2023 at 10:05:15AM +0200, Felix Palmen wrote: > > > * Felix Palmen [20230508 18:39]: > > > So, takeaway is: There is no safe choice other than allocating a > > > dedicated UID for every single daemon, even if it doesn't need to > > > own/access any files? Is this really correct? > >=20 > > This is clearly the right choice even it's a bit of a pain. >=20 > Thanks for confirming. Well, my concern wasn't the hassle to actually do > that, but more the confusion created by the comment on top of UIDs, and > also the fact that this seems to be a "waste" of precious "uid space" > below 1000 if you don't need any file permissions... Hey Felix, Is there a reason to use a UID below 1000? Why not let `pw` set the UID/GID for you upon creation of the account? But, in reality, having one account per daemon is preferred, regardless of *intentional* use of resources like filesystems, networks, hardware, etc. Having too many "widgets" running under a single UID/GID creates a large attack surface. Let's hypothetically say a system has 30 (thirty) unrelated daemons running as the same UID. An attacker has equal access to all thirty daemons upon compromising a single one. Dedicating a UID/GID to each daemon limits what an attacker can do, not just from a filesystems perspective, but from the perspective of other resources, too. One must rememder that debugging facilities like PTrace and procfs exist and can be (and are) abused for post-exploitation activities. Thanks, --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/raw/master/Shawn_Webb/03A= 4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc --sh3spq3733dx24sr Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAmRaY80ACgkQ/y5nonf4 4fry+xAAjH3rzJq9he+nH+rOltRSPZScBrW+J5B+9noPOMTCPlIcvG+TXuo4k5pZ jQfA360DAACUiFE8ItEV8pibk8aLU+V1egSDpXlgGQ1rnik+5iVyEuoF8eADiVGR /mRkRr0HUQ2Rql0AS6DpgXC1euByl1XeoInHqyPsgJTIMAMHfnDZ6ZL52chRhSTz VnActH2BJEwNyWrNslgAzlOek4xfvxu9zp/8PVPm00HtuMdpFr3Ix75BqX5dEZAw BHo1tpxrk40aSQjEYVwzD29cv+Gi0ECe/8wXJILNpin8miqJG41HoRUP0JA5hP0o 0Ptub3cSzW1Uj9PpXZ0pdHIkr2LuaLD9MF0X6lsArZkVUEP7fW6TS3ou6fLjlgNa t+TIEG1snsqlzJ8uy1YpJTu46OEmk5xHm2YvYyj/8TaGM4Gwzu1j0EArCDEapYFa U4qKSV3QzIuCVh4WCuzBVrFqJALUpgmqfvvgk4UDcyTlCB235mT4aZqhdi84iEGi Jf3fKsoRPcZ5hXYOvWUZzyswH45fj9+XVI22xCrCzVenasK4VrxBIaJVHUGGSNEI /ICZUtMhlJ1VROUox6nH9iRVeWKQ/7fnsHcKo2/XnZ/NhutJ3vdwTvsQgqbW9qYb J+5tmdLxgyd3NFeP8v8HoUNq9gH8ETqUM2fkKZAg1ZxN2rL0cC8= =DBmC -----END PGP SIGNATURE----- --sh3spq3733dx24sr--