#1021771 apache2: Accessing to type-map without .var suffix results 500 and apache2 exits

Package:
apache2
Source:
apache2
Description:
Apache HTTP Server
Submitter:
Shintaro Sakahara
Date:
2024-08-04 07:33:03 UTC
Severity:
normal
#1021771#5
Date:
2022-10-14 11:13:43 UTC
From:
To:
Dear Maintainer,

I recently upgraded my server from Debian 10 to 11 and encountered a problem
where apache2 responded 500 Internal Server Error and then the process exited
when a URL to a type-map, which referenced CGI script as actual content,
without ".var" suffix was getting accessed.

I created a small example using Docker and put on GitHub so that everyone could
easily reproduce this problem.

https://github.com/skhrshin/apache2-crash-example

* Steps to reproduce *

1. Clone the repo into somewhere
2. Run `docker-compose build`
3. Run `docker-compose up`
4. Access to http://localhost:8081/board.cgi with your web browser

* Expected behavior *

A string "OK" is displayed.

* Actual behavior *

Your web browser gets 500 Internal Server Error.
Also, in a few seconds, the apache2 process is terminated.

I'm not sure if the problem is caused solely by apache2 package or by some
other dependencies like apache2-suexec-pristine or libapache2-mpm-itk, but
I don't know how to find it out. So I asked about this issue to Debian-user ML
if there's something I can do, but I could get no answer, so now I'm reporting
it here. Please tell me if something is insufficient and there's a way to
investigate it more.

#1021771#10
Date:
2022-10-14 13:32:56 UTC
From:
To:
Hi,

could you please actually describe the problem into the bugreport?  While having
a reproducer is certainly nice, it's not enough to see what might be the problem.
And you can't expect other people do debug the Docker containers.

Ondrej
--
Ondřej Surý (He/Him)
ondrej@sury.org

#1021771#15
Date:
2022-10-14 13:32:56 UTC
From:
To:
Hi,

could you please actually describe the problem into the bugreport?  While having
a reproducer is certainly nice, it's not enough to see what might be the problem.
And you can't expect other people do debug the Docker containers.

Ondrej
--
Ondřej Surý (He/Him)
ondrej@sury.org

#1021771#20
Date:
2022-10-14 16:34:46 UTC
From:
To:
OK, here is the detailed version of steps to reproduce:

1. Install apache2, apache2-suexec-pristine and libapache2-mpm-itk packages.
2. Disable mpm_event and enable cgid, mpm_prefork and suexec modules.
3. Configure two sites on Apache2.
3-1. For the first one, enable SuexecUserGroup. (000-default in the example)
3-2. For the second one, enable AssignUserID. (001-userid in the example)
4. Enable type-map and CGI on the first site.
5. Place a type-map file whose filename ends with .cgi.var on the first
site. (board.cgi.var in the example)
6. In the type-map file, specify valid URIs to CGI scripts. Also specify
"Content-Type: application/x-httpd-cgi"
7. Using web browser, access to the path to the type-map file on the
first site, without putting .var suffix.
8. You'll see 500 Internal Server Error. Also, apache2 is terminated in
few seconds.

The problems you can confirm in the above steps are two:
 - The server responds 500 instead of running CGI correctly.
   When you access to the path to the type-map file *with* .var suffix,
   CGI is executed correctly.
 - The apache2 process is terminated.
   This has to be more severe than just returning 500.
   This problem doesn't occur if the second site doesn't exist.

In error.log, you'll see errors like below:
[Thu Sep 29 18:32:42.176871 2022] [cgid:error] [pid 209665] (104)Connection reset by peer: AH01248: Error reading request on cgid socket
[Thu Sep 29 18:32:42.177025 2022] [cgid:error] [pid 209704] [client xxx.xxx.xxx.xxx:53380] End of script output before headers: board.cgi
[Thu Sep 29 18:32:43.161802 2022] [cgid:error] [pid 209664] AH01239: cgid daemon process died, restarting
[Thu Sep 29 18:32:44.170387 2022] [mpm_prefork:emerg] [pid 209706] (22)Invalid argument: AH00144: couldn't grab the accept mutex
[Thu Sep 29 18:32:45.170296 2022] [core:alert] [pid 209664] AH00050: Child 209706 returned a Fatal error... Apache is exiting!

#1021771#23
Date:
2024-08-02 02:52:35 UTC
From:
To:
Hi there

I just came across your website and noticed that you have a number of toxic links pointing to it, which can prevent your site from getting ranked properly

If you would like to attend these with a professional links clean up service, we can help you out, totally free of charge.

 

Get your free clean up today:

https://www.hilkom-digital.co/free-cleanup/  (https://www.hilkom-digital.co/free-cleanup/)

 

 

Regards
Hilkom Digital Team

Unsubscribe  (https://clicks.hilkom-digital.co/?na=u&nk=466956-0df9b4f484&nek=16-)    |    Manage your subscription  (https://clicks.hilkom-digital.co/?na=p&nk=466956-0df9b4f484&nek=16-)    |    View online  (https://clicks.hilkom-digital.co/?na=v&nk=466956-0df9b4f484&id=16)

whatsapp