* temp file hole?
@ 2007-10-03 23:38 Stefan Monnier
2007-10-04 13:56 ` Michael Albinus
0 siblings, 1 reply; 11+ messages in thread
From: Stefan Monnier @ 2007-10-03 23:38 UTC (permalink / raw)
To: Michael Albinus; +Cc: emacs-devel
I'm afraid that the recent change to tramp-make-temp-file to use
makw-temp-name instead of make-temp-file introduced a security hole (the
very hole plugged by the introduction of make-temp-file in the first place).
I.e. if you want to keep using make-temp-name, please justify with comments
why your code is not vulnerable to the usual temp-file race condition
which goes something like:
1- Tramp decides to use /tmp/foo1234 as temp file.
2- some attacker creates a symlink from /tmp/foo1234 to some interesting place.
3- Tramp writes to /tmp/foo1234 without realizing that it's actually writing
to the interesting place through that symlink.
The make-temp-name docstring also says:
There is a race condition between calling `make-temp-name' and creating the
file which opens all kinds of security holes. For that reason, you should
probably use `make-temp-file' instead, except in three circumstances:
* If you are creating the file in the user's home directory.
* If you are creating a directory rather than an ordinary file.
* If you are taking special precautions as `make-temp-file' does.
-- Stefan
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: temp file hole?
2007-10-03 23:38 temp file hole? Stefan Monnier
@ 2007-10-04 13:56 ` Michael Albinus
2007-10-04 14:37 ` Johan Bockgård
` (3 more replies)
0 siblings, 4 replies; 11+ messages in thread
From: Michael Albinus @ 2007-10-04 13:56 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
Stefan Monnier <monnier@iro.umontreal.ca> writes:
Hi Stefan,
> I'm afraid that the recent change to tramp-make-temp-file to use
> makw-temp-name instead of make-temp-file introduced a security hole (the
> very hole plugged by the introduction of make-temp-file in the first place).
I confess that my Changelog entry is a little bit sloppy. And you are
right, there could be a security hole.
The other reason why I have switched from make-temp-file to
make-temp-name is that make-temp-file creates a file without the
possibility to declare a file name extension. In Tramp, it is
sometimes useful to have the same file name extension in both the
temporary file and the original file the temporary file is used
for. By this, some actions like deciding major mode etc works
automatically.
A solution could be that tramp-make-temp-file takes over part of the
implementation of make-temp-file, i.e. applies make-temp-name, adds
the desired extension to this file name, and creates immediately the
temporary file via a loop like in make-temp-file.
A similar approach should be applied to tramp-make-tramp-temp-file,
which suffers from this security hole since ever.
I'll commit a patch tonight (or tomorrow, depends on my spare time).
> -- Stefan
Thanks, and best regards, Michael.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: temp file hole?
2007-10-04 13:56 ` Michael Albinus
@ 2007-10-04 14:37 ` Johan Bockgård
2007-10-04 14:49 ` Michael Albinus
` (2 subsequent siblings)
3 siblings, 0 replies; 11+ messages in thread
From: Johan Bockgård @ 2007-10-04 14:37 UTC (permalink / raw)
To: emacs-devel
Michael Albinus <michael.albinus@gmx.de> writes:
> The other reason why I have switched from make-temp-file to
> make-temp-name is that make-temp-file creates a file without the
> possibility to declare a file name extension.
FWIW, the possibility exists in Emacs 22
(make-temp-file PREFIX &optional DIR-FLAG SUFFIX)
--
Johan Bockgård
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: temp file hole?
2007-10-04 13:56 ` Michael Albinus
2007-10-04 14:37 ` Johan Bockgård
@ 2007-10-04 14:49 ` Michael Albinus
2007-10-05 7:14 ` Ulrich Mueller
2007-10-05 13:15 ` Stefan Monnier
3 siblings, 0 replies; 11+ messages in thread
From: Michael Albinus @ 2007-10-04 14:49 UTC (permalink / raw)
To: Stefan Monnier, emacs-devel
I wrote:
> The other reason why I have switched from make-temp-file to
> make-temp-name is that make-temp-file creates a file without the
> possibility to declare a file name extension.
This is true for Emacs 21. For Emacs 22/23, I can use make-temp-file
as it is, of course.
Best regards, Michael.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: temp file hole?
2007-10-04 13:56 ` Michael Albinus
2007-10-04 14:37 ` Johan Bockgård
2007-10-04 14:49 ` Michael Albinus
@ 2007-10-05 7:14 ` Ulrich Mueller
2007-10-05 8:29 ` Michael Albinus
2007-10-06 12:06 ` Michael Albinus
2007-10-05 13:15 ` Stefan Monnier
3 siblings, 2 replies; 11+ messages in thread
From: Ulrich Mueller @ 2007-10-05 7:14 UTC (permalink / raw)
To: Michael Albinus; +Cc: emacs, Stefan Monnier, emacs-devel
>>>>> On Thu, 04 Oct 2007, Michael Albinus wrote:
> And you are right, there could be a security hole.
> [...]
> A similar approach should be applied to tramp-make-tramp-temp-file,
> which suffers from this security hole since ever.
> I'll commit a patch tonight (or tomorrow, depends on my spare time).
I noticed that a patch for tramp-make-temp-file was committed, but
tramp-make-tramp-temp-file is unchanged. Does this mean that the
latter is not suffering from the problem?
Ulrich
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: temp file hole?
2007-10-05 7:14 ` Ulrich Mueller
@ 2007-10-05 8:29 ` Michael Albinus
2007-10-06 12:06 ` Michael Albinus
1 sibling, 0 replies; 11+ messages in thread
From: Michael Albinus @ 2007-10-05 8:29 UTC (permalink / raw)
To: Ulrich Mueller; +Cc: emacs, Stefan Monnier, emacs-devel
Ulrich Mueller <ulm@gentoo.org> writes:
>> A similar approach should be applied to tramp-make-tramp-temp-file,
>> which suffers from this security hole since ever.
>
>> I'll commit a patch tonight (or tomorrow, depends on my spare time).
>
> I noticed that a patch for tramp-make-temp-file was committed, but
> tramp-make-tramp-temp-file is unchanged. Does this mean that the
> latter is not suffering from the problem?
It means that I'm still working on it. My patch runs OK with GNU Emacs
22/23 already, but I'll perform further compatibility tests with GNU
Emacs 21 and XEmacs. Will be committed when I'm ready.
> Ulrich
Best regards, Michael.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: temp file hole?
2007-10-04 13:56 ` Michael Albinus
` (2 preceding siblings ...)
2007-10-05 7:14 ` Ulrich Mueller
@ 2007-10-05 13:15 ` Stefan Monnier
2007-10-06 10:12 ` Michael Albinus
3 siblings, 1 reply; 11+ messages in thread
From: Stefan Monnier @ 2007-10-05 13:15 UTC (permalink / raw)
To: Michael Albinus; +Cc: emacs-devel
>> I'm afraid that the recent change to tramp-make-temp-file to use
>> makw-temp-name instead of make-temp-file introduced a security hole (the
>> very hole plugged by the introduction of make-temp-file in the first place).
> I confess that my Changelog entry is a little bit sloppy. And you are
> right, there could be a security hole.
Indeed, I also looked at the code, and I'm pretty sure there's
a security hole.
> The other reason why I have switched from make-temp-file to
> make-temp-name is that make-temp-file creates a file without the
> possibility to declare a file name extension. In Tramp, it is
Then please use make-temp-file when the SUFFIX arg is available, so at least
the security hole is plugged in Emacs-22.
Stefan
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: temp file hole?
2007-10-05 13:15 ` Stefan Monnier
@ 2007-10-06 10:12 ` Michael Albinus
0 siblings, 0 replies; 11+ messages in thread
From: Michael Albinus @ 2007-10-06 10:12 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> The other reason why I have switched from make-temp-file to
>> make-temp-name is that make-temp-file creates a file without the
>> possibility to declare a file name extension. In Tramp, it is
>
> Then please use make-temp-file when the SUFFIX arg is available, so at least
> the security hole is plugged in Emacs-22.
That's what I've done meanwhile, see tramp-compat.el.
> Stefan
Best regards, Michael.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: temp file hole?
2007-10-05 7:14 ` Ulrich Mueller
2007-10-05 8:29 ` Michael Albinus
@ 2007-10-06 12:06 ` Michael Albinus
2007-10-12 8:12 ` Ulrich Mueller
1 sibling, 1 reply; 11+ messages in thread
From: Michael Albinus @ 2007-10-06 12:06 UTC (permalink / raw)
To: Ulrich Mueller; +Cc: emacs, Stefan Monnier, emacs-devel
Ulrich Mueller <ulm@gentoo.org> writes:
> I noticed that a patch for tramp-make-temp-file was committed, but
> tramp-make-tramp-temp-file is unchanged. Does this mean that the
> latter is not suffering from the problem?
I've committed the patch for tramp-make-tramp-temp-file.
> Ulrich
Best regards, Michael.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: temp file hole?
2007-10-06 12:06 ` Michael Albinus
@ 2007-10-12 8:12 ` Ulrich Mueller
2007-10-12 8:32 ` Michael Albinus
0 siblings, 1 reply; 11+ messages in thread
From: Ulrich Mueller @ 2007-10-12 8:12 UTC (permalink / raw)
To: Michael Albinus; +Cc: emacs, Stefan Monnier, emacs-devel
This issue has a CVE number now: CVE-2007-5377
<http://nvd.nist.gov/nvd.cfm?cvename=CVE-2007-5377>
<http://bugs.gentoo.org/show_bug.cgi?id=194713>
Ulrich
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: temp file hole?
2007-10-12 8:12 ` Ulrich Mueller
@ 2007-10-12 8:32 ` Michael Albinus
0 siblings, 0 replies; 11+ messages in thread
From: Michael Albinus @ 2007-10-12 8:32 UTC (permalink / raw)
To: Ulrich Mueller; +Cc: emacs, Stefan Monnier, emacs-devel
Ulrich Mueller <ulm@gentoo.org> writes:
> This issue has a CVE number now: CVE-2007-5377
>
> <http://nvd.nist.gov/nvd.cfm?cvename=CVE-2007-5377>
> <http://bugs.gentoo.org/show_bug.cgi?id=194713>
Thanks. Tramp 2.1.11 has been released recently, which contains the fix.
> Ulrich
Best regards, Michael.
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2007-10-12 8:32 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-03 23:38 temp file hole? Stefan Monnier
2007-10-04 13:56 ` Michael Albinus
2007-10-04 14:37 ` Johan Bockgård
2007-10-04 14:49 ` Michael Albinus
2007-10-05 7:14 ` Ulrich Mueller
2007-10-05 8:29 ` Michael Albinus
2007-10-06 12:06 ` Michael Albinus
2007-10-12 8:12 ` Ulrich Mueller
2007-10-12 8:32 ` Michael Albinus
2007-10-05 13:15 ` Stefan Monnier
2007-10-06 10:12 ` Michael Albinus
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.