/** A program to illustrate system-call injection, * from user input. */ class Touch { final static String BASE_DIR = "/Users/ibarland/"; public static void main( String[] _ ) throws java.io.IOException { System.out.println( "What file inside " + BASE_DIR + " do you want to update? " ); String fname = new java.util.Scanner( System.in ).next(); String command = "touch " + BASE_DIR + fname; System.out.println( "About to execute: `" + command + "`"); Runtime.getRuntime().exec( command ); } }