我在一个java源代码上运行了IBM AppScan工具。它在"pageFile =新文件(FileName);“行上的”PathTraversal- Promote to Vulnerability“下列出了一些调查结果。我能知道纠正这个问题的解决方案是什么吗?
package mig;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.channels.FileChannel;
import mig.one.GenConstants;
import mig.one.GenInit;
import mig.one.GenException;
import mig.one.GenExpConstants;
import mig.one.GenLogger;
public class Generate {
private static final String EVENT_TYPE ="EXTENSION_XML";
private static GenLogger logger = GenLogger.getLogger();
public static void main(String[] args) throws GenException {
GenInit genMigration = new GenInit(args);
genMigration.parseArguments(args);
File pageFile=null;
String fileName = null;
try{
if(args[1].equalsIgnoreCase("-f")){
fileName = GenConstants.MAP_FILE;
logger.logDebug(EVENT_TYPE, "Menu Map File name ::"+ fileName);
pageFile = new File(fileName);
}
}
catch(GenException ume) {
logger.logError(EVENT_TYPE, ume.getMessage(),ume);
throw ume;
} catch(Throwable th) {
logger.logError(EVENT_TYPE, th.getMessage(), th);
throw new GenException(GenExpConstants.EM_UNKNOWN, new String[]{th.getMessage()},th);
} finally {
logger.logDebug(EVENT_TYPE, "####################################################\n");
}
}
}在上述代码中,GenConstants.MAP_FILE = System.getProperty("user.dir") + File.separator +"file.cfg";
发布于 2015-10-16 01:17:15
您将需要检查此发现的跟踪数据。根据您的更新,我认为污点来自user.dir属性,并且此值未经过清理。
https://stackoverflow.com/questions/27295987
复制相似问题