fix(manager-server): prevent plugin resource auth elevation - #463
Merged
Conversation
Contributor
Author
|
关于POC:我可以私有仓库+私发token形式给维护者先确认 |
Owner
感谢详细排查与修复。我们已复核 #462 的实际代码路径;当前 PR head 的 Manager Server、Windows SQLite、Docker Build 和 PR Template 检查均已通过。 该修复正确地让未通过 CPAMP Admin Key 验证的 resource 请求保留调用方原始 Authorization(或无 Authorization),避免 GET/HEAD 被替换为保存的 CPA Management Key,同时保持插件 caller-auth 兼容。因此该 PR 已具备合并条件,我们会将修复纳入下一个安全版本。 关于 POC:核心漏洞已确认,当前不需要公开可直接利用的 POC,也请不要私发任何真实 token、Admin Key、敏感响应或生产环境日志。若你发现某个具体插件存在额外影响,可以通过私有仓库提供完全脱敏的最小复现,例如 mock upstream、一次性测试值和非真实数据 |
19 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes an authentication privilege escalation in the Manager Server plugin resource proxy. Requests to
/v0/resource/plugins/*now use the saved CPA ManagementKey only after successful CPAMP admin authentication. Other requests preserve the caller's own authorization without privilege elevation.修复 Manager Server 插件资源代理中的认证提权漏洞。此前,未认证的 GET/HEAD 请求可能被自动替换为服务器保存的 CPA ManagementKey,并以管理权限访问上游插件资源。
修复后,只有通过 CPAMP Admin Key 验证的请求才能使用保存的 CPA ManagementKey;其他请求只保留调用者自己的 Authorization,未提供认证时则以无认证状态转发。
Scope
Changes
具体修改:
Vulnerability Details / 漏洞信息
CPAResourcehandler/v0/resource/plugins/*Root Cause / 根本原因
The vulnerable implementation initialized
useSavedManagementKeytotrue, but GET and HEAD requests did not executeAdminAuthService.VerifyHeader.As a result, unauthenticated GET/HEAD requests retained
useSavedManagementKey = trueand were forwarded throughProxyPluginResource. The reverse-proxy Director then replaced the upstream Authorization header with the CPA ManagementKey stored by Manager Server.原实现将
useSavedManagementKey默认设置为true,但 GET 和 HEAD 分支没有调用AdminAuthService.VerifyHeader。因此,无认证 GET/HEAD 请求会保持useSavedManagementKey = true,进入ProxyPluginResource,随后由反向代理将 Manager Server 保存的 CPA ManagementKey 写入上游 Authorization。这使未认证客户端能够借用 Manager Server 的管理权限访问插件资源。
Vulnerable Request Flow / 漏洞调用链
Affected Versions / 受影响版本
The release tags and handler implementations were checked directly.
已逐个检查正式 release tag 及对应 handler 实现。
<= v1.4.2CPAResourceand/v0/resource/plugins/*proxy route did not exist / 尚未引入插件资源代理v1.5.0ProxyCPA, which injected the saved ManagementKey / 无认证 GET/HEAD 直接进入保存密钥代理v1.6.0–v1.11.10useSavedManagementKey = truewithout admin verification / GET/HEAD 未认证且默认使用保存密钥The plugin resource proxy was introduced by commit
faa1659fand first released inv1.5.0. Inv1.5.0,CPAResourceforwarded unauthenticated GET/HEAD requests throughProxyCPA, which always inserted the saved CPA ManagementKey.Commit
c5826633, first included inv1.6.0, introduced caller-auth support but retained the unauthenticated GET/HEAD saved-key path. All published releases fromv1.5.0through the currentv1.11.10are affected.插件资源代理由提交
faa1659f引入,并首次包含在v1.5.0中。首次进入v1.6.0的提交c5826633增加了 caller-auth 支持,但 GET/HEAD 仍然保留未认证使用保存密钥的路径。从v1.5.0到当前最新正式版本v1.11.10,所有已发布版本均受影响。Affected Deployment Modes / 受影响部署范围
Affected / 受影响:
具体包括 Manager Server 模式、包含 Manager Server 的 Full Docker 部署、原生 Manager Server 部署,以及已配置 CPA upstream、保存 CPA ManagementKey 且可被不可信客户端访问的实例。
Not affected or not remotely exploitable / 不受影响或无法远程利用:
Impact / 漏洞影响
This issue does not directly return the CPA ManagementKey string to the unauthenticated caller. Instead, the caller's request is executed with the privileges of the saved ManagementKey, and the privileged upstream response is returned to the caller.
The exposed data depends on installed plugins and their resource handlers. Potential impact includes unauthorized access to management-protected plugin configuration, account/provider information, sensitive plugin status data, or credentials if a plugin resource returns them under management authorization.
The resource path is not a generic file-read primitive. The built-in
/v0/management/auth-filesendpoint is not directly exposed through this route.本漏洞不会直接把 CPA ManagementKey 字符串返回给攻击者。实际问题是攻击者的请求会借用该密钥的权限执行,并取得管理权限下的插件响应。最终可泄露的数据取决于已安装插件及其资源 handler;该路径不是任意文件读取接口,也不能直接访问内置的
/v0/management/auth-files。Fix / 修复方案
The fix changes credential substitution from a method-dependent default to an explicit authorization decision.
The core security invariant is:
核心安全约束是:
User Impact
Public plugin resources remain accessible according to the upstream CPA/plugin policy. Plugin caller-auth flows remain compatible. Unauthenticated callers can no longer have their requests elevated with the Manager Server's saved CPA ManagementKey.
公开插件资源仍然可以按照 CPA upstream 或具体插件的权限规则访问,插件自身的 caller-auth 流程保持兼容。用户侧唯一安全行为变化是:未通过 CPAMP 管理员认证的请求不再获得隐式 CPA 管理权限。
Compatibility / Runtime Notes
公开插件资源不会被统一强制为 CPAMP Admin Key;插件 caller-auth 请求继续保留原始 Authorization。Full Docker 和原生部署无需修改配置,也不需要数据迁移。
Data / Security Notes
The saved CPA ManagementKey remains encrypted at rest. Requests that do not pass CPAMP admin authentication are forwarded only with their original Authorization header, or without Authorization when none was supplied.
No secrets are added to logs or error responses by this change. No SQLite, auth-file, configuration, or stored-secret migration is involved.
保存的 CPA ManagementKey 仍然保持静态加密存储。未通过 CPAMP 管理员认证的请求只会携带其原始 Authorization;未提供 Authorization 时,上游请求也不会包含认证信息。本次修改不会向日志或错误响应添加密钥,也不涉及 SQLite、认证文件或配置迁移。
Risk / Rollback
Risk level: Medium
The main compatibility risk is changing how GET/HEAD plugin resource requests select their upstream Authorization. Regression tests cover unauthenticated public resources, caller-auth plugin resources, CPAMP-admin-authenticated resources, existing POST/PUT behavior, and unsupported HTTP methods.
主要兼容性风险是 GET/HEAD 插件资源请求的 Authorization 选择逻辑发生变化。回归测试已经覆盖无认证公开资源、插件 caller-auth、CPAMP Admin Key、现有 POST/PUT 行为和不支持的 HTTP 方法。
Rollback notes:
Reverting this change restores the previous proxy behavior and reopens the privilege-escalation path. Rollback is not recommended for an externally reachable Manager Server.
If an immediate upgrade is unavailable, temporarily restrict Manager Server access to localhost, a trusted private network, VPN, or an authenticated reverse proxy.
回滚会恢复旧代理行为并重新打开权限提升路径。如果暂时无法升级,应将 Manager Server 限制为仅 localhost、可信内网、VPN 或受保护的反向代理可访问。
Verification
Commands / evidence:
Mock upstream authorization verification:
Results:
go test ./...passes all relevant packages. The existing Windows-only data-key permission assertion reports mode0666instead of0600; this failure is unrelated to the plugin proxy change:Screenshots / Recordings
N/A — backend-only security fix.
本次修改不涉及前端页面或可见 UI。
Docs
Docs decision:
No user-guide changes are required. The fix should be documented in the next security/release notes.
下一版本发布说明建议注明
v1.5.0至v1.11.10受影响;使用 Manager Server、Full Docker 或原生完整模式的用户应尽快升级。曾将 Manager Server 暴露给不可信网络的用户应检查访问日志和已安装插件;如果插件资源可能返回敏感凭证,应在升级后轮换相关 API Key 或 Token。Related
Fixes #462