unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#28618: Emacs Security Issue
@ 2017-09-27 13:56 Dor Azouri
  2017-09-27 15:44 ` John Wiegley
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Dor Azouri @ 2017-09-27 13:56 UTC (permalink / raw)
  To: 28618

[-- Attachment #1: Type: text/plain, Size: 1388 bytes --]

Dear Emacs developers,

I would like to report a possible abuse one can perform on Emacs's
extensibility mechanism, that may lead to privilege escalation.

In short, a malicious actor that can execute code as one of the sudoers (in
non-elevated mode), can edit the init file, and add malicious commands to
it. Then he needs to wait for that user to invoke the editor in elevated
mode - and the plugin that was written before, will be loaded with the root
permissions.

The root cause that enables this abuse is basically incomplete separation
between regular and elevated execution modes of the editor (using "sudo").
I can suggest possible solutions to this issue, e.g.: applying better
permissions to the plugins directories.

Reproduction steps:
===================
1)  Add the following ELisp line of code to the init file. It will be
loaded on startup and execute the command “touch /stub.file”, when
“~/.emacs.d/” is the working directory.
        *(let ((default-directory "~/.emacs.d/")) (shell-command "touch
/stub.file"))*
2)  Wait for the user to invoke Emacs in elevated mode. The owner of the
newly created stub file is root.

* This simple command is just for demonstration - of course much more
complicated intentions can be achieved once Emacs is invoked with sudo.

I will be happy to provide more information as needed,
Dor Azouri

[-- Attachment #2: Type: text/html, Size: 1633 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2018-03-17  1:43 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-27 13:56 bug#28618: Emacs Security Issue Dor Azouri
2017-09-27 15:44 ` John Wiegley
2017-09-27 16:02   ` Dor Azouri
2017-09-27 16:23 ` Andreas Schwab
2017-09-27 17:24 ` Glenn Morris
2017-09-27 18:03   ` Glenn Morris
2017-09-28 11:25 ` Noam Postavsky
2017-09-29 12:57   ` Dor Azouri
2017-09-29 13:24     ` Noam Postavsky
2017-09-29 16:41       ` Glenn Morris
2017-09-29 22:55         ` Noam Postavsky
2017-10-01 15:27           ` Dor Azouri
2017-10-06  2:23             ` Noam Postavsky
2018-03-17  1:43               ` Noam Postavsky

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).