Ethical Hacking

Learn to find vulnerabilities before the bad guys do! Gain real world hands on hacking experience in our state of the art hacking lab. Course designed and taught by expert instructors with years of penetration testing experience. 12 student maximum in every class. Certification attempt included in every package.
Computer Forensics Training at InfoSec Institute

Gain the in-demand skills of a certified computer examiner, learn to recover trace data left behind by fraud, theft, and cybercrime perpetrators. Discover the source of computer crime and abuse at your organization so that it never happens again. All of our class sizes are guaranteed to be 12 students or less to facilitate one-on-one interaction with one of our expert instructors.




Network Security Vuln-Dev
[Top] [All Lists]

Re: Changes to the filesystem while find is running - comments?

Subject: Re: Changes to the filesystem while find is running - comments?
Date: Tue, 23 Nov 2004 07:39:56 +1100 (EST)
James,

You asked on bugtraq:

GNU find does a sanity check before and after calling chdir().  It
stats the directory it's about to move into, and stats "." after
chdir() succeeds.  It then compares the device numbers and inode
numbers returned by he two stat() calls.  This is done in a function
called wd_sanity_check().  If these are different, find prints an
error and exits fatally (in versions up to and including GNU findutils
4.2.5.
...
[ Shenanigans with automounter upset wd_sanity_check() ]
As of findutils 4.2.6/4.2.7, find will read /etc/mtab ...
[ Shenanigans in Solaris automounter upset mtab check ]
... Hence my question is :-
    Is it worthwhile at all to perform this "sanity check" or is it of 
    insufficient benefit?
I'd be grateful for your thoughts.

What I would like to see implemented (in some messy pseudo-code, starting
in parent directory):

  PARENT=stat(".");
  SUBDIR=stat("subdir");
  chdir("subdir");
  DOT=stat(".");
  if (SUBDIR != DOT) {
    Print warning message
  }
  else {
    Go on with find (recurse)
  }
  chdir("..");
  DOT=stat(".");
  if (PARENT != DOT) {
    Print message
    Exit with fatal error
  }

Do not descend into "dodgy" directories, but back out of them; exit fatally
if you cannot get back to solid ground.

Is this doable?

Cheers,

Paul Szabo - psz@maths.usyd.edu.au  http://www.maths.usyd.edu.au:8000/u/psz/
School of Mathematics and Statistics  University of Sydney   2006  Australia

<Prev in Thread] Current Thread [Next in Thread>