### 简要描述:
模板逻辑处理不当,导致死循环,耗费系统资源。
### 详细说明:
首先看下模板内容,关键部分在第四行代码处。
[<img src="https://images.seebug.org/upload/201405/08214141a8e04a4dff83a6350005f3dd8b14d069.jpg" alt="00.jpg" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201405/08214141a8e04a4dff83a6350005f3dd8b14d069.jpg)
配置文件截图
[<img src="https://images.seebug.org/upload/201405/082143074a45e07aa92da9231e23bda2d6067894.jpg" alt="00-1.jpg" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201405/082143074a45e07aa92da9231e23bda2d6067894.jpg)
,首先我们先看下Apache的进程状态:
[<img src="https://images.seebug.org/upload/201405/08214853cdd025e904b806bc20c56968cc1e75b2.jpg" alt="00-2.jpg" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201405/08214853cdd025e904b806bc20c56968cc1e75b2.jpg)
我们打开首页,再看下Apache进程状态
[<img src="https://images.seebug.org/upload/201405/08215037bf7c9dbf9a9a73bb6a1bc32647c90c32.jpg" alt="00-3.jpg" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201405/08215037bf7c9dbf9a9a73bb6a1bc32647c90c32.jpg)
内存直线上升有木有,三十秒后
[<img src="https://images.seebug.org/upload/201405/08215128a12093f8a600cbe381c5c4f0ffdecd5a.jpg" alt="00-3-1.jpg" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201405/08215128a12093f8a600cbe381c5c4f0ffdecd5a.jpg)
我们再来看下日志
[<img src="https://images.seebug.org/upload/201405/082154323250ec745119445cbf6b02f19b746e88.jpg" alt="00-4.jpg" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201405/082154323250ec745119445cbf6b02f19b746e88.jpg)
[<img src="https://images.seebug.org/upload/201405/082155192efc84a728ade9b548264f5f210c5811.jpg" alt="00-5.jpg" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201405/082155192efc84a728ade9b548264f5f210c5811.jpg)
日志都写满了,既然日志给出了详细的报错地址我们进去看看怎么写的
[<img src="https://images.seebug.org/upload/201405/08215850c3b6a6c91069cd593a0094db2c0bd282.jpg" alt="4.jpg" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201405/08215850c3b6a6c91069cd593a0094db2c0bd282.jpg)
根据注释信息,和函数的名字猜出是读取tpl的模板文件。和日志的错误信息对比
```
failed to open stream: Invalid argument D:\xxx\TP\Library\Think\Template.class.php
```
文件应该没找到。通过输出变量定位到
[<img src="https://images.seebug.org/upload/201405/0822041444ff0f9342d0a2e6caac6f411049b161.jpg" alt="5-5.jpg" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201405/0822041444ff0f9342d0a2e6caac6f411049b161.jpg)
根据截图中的语句定位到
```
TP\Common\functions.php
```
[<img src="https://images.seebug.org/upload/201405/0822075717079e94346f89a0eecd60503a5d4862.jpg" alt="5-6.jpg" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201405/0822075717079e94346f89a0eecd60503a5d4862.jpg)
```
经过分析发现是parse_url函数对:foofer参数处理时没有产生scheme,host
```
[<img src="https://images.seebug.org/upload/201405/082215038ee4a3802217b26081db6db43b743490.jpg" alt="2014-05-08_221314.jpg" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201405/082215038ee4a3802217b26081db6db43b743490.jpg)
最后导致访问index模板时一直创建index模板
[<img src="https://images.seebug.org/upload/201405/08221613d39df1a4f4e45bdbd41ba16567cd48d0.jpg" alt="9.jpg" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201405/08221613d39df1a4f4e45bdbd41ba16567cd48d0.jpg)
### 漏洞证明:
[<img src="https://images.seebug.org/upload/201405/0822164320209a8bd8176880da455d95c7afefcd.jpg" alt="00-3-1.jpg" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201405/0822164320209a8bd8176880da455d95c7afefcd.jpg)
暂无评论