I am using Runtime.exec() to run an executable file. I have been researching and found out that there could be security concerns when using this in a application. Are there any security concerns when using Runtime.exec() to run an executable file?
Share
The biggest one I can think of is Command Injection. YOu want to whitelist what gets run so someone can’t run “rm /” via your Runtime.exec. There are more ways for this to happen than you might think. For example what if a “directory” name is passed in as “foo; rm -r ; ls”.
Another one – if this is a web application – is that the permissions for the application (and therefore your Runtime.exec() command line aren’t the same as what the person hitting the web page has. Which means the person could delete your Tomcat or insert data into a database or …