🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.bug
Article #98731

Emacs support for Trojan horses

#98731
From: Guido van Rossum
Date: Thu, 21 Mar 1991 13:43
27 lines
1972 bytes
There is a feature of GNU Emacs, enabled by default, which makes a
very convenient vehicle for Trojan horses.  The facility is described
in the 'file variables' section of the info tree, and lets you execute
any Emacs Lisp code when a file is loaded into a buffer.  As a benign
example, the following code, which I found the end of file written by
a Scheme application, will format the file, destroy itself, and save
the file, all when you first open the file:

;;; Local Variables:
;;; mode: scheme
;;; eval: (save-excursion (goto-char (point-min)) (kill-line 3))
;;; eval: (save-excursion (goto-char (point-min)) (replace-regexp "[ \n]*)" ")")
)
;;; eval: (indent-region (point-min) (point-max) nil)
;;; eval: (progn (kill-line -3) (delete-backward-char 1) (save-buffer))
;;; End:

Given Emacs' capability to start processes, write files, etc., a
Trojan horse using this feature can obviously be used to do great
damage to people who have the habit of using Emacs as a file browser.

Shouldn't this feature be protected in some way, e.g., by asking the
user permission to execute such code (if it is more than just setting
a major mode)?

--Guido van Rossum, CWI, Amsterdam <guido@cwi.nl>
"He used to be a euphemism, now he's just a friend"
Technical Details
Message-ID: <3188@charon.cwi.nl>
Path: arc1-ca.pugleaf.net!gmdzi!unido!fauern!ira.uka.de!sol.ctr.columbia.edu!spool.mu.edu!samsung!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!tut.cis.ohio-state.edu!unreplyable!garbage

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fb2f1,20b72a5f29845d78,start
X-Google-Attributes: gidfb2f1,public
X-Google-ArrivalTime: 1991-03-21 05:43:58 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!fauern!ira.uka.de!sol.ctr.columbia.edu!spool.mu.edu!samsung!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!tut.cis.ohio-state.edu!unreplyable!garbage
From: guido@cwi.nl (Guido van Rossum)
Newsgroups: gnu.emacs.bug
Subject: Emacs support for Trojan horses
Keywords: Trojan horse, security, Emacs
Message-ID: <3188@charon.cwi.nl>
Date: 21 Mar 91 13:43:58 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 27
Approved: bug-gnu-emacs@prep.ai.mit.edu