商业级别Fortify白盒神器介绍与使用分析

转自:http://www.freebuf.com/sectool/95683.html

什么是fortify它又能干些什么?

答:fottify全名叫:Fortify SCA ,是HP的产品 ,是一个静态的、白盒的软件源代码安全测试工具。它通过内置的五大主要分析引擎:数据流、语义、结构、控制流、配置流等对应用软件的源代码进行静态的分析,分析的过程中与它特有的软件安全漏洞规则集进行全面地匹配、查找,从而将源代码中存在的安全漏洞扫描出来,并给予整理报告。

它支持扫描多少种语言?

答:FortifySCA支持的21语言,分别是:     

1. asp.net     
2. VB.Net     
3. c#.Net     
4. ASP     
5. VBscript     
6. VS6     
7.java     
8.JSP     
9.javascript     
10. HTML     
11. XML     
12. C/C++     
13.PHP     
14.T-SQL     
15.PL/SQL     
16. Action script      
17. Object-C (iphone-2012/5)     
18. ColdFusion5.0 - 选购     
19. python -选购     
20. COBOL - 选购     
21.SAP-ABAP -选购

他是免费的吗?

答:不是,是收费的。当然网上也没有破解的。貌似他一个月收费10万。

如何使用?

安装fortify之后,打开

1.png

界面:

Image.png

选择高级扫描

Image.png

他问要不要更新? 我就选择No,因为这是我私人的,我是在2015年7月份购买的试用期为1个月。怕更新了就用不了了。如果你购买了可以选择YES。

选择之后出现如下界面

Image.png

浏览意思是:扫描之后保存的结果保存在哪个路径。

然后点击下一步。

Image.png

参数说明:

enable clean :把上一次的扫描结果清楚,除非换一个build ID,不然中间文件可能对下一次扫描产生影响。
enable translation: 转换,把源码代码转换成nst文件
-64: 是扫描64位的模式,sca默认扫描是32位模式。
-Xmx4000m:4000M大概是4G,制定内存数-Xmx4G :也可以用G定义这个参数建议加
-encoding: 定制编码,UTF-8比较全,工具解析代码的时候指定字符集转换的比较好,建议加,如果中文注释不加会是乱码。
-diable-source-:rendering:不加载与漏洞无关的代码到审计平台上,不建议加,这样代码显示不全。

然后点击下一步

Image.png

它说:这是一个J2EE Web应用

选择No    (因为你扫的是PHP)

然后scan(开始扫描)

Image.png

Always run in background 意思:总是在后台运行

run in background 意思:后台运行

cancel 意思 : 取消

Details 意思:细节

扫完之后:
 

I$@Q`AUNPD}~4YZ$T}RGJ$V.png

none 代表其他 1个
A1 注入 7个 
A3 xss 37个
A4 不安全的直接对象引用 35个
A6 敏感数据暴露 4个
A10 未验证的重定向和转发 2个

如果发现是英文的,想改成如下方法中文:

Image.png

以下是官网提供的分析图:

Image.png

分析漏洞:

none漏洞:

NE%G$Q7(V(OWCK}SG8LP3MD.png

这是一个可变变量,按照中国人说法简称:“变量覆盖”。

讲一下这个漏洞的原理:

可变变量

$first ="hello";
$hello ="world";
echo $first." ".$$first;

结果是 hello world

$$first就是$hello,因为$first的值是hello

———————————但是在foreach 就不一样了—————————————————–

<?php
$a = 'sss';
foreach ($_GET as $key => $value) {
     //如果在foreach那就不一样了
     echo $$key;  //将$$区分开 然后$key 等于键 然后开始合并 比如打开http://www.com.com/demo.php?a=值 就变成了$a  因为$key的键是a 所以就变成了$a
     $$key = $value;//$a = 值  替换变量
    
}
echo '<hr '>';
echo $a;
?>

Image.png

{]9T}6N7VN]M$5MRHC2T6~N.png

A1 注入漏洞:

]WS{P]@%K%~33)]6X]_(94Q.png

发现$c变量是由客户端进行GET请求控制的。

safe_replace函数过滤如下字符:

function safe_replace($string) {
$string = str_replace('%20','',$string);
$string = str_replace('%27','',$string);
$string = str_replace('%2527','',$string);
$string = str_replace('*','',$string);
$string = str_replace('"','"',$string);
$string = str_replace("'",'',$string);
$string = str_replace('"','',$string);
$string = str_replace(';','',$string);
$string = str_replace('<','<',$string);
$string = str_replace('>','>',$string);
$string = str_replace("{",'',$string);
$string = str_replace('}','',$string);
$string = str_replace('\\','',$string);
return $string;
}

include $c.".php";  但是后面有个.php是拼接的。

但是如果php版本小于5.3.40可以采用空字节也就是%00的二进制视作字符串的结束,按照其他说法的话也就是截断。。。。。

K)L(HC`1_UPCWPPZH_IDK]U.png

33TSUWKR(W1{KV5$7)RMYKA.png

A3 xss 漏洞

$field_sql="update ".DB_PRE."member set {$field_sql} where userid={$last_id}";
$query=$this->mysql->query($field_sql);

~NAEKD]S_[TYWFJ1K]N@]5K.png

写入数据库的时候没有任何限制或者输出的时候没有做任何的过滤就直接输出导致造成了XSS。(我就不一一解释了)

W[QZG7AU1S%CAJ8TCRDFLLE.png

A4 不安全的直接对象引用漏洞

AQ(5Q9UM78QECELLH6H%ES4.png

文件上传次数未做策略,可导致攻击。

U9FJP_3`A5[4}G$`VFT)II6.png

A6 敏感数据暴露漏洞:

R8H_JLQ8J5LS)L2EEJ)HV$W.png

A10 未验证的重定向和转发漏洞:

这里我就不去定位看谁使用这个函数了,懂点PHP的人相信都懂。。

`B5$1_I{[5C`_)13MUE}@ZV.png

整个过程基本已经结束了,但是有点我想提醒大家,在设置内存的时候如果你不设置内存他会自动帮你设置,比如你的电脑内存是8G 他就自动设置为8G 然后就会占用你8G内存,然后搞得你电脑卡卡卡卡卡卡卡的。下次扫之前记得要设置你的内存,如果你电脑是8G内存 设置7G就好了,还剩下1G就可以玩4399小小游戏了。 ~_~ 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值