From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Bj=C3=B6rn?= Bidar via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#75017: 31.0.50; Untrusted user lisp files Date: Mon, 23 Dec 2024 21:15:32 +0200 Message-ID: <13381.9325173803$1734981401@news.gmane.org> References: <87bjx43gp7.fsf@pub.pink> <86h66w6yam.fsf@gnu.org> <86ikrb5zms.fsf@gnu.org> Reply-To: =?UTF-8?Q?Bj=C3=B6rn?= Bidar Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19811"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Eli Zaretskii , acorallo@gnu.org, monnier@iro.umontreal.ca, jm@pub.pink, 75017@debbugs.gnu.org To: Stefan Kangas Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Dec 23 20:16:33 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1tPnuq-00052L-MC for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 23 Dec 2024 20:16:33 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tPnuR-0003uf-K6; Mon, 23 Dec 2024 14:16:07 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tPnuM-0003uP-SI for bug-gnu-emacs@gnu.org; Mon, 23 Dec 2024 14:16:03 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tPnuM-0001a2-JD for bug-gnu-emacs@gnu.org; Mon, 23 Dec 2024 14:16:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=KGF3GjbkYGW/f3vBsxhkKBoVKIW9VYxmiIjBY4C8yEI=; b=WanXW4bEmcATCS/fQ8AzPsUss9JoLgJGrwqClkIXhCriBsxZ7O7boXJQCUkXhv6VHiODRPM84r4zGGszzoKT0nh1NEf59PBmvel1okWQOmu79+6o6izFdoMqQIYW8fjKRj0XdpWtlyMXkszTNKFw3GmkwFhpweOW5TgCScCpXZZsQfwU/PZ6UCBbD1zV0U+nI+j453WuLNrFSF2JmBSiRghLp69FMY+DGWF0QgZ/NNO7XJ24NSgT/r9nfHRU/E6CHT/GLWsQLRUjd8yu4zYiR1oIAmwRl6qFkEn2RGl4cklz0JASO0zEtg8dm3iTIjy4jjJoq4ix1DjeavOtCM2cIQ==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tPnuM-0006s7-D9 for bug-gnu-emacs@gnu.org; Mon, 23 Dec 2024 14:16:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Bj=C3=B6rn?= Bidar Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 23 Dec 2024 19:16:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 75017 X-GNU-PR-Package: emacs Original-Received: via spool by 75017-submit@debbugs.gnu.org id=B75017.173498134926391 (code B ref 75017); Mon, 23 Dec 2024 19:16:02 +0000 Original-Received: (at 75017) by debbugs.gnu.org; 23 Dec 2024 19:15:49 +0000 Original-Received: from localhost ([127.0.0.1]:57907 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tPnu8-0006rb-If for submit@debbugs.gnu.org; Mon, 23 Dec 2024 14:15:49 -0500 Original-Received: from thaodan.de ([185.216.177.71]:52436) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tPnu5-0006r8-Le for 75017@debbugs.gnu.org; Mon, 23 Dec 2024 14:15:46 -0500 Original-Received: from odin (dsl-trebng12-50dc7b-49.dhcp.inet.fi [80.220.123.49]) by thaodan.de (Postfix) with ESMTPSA id 6C291D0004A; Mon, 23 Dec 2024 21:15:34 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=thaodan.de; s=mail; t=1734981334; bh=UavU92gtNpMuMHUaaHWtvn/EJyJz99NEs9IM4pGGjK4=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=BDgfbVCsEJ5dxVSim/M0w0Xv47ICf1TEwoa62RjkrJUESk0I8YBGKMZ50VUbMxi+B 4fvG1YG99q9lZCph0GT94/XMFqcRGu9AwToMSAprUBA4aTZaaEotRXA8kGtLEfWtXn LtWUoByiWp0cdYEXcCRod3BDIml5Ji0Tu39wO0d2b721Ny/X6tnWKcbPkEv+JaWeGV OqfsO2A8IzpAxvQDPXSzopUDFS6pPg4aYpqdFeHIzOyzhgTVNJkMeDUZFHts4cf5ib I8xzyH4gfL31xyXunwwbon8IlFwOOSFEoaqWOZ0cObbMudj/+6Q/HMzQ6gSMgdDlal B9UwAbS2f3GpJYHNk2DbLApzKgQIMfVQAySU0GhWrrM/IhbmZ5Jv/wjevDyPBEPv2p KVmven+Bpu6qFOlHl6GAzv2/Qn6I+ynXUQLiuOkyZJP77i8IW16iYNCGVYVyvDCU0d DRLlpcqF7jj8jODnbC6wtSpplyQN1/rUho1qVoe5UY4Mayi88N5Q3grNPSI7OZYfkA R1fPCneIv9u9uwlwUWULcAtANtu9ZGFFC590bLpBgBGvXZQD9/TLR0tpnmN74sjwah KcnOs4d0oUq3mTrZMbQsfDX5G/zwj6zIBodGjAYuY+RcP3k8AZDaqZDUgR7n4pmtgR MJDr4ETbD9fDtYyjdL2zApCw= In-Reply-To: (Stefan Kangas's message of "Mon, 23 Dec 2024 14:10:30 +0000") Autocrypt: addr=bjorn.bidar@thaodan.de; prefer-encrypt=nopreference; keydata= mDMEZNfpPhYJKwYBBAHaRw8BAQdACBEmr+0xwIIHZfIDlZmm7sa+lHHSb0g9FZrN6qE6ru60JUJq w7ZybiBCaWRhciA8Ympvcm4uYmlkYXJAdGhhb2Rhbi5kZT6IlgQTFgoAPgIbAwULCQgHAgIiAgYV CgkICwIEFgIDAQIeBwIXgBYhBFHxdut1RzAepymoq1wbdKFlHF9oBQJk1/YmAhkBAAoJEFwbdKFl HF9oB9cBAJoIIGQKXm4cpap+Flxc/EGnYl0123lcEyzuduqvlDT0AQC3OlFKm/OiqJ8IMTrzJRZ8 phFssTkSrrFXnM2jm5PYDoiTBBMWCgA7FiEEUfF263VHMB6nKairXBt0oWUcX2gFAmTX6T4CGwMF CwkIBwICIgIGFQoJCAsCBBYCAwECHgcCF4AACgkQXBt0oWUcX2hbCQEAtru7kvM8hi8zo6z9ux2h K+B5xViKuo7Z8K3IXuK5ugwA+wUfKzomzdBPhfxDsqLcEziGRxoyx0Q3ld9aermBUccHtBxCasO2 cm4gQmlkYXIgPG1lQHRoYW9kYW4uZGU+iJMEExYKADsCGwMFCwkIBwICIgIGFQoJCAsCBBYCAwEC HgcCF4AWIQRR8XbrdUcwHqcpqKtcG3ShZRxfaAUCZNf2FQAKCRBcG3ShZRxfaCzSAP4hZ7cSp0YN XYpcjHdsySh2MuBhhoPeLGXs+2kSiqBiOwD/TP8AgPEg/R+SI9GI9on7fBJJ0mp2IT8kZ2rhDOjg gA6IkwQTFgoAOxYhBFHxdut1RzAepymoq1wbdKFlH X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:297660 Archived-At: Stefan Kangas writes: > Eli Zaretskii writes: > >>> From: Stefan Kangas >>> Date: Sun, 22 Dec 2024 17:36:15 +0000 >>> Cc: jm@pub.pink, 75017@debbugs.gnu.org, acorallo@gnu.org >>> >>> Eli Zaretskii writes: >>> >>> >> From: Stefan Monnier >>> >> Cc: john muhl , 75017@debbugs.gnu.org, Eli Zaretskii >>> >> , Andrea Corallo >>> >> Date: Sat, 21 Dec 2024 22:16:05 -0500 >>> >> >>> >> > Maybe we should install something like the below? >>> >> >>> >> Fine by me, but I think this should be added via a new >>> >> `trusted-content-function(s)` and added buffer-locally only in >>> >> elisp-mode buffers. >>> > >>> > Sorry, but this is slippery slope. For starters, no one said that >>> > site-run-file is installed by a sysadmin -- that is only so on certain >>> > systems. For example, MS-Windows is generally not in that category. >>> >>> It doesn't matter who can edit it. `site-run-file` is already trusted, >>> since it is loaded at run-time before `user-init-file`. >> >> It is loaded if it is there. On my system, there's no such file, and >> I don't expect to have it. > > This seems orthogonal to the issue at hand. > > If you don't want to load `site-run-file`, you should use the > --no-site-file flag. (We should probably take that flag into account > when saying if that file is `trusted-content-p` though.) How does it make sense to not trust site-run-file when we trust the site-lisp? Further it is very likely or on Unix systems almost always the case that Emacs was built by those who control the site-run-file. How is it possible to trust them on the Emacs binary or anything elese included in the Emacs package but not site-run-file? > > Without that flag, we load files in these well-known locations > unconditionally. In my view, it then makes little sense to worry about > loading any `eval-when-compile` forms (or similar) in these files when > byte-compiling them. If they contain malicious code, that code has > already been run when Emacs started, or it will be run the next time > Emacs starts (e.g., if it has been modified after Emacs started). > > In other words, this case is quite analogous to `user-init-file`. > >> So if such a file somehow materializes there, I want to know, pronto. > > First, I note that it's likely already game over if an attacker can > write to `site-init-file`, because they can then just as easily write to > your init file (or other relevant files in `load-path`) instead. Also by that point the attacker could already manipulate other files such as the Emacs binary itself. > But to do what you suggest, we would need to start with deciding under > what circumstances it is not expected to find a file in this location, > and then not just warn but refuse to load it if it meets that criteria. > I don't know how to design such criteria. > > If we can figure out a way to do that, then I agree that it would be > consistent not to treat this file as `trusted-content-p`, when it exists > unexpectedly. What about checking if the location of site-run-file machtes with the location of the fiel during compilation e.g. by taking the value from the pdump or configuring the check value into the executable without pdump if that is better?