项目工具Fortify翻译

上一篇 / 下一篇  2008-08-27 14:46:33 / 个人分类:Fortify

 
 
                          项目工具Fortify翻译 
 
一。分析方法概述:
1.       以下为Fortify工具归纳的几种项目代码漏洞类型:
1.1. Analyzers: Data Flow数据流分析
原文:Follows the propagation of tainted data starting from aSource(function that introduces any input source to the program), through intermediate function calls until it reaches aSink(potentially vulnerable function)
翻译:顺着从一个被污染的源(一个有返回值的函数),通过中间函数的调用直到它返回一个结果(潜在的易受攻击的函数)。
理解:如果一个函数易受攻击或者被污染,那么调用这个函数的程序点就有风险。
1.2. Analyzers: Control Flow控制流分析
原文:Looks for dangerous sequences of operations
翻译:查找危险的操作顺序
1.3. Analyzers: Semantic语义分析
原文:Looks for unsafe function calls
翻译:查找不安全的函数调用
1.4. Analyzers: Structural结构分析
原文:Detects potentially dangerous flaws in the structure or definition of the program
翻译:在结构中或者程序的定义中发现潜在的危险和错误。
1.5. Analyzers: Configuration配置分析
Analyzes XML configuration files 分析XML配置文件。
web.xml for J2EE applications分析J2EE工程中的web.xml文件。
Uses XPath queries to identify unsafe XML elements and attribute definitions
通过XPth查询去识别不安全的XML元素和属性定义。

二。分析一个具体项目:分析方面,将错误分类(使用了一个软件系统的生产代码):
4.1.Process Control(Data Flow):
源文件:AgentServlet.java.
代码:obj = this.getClass().getClassLoader().loadClass(servletName).newInstance();
原文:Loading libraries from an untrusted source or in an untrusted environment can cause an application to execute malicious commands on behalf of an attacker.
翻译:从一个不值得信任的库或者环境加载库将使得应用程序去执行一个恶意的攻击命令。
理解:在次不值得信任的库指的就是参数servletName。
4.2.Http response splitting(Data Flow):
源文件:WorkPageDispatcher.java.
代码:rep.sendRedirect(url);
原文:Including unvalidated data in an HTTP response header can enable cache-poisoning, cross-site scrīpting, cross-user defacement or page hijacking attacks.
翻译:在Http响应头中包含没有经过验证的数据将会使缓存中毒,经过的站点和经过的用户信息遭到毁坏,页面受到控制。
理解:在此处指url这个参数有可能会不安全。
4.3.Unreleased resource:Streams(Control Flow):
源文件:ApproveCenterConfig.java.
代码:InputStream s = ApproveCenterConfig.class.     getResourceAsStream
("/cn/ccb/clpm/common/rule/ApproveCenterConfigFile.xml");
原文:The program can potentially fail to release a system resource.
翻译:程序有可能不能释放系统资源。
理解:在此处指变量s有可能没有释放资源。
4.4.Null dereference (Control Flow):
源文件:ApplicationCheckupBackingBean.java.
代码:configDataMap = checkupTaskVO.getConfigItems();
原文:The program can potentially dereference a null pointer, thereby raising a NullPointerException..
翻译:程序有可能间接引用一个空指针,由此产生了一个空指针异常。
理解:在此处指的是,变量checkupTaskVO有可能为空。
4.5.Missing check against null(Control Flow):
源文件:AgentServlet.java.
代码:obj = this.getClass().getClassLoader().loadClass(servletName).newInstance();
原文:The program may dereference a null pointer because it does not check the return value of a function that can return null..
翻译:因为没有检查有可能返回null的函数的返回值,程序会间接引用一个空指针。
4.6.Missing XML validation(Control Flow):
源文件:QueryPrivilegeConfig.java.
代码:db = dbf.newDocumentBuilder();
原文:Failure to enable validation when parsing XML gives an attacker the opportunity to supply malicious input..
翻译:因为没有去验证,所以当解析XML的时候会给攻击者一个输入恶意数据的机会。
4.7.System Information Leak(Data Flow):
源文件:BizApplicationApprovalBackingBean.java.
代码:logger.error("BizApplicationApprovaBB 出错:" + e.getMessage());
原文:Revealing system data or debugging information helps an adversary learn about the system and form a plan of attack.
翻译:展现系统数据或调试信息将帮助攻击者了解系统和制定攻击的计划。
理解:就是系统消息泄露。
4.8.Code Correctness():Erroneous class compare(Data Flow):
源文件:BizHandledQueryDAO.java
代码:if(dataMap.get("comment_issuing_time").getClass().getName().
equals("oracle.sql.DATE"))
原文:Determining an object's type based on its class name can lead to unexpected behavīor or allow an attacker to inject a malicious class..
翻译:根据类名来决定一个对象的类型将会引起不可预料的行为,例如攻击者注入一个恶意的类型。
理解:在此处是从项目的安全性考虑,攻击者可以在dataMap中注入类型为”oracle.sql.DATE”来让这段程序执行。
4.9.Log Forging(Data Flow):
源文件:AgentServlet.java
代码:if(obj instanceof Servlet)
logger.info("agent servlet  init:"+servletName);
原文:Writing unvalidated user input to log files can allow an attacker to forge log entries or inject malicious content into the logs..
翻译:将一个没有过经过验证的用户输入写入日志文件中将允许攻击者伪造日志输入或者将恶意的内容注入到日志中。
理解:也是从项目的安全性(验证用户)方面来考虑。
4.10.Password management(Data Flow):
源文件:WLIContextHolder.java
代码:env.put(Context.SECURITY_CREDENTIALS, passwd);
原文:Storing a password in plaintext may result in a system compromise.
翻译:基于折衷考虑用一个清晰的文本保存密码。
理解:也是从项目的安全性(密码管理)方面来考虑,在次Fortify将次风险归纳为warning级别。
4.11.Denial of service(Data Flow):
源文件:Metronome.java
代码:sleep(thisTime);
原文:An attacker could cause the program to crash or otherwise become unavailable to legitimate users.
翻译:攻击者可以使程序崩溃,否则为了让自己变成合法用户而让程序变得不可用。
理解:如果给变量thisTime一个很大的值,就可以让本线程一直sleep下去,所以这种风险类型归纳为服务拒绝。
4.12.System information leak:missing catch block(structural):
源文件:FileDownloadServlet.java
代码:public void doGet(HttpServletRequest req, HttpServletResponse rep)throws ServletException,IOException{
原文:If a Servlet fails to catch all exceptions, it may reveal debugging information that will help an adversary form a plan of attack..
翻译:如果一个Servlet不能捕捉所有异常,它将会显示出可以帮助攻击者制定攻击计划的调试信息,
理解:该方法的全部程序如下:
public void doGet(HttpServletRequest req, HttpServletResponse rep)throws ServletException,IOException{
try{
doDownload(req, rep);
}catch(BizException ex){
throw new ServletException("File download failure",ex);
}
}
在该方法中只捕捉了BizException,这样如果出现ServletException或IOException的时候,如果代码中包含一下代码:out.println("hello " + addr.getHostName());,将会存在风险。
4.13.System Information Leak(Semantic):
源文件:AgentServlet.java.
代码:catch (NamingException e) {
e.printStackTrace();
}
原文:Revealing system data or debugging information helps an adversary learn about the system and form a plan of attack.
翻译:展现系统数据或调试信息将帮助攻击者了解系统和制定攻击的计划。
理解:在次还可以从另外一个角度考虑,就是异常被吃掉了。
4.14.Poor error handling:Program catchs nullpointexception(Structual):
源文件:RequestMap。java
代码:}catch(NullPointerException e){}
原文:It is generally a bad practice to catch NullPointerException.
翻译:不能捕捉空指针异常。
4.15.Poor error handling:Empty ctach block(structual):
源文件:BizElementMapping.java
代码:} catch (BizException e) {}
原文:Ignoring an exception can cause the program to overlook unexpected states and conditions.
翻译:忽视一个异常将会出现不能预料的状态和情况。
4.16.Poor error handling:Overly broad throws(Structural):
源文件:ArrangeMeetingBackingBean.java
代码: public String makeMeetingVOFromMeetingId() throws Exception{
原文:The method throws a generic exception making it harder for callers to do a good job of error handling and recovery..
翻译:这个方法抛出一个一般的异常使得调用者很难做好错误处理和恢复。
4.17.Poor error handling:Overly broad catch(Structural):
源文件:AcceptApplicationBackingBean.java
代码:catch(Exception e){
原文:The catch block handles a broad swath of exceptions, potentially trapping dissimilar issues or problems that should not be dealt with at this point in the program..
翻译:这个捕捉异常的块可以处理所有的异常,潜在的陷入了在这段程序中不能处理的不同问题。
理解:如果捕捉exception,就不能让处理异常的逻辑细化,也就是所有的异常都按照同样的逻辑处理是不行的。


4.18.Poor logging practice:logger not declared static final(structual):
源文件:CreditRatingApprovalDisplayUCCImpl.java
代码:  private Logger logger = Logger.getLogger
(CustomerManagerTeamBSImpl.class);
原文:Declare loggers to be static and final..
翻译:定义日志工具必须是static和final的。
4.19.Poor logging practice:Use of a system output stream(structural):
源文件:BizElementMapping.java
代码:  System.out.println("----"+s[i]);
原文:Using System.out or System.err rather than a dedicated logging facility
makes it difficult to monitor the behavīor of the program...
翻译:System.out或者System.err和一个专门的日志组件相比,更难监控
程序的行为。
理解:就是要统一使用日志组件。
4.20.Poor style:Value never read(Structural):
源文件:AddCLProdMaintainUCCImpl.java
代码:  if(prodList!=null){    int i = prodList.size();  }
原文:The variable's value is assigned but never used, making it a dead store.
翻译:变量被定义了,但是没有使用。
4.21.Poor style:Confusing naming(Structural):
源文件:BPCodeConstants.java
代码:  private static  final String RATING_BP_CODE = "WF001";  
public static String RATING_BP_CODE() {}
原文:The class contains a field and a method with the same name.
翻译:该类包含相同名字的属性和方法。
4.22.Code correctness:null argument to equals(Structual):
源文件:SystemCommonParameters.java
代码:  if (obj==null||obj.equals(null)) {
原文:The expression obj.equals(null) will always be false.
翻译:表达式obj.equals(null)总是为false.
4.23.Code correctness:Erroneous String compare(Structural):
源文件:BizApplicationApprovalBackingBean.java
代码:  if ((briefBizTaskVO.getDeptCode() != null) && (briefBizTaskVO.getDeptCode() != "")) {
原文:Strings should be compared with the equals() method, not == or !=.
翻译:字符串的比较要用equals方法,而不是==或者!=.
4.24.Dead code:unused field(Structural):
    Dead code:unused method(Structural):
源文件:BaseWFBO.java
        BaseBackingBean.java.
代码:BaseWFBO.java   private Map historyInfo;
BaseBackingBean.java   private static ValueBinding getValueBinding(String el) {
原文:This field is never used.
      This method is never called or is only called from other dead code.
翻译:属性没有使用。      
方法没有被调用或者仅仅被无用的代码调用。
4.25.J2EE bad practices:Leftover debug code(Structural):    
源文件:BizElementMapping.java.
代码:public static void main(String args[]){
原文:Debug code can create unintended entry points in a deployed web application.
翻译:在一个已经发布的web应用程序中,调试代码会创建一个无意识的入口。
理解:就是从项目的安全方面考虑,攻击者可以在web应用程序中直接调用main方法。
4.26.J2EE bad practices:Leftover threads(Semantic):    
源文件:Metronome.java.
代码:tempCon= new Container(tempClassName,tempTime);
原文:Thread management in a web application is forbidden in some circumstances and is always highly error prone..
翻译:在wen应用程序中线程管理器在一些情况下会被禁止,并且总是有很高的错误倾向。
理解:Thread management in a web application is forbidden by the J2EE standard in some circumstances and is always highly error prone.
Managing threads is difficult and is likely to interfere in unpredictable ways with the behavīor of the application container.
Even without interfering with the container, thread management usually leads to bugs that are hard to detect and diagnose like deadlock,
race conditions, and other synchronization errors.
理解:在wen应用程序中线程管理器在一些情况下会被禁止,并且总是有很高的错误倾向。管理线程是困难的,
并以不可预料的方式去妨碍应用程序容器的行为。即使没有妨碍容器,线程管理器通常也容易导致很难调试的bug
,死锁,程序紊乱,或者其它的线程错误。
4.27.Insecure randomness(Semantic)::    
源文件:DisplayDeptTreeBackingBean.java.
代码:  String root = Double.toString(Math.random());
原文:Standard pseudo-random number generators cannot withstand cryptographic attacks..
翻译:标准的劣质的随机数产生器不能禁受起破译密码程序攻击。
       理解:就是要改进产生随机数的方法.                                     -                            ------------20080630北京。
 

TAG: Fortify

 

评分:0

我来说两句

日历

« 2024-04-18  
 123456
78910111213
14151617181920
21222324252627
282930    

数据统计

  • 访问量: 25872
  • 日志数: 25
  • 建立时间: 2008-08-27
  • 更新时间: 2008-09-02

RSS订阅

Open Toolbar