[UNIX] Directory.php Allows Arbitrary Code Execution

From: support@securiteam.com
Date: 03/11/02

From: support@securiteam.com
To: list@securiteam.com
Date: Mon, 11 Mar 2002 13:31:51 +0100 (CET)

The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com
- - promotion

When was the last time you checked your server's security?
How about a monthly report?
http://www.AutomatedScanning.com - Know that you're safe.
- - - - - - - - -

  Directory.php Allows Arbitrary Code Execution


 <http://www.xenakis.net> Marcus S. Xenakis has developed some quite nice
PHP scripts to support shell commands.
The "directory.php" script is based on the "ls" command and reads the
directory based upon the passed parameter.

A security problem in this script allows viewing of arbitrary directories
on the file system.
Furthermore it allows arbitrary code execution caused by missing filters
for dangerous characters such as ";". This is quite the same as the
<http://www.securiteam.com/unixfocus/6K00B2A3FG.html> Unix Manual PHP
Script bug of the same author, which was discovered and fixed recently.


Marcus S. Xenakis PHP-Scripts very often use simple calls of shell

exec("ls -la $dir",$lines,$rc);

This is quite easy programming but doesn't deal with dangers that calls of
shell commands can bring.

It is possible to execute arbitrary code with the rights of the

In contrary to the "Unix Manual PHP Script" this script doesn't offer a
form where you can enter the commands. Because of that you have to call
the script directly including the parameter and command you want to

will show you the Password File.

will show you all running processes.

Implement a filter which filters dangerous characters, especially ";".

Vendor Status:
Vendor has been contacted.


The information has been provided by
<mailto:advisories@it-checkpoint.net> BlueScreen.


This bulletin is sent to members of the SecuriTeam mailing list.
To unsubscribe from the list, send mail with an empty subject line and body to: list-unsubscribe@securiteam.com
In order to subscribe to the mailing list, simply forward this email to: list-subscribe@securiteam.com


The information in this bulletin is provided "AS IS" without warranty of any kind.
In no event shall we be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages.