Re: Question on os.tempnam() vulnerability

2008-01-05 Thread Grant Edwards
On 2008-01-05, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Grant Edwards wrote: > >>> IOW, it's the same approach as on Unix. >> >> Not really. Under Unix you can safely create a temp file with >> a name that can be used to open the file. > > Unless I'm missing something, it's not possible to do t

Re: Question on os.tempnam() vulnerability

2008-01-05 Thread Martin v. Löwis
> That's an answer, though not for the question I asked. I think you'll have to pose a complete question again, rather than "how do I do that", if you want to get an answer to your question. > Not really. Under Unix you can safely create a temp file with > a name that can be used to open the fil

Re: Question on os.tempnam() vulnerability

2008-01-05 Thread Fredrik Lundh
Grant Edwards wrote: >> IOW, it's the same approach as on Unix. > > Not really. Under Unix you can safely create a temp file with > a name that can be used to open the file. Unless I'm missing something, it's not possible to do this in a safe way in the shared temp directory; you can do that on

Re: Question on os.tempnam() vulnerability

2008-01-05 Thread Grant Edwards
On 2008-01-05, Martin v. Löwis <[EMAIL PROTECTED]> wrote: >> I know. That's the point of my question: how do you do that >> under Windows? > > When you create a new process, you have the option to inherit > file handles to the new process. So the parent should open the > file, and then inherit th

Re: Question on os.tempnam() vulnerability

2008-01-05 Thread Martin v. Löwis
> I know. That's the point of my question: how do you do that > under Windows? When you create a new process, you have the option to inherit file handles to the new process. So the parent should open the file, and then inherit the handle to the new process. The new process will need to know what

Re: Question on os.tempnam() vulnerability

2008-01-05 Thread Grant Edwards
On 2008-01-05, Jarek Zgoda <[EMAIL PROTECTED]> wrote: >> Under Windows, is there a "safe" way to create a temp file >> that has a name that can be passed to a program which will >> then open it? I never figured out a way to do that and had to >> fall back on the "unsafe" tmpnam method. > > I think

Re: Question on os.tempnam() vulnerability

2008-01-05 Thread Jarek Zgoda
Grant Edwards pisze: >> you get a name instead of a file, so someone else can create that file >> after you've called tempnam/tmpnam, but before you've actually gotten >> around to create the file yourself. which means that anyone on the >> machine might be able to mess with your application's

Re: Question on os.tempnam() vulnerability

2008-01-04 Thread [EMAIL PROTECTED]
On Jan 4, 12:09 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > Does any one know what kind of security risk these message are > > suggesting? > > f = os.tempnam() > > __main__:1: RuntimeWarning: tempnam is a potential security risk to > > your program > f > >

Re: Question on os.tempnam() vulnerability

2008-01-04 Thread Grant Edwards
On 2008-01-04, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > you get a name instead of a file, so someone else can create that file > after you've called tempnam/tmpnam, but before you've actually gotten > around to create the file yourself. which means that anyone on the > machine might be able

Re: Question on os.tempnam() vulnerability

2008-01-04 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > Does any one know what kind of security risk these message are > suggesting? > f = os.tempnam() > __main__:1: RuntimeWarning: tempnam is a potential security risk to > your program f > '/tmp/filed4cJNX' > g = os.tmpnam() > __main__:1: RuntimeWarning: tmp

Question on os.tempnam() vulnerability

2008-01-04 Thread [EMAIL PROTECTED]
Hello, Does any one know what kind of security risk these message are suggesting? >>> f = os.tempnam() __main__:1: RuntimeWarning: tempnam is a potential security risk to your program >>> f '/tmp/filed4cJNX' >>> g = os.tmpnam() __main__:1: RuntimeWarning: tmpnam is a potential security risk to y