oss-sec mailing list archives

Re: Python Unsafe Module Loading


From: Florian Weimer <fw () deneb enyo de>
Date: Thu, 05 Jun 2008 11:35:57 +0200

* Ned Ludd:

Re: (1)
How this limited to interactive shells? Our portage/emerge being 
directly not vuln is left to near sheer luck that Nick.C opted to shove 
a path into our portage module a-long time ago.. But our tools are 
questionable as it all depends on load order..

More examples:

solar@media /tmp $ touch re.so
solar@media /tmp $ cat foo.py 
import string
print "foo"

solar@media /tmp $ python foo.py
Traceback (most recent call last):
  File "foo.py", line 1, in ?
    import string
  File "/usr/lib/python2.4/string.py", line 83, in ?
    import re as _re
ImportError: /tmp/re.so: file too short
solar@media /tmp $ ls -l re.so 
-rw-r--r-- 1 solar solar 0 Jun  5 01:22 re.so

I think this is actually case (2) because it's not the current directory
which is on the search path, but the directory in which the script
resides.  They just happen to be the same in your example.

I think the behavior for "python -c" ought to be fixed, though.


Current thread: