tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: Security of WEB-INF content
Date Mon, 01 Nov 2010 15:11:50 GMT
Hash: SHA1


On 10/29/2010 7:57 AM, Mark Thomas wrote:
> On 29/10/2010 12:30, Haledor wow wrote:
>> Hi,
>> I have read in various forums that there are situations where the content of
>> WEB-INF can be accessed. Some people say that it is good practice to hide
>> sensitive files in WEB-INF and some say it might not be...
>> I am using Tomcat 6.0 and I am worried someone could access some of my
>> sensitive files located inside the WEB-INF folder. Could you explain to me
>> whether this is possible or not.
> Nothing under WEB-INF is directly accessible to a user. Requests to
> http://host:port/app/WEB-INF/... will always be rejected.

If Tomcat is being used behind a web server such as Apache httpd, then
the web server can be used to subvert the security provided by Tomcat.

For example, a naive configuration might be:

DocumentRoot /var/www/my-webapp
JkMount /*.jsp worker

<Context docBase="/var/www/my-webapp" />

If a request comes in for /WEB-INF/web.xml, Apache httpd will happily
serve that file off the disk while the same request to Tomcat would fail.

There are many solutions to this problem, including:

1. Not using a fronting web server
2. Setting DocumentRoot != docBase
3. Adding <Limit> directives to httpd.conf to specifically
   exclude WEB-INF and other sensitive areas
4. Making WEB-INF and other sensitive areas unreadable
   by the httpd process
5. Use a more general (or additional) JkMount directives, like
   JkMount /*.jsp worker
   JkMount /WEB-INF/* worker
   ... though if you have a JkMount for /WEB-INF/, you may as
   well do #3 or #4 above.

I highly favor #1 and #2 above, though your environment may necessitate
some of the other options.

- -chris
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla -


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message