You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Glenn Nielsen <gl...@voyager.apg.more.net> on 2001/11/25 22:44:57 UTC

[PROPOSAL] Tomcat 4.1 Security Changes

Currently, all supporting jar files for servlets which come with Tomcat 4
are placed in the $CATALINA_HOME/server/lib directory with the Tomcat 4
core jar files.  This is a potential security problem because the default
catalina.policy grants AllPermission to all jar files located in
$CATALINA_HOME/server/lib.  I don't think the default policy for these
servlets should be AllPermission.  Especially for the SSI and CGI servlets.
To make the default catalina.policy more secure and make configuring security
policies easier, I recommend the following changes:

1.  Create $CATALINA_HOME/servlets/lib and $CATALINA_HOME/servlets/classes.
    This is where global servlets provided with Tomcat 4 can be installed.

2.  Move the following jar files into $CATALINA_HOME/servlets/lib

servlets-cgi.renametojar
servlets-common.jar
servlets-default.jar
servlets-invoker.jar
servlets-manager.jar
servlets-snoop.jar
servlets-ssi.jar
servlets-webdav.jar

3.  Update the class loader creation in Bootstrap.java for the catalina loader
    to look for jar files and classes in $CATALINA_HOME/servlets in addition
    to $CATALINA_HOME/server.

4.  Update the default catalina.policy so that it provides explicit
    permissions for each jar file in $CATALINA_HOME/servlets/lib.

5.  Update the documentation regarding the above changes.

Please vote +1 so I can implement the above changes.

Thanks,

Glenn

----------------------------------------------------------------------
Glenn Nielsen             glenn@more.net | /* Spelin donut madder    |
MOREnet System Programming               |  * if iz ina coment.      |
Missouri Research and Education Network  |  */                       |
----------------------------------------------------------------------

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


You can help me ....

Posted by Juan Carlos Fernández Galante <ju...@upcnet.es>.
Hi,

I want to load  a jsp file on a org.apache.catalina.core.StandardWrapper (of
Catalina API), but this fragment of code not make it, Can someone Help me?

StandardWrapper theStandardWrapper = new StandardWrapper();

theStandardWrapper.setJspFile("file://C:/proyectos/varios/jasper/bak/hello.j
sp");
  theStandardWrapper.setServletName("hello.jsp");
  theStandardWrapper.setServletClass("jsp.hello");
  StandardContext theStandardContext = new StandardContext();
  theStandardContext.addChild(theStandardWrapper);

  theStandardWrapper.setParent(theStandardContext);

  try
  {
       //Sets the loader
       WebappLoader theWebappLoader = new WebappLoader();
       theStandardWrapper.setLoader(theWebappLoader);
       Servlet theServlet = theStandardWrapper.allocate();
    }catch (Exception e)
   {
    e.printStackTrace();
   }
  }

The exception throws is :
--------------------------------------------------------
javax.servlet.ServletException: Servlet.init() for servlet hello.jsp threw
exception

 void org.apache.catalina.core.StandardWrapper.load()

  StandardWrapper.java:871

 javax.servlet.Servlet org.apache.catalina.core.StandardWrapper.allocate()

  StandardWrapper.java:615

 void jsp.Prueba1.<init>()

  Prueba1.java:39

 void jsp.Prueba1.main(java.lang.String[])

  Prueba1.java:73
----------------------------------------------------------------------------




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [PROPOSAL] Tomcat 4.1 Security Changes

Posted by Remy Maucherat <re...@apache.org>.
> Remy Maucherat wrote:

> > If you give the appropriate permissions to allow SSI and CGI, you're
> > actually giving AllPermissions anyway (since you're allowing a native
script
> > or executable to run, which is not constrained by the Java sandbox), so
I'm
> > missing the point here.
> >
>
> Yes, once control is handed over to a native executable from the CGI
servlet,
> all sandbox protections are lost.
> But perhaps the Tomcat admin only wants to allow the user to execute
specific CGI
> scripts which are known to be secure and can not be modified. By
configuring a
> policy for the CGI servlet the admin can restrict what CGI scripts can be
> read and executed using a FilePermission.

Yes, you could do that. That's still quite risky (any vulnerability in the
script itself, and your server is compromised).

> > This seems reasonable.
> > (Of course, it's going to break all the scripts yet again ;-))
>
> Which scripts?

- The Catalina scripts (obviously)
- The installer scripts
- My Slide build script

But it's ok, really. It's not like it's the first time or the last time it
happens ;-)
You can do the updates to the Catalina scripts, and I'll do the rest.

Remy


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [PROPOSAL] Tomcat 4.1 Security Changes

Posted by Glenn Nielsen <gl...@voyager.apg.more.net>.
Remy Maucherat wrote:
> 
> > Currently, all supporting jar files for servlets which come with Tomcat 4
> > are placed in the $CATALINA_HOME/server/lib directory with the Tomcat 4
> > core jar files.  This is a potential security problem because the default
> > catalina.policy grants AllPermission to all jar files located in
> > $CATALINA_HOME/server/lib.  I don't think the default policy for these
> > servlets should be AllPermission.  Especially for the SSI and CGI
> servlets.
> 
> If you give the appropriate permissions to allow SSI and CGI, you're
> actually giving AllPermissions anyway (since you're allowing a native script
> or executable to run, which is not constrained by the Java sandbox), so I'm
> missing the point here.
> 

Yes, once control is handed over to a native executable from the CGI servlet,
all sandbox protections are lost.
But perhaps the Tomcat admin only wants to allow the user to execute specific CGI
scripts which are known to be secure and can not be modified. By configuring a 
policy for the CGI servlet the admin can restrict what CGI scripts can be 
read and executed using a FilePermission.

> > To make the default catalina.policy more secure and make configuring
> security
> > policies easier, I recommend the following changes:
> >
> > 1.  Create $CATALINA_HOME/servlets/lib and
> $CATALINA_HOME/servlets/classes.
> >     This is where global servlets provided with Tomcat 4 can be installed.
> >
> > 2.  Move the following jar files into $CATALINA_HOME/servlets/lib
> >
> > servlets-cgi.renametojar
> > servlets-common.jar
> > servlets-default.jar
> > servlets-invoker.jar
> > servlets-manager.jar
> > servlets-snoop.jar
> > servlets-ssi.jar
> 
> This one is disabled by default too.
> 
> > servlets-webdav.jar
> >

But if I choose to enable it, it should be easy for the admin to configure
a policy which is more strict than that for the Tomcat core classes.

> > 3.  Update the class loader creation in Bootstrap.java for the catalina
> loader
> >     to look for jar files and classes in $CATALINA_HOME/servlets in
> addition
> >     to $CATALINA_HOME/server.
> >
> > 4.  Update the default catalina.policy so that it provides explicit
> >     permissions for each jar file in $CATALINA_HOME/servlets/lib.
> >
> > 5.  Update the documentation regarding the above changes.
> >
> > Please vote +1 so I can implement the above changes.
> 
> This seems reasonable.
> (Of course, it's going to break all the scripts yet again ;-))

Which scripts?

> 
> Remy
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>

-- 
----------------------------------------------------------------------
Glenn Nielsen             glenn@more.net | /* Spelin donut madder    |
MOREnet System Programming               |  * if iz ina coment.      |
Missouri Research and Education Network  |  */                       |
----------------------------------------------------------------------

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [PROPOSAL] Tomcat 4.1 Security Changes

Posted by Remy Maucherat <re...@apache.org>.
> Currently, all supporting jar files for servlets which come with Tomcat 4
> are placed in the $CATALINA_HOME/server/lib directory with the Tomcat 4
> core jar files.  This is a potential security problem because the default
> catalina.policy grants AllPermission to all jar files located in
> $CATALINA_HOME/server/lib.  I don't think the default policy for these
> servlets should be AllPermission.  Especially for the SSI and CGI
servlets.

If you give the appropriate permissions to allow SSI and CGI, you're
actually giving AllPermissions anyway (since you're allowing a native script
or executable to run, which is not constrained by the Java sandbox), so I'm
missing the point here.

> To make the default catalina.policy more secure and make configuring
security
> policies easier, I recommend the following changes:
>
> 1.  Create $CATALINA_HOME/servlets/lib and
$CATALINA_HOME/servlets/classes.
>     This is where global servlets provided with Tomcat 4 can be installed.
>
> 2.  Move the following jar files into $CATALINA_HOME/servlets/lib
>
> servlets-cgi.renametojar
> servlets-common.jar
> servlets-default.jar
> servlets-invoker.jar
> servlets-manager.jar
> servlets-snoop.jar
> servlets-ssi.jar

This one is disabled by default too.

> servlets-webdav.jar
>
> 3.  Update the class loader creation in Bootstrap.java for the catalina
loader
>     to look for jar files and classes in $CATALINA_HOME/servlets in
addition
>     to $CATALINA_HOME/server.
>
> 4.  Update the default catalina.policy so that it provides explicit
>     permissions for each jar file in $CATALINA_HOME/servlets/lib.
>
> 5.  Update the documentation regarding the above changes.
>
> Please vote +1 so I can implement the above changes.

This seems reasonable.
(Of course, it's going to break all the scripts yet again ;-))

Remy


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>