Koozali.org: home of the SME Server

Apache Problem

tymiles

Apache Problem
« on: May 28, 2004, 01:29:25 PM »
Has anyone encountered this issue. I am using my server in a government building when I did a security scan on this server the scan software (nCircle IP 360) found the problem below:

Versions of Apache webserver shipping with Red Hat Linux 7.0, (and possibly other Apache distributions) install with a default misconfiguration which can permit remote users to determine whether a given username exists on the vulnerable system.

When a remote user submits an HTTP request for a possible user's default home page, the server has one of three responses.

In a case where the tested username is valid, and that account has been configured with a homepage, the server replies with HTTP result code 200, and the user's homepage.

Alternatively, when the tested username does exist on the system, but does not have a homepage, the server responds with HTTP result code 403, and the server message "You don't have permission to access /~username on this server."

However, if the tested username does not exist as an account on the system, the Apache server's response is HTTP result code 404 and the message "The requested URL /~username was not found on this server."

Because the server responds differently in the latter two cases, a remote user can test and enumerate possible usernames. Properly exploited, this information could be used in further attacks on the vulnerable host.

SOLUTION
Workaround 1:

Disable the default-enabled UserDir directive:

% echo 'UserDir Disabled' >> /var/www/conf/httpd.conf

Workaround 2:

Substitute URL for pathname in httpd.conf:

% echo 'ErrorDocument 404 http://localhost/sample.html' >> /var/www/conf/httpd.conf
% echo 'ErrorDocument 403 http://localhost/sample.html' >> /var/www/conf/httpd.conf
% sudo apachectl restart

My server does give back the pages above if you manualy browse to the server.

Just wondering if I can use the fix above or if someone else here has a fix idea! Thanks guys!

Offline NickR

  • *
  • 283
  • +0/-0
    • http://www.witzendcs.co.uk/
Apache Problem
« Reply #1 on: May 30, 2004, 02:23:37 AM »
Good catch!  

Fortunately, it's an easy one to fix:

mkdir -p /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf
cp /etc/e-smith/templates/etc/httpd/conf/httpd.conf/50UserDir00     /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/.

then edit the fragment in:

/etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/50UserDir00

from:

# UserDir public_html

to:

UserDir disabled


then do:

/sbin/e-smith/expand-template /etc/httpd/conf/httpd.conf

service httpd restart

This will then give a consistant 404 error whether the user exists or not. This implements Workaround 1 in your example.
--
Nick......

tymiles

Apache Problem
« Reply #2 on: May 30, 2004, 08:41:10 AM »
Quote from: "NickR"
Good catch!  

Fortunately, it's an easy one to fix:

mkdir -p /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf
cp /etc/e-smith/templates/etc/httpd/conf/httpd.conf/50UserDir00     /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/.

then edit the fragment in:

/etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/50UserDir00

from:

# UserDir public_html

to:

UserDir disabled


then do:

/sbin/e-smith/expand-template /etc/httpd/conf/httpd.conf

service httpd restart

This will then give a consistant 404 error whether the user exists or not. This implements Workaround 1 in your example.


Nick you are the man. I figured it would be easy for a smart guy like you to knock right out. Great will hit my server on Monday morning to squash this and will hit all servers.

It may be a good idea to put this in by default if it does not hurt the server in anyway.

Offline NickR

  • *
  • 283
  • +0/-0
    • http://www.witzendcs.co.uk/
Apache Problem
« Reply #3 on: May 30, 2004, 11:28:15 AM »
Quote from: "tymiles"

It may be a good idea to put this in by default if it does not hurt the server in anyway.


It wouldn't hurt in principle, but be aware that a future patch or upgrade may nuke the change.  Putting the fragment in templates-custom will ensure it survives in future.  FYI, I have reported this issue to security@lists.contribs.org
--
Nick......