all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Björn Bidar via Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Stefan Kangas <stefankangas@gmail.com>
Cc: Eli Zaretskii <eliz@gnu.org>,
	acorallo@gnu.org, monnier@iro.umontreal.ca, jm@pub.pink,
	75017@debbugs.gnu.org
Subject: bug#75017: 31.0.50; Untrusted user lisp files
Date: Mon, 23 Dec 2024 21:15:32 +0200	[thread overview]
Message-ID: <13381.9325173803$1734981401@news.gmane.org> (raw)
In-Reply-To: <CADwFkmmyqFoZ1b44asf+kRJXo3fxHoH+Aqj+kgB93N=DiHbhZg@mail.gmail.com> (Stefan Kangas's message of "Mon, 23 Dec 2024 14:10:30 +0000")

Stefan Kangas <stefankangas@gmail.com> writes:

> Eli Zaretskii <eliz@gnu.org> writes:
>
>>> From: Stefan Kangas <stefankangas@gmail.com>
>>> Date: Sun, 22 Dec 2024 17:36:15 +0000
>>> Cc: jm@pub.pink, 75017@debbugs.gnu.org, acorallo@gnu.org
>>>
>>> Eli Zaretskii <eliz@gnu.org> writes:
>>>
>>> >> From: Stefan Monnier <monnier@iro.umontreal.ca>
>>> >> Cc: john muhl <jm@pub.pink>,  75017@debbugs.gnu.org,  Eli Zaretskii
>>> >>  <eliz@gnu.org>,  Andrea Corallo <acorallo@gnu.org>
>>> >> 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?





  parent reply	other threads:[~2024-12-23 19:15 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-21 20:48 bug#75017: 31.0.50; Untrusted user lisp files john muhl
2024-12-22  2:47 ` Stefan Kangas
2024-12-22  3:16   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-22  6:12     ` Eli Zaretskii
2024-12-22 17:36       ` Stefan Kangas
2024-12-22 18:41         ` Eli Zaretskii
2024-12-22 18:47           ` Drew Adams via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-23 14:10           ` Stefan Kangas
2024-12-23 14:29             ` Eli Zaretskii
2024-12-24  0:35               ` Stefan Kangas
2024-12-24 12:15                 ` Eli Zaretskii
2024-12-23 19:15             ` Björn Bidar via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-12-22  6:19 ` Eli Zaretskii
2024-12-22 17:20   ` Stefan Kangas
2024-12-22 18:38     ` Eli Zaretskii
2024-12-22 19:52       ` Dmitry Gutov
2024-12-22 20:23         ` Eli Zaretskii
2024-12-22 20:27           ` Dmitry Gutov
     [not found]             ` <865xna60oj.fsf@gnu.org>
2024-12-23 14:36               ` Stefan Kangas
2024-12-23  0:32   ` john muhl
     [not found]     ` <86v7va4kj6.fsf@gnu.org>
2024-12-23 17:53       ` john muhl
2024-12-24  5:48       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='13381.9325173803$1734981401@news.gmane.org' \
    --to=bug-gnu-emacs@gnu.org \
    --cc=75017@debbugs.gnu.org \
    --cc=acorallo@gnu.org \
    --cc=bjorn.bidar@thaodan.de \
    --cc=eliz@gnu.org \
    --cc=jm@pub.pink \
    --cc=monnier@iro.umontreal.ca \
    --cc=stefankangas@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.