Bug 32696 - WEB-INF protection stops IIS
WEB-INF protection stops IIS
Status: RESOLVED FIXED
Product: Tomcat Connectors
Classification: Unclassified
Component: Common
unspecified
PC Windows NT
: P2 critical (vote)
: ---
Assigned To: Tomcat Developers Mailing List
: ErrorMessage, NeedsReleaseNote
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2004-12-14 16:39 UTC by Hugo Mendonca
Modified: 2008-10-05 03:08 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Hugo Mendonca 2004-12-14 16:39:16 UTC
Hi,

 

We are having a strange behavior with Jakarta filter loaded in NT4.0 Enterprise 
Edition with IIS 4.0.

After reproducing the steps the IIS service stops:

“telnet (server) 80

GET /WEB-INF./web.xml http/1.1”

 

The output generated is:

################################################################################
########

HTTP/1.1 403 Forbidden

Server: Microsoft-IIS/4.0

Date: Thu, 09 Dec 2004 23:34:29 GMT

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML><HEAD><TITLE

>Access forbidden!!</TITLE></HEAD><BODY><H1>Access forbidden!</H1><DL><DD>

                                                                          You do

n't have permission to access the requested object.It is either read-protected o

r not readable by the server.</DL></DD></BODY></HTML>

################################################################################
########

 

In the event viewer is displayed (sounds correct):

################################################################################
########

Emerg:  [jk_isapi_plugin.c (434)]: HttpFilterProc [/web-inf./web.xml] points to 
the web-inf or meta-inf directory.

Somebody try to hack into the site!!!

################################################################################
########

 

If Jakarta filter is not loaded there is no problem. We are using jakarta-
tomcat-connectors jk 1.2.6 win32-IIS.

 

Regards,

Hugo Mendonça
Comment 1 Mladen Turk 2004-12-14 16:43:21 UTC
WEB-INF is protected folder.

The log file says:
HttpFilterProc [/web-inf./web.xml] points to the web-inf or meta-inf directory.
Somebody try to hack into the site!!!

So what's unclear?
Comment 2 Hugo Mendonca 2004-12-14 17:25:18 UTC
(In reply to comment #1)
> WEB-INF is protected folder.
> The log file says:
> HttpFilterProc [/web-inf./web.xml] points to the web-inf or meta-inf 
directory.
> Somebody try to hack into the site!!!
> So what's unclear?


Like i said clearly in the last thread "IIS service stops". That's the problem! 
Imagine a have a Web Server and a Hacker. If the hacker tries to make "GET /WEB-
INF./web.xml http/1.1" every 1 minute (or so), my Web Server will stop every 
time, because IIS Stops.

I know that WEB-INF is protected but that does not mean that he simply throws 
down IIS everytime somebody tries to access it. It makes no sense at all!

I believe this is not a normal behaviour. What's your opinion?

Tks.

Comment 3 Mladen Turk 2004-12-14 19:56:55 UTC
You are correct.
The IIS really shuts down.
I'll fix that security hole ASAP.

Comment 4 Mladen Turk 2004-12-14 20:20:07 UTC
Fixed in the CVS.
The patch will be available for testing in beta-4 if released
or at 1.2.8
Comment 5 Mladen Turk 2004-12-14 20:35:28 UTC
Fixed in the CVS.
Comment 6 Hugo Mendonca 2004-12-15 17:52:42 UTC
(In reply to comment #5)
> Fixed in the CVS.

Hi again.

Thank you very much for the correction of the bug.

Meanwhile, is there any possibility for you to compile the code and send it to 
me? I'm very desperate because we'll have an inspection team looking at our 
code (and bugs) tomorrow and i have no time to compile the entire project. I 
would have even to install VC++, since i don't have it installed in my machine.

So, please, can you help me in this issue?

Many thanks.

Hugo Mendonça
Comment 7 JJSizing 2005-03-02 19:22:05 UTC
Finding: When the scanning tools guessed WEB-INF directory, the error message 
indicated that access to the directory was denied.  As a result, the error 
message confirmed the existence of this directory.

Tomcat response HTTP Status 404, while isapi_redirect.dll redirector responses 
Access forbidden!...., which is HTTP Status 403.

Example:
http://localhost:8080/WEB-INF/
Return: HTTP Status 404 - /WEB-INF/
This is correct.

http://localhost:80/WEB-INF/
Return: Access forbidden!
You don't have permission to access the requested object. It is either read-
protected or not readable by the server.

This should be 404, not 403.

I have checked the code, jakarta-tomcat-connectors-1.2.8-
src\jk\native\isapi\jk_isapi_plugin.c, at line 713, and it does response 403 
HTTP Status.  I cannot find the place to change it from configuration file 
except re-compile this redirector.

While directory listing is not strictly considered vulnerability, I suggest to 
response 404 HTTP Status to hide the directory, like Tomcat does now.

I found a link http://jakarta.apache.org/tomcat/connectors-doc/howto/iis.html 
mentions something like this:

Protecting the WEB-INF Directory 
...., this directory contains sensitive configurations data and Java classes 
and must be kept hidden from web users. Using the IIS management console it is 
possible to protect the WEB-INF directory from user access,.....

To avoid this need the redirector plugin automatically protects your WEB-INF 
directories by rejecting any request that contains WEB-INF in its URL-Path.

I tried to configure IIS, but it looks like jk_isapi gets higher priority to 
handle the request and always returns 403 status.  Without re-compile the 
program, how can I make IIS return 404 status?  Or maybe next release will do?

Recommendation from Cert: When an unauthorized user attempts to access a 
directory, they should receive an error message that doesn't confirm the 
existence of the directory.  Whether a user is trying to access a valid or 
invalid directory, they should receive the same error message.

My system environment:
Win 2K
Tomcat 4.1.31
IIS 5
JK-1.2.8 - isapi_redirect-1.2.8.dll binary version - 17 December


Comment 8 Mladen Turk 2005-03-17 13:07:47 UTC
Fixed in the CVS for mod_jk.
Thanks for spotting that we did not follow the Servlet spec.

Mladen

Comment 9 jks 2005-04-29 22:12:36 UTC
Where exactly in the spec does it say to return 404 instead of 403?