CLASSPATH Security

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP








up vote
1
down vote

favorite












On this post someone mentioned in a comment that adding .: to the PATH environment variable is a security vulnerability. Is adding .: to the CLASSPATH environment variable also a security vulnerability?







share|improve this question


























    up vote
    1
    down vote

    favorite












    On this post someone mentioned in a comment that adding .: to the PATH environment variable is a security vulnerability. Is adding .: to the CLASSPATH environment variable also a security vulnerability?







    share|improve this question
























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      On this post someone mentioned in a comment that adding .: to the PATH environment variable is a security vulnerability. Is adding .: to the CLASSPATH environment variable also a security vulnerability?







      share|improve this question














      On this post someone mentioned in a comment that adding .: to the PATH environment variable is a security vulnerability. Is adding .: to the CLASSPATH environment variable also a security vulnerability?









      share|improve this question













      share|improve this question




      share|improve this question








      edited May 21 at 6:29

























      asked May 18 at 23:44









      SkippyNBS

      83




      83




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          2
          down vote



          accepted










          Yes, it can be a security vulnerability.



          Putting .: at the front of CLASSPATH means that Java uses classes under the current directory before bothering to search the rest of the CLASSPATH paths. This means that .class files in the current directory or its subdirectories will be used in place of just about any class or interface. For example, if the file ./java/lang/String.class exists, it will be used instead of the standard String class.



          That means that if you're not paying attention to what the current directory is when you run a Java program, the program might load malicious classes in the place of just about any class whatsoever.



          To save yourself the effort of strenuously checking the current directory every time you ever run a Java program, you shouldn't set the system to do that by default.



          If you're going to use classes under the current directory when you run a particular Java program, you should generally skip setting CLASSPATH and use the -cp argument to java instead, as in:



          java -cp ".:…" …


          This completely avoids affecting other Java programs through the CLASSPATH environment variable. You should only do this in cases where you know the files under the current directory aren't malicious.






          share|improve this answer






















            Your Answer







            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "89"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            convertImagesToLinks: true,
            noModals: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );








             

            draft saved


            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1037917%2fclasspath-security%23new-answer', 'question_page');

            );

            Post as a guest






























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            2
            down vote



            accepted










            Yes, it can be a security vulnerability.



            Putting .: at the front of CLASSPATH means that Java uses classes under the current directory before bothering to search the rest of the CLASSPATH paths. This means that .class files in the current directory or its subdirectories will be used in place of just about any class or interface. For example, if the file ./java/lang/String.class exists, it will be used instead of the standard String class.



            That means that if you're not paying attention to what the current directory is when you run a Java program, the program might load malicious classes in the place of just about any class whatsoever.



            To save yourself the effort of strenuously checking the current directory every time you ever run a Java program, you shouldn't set the system to do that by default.



            If you're going to use classes under the current directory when you run a particular Java program, you should generally skip setting CLASSPATH and use the -cp argument to java instead, as in:



            java -cp ".:…" …


            This completely avoids affecting other Java programs through the CLASSPATH environment variable. You should only do this in cases where you know the files under the current directory aren't malicious.






            share|improve this answer


























              up vote
              2
              down vote



              accepted










              Yes, it can be a security vulnerability.



              Putting .: at the front of CLASSPATH means that Java uses classes under the current directory before bothering to search the rest of the CLASSPATH paths. This means that .class files in the current directory or its subdirectories will be used in place of just about any class or interface. For example, if the file ./java/lang/String.class exists, it will be used instead of the standard String class.



              That means that if you're not paying attention to what the current directory is when you run a Java program, the program might load malicious classes in the place of just about any class whatsoever.



              To save yourself the effort of strenuously checking the current directory every time you ever run a Java program, you shouldn't set the system to do that by default.



              If you're going to use classes under the current directory when you run a particular Java program, you should generally skip setting CLASSPATH and use the -cp argument to java instead, as in:



              java -cp ".:…" …


              This completely avoids affecting other Java programs through the CLASSPATH environment variable. You should only do this in cases where you know the files under the current directory aren't malicious.






              share|improve this answer
























                up vote
                2
                down vote



                accepted







                up vote
                2
                down vote



                accepted






                Yes, it can be a security vulnerability.



                Putting .: at the front of CLASSPATH means that Java uses classes under the current directory before bothering to search the rest of the CLASSPATH paths. This means that .class files in the current directory or its subdirectories will be used in place of just about any class or interface. For example, if the file ./java/lang/String.class exists, it will be used instead of the standard String class.



                That means that if you're not paying attention to what the current directory is when you run a Java program, the program might load malicious classes in the place of just about any class whatsoever.



                To save yourself the effort of strenuously checking the current directory every time you ever run a Java program, you shouldn't set the system to do that by default.



                If you're going to use classes under the current directory when you run a particular Java program, you should generally skip setting CLASSPATH and use the -cp argument to java instead, as in:



                java -cp ".:…" …


                This completely avoids affecting other Java programs through the CLASSPATH environment variable. You should only do this in cases where you know the files under the current directory aren't malicious.






                share|improve this answer














                Yes, it can be a security vulnerability.



                Putting .: at the front of CLASSPATH means that Java uses classes under the current directory before bothering to search the rest of the CLASSPATH paths. This means that .class files in the current directory or its subdirectories will be used in place of just about any class or interface. For example, if the file ./java/lang/String.class exists, it will be used instead of the standard String class.



                That means that if you're not paying attention to what the current directory is when you run a Java program, the program might load malicious classes in the place of just about any class whatsoever.



                To save yourself the effort of strenuously checking the current directory every time you ever run a Java program, you shouldn't set the system to do that by default.



                If you're going to use classes under the current directory when you run a particular Java program, you should generally skip setting CLASSPATH and use the -cp argument to java instead, as in:



                java -cp ".:…" …


                This completely avoids affecting other Java programs through the CLASSPATH environment variable. You should only do this in cases where you know the files under the current directory aren't malicious.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited May 19 at 2:38

























                answered May 19 at 2:24









                Chai T. Rex

                3,45611132




                3,45611132






















                     

                    draft saved


                    draft discarded


























                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1037917%2fclasspath-security%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Popular posts from this blog

                    Trouble downloading packages list due to a “Hash sum mismatch” error

                    How do so many people here on Academia.SE, and in general, afford lavish higher education programs?

                    How do I move numbers in filenames, in a batch renaming operation?