# 第一次挖洞,doyocms

**URL:** <https://forum.90sec.com/t/topic/3732>\
**Category:** 代码审计\
**Created:** [2012 年6 月 16 日 10:20 UTC](https://forum.90sec.com/t/topic/3732 "2012-06-16T10:20:46Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

作者： ![54966850](https://forum.90sec.com/letter_avatar_proxy/v4/letter/5/ed8c4c/32.png) [@54966850](https://forum.90sec.com/u/54966850)\
发布日期： [2012 年6 月 16 日 10:20 UTC](https://forum.90sec.com/t/topic/3732/1 "2012-06-16T10:20:46Z")

</div>

_本帖最后由 西毒 于 2012-6-16 18:33 编辑_

author: 西毒

第一次挖洞，然而挖了个很鸡肋很鸡肋的洞.....这个cms也是乱下一个就开始研究的，我技术很菜，发布出来，希望更多的爱好者能加入进来，一起来研究挖洞洞。  
我就直接把有问题的地方贴出来，我自己对PHP也不是很熟悉，希望有不对的地方，欢迎大家指点。。。。。。  
[1.jpg](https://forum.90sec.com/discuz-migration/attachments/09cb034e24206b1180a6a56938d561dd312da31245345f52f3e09573d88ce59c)  
这是这套CMS ，这个很简洁。。。  
[2.jpg](https://forum.90sec.com/discuz-migration/attachments/d90bb536beb64ce037485bb2cd1093c3d790661692bd02518920d55d68ecb87f)  
这里的$handle\_controller = syClass($\_\_controller, null, GLOBALS['G\_DY']["controller\_path"].'/'.\_\_controller.".php");  
接下来往下看  
[class.jpg](https://forum.90sec.com/discuz-migration/attachments/d2177caa4c4dc18239dc5fc7f8d594dba736bb1edb04930c1165ec4a0a51d39f)  
这里的$sdir 没有经过任何过滤来的，  
然后看下这个import函数  
[import.jpg](https://forum.90sec.com/discuz-migration/attachments/90be22f95bbaea02ebaaac054898ff6a9fb77588e8752ac77f1f2fc64eba4d20)  
这里直接包含了该文件  
require($sfilename);  
所以结合前面的  
GLOBALS['G\_DY']["controller\_path"].'/'.\_\_controller.".php"  
$\_\_controller是我们可控的变量，也没有经过任何过滤，我们想可以通过%00截断，然后包含我们上传的文件就达到了目的  
这也就是鸡肋的地方了，如果要截断，要保证php版本小于5.4(我自己也记不太清了) 因为高版本的修复了该截断的漏洞。 然后这里要保证魔术常量是关闭的。  
下图就是成功包含的图  
[原附件 2571 未导入：没有文件记录，保留于迁移清单]  
所以这个还是蛮鸡肋的，我第一次挖洞，希望大牛多多指导。。。。相互学习  
交流QQ群:62512676 一起交流技术，一起学习

[22I8A\_0`I7L18K$C@IM\_ZKT.jpg](https://forum.90sec.com/discuz-migration/attachments/a631b0b5320fefd78176958e2b7ca9a6a7f64bf77adc87cb66dbe80dbee5e30f)

---

<div class="post-metadata">

作者： ![54966850](https://forum.90sec.com/letter_avatar_proxy/v4/letter/5/ed8c4c/32.png) [@54966850](https://forum.90sec.com/u/54966850)\
发布日期： [2012 年6 月 16 日 10:42 UTC](https://forum.90sec.com/t/topic/3732/2 "2012-06-16T10:42:14Z")

</div>

{:4\_62:}

---

<div class="post-metadata">

作者： ![wefgod](https://forum.90sec.com/letter_avatar_proxy/v4/letter/w/a587f6/32.png) [@wefgod](https://forum.90sec.com/u/wefgod)\
发布日期： [2012 年6 月 16 日 10:44 UTC](https://forum.90sec.com/t/topic/3732/3 "2012-06-16T10:44:18Z")

</div>

嗯不错。支持

---

<div class="post-metadata">

作者： ![54966850](https://forum.90sec.com/letter_avatar_proxy/v4/letter/5/ed8c4c/32.png) [@54966850](https://forum.90sec.com/u/54966850)\
发布日期： [2012 年6 月 16 日 10:45 UTC](https://forum.90sec.com/t/topic/3732/4 "2012-06-16T10:45:49Z")

</div>

\*\*回复 [3#](http://www.90sec.org/redirect.php?goto=findpost&pid=30729&ptid=2696) _wefgod_ \*\*

我知道你是谁了 {:4\_69:}

---

<div class="post-metadata">

作者： ![user72](https://forum.90sec.com/letter_avatar_proxy/v4/letter/u/bbce88/32.png) [@user72](https://forum.90sec.com/u/user72)\
发布日期： [2012 年6 月 16 日 13:35 UTC](https://forum.90sec.com/t/topic/3732/5 "2012-06-16T13:35:28Z")

</div>

有了西毒大牛，，怎么不见东邪大牛啊！！之后 南帝 北丐也都会相许而出

---

<div class="post-metadata">

作者： ![zenghuan](https://forum.90sec.com/user_avatar/forum.90sec.com/zenghuan/32/11417_2.png) [@zenghuan](https://forum.90sec.com/u/zenghuan)\
发布日期： [2012 年6 月 16 日 13:47 UTC](https://forum.90sec.com/t/topic/3732/6 "2012-06-16T13:47:24Z")

</div>

多次拿站都死在魔术转义上

---

<div class="post-metadata">

作者： ![54966850](https://forum.90sec.com/letter_avatar_proxy/v4/letter/5/ed8c4c/32.png) [@54966850](https://forum.90sec.com/u/54966850)\
发布日期： [2012 年6 月 16 日 14:26 UTC](https://forum.90sec.com/t/topic/3732/7 "2012-06-16T14:26:57Z")

</div>

\*\*回复 [6#](http://www.90sec.org/redirect.php?goto=findpost&pid=30759&ptid=2696) _四哥_ \*\*

```
你不是东邪大牛吗 {:4_67:}

```

---

<div class="post-metadata">

作者： ![user10](https://forum.90sec.com/user_avatar/forum.90sec.com/user10/32/11334_2.png) [@user10](https://forum.90sec.com/u/user10)\
发布日期： [2012 年6 月 17 日 03:07 UTC](https://forum.90sec.com/t/topic/3732/8 "2012-06-17T03:07:56Z")

</div>

{:4\_48:}学习了，我也正在研究php审计

---

<div class="post-metadata">

作者： ![ghcshell](https://forum.90sec.com/user_avatar/forum.90sec.com/ghcshell/32/11462_2.png) [@ghcshell](https://forum.90sec.com/u/ghcshell)\
发布日期： [2012 年6 月 17 日 08:44 UTC](https://forum.90sec.com/t/topic/3732/9 "2012-06-17T08:44:31Z")

</div>

呵呵 大牛

---

<div class="post-metadata">

作者： ![user75](https://forum.90sec.com/letter_avatar_proxy/v4/letter/u/aca169/32.png) [@user75](https://forum.90sec.com/u/user75)\
发布日期： [2012 年6 月 17 日 18:07 UTC](https://forum.90sec.com/t/topic/3732/10 "2012-06-17T18:07:03Z")

</div>

话说我也在研究这个CMS，初学PHP，还是一句一句理解中。

---

<div class="post-metadata">

作者： ![talaso](https://forum.90sec.com/letter_avatar_proxy/v4/letter/t/ba9def/32.png) [@talaso](https://forum.90sec.com/u/talaso)\
发布日期： [2012 年6 月 18 日 00:30 UTC](https://forum.90sec.com/t/topic/3732/11 "2012-06-18T00:30:46Z")

</div>

这个%00截断貌似只能在win32下有效 不知道楼主研究过长文件名截断没

---

<div class="post-metadata">

作者： ![54966850](https://forum.90sec.com/letter_avatar_proxy/v4/letter/5/ed8c4c/32.png) [@54966850](https://forum.90sec.com/u/54966850)\
发布日期： [2012 年6 月 18 日 03:24 UTC](https://forum.90sec.com/t/topic/3732/12 "2012-06-18T03:24:31Z")

</div>

\*\*回复 [12#](http://www.90sec.org/redirect.php?goto=findpost&pid=30988&ptid=2696) _talaso_ \*\*

```
不是的吧，在linux下也可以吧！ 我只知道听说在php5.4以下就可以截断...........如果有不对的地方，请指正 {:4_62:}

```

---

<div class="post-metadata">

作者： ![talaso](https://forum.90sec.com/letter_avatar_proxy/v4/letter/t/ba9def/32.png) [@talaso](https://forum.90sec.com/u/talaso)\
发布日期： [2012 年6 月 18 日 06:27 UTC](https://forum.90sec.com/t/topic/3732/13 "2012-06-18T06:27:28Z")

</div>

\*\*回复 [13#](http://www.90sec.org/redirect.php?goto=findpost&pid=31005&ptid=2696) _西毒_ \*\*

```
我是在&lt;&lt;白帽子讲web安全&gt;&gt; 这本书上的320页 看到的 具体的自己没试过 说Linux下文件名超过4096个字节就会被截断 而windows下是256字节

```

---

<div class="post-metadata">

作者： ![54966850](https://forum.90sec.com/letter_avatar_proxy/v4/letter/5/ed8c4c/32.png) [@54966850](https://forum.90sec.com/u/54966850)\
发布日期： [2012 年6 月 18 日 07:58 UTC](https://forum.90sec.com/t/topic/3732/14 "2012-06-18T07:58:26Z")

</div>

\*\*回复 [14#](http://www.90sec.org/redirect.php?goto=findpost&pid=31022&ptid=2696) _talaso_ \*\*

```
擦.......那我又学到东西了，谢谢

```

---

<div class="post-metadata">

作者： ![wefgod](https://forum.90sec.com/letter_avatar_proxy/v4/letter/w/a587f6/32.png) [@wefgod](https://forum.90sec.com/u/wefgod)\
发布日期： [2012 年6 月 19 日 05:01 UTC](https://forum.90sec.com/t/topic/3732/15 "2012-06-19T05:01:50Z")

</div>

> 回复 talaso
> 
> ```
> 不是的吧，在linux下也可以吧！ 我只知道听说在php5.4以下就可以截断...........如 ...
> 
> ```
> 
> 西毒 发表于 2012-6-18 11:24 [[img][http://www.90sec.org/images/common/back.gif[/img\]](http://www.90sec.org/images/common/back.gif%5B/img%5C%5D)]([http://www.90sec.org/redirect.php?goto=findpost&pid=31005&ptid=2696](http://www.90sec.org/redirect.php?goto=findpost&pid=31005&ptid=2696))

我见似乎低版本也不行的样子？过去我测试过应该是PHP5.3的，不行。linux下

---

<div class="post-metadata">

作者： ![user16](https://forum.90sec.com/user_avatar/forum.90sec.com/user16/32/11346_2.png) [@user16](https://forum.90sec.com/u/user16)\
发布日期： [2012 年6 月 19 日 05:06 UTC](https://forum.90sec.com/t/topic/3732/16 "2012-06-19T05:06:30Z")

</div>

挖洞 挖洞！

---

<div class="post-metadata">

作者： ![54966850](https://forum.90sec.com/letter_avatar_proxy/v4/letter/5/ed8c4c/32.png) [@54966850](https://forum.90sec.com/u/54966850)\
发布日期： [2012 年6 月 19 日 05:07 UTC](https://forum.90sec.com/t/topic/3732/17 "2012-06-19T05:07:45Z")

</div>

\*\*回复 [17#](http://www.90sec.org/redirect.php?goto=findpost&pid=31252&ptid=2696) _葙守_ \*\*

```
擦..................俺是小菜，好不好 {:4_69:}

```

---

<div class="post-metadata">

作者： ![54966850](https://forum.90sec.com/letter_avatar_proxy/v4/letter/5/ed8c4c/32.png) [@54966850](https://forum.90sec.com/u/54966850)\
发布日期： [2012 年6 月 19 日 05:41 UTC](https://forum.90sec.com/t/topic/3732/18 "2012-06-19T05:41:24Z")

</div>

\*\*回复 [14#](http://www.90sec.org/redirect.php?goto=findpost&pid=31022&ptid=2696) _talaso_ \*\*

```
嗯，你说的比较对，可以利用././ 这样一下下去，可以截断，但是我再本机却没有实现，不知道是为什么，win7 256字节可以截断， *nix下的4000多吧。。。反正我再本机是没有实现成功，请问你截断成功了么？

```

请教 {:4\_87:}

---

<div class="post-metadata">

作者： ![talaso](https://forum.90sec.com/letter_avatar_proxy/v4/letter/t/ba9def/32.png) [@talaso](https://forum.90sec.com/u/talaso)\
发布日期： [2012 年6 月 19 日 06:31 UTC](https://forum.90sec.com/t/topic/3732/19 "2012-06-19T06:31:09Z")

</div>

\*\*回复 [19#](http://www.90sec.org/redirect.php?goto=findpost&pid=31269&ptid=2696) _西毒_ \*\*

```
没成功

```

---

<div class="post-metadata">

作者： ![54966850](https://forum.90sec.com/letter_avatar_proxy/v4/letter/5/ed8c4c/32.png) [@54966850](https://forum.90sec.com/u/54966850)\
发布日期： [2012 年6 月 19 日 06:45 UTC](https://forum.90sec.com/t/topic/3732/20 "2012-06-19T06:45:30Z")

</div>

\*\*回复 [14#](http://www.90sec.org/redirect.php?goto=findpost&pid=31022&ptid=2696) _talaso_ \*\*

```
其实，我发现截断成功了，我发现超过254确实可以截断，呵呵{:4_28:}

```

[下一页](https://forum.90sec.com/t/topic/3732.md?page=2)
