CLASSPATH Security

Clash 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?
java security paths
add a comment |Â
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?
java security paths
add a comment |Â
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?
java security paths
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?
java security paths
edited May 21 at 6:29
asked May 18 at 23:44
SkippyNBS
83
83
add a comment |Â
add a comment |Â
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.
add a comment |Â
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.
add a comment |Â
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.
add a comment |Â
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.
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.
edited May 19 at 2:38
answered May 19 at 2:24
Chai T. Rex
3,45611132
3,45611132
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password