【问题标题】:Rectify PathTraversal found in AppScan Tool纠正在 AppScan 工具中发现的 PathTraversal
【发布时间】:2014-12-04 14:02:18
【问题描述】:

我在 java 源上运行 IBM AppScan 工具。它在“pageFile = new File(fileName);”行的“PathTraversal - 升级为漏洞”下列出了一些发现。我可以知道有什么解决方案来纠正这个问题吗?

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";

【问题讨论】:

    标签: java


    【解决方案1】:

    您需要检查此结果的跟踪数据。根据您的更新,我认为污点来自 user.dir 属性,并且该值未经过处理。

    【讨论】:

      猜你喜欢
      • 2017-01-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-04
      相关资源
      最近更新 更多