查看: 36232|回复: 25

Ecshop 后台getshell

[复制链接]
发表于 2013-1-7 21:23:29 | 显示全部楼层 |阅读模式
首先 ecshop用的是smarty 这样就可以通过它的fetch函数来执行模板
而模板里面可以执行他定义的php代码,这样只要可以写出模板 然后找到调用就可以拿到shell了
但是ecshop似乎不支持{php}{/php}这个标签来执行php代码
admin/template.php

  1. if ($_REQUEST['act'] == 'update_library')

  2. {
  3.     check_authz_json('library_manage');

  4.     $html = stripslashes(json_str_iconv($_POST['html']));

  5.     $lib_file = '../themes/' . $_CFG['template'] . '/library/' . $_POST['lib'] . '.lbi'; //模板文件

  6.     $lib_file = str_replace("0xa", '', $lib_file); // 过滤 0xa 非法字符

  7.     $org_html = str_replace("\xEF\xBB\xBF", '', file_get_contents($lib_file));

  8.     if (@file_exists($lib_file) === true && @file_put_contents($lib_file, $html))//写出
  9.     {
  10.         @file_put_contents('../temp/backup/library/' . $_CFG['template'] . '-' . $_POST['lib'] . '.lbi', $org_html);
  11.         make_json_result('', $_LANG['update_lib_success']);
  12.     }
  13.     else
  14.     {
  15.         make_json_error(sprintf($_LANG['update_lib_failed'], 'themes/' . $_CFG['template'] . '/library'));
  16.     }
  17. }
复制代码
那么找个比较方便调用了模板的文件
index.php

  1. if ($act == 'cat_rec')

  2. {

  3.     $rec_array = array(1 => 'best', 2 => 'new', 3 => 'hot');

  4.     $rec_type = !empty($_REQUEST['rec_type']) ? intval($_REQUEST['rec_type']) : '1';

  5.     $cat_id = !empty($_REQUEST['cid']) ? intval($_REQUEST['cid']) : '0';

  6.     include_once('includes/cls_json.php');

  7.     $json = new JSON;

  8.     $result   = array('error' => 0, 'content' => '', 'type' => $rec_type, 'cat_id' => $cat_id);

  9.     $children = get_children($cat_id);

  10.     $smarty->assign($rec_array[$rec_type] . '_goods',      get_category_recommend_goods($rec_array[$rec_type], $children));    // 推荐商品

  11.     $smarty->assign('cat_rec_sign', 1);

  12.     $result['content'] = $smarty->fetch('library/recommend_' . $rec_array[$rec_type] . '.lbi');//使用了模板文件 该模板文件为recommend_best

  13.         echo 'library/recommend_' . $rec_array[$rec_type] . '.lbi';

  14.         echo $rec_array[$rec_type];

  15.     die($json->encode($result));

  16. }
复制代码
那么就有利用方法了
post包到http://localhost/ec/admin/template.php?act=update_library
Post内容:
游客,如果您要查看本帖隐藏内容请回复

密码c

作者:Cond0r
回复

使用道具 举报

发表于 2013-1-8 16:50:58 | 显示全部楼层
学习一下
回复 支持 反对

使用道具 举报

发表于 2013-1-8 21:10:28 | 显示全部楼层
我勒个去。。。来看看
回复 支持 反对

使用道具 举报

发表于 2013-1-9 09:16:07 | 显示全部楼层
真的可以!嘿嘿!
回复 支持 反对

使用道具 举报

发表于 2013-1-9 13:12:22 | 显示全部楼层
楼主好淫
回复 支持 反对

使用道具 举报

发表于 2013-1-10 17:09:52 | 显示全部楼层
学习学习,,
回复 支持 反对

使用道具 举报

发表于 2013-1-10 17:10:08 | 显示全部楼层
学习学习,,
回复 支持 反对

使用道具 举报

发表于 2013-9-18 03:25:44 | 显示全部楼层
{:soso_e122:}POST 收藏漏洞 感谢分享
回复 支持 反对

使用道具 举报

发表于 2013-10-18 18:56:04 | 显示全部楼层
来看看,学习学习
回复 支持 反对

使用道具 举报

发表于 2013-10-18 23:18:08 | 显示全部楼层
学习了。。。。。。。。。。。。。。
回复 支持 反对

使用道具 举报

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

本版积分规则

指导单位

江苏省公安厅

江苏省通信管理局

浙江省台州刑侦支队

DEFCON GROUP 86025

旗下站点

邮箱系统

应急响应中心

红盟安全

联系我们

官方QQ群:112851260

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

官方核心成员

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

GMT+8, 2025-3-7 01:17 , Processed in 0.020962 second(s), 8 queries , Gzip On, MemCache On.

Powered by ihonker.com

Copyright © 2015-现在.

  • 返回顶部