Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug
Bug#: 236498
Alias:
Product:
Component:
Status: RESOLVED
Resolution: FIXED
Assigned To: Gentoo Security <security@gentoo.org>
Hardware:
OS:
Version:
Priority:
Severity:
Reporter: Robert Buchholz <rbu@gentoo.org>
Add CC:
CC:
Remove selected CCs
URL:
Summary:
Status Whiteboard:
Keywords:
Flags: Requestee:
 
 
  ()

Filename Description Type Creator Created Size Actions
emacs-python-nopwd.patch emacs-python-nopwd.patch patch Robert Buchholz 2008-09-02 20:52 0000 1.16 KB Details | Diff
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 236498 depends on: 220535 Show dependency tree
Bug 236498 blocks:

Additional Comments: (this is where you put emerge --info)


Not eligible to see or edit group visibility for this bug.






View Bug Activity   |   Format For Printing   |   XML   |   Clone This Bug


Description:   Opened: 2008-09-02 20:50 0000
** Please note that this issue is confidential and no information should be
disclosed until it is made public, see "Whiteboard" for a date **

Chong Yidong wrote:
Romain Francoise has found a security risk in a feature of GNU Emacs
related to interacting with Python.

Emacs allows the user to launch an interactive Python process.  When
this process is started, Emacs automatically sends it the line

import emacs

which imports a script named emacs.py which is distributed with Emacs.
This script is typically located in a write-protected installation
directory, together with other Emacs program files; it provides various
functions to help the Python process communicate with Emacs.  Upon
running, emacs.py imports other Python modules which are not built-in:

import os, sys, traceback, inspect, __main__

Merely visiting and editing a *.py source file does not launch a Python
subprocess; you have to enable certain Emacs modes, such as eldoc-mode,
to do so.

The vulnerability arises because Python, by default, prepends '' to the
module search path, so modules are looked for in the current directory.
If the user opens a Python file in a world-writable directory, an
attacker could insert malicious code by adding fake modules to that
directory, such as a fake emacs.py or inspect.py.

The Python developers have told us that they do not regard the importing
of modules from the current directory as a security problem for Python
itself.  The argument is that running a python script in a
world-writable directory is itself a security hazard.  However, when
running an Emacs command, it may be much less obvious to the user that a
security hazard is present.

The following patch, against the Emacs 22.2 source tree, fixes the
problem by removing '' from sys.path in the command-line arguments for
invoking the Python process.  (Because `sys' is a "built-in module", an
attacker cannot insert malicious code by adding sys.py to the current
directory.)

A forthcoming release of GNU Emacs, version 22.3, will contain this fix.

If any vendor would like further details, please send me an email.
Please let us know before disclosing this vulnerability by updating your
Emacs packages.

------- Comment #1 From Robert Buchholz 2008-09-02 20:52:47 0000 -------
Created an attachment (id=164408) [details]
emacs-python-nopwd.patch

------- Comment #2 From Christian Faulhammer 2008-09-02 21:42:10 0000 -------
*** Bug 236508 has been marked as a duplicate of this bug. ***

------- Comment #3 From Robert Buchholz 2008-09-02 22:17:32 0000 -------
Arch Security Liaisons, please test and mark stable:
=app-editors/emacs-22.2-r3
Target keywords : "alpha amd64 arm hppa ia64 ppc ppc64 s390 sh sparc x86"

CC'ing current Liaisons:
   alpha : yoswink, armin76
   amd64 : keytoaster, tester
    hppa : jer
     ppc : dertobi123
   ppc64 : corsair
   sparc : fmccor
     x86 : maekke, armin76

------- Comment #4 From Ulrich Müller 2008-09-03 00:22:16 0000 -------
app-editors/emacs <22 and app-editors/emacs-cvs are not affected.

------- Comment #5 From Olivier Crete 2008-09-03 03:09:51 0000 -------
amd64 stable

------- Comment #6 From Markus Rothe 2008-09-03 06:08:41 0000 -------
ppc64 stable

------- Comment #7 From Jeroen Roovers 2008-09-03 07:04:05 0000 -------
Stable for HPPA.

------- Comment #8 From Raúl Porcel 2008-09-03 09:51:26 0000 -------
alpha/ia64/sparc/x86 stable

------- Comment #9 From Ulrich Müller 2008-09-05 19:07:06 0000 -------
The vulnerability has been announced at
<http://lists.gnu.org/archive/html/emacs-devel/2008-09/msg00215.html>, so can
you please open this bug now?

------- Comment #10 From Pierre-Yves Rofes 2008-09-05 20:31:54 0000 -------
(In reply to comment #9)
> The vulnerability has been announced at
> <http://lists.gnu.org/archive/html/emacs-devel/2008-09/msg00215.html>, so can
> you please open this bug now?
> 
done, removing sec liaison and CC'ing remaining arches.

------- Comment #11 From Christian Faulhammer 2008-09-05 20:38:46 0000 -------
(In reply to comment #10)
> (In reply to comment #9)
> > The vulnerability has been announced at
> > <http://lists.gnu.org/archive/html/emacs-devel/2008-09/msg00215.html>, so can
> > you please open this bug now?
> > 
> done, removing sec liaison and CC'ing remaining arches.

 This bug can be safely closed after a possible GLSA as we handle further
stabilisations in bug 220535

------- Comment #12 From Pierre-Yves Rofes 2008-09-05 20:40:42 0000 -------
(In reply to comment #11)
> (In reply to comment #10)
> > (In reply to comment #9)
> > > The vulnerability has been announced at
> > > <http://lists.gnu.org/archive/html/emacs-devel/2008-09/msg00215.html>, so can
> > > you please open this bug now?
> > > 
> > done, removing sec liaison and CC'ing remaining arches.
> 
>  This bug can be safely closed after a possible GLSA as we handle further
> stabilisations in bug 220535
> 

ok, thanks for the info.

------- Comment #13 From Tobias Scherbaum 2008-09-06 21:35:55 0000 -------
ppc stable

------- Comment #14 From Ulrich Müller 2008-09-06 22:07:48 0000 -------
All supported archs stable.

Vulnerable versions: <22.2-r3
Unaffected:          >=22.2-r3, <22

------- Comment #15 From Ulrich Müller 2008-09-26 09:28:29 0000 -------
arm/s390/sh stable, thanks vapier and armin76.

------- Comment #16 From Christian Faulhammer 2009-01-29 07:54:48 0000 -------
Security, can we assist you in any way bringing out the GLSA?  Maybe by
reviewing it.

------- Comment #17 From Pierre-Yves Rofes 2009-02-23 22:23:36 0000 -------
GLSA 200902-06, sorry for the delay.

Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug