cat /directory shows a (somewhat messy) list of files in a directory (even removed files)

Robert Sebastian Gerus arachnist at gmail.com
Sun Mar 26 02:04:49 PST 2006


When you create some dir, create some files in it, then remove them
and do a cat /path/to/that/dir you get a messed-up list of files along
with the removed ones, in some situations this might be considered a
security threat. The following script ilustrates what i mean:

#!/bin/sh
mkdir somedir
for i in file1 file2 file3 file4; do
touch somedir/$i;
done
echo contents of somedir:
ls somedir
for i in file1 file2 file3 file4; do
rm somedir/$i;
done;
echo contents of somedir:
ls somedir
echo that shouldn\'t be here
cat somedir

Expected results:
nothing or a ls-like list of files

What i got:

contents of somedir:
file1   file2   file3   file4
contents of somedir:
that shouldn't be here
2

 .Yô..3
      file1$ÁJ
             file2$ÁM
                    file3$ÁN

--
jid: arachnist at xxxxxxxxx
gg: 7988510
irc: ar/arachnist @ ircnet/efnet/freenode






More information about the Bugs mailing list