Long filesystem paths

Summary
Description:One thing you can do to be highly annoying is create very long directory paths. These cause *major* problems to many system utilities. This post provides useful one-liners for the purpose.
Author:Zack Weinberg <zack@RABI.PHYS.COLUMBIA.EDU>
Compromise:Annoying DOS
Vulnerable Systems:Those that allow very long directory paths. I just created one 10002 directories deep on my Linux box (I stopped it, it could have gone further). Fortunately Microsoft OS users don't have this problem due to small filesystem depth restrictions ;)
Date:2 December 1997
Details


Date: Tue, 2 Dec 1997 10:49:17 -0500
From: Zack Weinberg <zack@RABI.PHYS.COLUMBIA.EDU>
To: BUGTRAQ@NETSPACE.ORG
Subject: Re: longpath.sh

On Mon, 1 Jan 1996 16:37:01 +0200, Szekely-Benczedi Endre wrote:
>        There is a nice small shell script at www.rootshell.com,
>longpath.sh, wich exploits some bug in Linux about long pathnames...
>
>Here's the program:
[snip]

>I tried the script on a RedHat Linux, and... well... I can't erase the
>directory now ;-)
>        I wonder if anyone of you knows the problem, and can help me with
>that..

It's a widespread problem, Solaris tools get just as confused (although
nothing coredumped on me).  The script, btw, can be expressed as a perl
one-liner:

perl -e '$a = shift; while(mkdir($a, 0755)) { chdir $a; }' <dir>

which will go as deep as your OS allows.  To get rid of it, try

perl -e '$a = shift; 1 while(chdir($a));
         do { chdir("..") } while(rmdir($a));' <dir>

where <dir> is the name of the directory tree you want to create/delete.

zw

More Exploits!

The master index of all exploits is available here (Very large file)
Or you can pick your favorite operating system:
All OS's Linux Solaris/SunOS Micro$oft
*BSD Macintosh AIX IRIX
ULTRIX/Digital UNIX HP/UX SCO Remote exploits

This page is part of Fyodor's exploit world. For a free program to automate scanning your network for vulnerable hosts and services, check out my network mapping tool, nmap. Or try these Insecure.Org resouces:

[ Nmap | Sec Tools | Mailing Lists | Site News | About/Contact | Advertising | Privacy ]
AlienVault