Fortify代码扫描工具

一、Fortify介绍     

 Fortify是一款强大的静态代码扫描分析工具,其发现代码漏洞缺陷的能力十分强悍,主要是将代码经过编译,依托于其强大的内置规则库来发现漏洞的。其次fortify SCA团队在开发此商业工具时,也提供了自定义规则的接口,只要经过正版授权后,便可以在此基础上自定义规则,来增强Fortify SCA的漏洞识别能力,同时经过自定义规则,也可以降低误报,使静态分析的准确度和高效性。

     默认情况下,Fortify SCA使用安装的安全编码规则包来检查源代码,并定义一系列可能出现的问题,如可被攻击者利用的安全漏洞和不良的编码缺陷。

    安全编码规则中的规则分析受支持语言的核心和扩展的API包中的函数,并将分析结果记录在Fortify SCA中。每一个问题的解释包含了对问题的描述和建议的解决方案,一边更好的解决程序中的漏洞和缺陷。也可以通过创建自定义规则包来准确地分析特定的应用程序,验证专门的安全规则以及细化Fortify SCA所报告的问题。

二、编写自定义规则原理

要编写有效的自定义规则,就必须熟悉已知的安全漏洞类别和通常与他们相关的函数类型。深入理解各类经常出现在特定类型漏洞的函数,有利于在编写自定义规则过程中能够准确地找到与安全相关的函数。任何一门语言,都有其庞大的开源框架和lib库。所以自定义规则,既要精通安全漏洞原理,又要熟练掌握一门或几门开发语言,一般自定义规则用的比较多的语言有java、C/C++、PHP等。其次必须识别与安全相关的函数,并熟悉这些函数的特性以此来确定能够体现各个函数具体行为和与之相关的漏洞类别的正确规则形式。一旦确定好了这种联系,使用自定义规则编辑器来创建规则就相对简单了。

三、自定义规则

1). 在fortify SCA安装的bin目录下找到打开自定义规则编辑器,CustomRulesEditor.cmd,如下图所示:

2). 打开编辑器后,选择File ——>Generate Rule,弹出规则向导框。

3). 自定义规则模板可以按照漏洞类型(Category)和规则类型(Rule Type)进行分类,不管是何种方式分类,这些模板大体上分为,数据污染源tainted规则,数据控制流规则,数据传递规则,以及漏洞缺陷爆发的sink规则。只要理解了这些规则模板,和开发语言的函数特征,建立规则就简单了。

fortify扫描工具的说明手册,对实际工作有指导作用,讲的比较清晰。 Fortify SCA分析原理 Front-End 3rd party IDE Java Pug-In C/C++ MicrOsoL NET IBM.eclipse Audit workbench PLSQL XML Analysis Engine Semantic fdi/ fpr Gobal Data flow N Control Flow Configuration Structural Fortify Manager NST Rules builder Custom Pre-Packaged FORTIFY Fortify SCA分析过程 SCA Engine Intermediate Scan phase fles Using Analyzers Tt transation (NST) .Rules Analysis Result File -b build id 阶段一:转换阶段( Translation) 阶段二:分析阶段(Scan o sourceanalyzer-b <build-id>-clean o sourceanalyzer -b <build-id> sourceanalyzer-b <build-id> -Xmx1250m-scan-f results fpr FORTIFY Fortify SCA扫描的工作 Visual studio Eclipse, IBM RAD 面 Audit Workbench Java,. Net Fortify Global Build Tool C, C/C++ Analysis JSP Touchless Build Fortify PL/SQL IDE Intermediate FPR TSOL Model Cold Command Line Interface Fusion 运己 Fortify I m Manager Secure Coding Rules Fortify Customized Rules Rules FORTIFY Fortify SCA扫描的五种方式 插件方式: Plug-In(Eclipse, vs WsAd,rad) 命令行方式 Command line ●扫描目录方式: Audit workbench scan Folder 与其他工具集成: Scan with ANt, Makefile ●编译监控器方式: Fortify SCA Build Monitor FORTIFY Fortify SCA扫描的四个步骤 Fortify SCA扫描总共可以分为四个步骤: ●1. Clean:清除阶段: sourceanalyzer -b proName -clean 2. Translation:转换阶段 3.ShoW-fe:查看阶段 sourceanalyzer -b proName -show-files 4.scan:扫描阶段 sourceanalyzer-b proName -Xmx1250m -scan -f proName. fpr FORTIFY Fortify SCA命令行参数说明 查看SCA扫描命令及参数→> sourceanalyzer ca\ C:\VIRDoS\syste32\cd. exe 川 icrosoft Windows XP[版不5.1268g Kc版权所有1985-2 061 Microsoft Gorp :Documents and settings anming >sourceanalyzer --he lp Fortify Source Code Analyze4..日.回153 Copyright (c>2003-2006 Fortify Software Usage Bu⊥1d Java: sourceanalyzer -b <buildid> <files> sourceanalyzer -b <buildid> javac <compiler opts> <files> G/C++: sourceanalyzer -b <buildid> <compiler> <compiler opts> <files> NET: sourceanalyzer -b <buildin> <exe file> scan〓 sourceanalyzer -b <buildid> -scan -f results. fpr Output opt ions -format <fmt> Controls the output format. Valid options are auto, fpr. fvdl, and text. Default is auto for which type will be determined automatically based on file extension 一£<fi1e> The file to which results are written Default is stdout build-pro ject <name> The name of the project being scanned. Will be inc luded in the output bu⊥1d-1abe1<labe1> The1abe1 of the project being scanned.W主工1 be inc luded in the output build-version <version> The version of the project being scanned. wil1RTIFY. e uale OFTWARE Fortify SCA转换源代码 转换Java代码 Java程序命令行语法 JaVa命令行语法例子 转换J2EE应用程序 使用 Find bugs 转换NET源代码 o. NET Versions 1.1 and 2.0 Visual studio. net version 2003 o Visual studio.net version 2005 转换CC++代码 ●转换 PL/SQLITSQL FORTIFY SCA转换JAVA源代码命令 sourceanalyzer -b <build-id> -cp <classpath> <file-list> ●附注参数:-Xmx;- encoding-jdk;- appserver- appserver- veron -appserver-home Table 1: File specifiers File specifier Description darna盈e All files found under the named directory or any subdirectories dx己盈e/古古 Any file named Example. java found under the named Example java directory or any subdirectories dx22盈e/,ava Any file with the extension. j ava found in the named directory dxna盈e吉/古,java Any file wth the extension j ava found under the named directory or any subdirectories d工22a盈e/方/吉 All files found under the named directory or ary subdirectories (same as dirname FORTIFY
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值