You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apache-bugdb@apache.org by Paul Stewart <st...@parc.xerox.com> on 2001/10/13 21:31:31 UTC
mod_cgi/8531: CGI PATH_INFO translates "/foocgi/bar//../baz" into "/foocgi/bar/baz/"
>Number: 8531
>Category: mod_cgi
>Synopsis: CGI PATH_INFO translates "/foocgi/bar//../baz" into "/foocgi/bar/baz/"
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: apache
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: apache
>Arrival-Date: Sat Oct 13 12:40:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: stewart@parc.xerox.com
>Release: 1.3.19
>Organization:
apache
>Environment:
Linux / RedHat 7.1 dist
>Description:
When "cleaning up" PATH_INFO for a CGI script, Apache fails to gobble up "//"
entries. While not a real problem in itself, it treats "//" as a first-class
path component when gobbling up "../" entries. This means that a CGI script
passed a path "/bar//../baz" is now passed "/bar/baz" instead of the correct
"/baz".
>How-To-Repeat:
With a trivial CGI script:
#!/usr/bin/perl
my $filePath = $ENV{PATH_INFO};
print "Content-Type: text/plain\n\nInitial file path: $filePath\n";
Then (if the script is http://host/cgi-bin/test.cgi) perform GETs of
http://host/cgi-bin/test.cgi/foo//../bar
>Fix:
Gobble up "//" first.
>Release-Note:
>Audit-Trail:
>Unformatted:
[In order for any reply to be added to the PR database, you need]
[to include <ap...@Apache.Org> in the Cc line and make sure the]
[subject line starts with the report component and number, with ]
[or without any 'Re:' prefixes (such as "general/1098:" or ]
["Re: general/1098:"). If the subject doesn't match this ]
[pattern, your message will be misfiled and ignored. The ]
["apbugs" address is not added to the Cc line of messages from ]
[the database automatically because of the potential for mail ]
[loops. If you do not include this Cc, your reply may be ig- ]
[nored unless you are responding to an explicit request from a ]
[developer. Reply only with text; DO NOT SEND ATTACHMENTS! ]