From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Kangas Newsgroups: gmane.emacs.bugs Subject: bug#75017: 31.0.50; Untrusted user lisp files Date: Mon, 23 Dec 2024 14:36:35 +0000 Message-ID: References: <87bjx43gp7.fsf@pub.pink> <86frmg6xzf.fsf@gnu.org> <86ldw75zrd.fsf@gnu.org> <9a4969f4-858e-4493-a69f-8ca9b2861917@gutov.dev> <868qs75uwp.fsf@gnu.org> <36eb8d61-cf0c-4ac9-a679-252a46a874ee@gutov.dev> <865xna60oj.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21134"; mail-complaints-to="usenet@ciao.gmane.io" Cc: jm@pub.pink, 75017@debbugs.gnu.org To: Eli Zaretskii , Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Dec 23 15:38:29 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 1tPjZk-0005MU-GR for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 23 Dec 2024 15:38:28 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tPjZN-0008P2-3K; Mon, 23 Dec 2024 09:38:05 -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 1tPjZK-0008N3-PX for bug-gnu-emacs@gnu.org; Mon, 23 Dec 2024 09:38:02 -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 1tPjZK-0000MQ-H0 for bug-gnu-emacs@gnu.org; Mon, 23 Dec 2024 09:38:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=Date:MIME-Version:References:In-Reply-To:From:To:Subject; bh=W7XQzFIC6rpyEob9QF84p+boiFKR8rbRx+3KhEHqbtA=; b=QjhQAX/KNfirSTEaPuz/9vxmuXJmNGKhWKaCJF80srGsM9E2lsp57j+uPPUpf6jMgpUmw0fL6Y19piYzzWM5H+0JEc2CHGxmKk5H6M5rJRF6qofaHuqRLZcwv49n4e1ZgrhrSK5/w4pu4HQu/ZAICGp4uqxZQ+AndbEUPUvq1EbIy0BY3vF6r+k/zufgimV5MN+sPnDPJ7NE/MIM/qIXTA1e5I0CDNyChRZ6xzYNbjjJ/Tjnh7B9oN8xUHcENx0XPMVAqJaz2Dq8f0ZMUq1MY3GiRp+qIj+2Rb9dEq4mOXQuRUYHXZA54aZEfHRGBPMAB0uVcLKyCsa9GG6laSDZXQ==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tPjZK-0000O6-A3 for bug-gnu-emacs@gnu.org; Mon, 23 Dec 2024 09:38:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 23 Dec 2024 14:38: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.17349646641453 (code B ref 75017); Mon, 23 Dec 2024 14:38:02 +0000 Original-Received: (at 75017) by debbugs.gnu.org; 23 Dec 2024 14:37:44 +0000 Original-Received: from localhost ([127.0.0.1]:53849 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tPjZ2-0000NM-38 for submit@debbugs.gnu.org; Mon, 23 Dec 2024 09:37:44 -0500 Original-Received: from mail-ed1-f44.google.com ([209.85.208.44]:59876) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tPjZ0-0000N9-4F for 75017@debbugs.gnu.org; Mon, 23 Dec 2024 09:37:42 -0500 Original-Received: by mail-ed1-f44.google.com with SMTP id 4fb4d7f45d1cf-5d3e8f64d5dso7285628a12.3 for <75017@debbugs.gnu.org>; Mon, 23 Dec 2024 06:37:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1734964596; x=1735569396; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:from:to:cc:subject:date:message-id:reply-to; bh=W7XQzFIC6rpyEob9QF84p+boiFKR8rbRx+3KhEHqbtA=; b=Kth/g6WRHkuMlxiqrkTNJzIHiRj0GusgjoVwjPiuaVCnCVGjcpQqlrSbDmppdMC9gv 6D46iHtzFzS5ttHHh2Q/0MuJrm+B3QUj/lpxmXdwfrpMT4H7+O/h5Z5+8KdlPsjJ8D/N /5s5TfCiaVU9vRHiL9d7Y+etYXePAgoyqnTP5nW1Qoz9bNe4L5Ngi0haEqSGs8jsEp1X 9u+CqHGRIiZ0RSJHPK/tXQ1m6RB5+G66iiEaXS5Btr85rxWQtUf1xasmdUPDkiO0Rh8w UEhs5M/zw5agJLZ3h7VIeWQILSdi/0t6QcdBASNoyPU4v1O3rrFix/Lr+l5oHalHuTHg 9j1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734964596; x=1735569396; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=W7XQzFIC6rpyEob9QF84p+boiFKR8rbRx+3KhEHqbtA=; b=V6gsRG3CGODCNDL9mn8859+32yfioCSMz0CZd8EIZPPu7A8RjlKU/3+VVUPXBYPb9r ZCKtcSsZOJ5E1bjLhR8ZT7BXHJUxc6Um9iB/VIuFxmv2CUv/wPd+k5geQnyzV6+L8e2N bF6x7oV7fYUHCYp6CTWOkG4Rnck+42NGy4LULDm3BJNYvNDPHbrX4N8o7sMOOUQGGo6j SOumkl4EvfmxzYJuCW9oesFWWTmWg6BvgEw9ADMlq9bcylbSETfIlsj6MXCC+97ZfiuS Q0iEK2rV5Q91Qr++jAgqJlPYwIxSJs7qov2GfjA0KduaXPl/NSQRV0jQDqCMaA/ydXAJ WqQA== X-Forwarded-Encrypted: i=1; AJvYcCW7DsZ0v84h7PY+kkDzsgmEl+VYpwmv06ArnLuol1wIf22aFASwIDcdgsS5/cEH14kZcY+Big==@debbugs.gnu.org X-Gm-Message-State: AOJu0YwoQgfndZj1A2xQCutcG6I9ZlPza0Z+xq81Ls8yhAHX4G1+baHi lm/Mgm4Q5XQb78XrCbWReG4W/kY4BufaS76VxDZlHktGrtHTlRNXtYcWUNJPJ3PUze925JAc+1F phnUAPvc9ooYFd1S2T/4fGo/Dogs= X-Gm-Gg: ASbGncvTlNBfLmD2Rj6NfpLi7EDRe3kq926iQUlg/D3IsIqWqJCBH3R4Bpwe0twsCxk JHXCCsKiCPne7OnqOJhaeIO7D6K9/W3tvnRwbshA= X-Google-Smtp-Source: AGHT+IErh4chF0wkSoy/LKhYDkpdLYpSFUyPj70ybG+dQwwSisFu9S35qoFI30qG9UNfMWk0oaIw7/QDGl0fgo+3OT0= X-Received: by 2002:a05:6402:321b:b0:5d3:bc56:3b24 with SMTP id 4fb4d7f45d1cf-5d81ddd6558mr13625514a12.4.1734964595988; Mon, 23 Dec 2024 06:36:35 -0800 (PST) Original-Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Mon, 23 Dec 2024 14:36:35 +0000 In-Reply-To: <865xna60oj.fsf@gnu.org> 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:297646 Archived-At: Eli Zaretskii writes: >> Date: Sun, 22 Dec 2024 22:27:34 +0200 >> Cc: stefankangas@gmail.com, jm@pub.pink, 75017@debbugs.gnu.org >> From: Dmitry Gutov >> >> On 22/12/2024 22:23, Eli Zaretskii wrote: >> >> And Emacs will load whatever's written there on the next restart. >> >> Whether the user wrote to those files, or someone else. >> > Yes, and your point is..? >> >> That whatever malicious code we try to protect against using the >> "trusted content" mechanism would be executed anyway. > > The scenario I have in mind is this: > > . Emacs session is running; when it was started, there was no > site-init file > . User notices that site-init file appeared > . User visits the site-init file > . Malicious macro in site-init file is executed > > IOW, there could be valid situations where the user visits the file > before restarting Emacs (which would load the file). In these > situations, it would make sense to treat the file as not trusted -- > unless the user tells us it should always be unconditionally trusted. Thanks, I saw this post after sending my most recent reply. I think the above scenario is valid, but I don't think it's common. However, if we want to mitigate that specific scenario, maybe we should only treat `site-init-file` as `trusted-content-p` if a site-file existed on Emacs startup. While I do see a difference between `user-init-file` and `site-init-file`, I think we should treat this set of files as equivalent when it comes to `trusted-content-p`: user-init-file early-init-file site-init-file Either they should all be `trusted-content-p`, or none of them should. In other words, I believe that this part of my reply also still stands: SK> First, I note that it's likely already game over if an attacker can SK> write to `site-init-file`, because they can then just as easily write SK> to your init file (or other relevant files in `load-path`) instead. BTW, this all shows that Stefan Monnier is correct when he laments that "trust sucks". It really does. We should implement proper sandboxing when byte-compiling these files, using bwrap or similar. Only when that is done, can we have reasonably strong security guarantees.