Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Mar 2007
    Posts
    2

    Red face Tomcat/JSP Suppport security issue

    I have a friend who is giving me web hosting support. I requested him to give my user account Tomcat and servlet hosting support.

    I made a simple JSP file and ran it, and it looks like to me a big security issue. Maybe he (my friend) was not able to configure the support properly.

    Can some one help me out on how to properly secure the Tomcat/Servlet support so that one user cannot access other users files.

    Regards,

    PHP Code:
    <html>
        <
    head>
            <
    title>A Simple JSP Page</title>
        </
    head>
        <
    body>
        <
    pre>
        
    The current date is <%= new java.util.Date() %>
        </
    pre>
        <
    pre>
        
    The current working dir is <%= System.getProperty("user.dir") %>
        </
    pre>
        
    My home directory is /home/<myusername>
        <
    pre>
        <%= 
    visitAllDirsAndFiles(new java.io.File("/home/<myusername>"), true0) %>
        </
    pre>
        
    My document root directory is /home/<myusername>/public_html (i know that)
        <
    pre>
        <%= 
    visitAllDirsAndFiles(new java.io.File("/home/<myusername>/public_html"), true0) %>
        </
    pre>
        
    My other document root directory is /home/<otherusername>/public_html
        
    <pre>
        <%= 
    visitAllDirsAndFiles(new java.io.File("/home/<otherusername>/public_html"), true0) %>
        </
    pre>
        
    Linux root directory is /
        <
    pre>
        <%= 
    visitAllDirsAndFiles(new java.io.File("/"), true0) %>
        </
    pre>
        </
    body>
    </
    html>

    <%!
    public static 
    String process(java.io.File dirint index) {
        
    String s "";
        for (
    int i=0i<indexi++) {
            
    += "  ";
        }
        if (
    dir == null) {
            
    += "{null}\n";
        } else {
            if (
    dir.isDirectory()) {
               
    += "[" dir "]";
            } else {
               
    += "" dir "";
            }
           if (
    dir.canRead()) {
               
    += " ~ readable";
           } else {
               
    += " ~ NOT readable";
           }
           if (
    dir.canWrite()) {
               
    += " ~ writable";
           } else {
               
    += " ~ NOT writable";
           }
           
    += "\n";
        }
        return 
    s;
    }

    public static 
    String visitAllDirsAndFiles(java.io.File dirboolean subint index) {
        
    String s process(dirindex);
        if (!
    sub) {
          
    sub = (index 1);
        }
        if (
    dir == null) {
            
    // do nothing.
        
    } else {
            if (
    dir.isDirectory()) {
                if (
    sub) {
                    
    String[] children dir.list();
                    if (
    children != null) {
                        
    += children.length " children(s)\n";
                        for (
    int i=0i<children.lengthi++) {
                            
    += visitAllDirsAndFiles(new java.io.File(dirchildren[i]), falseindex+1);
                        }
                    } else {
                        
    += "<null>\n";
                    }
                }
            }
        }
        
        return 
    s;
    }
    %> 

  2. #2
    Registered User
    Join Date
    Mar 2007
    Posts
    2

    Default

    bump ...
    any help appreciated ...

  3. #3
    Member
    Join Date
    Feb 2007
    Posts
    20

    Default

    That is probably an inherent problem with the Default java support as it uses a shared
    JVM. You may want to consider a Java Hosting tool such as NGASI AppServer Manager,
    which runs user applications in separate JVMS and in separate Application Servers.
    Check out http://www.ngasi.com

    NGASI AppServer Manager
    Private JVM Java Hosting Addon
    http://www.ngasi.com

Similar Threads & Tags
Similar threads

  1. Tomcat jsp issue
    By Menta2K in forum cPanel and WHM Discussions
    Replies: 8
    Last Post: 02-22-2008, 03:37 PM
  2. About JSP (Tomcat)
    By Domenico in forum cPanel and WHM Discussions
    Replies: 17
    Last Post: 08-07-2004, 10:24 PM
  3. Tomcat JSP
    By casey in forum cPanel and WHM Discussions
    Replies: 18
    Last Post: 04-14-2003, 03:57 AM
  4. Tomcat jsp troubles
    By Domenico in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 08-21-2002, 03:45 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube