This has always puzzled me. Why does the root directory contain a reference to a parent directory?
bob@bob:/$ ls -a . build home lib32 mnt .rpmdb sys vmlinuz .. cdrom initrd.img lib64 opt sbin tmp vmlinuz.old bin dev initrd.img.old lost+found proc selinux usr boot etc lib media root srv var
I understand how directories are managed in the filesystem - each directory has n+2 pointers to itself (n = number of subdirectories inside the directory). One for each immediate subdirectory, one for its parent, and one for itself.
But what is /
's parent?
/../../../../..
is a valid path then? (And is equal to/
.) – Nathan Osman Jan 12 '11 at 03:09../../../../../../../../../../../../../../../../etc/passwd
– Michael Mrozek Jan 12 '11 at 03:36/
. Between../
(not necessarily at the beginning!) and symbolic links, it's very hard to do, especially considering the attacker may be moving directories under the program's nose. – Gilles 'SO- stop being evil' Jan 12 '11 at 08:08/
has..
that points to itself... – musiphil Dec 03 '12 at 03:10