From: "João Távora" <joaotavora@gmail.com>
To: Michael Albinus <michael.albinus@gmx.de>,
emacs-devel <emacs-devel@gnu.org>
Cc: Eli Zaretskii <eliz@gnu.org>, Stefan Monnier <monnier@iro.umontreal.ca>
Subject: Re: sudo:: method in tramp possible security issue
Date: Tue, 20 Nov 2018 14:13:32 +0000 [thread overview]
Message-ID: <CALDnm51BJJiRfMgK+cKp=0wHBqZh7gKUffAR-m4yfStX+aoJ-g@mail.gmail.com> (raw)
In-Reply-To: <87o9ajvost.fsf@gmx.de>
[-- Attachment #1: Type: text/plain, Size: 3548 bytes --]
Hello emacs-devel,
The off-list discussion below is about TRAMP's usage of
the /sudo:: method, which surprised me very much recently
because I discovered that it lets any elisp run arbitrary shell
commands with root permissions while the buffer editing a file
with /sudo:: is live.
So in theory you could write malicious elisp code to lay there
hoping to hijack a users system on their first file of
/sudo::/etc/apt/sources.list, for example. Supposing all the user
wanted is to edit that file, starting a full "elisp sudo server" for
the duration of the buffer is clearly overkill and unnecessarily
dangerous for most users.
For me this is a very serious security hole, but apparently
it's part of the contract of the /sudo:: method.
I am arguing for:
1. A sudoedit method that works like `sudo -e`
2. A one-time stern warning the first time that the user uses /sudo::
to explain the security implications to new users.
Michael and I are converging on some possibilities, but I
think it's a good idea to have the rest of emacs-devel speak
their mind.
[Michael you have my new in-line replies below, too]
Thanks,
João
On Tue, Nov 20, 2018 at 1:53 PM Michael Albinus <michael.albinus@gmx.de>
wrote:
> João Távora <joaotavora@gmail.com> writes:
>
> > For the time being, the Tramp manual says:
> >
> > --8<---------------cut here---------------start------------->8---
> > ‘sudo’
> >
> > Similar to ‘su’ method, ‘sudo’ uses ‘sudo’. ‘sudo’ must have
> > sufficient rights to start a shell.
> > --8<---------------cut here---------------end--------------->8---
> >
> > It says already that a shell is used, but perhaps we shall
> > emphasize it more. As I said: manuals are unread ...
> >
> > Very true, and this is why I am suggesting an in-your-face warning.
>
> That would be bossy. People would start to modify the code in order to
> bypass this.
>
Perhaps I didn't explain myself. I'm talking about a one-time thing, like
the warnings for a disabled command. Something that you can answer
"I understand the risks: never ask for this again".
Once sudoedit is offered by Tramp, I expect a respective recommendation
> for Emacs.
>
OK. I believe this is not quite enough. But I'm talking for myself. I think
we should indeed raise the matter publicly.
> > And I don't agree it's like sudo -i, because I don't think there is an
> > easy way for non-root code running before the sudo -i session to
> > inject itself into the root session, or is there? Certainly not as
> > easy as writing some trivial elisp.
>
> Everybody is able to write such code. A simple `shell-command' with
> "sudo" might suffice to run any command with root permissions. Or use
> the interactive `shell', and call "sudo -i" there. Nothing you need
> Tramp for.
>
I was just arguing that the comparison between "sudo -i", meant to be
run in a shell and tramp's launching of a "sudo shell" isn't adequate,
because
there's no easy way for some unprivileged code to stay around
and wait for an opportunity to hijack your interactive "sudo -i"
>
> > /Sudoedit:: would be a really good addition. It would replace all the
> > usage I and quite possibly many others have ever had of /sudo::.
>
> Agreed. If it is possible to implement as proposed.
>
> (Please write the bug report about, in order to discuss it with greater
> audience. Or start a discussion at the emacs-devel ML.)
>
I just did that.
[-- Attachment #2: Type: text/html, Size: 5127 bytes --]
next parent reply other threads:[~2018-11-20 14:13 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CALDnm52oYOV_kPWZH62ub8seM4uug-GH68ywgXGJfDAbG7_4Xg@mail.gmail.com>
[not found] ` <87ftvwdcdw.fsf@gmx.de>
[not found] ` <CALDnm51fhzD48-40-t04KU9S19Lz8_sf8Y=pKZbnSHR+tbCgTQ@mail.gmail.com>
[not found] ` <87bm6kdb68.fsf@gmx.de>
[not found] ` <CALDnm53tX4vFz4CH=P27_dUt=9dXWMrE7xdTz3iZuqybsndygg@mail.gmail.com>
[not found] ` <jwvmuq4zqsz.fsf-monnier+emacs@gnu.org>
[not found] ` <CALDnm52moQthtMvSEw2ELWjZg3yJ8jypG=TBLgSsdr6R8ru0Aw@mail.gmail.com>
[not found] ` <87bm6kyxc3.fsf@gmx.de>
[not found] ` <CALDnm5211UDT_pW-HzgnRb5dQtnCZSgN+GRGHYM1hPVAjBWavA@mail.gmail.com>
[not found] ` <87k1l83yd3.fsf@gmx.de>
[not found] ` <CALDnm52KU0wNd3Sd-7m78JrPcLsiNuZ8hQxcTs3PgDNG7+0a0g@mail.gmail.com>
[not found] ` <87o9ajvost.fsf@gmx.de>
2018-11-20 14:13 ` João Távora [this message]
2018-11-20 21:14 ` sudo:: method in tramp possible security issue Paul Eggert
2018-11-20 21:18 ` Stefan Monnier
2018-11-20 21:25 ` Paul Eggert
2018-11-20 21:44 ` Stefan Monnier
2018-11-20 22:06 ` Michael Albinus
2018-11-20 22:27 ` João Távora
2018-11-20 23:12 ` Stefan Monnier
2018-11-21 7:41 ` Michael Albinus
2018-11-21 12:26 ` Michael Albinus
2018-11-21 12:44 ` Filipp Gunbin
2018-11-21 12:51 ` Michael Albinus
2018-11-21 14:44 ` John Shahid
2018-11-21 14:52 ` Michael Albinus
2018-11-21 14:55 ` John Shahid
2018-11-21 15:07 ` Michael Albinus
2018-11-20 22:16 ` Michael Albinus
2018-11-20 22:30 ` Michael Albinus
2018-11-20 22:54 ` João Távora
2018-11-21 7:49 ` Michael Albinus
[not found] ` <87ftvwyxh7.fsf@gmx.de>
2018-12-16 15:24 ` Tramp sudoedit method (was: sudo:: method in tramp possible security issue) Michael Albinus
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='CALDnm51BJJiRfMgK+cKp=0wHBqZh7gKUffAR-m4yfStX+aoJ-g@mail.gmail.com' \
--to=joaotavora@gmail.com \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=michael.albinus@gmx.de \
--cc=monnier@iro.umontreal.ca \
/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.