zsh-workers
 help / color / mirror / code / Atom feed
From: Zefram <zefram@dcs.warwick.ac.uk>
To: hzoli@cs.elte.hu (Zoltan Hidvegi)
Cc: zsh-workers@math.gatech.edu (Z Shell workers mailing list)
Subject: Re: files module improvements
Date: Thu, 2 Jan 1997 11:16:34 +0000 (GMT)	[thread overview]
Message-ID: <23838.199701021116@stone.dcs.warwick.ac.uk> (raw)
In-Reply-To: <199701020352.EAA05348@hzoli.ppp.cs.elte.hu> from "Zoltan Hidvegi" at Jan 2, 97 04:52:58 am

Zoltan Hidvegi wrote:
>If chdir("..") succeeds it always go back where you started so it is as
>safe to use as fchdir.

Not true.  If a directory is moved, its .. changes.  One of the attacks
on /tmp-clearing cron jobs that has been proposed goes like

mkdir -p /tmp/a/b
# make large directory tree under /tmp/a/b
# wait for the cron job to start deleting under /tmp/a/b
mv /tmp/a/b /tmp/b

and when the rm does chdir("..") from b, thinking it is going back to
/tmp/a, it is actually entering /tmp.  It then does another
chdir(".."), trying to get back to /tmp, and actually enters /.

This attack can be detected (but not prevented entirely) by doing
stat(".") before entering a subdirectory, and after leaving it.  If the
two do not match, then the directory was moved while being cleared, and
the current directory could be pretty much anything -- rm would have to
abort.

-zefram


      reply	other threads:[~1997-01-02 11:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-12-31 12:51 Zefram
1997-01-02  3:52 ` Zoltan Hidvegi
1997-01-02 11:16   ` Zefram [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=23838.199701021116@stone.dcs.warwick.ac.uk \
    --to=zefram@dcs.warwick.ac.uk \
    --cc=hzoli@cs.elte.hu \
    --cc=zsh-workers@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).