RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1673457 - Apache child process crashes because ScriptAliasMatch directive.
Summary: Apache child process crashes because ScriptAliasMatch directive.
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: httpd
Version: 7.6
Hardware: Unspecified
OS: Linux
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Luboš Uhliarik
QA Contact: Maryna Nalbandian
URL:
Whiteboard:
Depends On:
Blocks: 1716962
TreeView+ depends on / blocked
 
Reported: 2019-02-07 15:04 UTC by Àngel Ollé Blázquez
Modified: 2022-03-13 16:57 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-03-31 20:03:28 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
patch notes (1.05 KB, text/plain)
2019-02-07 15:05 UTC, Àngel Ollé Blázquez
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2020:1121 0 None None None 2020-03-31 20:04:05 UTC

Description Àngel Ollé Blázquez 2019-02-07 15:04:23 UTC
Description of problem:
httpd configured with long URI ScriptAliasMatch directive causes child process to crash.

Version-Release number of selected component (if applicable):
httpd-2.4.6-88.el7.x86_64 

How reproducible:
Whenever a long URI is called.

Steps to Reproduce:
Prepare test script:
~~~
cat <<EOF > /var/www/cgi-bin/hello.cgi
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "Hello, World!";
EOF
~~~

Set file permissions:
~~~
chmod 755 /var/www/cgi-bin/hello.cgi
~~~

Add ScriptAliasMatch configuration to httpd:
~~~
ScriptAliasMatch ^/test/ /var/www/cgi-bin/hello.cgi
~~~

grant cgi-bin Directory:
~~~
<Directory "/var/www/cgi-bin">
    AllowOverride None
    Options None
    Require all granted
</Directory>
~~~

Restart httpd:
~~~
systemctl restart httpd.service
~~~

make a long request:
~~~
curl -v http://localhost/test/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
* About to connect() to localhost port 80 (#0)
*   Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 80 (#0)
> GET /test/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa HTTP/1.1
> User-Agent: curl/7.29.0
> Host: localhost
> Accept: */*
> 
* Empty reply from server
* Connection #0 to host localhost left intact
curl: (52) Empty reply from server
~~~

/var/log/httpd/error_log:
~~~
[crit] Memory allocation failed, aborting process.
[] [core:notice] [pid 17335:tid 140700752099456] AH00052: child pid 17567 exit signal Aborted (6)
~~~


Actual results:
httpd child process crashes.


Expected results:
~~~
curl -v http://localhost/test/aaaaaa
* About to connect() to localhost port 80 (#0)
*   Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 80 (#0)
> GET /test/aaaaaa HTTP/1.1
> User-Agent: curl/7.29.0
> Host: localhost
> Accept: */*
> 
< HTTP/1.1 200 OK
< Date: 
< Server: Apache/2.4.6 (Red Hat Enterprise Linux)
< Transfer-Encoding: chunked
< Content-Type: text/html; charset=UTF-8
< 
* Connection #0 to host localhost left intact
Hello, World!
~~~


Additional info:
Workaround: handle the long URI with rewrite rules. Example:

~~~
ScriptAliasMatch /script/ /var/www/html/wms/script/hello.cgi

RewriteEngine On
RewriteRule ^/test/ /script/ [NC,PT]
~~~

~~~
curl -v http://localhost/test/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
* About to connect() to localhost port 80 (#0)
*   Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 80 (#0)
> GET /test/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa HTTP/1.1
> User-Agent: curl/7.29.0
> Host: localhost
> Accept: */*
> 
< HTTP/1.1 200 OK
< Date: 
< Server: Apache/2.4.6 (Red Hat Enterprise Linux)
< Transfer-Encoding: chunked
< Content-Type: text/html; charset=UTF-8
< 
* Connection #0 to host localhost left intact
Hello, World!
~~~

Comment 2 Àngel Ollé Blázquez 2019-02-07 15:05:51 UTC
Created attachment 1527837 [details]
patch notes

Comment 3 Àngel Ollé Blázquez 2019-02-07 15:17:47 UTC
The ScriptAliasMatch directive of workaround example:

~~~
ScriptAliasMatch /script/ /var/www/html/wms/script/hello.cgi
~~~

should be:

~~~
ScriptAliasMatch /script/ /var/www/cgi-bin/hello.cgi
~~~

Comment 4 Joe Orton 2019-06-06 08:43:26 UTC
Thanks for the analysis!  This is upstream in 2.4.x as:

https://svn.apache.org/viewvc?view=revision&revision=1583175

Comment 12 errata-xmlrpc 2020-03-31 20:03:28 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2020:1121


Note You need to log in before you can comment on or make changes to this bug.