<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[Heck's  Blog]]></title> 
<link>https://www.heckjj.com/index.php</link> 
<description><![CDATA[一瞬间的决定，往往可以改变很多，事实上，让自己成功的往往不是知识，是精神！ 如果你总是为自己找借口，那只好让成功推迟。执行力，今天！]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[Heck's  Blog]]></copyright>
<item>
<link>https://www.heckjj.com/resolve-the-or-equals-or-sqlinject-html/</link>
<title><![CDATA[or = or 网站万能密码漏洞修补和总结]]></title> 
<author>Heck &lt;@hecks.tk&gt;</author>
<category><![CDATA[黑客攻防]]></category>
<pubDate>Tue, 18 Jan 2011 07:20:35 +0000</pubDate> 
<guid>https://www.heckjj.com/resolve-the-or-equals-or-sqlinject-html/</guid> 
<description>
<![CDATA[ 
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="font-family: 微软雅黑;">咱们提起这个万能密码，我相信玩过黑的都非常熟悉吧，也就是&#039;or&#039; = &#039;or&#039;属于很老的漏洞，这只最基础的一种，最近我看见很多网站有这种bug，最近有个辽宁沈阳的小伙在google搜索关键词“332003231 后台”貌似想黑哥我一把。下面我来总结一下吧:<br/><br/>1：语句:&#039;&#039;or&#039;=&#039;or&#039; a&#039;or&#039;1=1-- &#039;or1=1-- &quot;or1=1-- or1=1-- &#039;or&quot;=&quot;a&#039;=&#039;a &#039;) or (&#039;a&#039;=&#039;a等等。。。<br/>&lt;%<br/>(1)pwd = request.form(&quot;pwd&quot;) &quot;获取客户端输入的密码,再把值赋给pwd&quot;<br/>(2)name = request.form(&quot;name&quot;) &quot;获取客户端输入的用户名再把值赋给name&quot;<br/>都没有进行任何过滤<br/>(3)Set rs = Server.CreateObject(&quot;ADODB.Connection&quot;) &quot;利用Server对象的CreateObject方法创建ADO组件的Connection对象&quot;<br/>(4)sql = &quot;select * from Manage_User where UserName=&#039;&quot; &amp; name &amp; &quot;&#039; And PassWord=&#039;&quot;&amp;encrypt(pwd)&amp;&quot;&#039;&quot; &quot;将用户名和密码放入查询语句中查询数据库&quot;<br/>(5)Set rs = conn.Execute(sql) &quot;执行SQL语句&quot;<br/> <br/>(6)If Not rs.EOF = True Then &quot;当前的记录位于Connection对象的最记录之后一个前&quot;<br/>(7)Session(&quot;Name&quot;) = rs(&quot;UserName&quot;) &quot;将UserName的属性赋给Name的Session自定义变量&quot;<br/>(8)Session(&quot;pwd&quot;) = rs(&quot;PassWord&quot;) &quot;将PassWord的属性赋给pwd的Session自定义变量&quot;<br/>(9)Response.Redirect(&quot;Manage.asp&quot;)了 &quot;利用Response对象的Redirect方法重定向&quot;Manage.asp&quot;<br/>(10)Else<br/>(11)Response.Redirect &quot;chklogin.asp?msg=您输入了错误的帐号或口令，请再次输入！&quot;<br/>(12)End If<br/>(13)end if<br/>%&gt;</span><span style="font-family: 微软雅黑;"><br/>这是很明显有漏洞的login.asp的代码.<br/>直接从这两句就可以看出来..<br/>(1)pwd = request.form(&quot;pwd&quot;) &quot;获取客户端输入的密码,再把值赋给pwd&quot;<br/>(2)name = request.form(&quot;name&quot;) &quot;获取客户端输入的用户名再把值赋给name&quot;<br/>没有进行任何的过滤..<br/>网上流传着这么一个代码说是很好的防范的..<br/>name=replace(request.form(&quot;name&quot;) ,&quot;&#039;&quot;,&quot;&quot;) <br/>pass=replace(request.form(&quot;pass&quot;) ,&quot;&#039;&quot;,&quot;&quot;)<br/>可是一旦用上了此代码 就发现了问题了.<br/>过滤掉了&#039;号之后管理员的密码和名称就不能用这样的符号了，那怎么办呢？看我这个方法..<br/>嘿嘿。<br/>pwd = request.form(&quot;pwd&quot;)<br/>name = request.form(&quot;name&quot;)<br/>if (name&lt;&gt;&quot;&quot;) and (Pwd&lt;&gt;&quot;&quot;) then &#039;判断数据为非空<br/>name=Replace(Replace(name,&quot;&#039;&quot;,&quot;&quot;),&quot;or&quot;,&quot;&quot;) &#039;嵌套了两个replace函数，过滤特殊字符<br/>Pwd=Replace(Replace(Pwd,&quot;&#039;&quot;,&quot;&quot;),&quot;or&quot;,&quot;&quot;)<br/><br/>当然还有一种办法是定义一个检查输入的方法，然后登陆时调用这个方法：<br/>&lt;%<br/>Function ChkStr(istr)<br/>dim Sql_Kill,Sql_Kill_2,Sql_Kill_3<br/>Sql_Kill = &quot;&#92;&#039;&#124;and&#124;or&#124;exec&#124;insert&#124;select&#124;delete&#124;update&#124;count&#124;*&#124;%&#124;chr&#124;mid&#124;master&#124;truncate&#124;char&#124;declare&#124;set&#124;;&#124;from&#124;=&quot;<br/>Sql_Kill_2 = split(Sql_Kill,&quot;&#124;&quot;)<br/>for Each Sql_Kill_3 In Sql_Kill_2<br/>istr=Replace(istr,Sql_Kill_3,&quot;&quot;)<br/>Next<br/>ChkStr=istr<br/>End Function<br/>%&gt;<br/>上面的方法也是就是将比如&quot;or&quot;这些关键词给替换成空格。</span><br/>Tags - <a href="https://www.heckjj.com/tags/sql%25E6%25B3%25A8%25E5%2585%25A5/" rel="tag">sql注入</a>
]]>
</description>
</item><item>
<link>https://www.heckjj.com/resolve-the-or-equals-or-sqlinject-html/#blogcomment</link>
<title><![CDATA[[评论] or = or 网站万能密码漏洞修补和总结]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>https://www.heckjj.com/resolve-the-or-equals-or-sqlinject-html/#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>