in reply to chroot a directory...
If I've understood correctly, the problem is that someone could use the .. parent directory syntax to request a file/page outside of your $docroot ?
If so, then you may want to consider checking $path before opening the file. Use a regex to see if it contains .. preceded or followed by a / (there may be other possibilities, I haven't thought about it a great deal). If so, then deny the request.
One other security hole you should definitely close, is to use the 3-argument open():
open (FILE, '<', "$docroot$path")
Otherwise you are open to people crafting a request ending with | which could allow someone to run arbitrary code on your machine.
This is just a couple of things I thought of, there are probably other issues to be aware of as well...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: chroot a directory...
by Anonymous Monk on Sep 09, 2004 at 16:34 UTC | |
by muntfish (Chaplain) on Sep 10, 2004 at 08:12 UTC |