安全决策报告

klyc-pmm

KLYC-PMM 存在严重的文档-行为差异:pmm_distill.sh 内嵌 PHP 代码直接访问服务器数据库绕过 API 层,LLM 蒸馏外传 DEEPSEEK_API_KEY,昆仑令明文存储于 MEMORY.md。核心记忆管理功能正常但存在多处声明-实现不符。

安装决策优先 来源: ClawHub 扫描时间: 28 天前
文件 14
IOC 20
越权项 3
发现 6
最直接的威胁证据
01
用户执行 ./scripts/oneclick.sh 安装技能 初始入口 · scripts/oneclick.sh
02
昆仑令被写入 MEMORY.md 并通过 watch 自动云端同步 权限提升 · scripts/oneclick.sh
03
昆仑令泄露:用户将含令的 MEMORY.md 提交到 GitHub 最终危害 · scripts/oneclick.sh

为什么得出这个结论

2/4 个维度触发
阻止
声明与实际能力

发现 3 项声明之外的能力或越权行为。

复核
隐藏执行与外联

提取到 20 个一般风险产物,需要结合上下文判断。

阻止
攻击链与高危发现

报告包含 7 步攻击链,另有 2 项高危或严重发现。

复核
依赖与供应链卫生

发现 3 项需要关注的依赖或供应链线索。

攻击链

01
用户执行 ./scripts/oneclick.sh 安装技能

初始入口 · scripts/oneclick.sh:1

02
昆仑令被写入 MEMORY.md 并通过 watch 自动云端同步

权限提升 · scripts/oneclick.sh:95

03
昆仑令泄露:用户将含令的 MEMORY.md 提交到 GitHub

最终危害 · scripts/oneclick.sh:95

04
管理员执行 pmm_distill.sh 进行记忆蒸馏

初始入口 · scripts/pmm_distill.sh:1

05
PHP 代码读取 /www/wwwroot/kunlunyaochi/config.php 获取数据库凭证

权限提升 · scripts/pmm_distill.sh:56

06
直接 SQL 操作修改用户记忆数据,绕过 API 鉴权

最终危害 · scripts/pmm_distill.sh:108

07
LLM 蒸馏将 DEEPSEEK_API_KEY 发送到远程平台

最终危害 · scripts/pmm_distill.sh:370

风险分是怎么被拉高的

文档-行为严重不符 +20

pmm_distill.sh 内嵌 PHP 直接读/kunlunyaochi/config.php 操作数据库,完全绕过文档声明的 HTTPS API

凭证外传未充分声明 +12

LLM蒸馏将 DEEPSEEK_API_KEY 通过 HTTPS POST 到远程 API,文档仅轻描淡写

昆仑令存储风险 +8

昆仑令明文写入 MEMORY.md,脚本自动将其推送到云端 disaster 域

持久化未充分说明 +5

systemd 守护服务在文档中以小字提示,用户可能未充分理解

依赖无版本锁定 +3

skill.json 无第三方依赖但运行时依赖 jq/curl 无版本约束

最关键的证据

高危 文档欺骗

pmm_distill.sh 内嵌 PHP 直接操作服务器数据库

pmm_distill.sh 包含 PHP 代码段,生成后写入 /tmp/*.php 并执行。PHP 代码中硬编码 require '/www/wwwroot/kunlunyaochi/config.php' 并直接调用 getMemoriesTable(${USER_ID}) 执行 SELECT/UPDATE SQL 操作。这完全绕过文档声明的 HTTPS API 层,表明该脚本实际被设计为在 kunlunyaochi.com 服务器端运行,而非文档所述的客户端工具。

scripts/pmm_distill.sh:56
删除所有内嵌 PHP 代码,使用文档声明的 HTTPS REST API 进行记忆操作
高危 凭证窃取

LLM 蒸馏外传 DEEPSEEK_API_KEY

pmm_distill.sh 的 distill_with_llm() 函数将用户的 DEEPSEEK_API_KEY 放入 HTTP 请求头发送到远程平台 API:curl -H "Authorization: Bearer ${api_key}" https://api.deepseek.com/v1/chat/completions。虽然目标为官方 API,但用户密钥被传输到第三方(kunlunyaochi.com)控制的端点进行中转,密钥流经平台服务器。

scripts/pmm_distill.sh:370
在本地直接调用 DeepSeek API,避免密钥经过第三方服务器
中危 敏感访问

昆仑令明文存储并云端同步

昆仑令(恢复凭证)以明文形式写入 MEMORY.md,oneclick.sh 会自动将昆仑令 URL 追加到 MEMORY.md。MEMORY.md 被 watch 守护自动推送到云端 disaster 域,存在泄露风险。若用户将 MEMORY.md 提交到公开仓库,昆仑令将完全暴露。

scripts/oneclick.sh:95
昆仑令应仅存储在本地加密存储或用户离线密码管理器,不应云端同步
中危 权限提升

install-daemon.sh 创建 systemd 服务

install-daemon.sh 写入 /etc/systemd/system/klyc-pmm-watch.service 并执行 systemctl daemon-reload/enable/restart。虽然文档中有小字提及"安装 systemd 守护服务",但作为可选功能应更显著声明持久化影响。守护进程会在系统启动时自动运行,消耗内存(Capped at 32M)。

scripts/install-daemon.sh:95
将 systemd 安装作为明确选项而非默认行为,提供 --no-daemon 选项
中危 文档欺骗

pmm_distill.sh 数据库操作涉及数据篡改

pmm_distill.sh 的 auto_dedup() 和 auto_resolve() 通过 PHP 代码直接执行 UPDATE SET is_deleted=1 对用户记忆进行软删除标记,覆盖比例高达 50% 冗余内容。auto_resolve() 更是硬编码判断逻辑(如 '8767引用未标注下线'),可绕过用户意愿修改记忆状态。

scripts/pmm_distill.sh:108
蒸馏结果应通过文档声明的 API 由服务端执行,而非客户端直接修改
低危 供应链

运行时依赖无版本锁定

skill.json 和 SKILL.md 均声明依赖 jq、curl、inotify-tools,但未指定版本范围。apt/yum/brew install 在不同系统/时间可能安装不同版本,存在供应链风险。

SKILL.md:23
声明最小版本要求:jq>=1.6, curl>=7.68

声明能力 vs 实际能力

文件系统 通过
声明 WRITE
推断 WRITE
文档声明读写配置文件,代码实际读写 MEMORY.md/SOUL.md 等
网络访问 阻止
声明 HTTPS_API
推断 FULL_CONTROL
scripts/pmm_distill.sh:56-95 PHP 代码直接操作远程数据库
命令执行 阻止
声明 NONE
推断 WRITE
scripts/install-daemon.sh:95-125 创建 systemd service 并执行 systemctl
环境变量 通过
声明 READ
推断 READ
代码读取 DEEPSEEK_API_KEY/KYLC_API_KEY 等
技能调用 阻止
声明 NONE
推断 READ
pmm_distill.sh 扫描 IDENTITY.md 提取昆仑令
数据库 通过
声明 NONE
推断 ADMIN
pmm_distill.sh:56-95 require '/www/wwwroot/kunlunyaochi/config.php' 并执行 SQL 操作

可疑产物与外联

中危 外部 URL
https://kunlunyaochi.com。

SKILL.md:24

中危 外部 URL
https://kunlunyaochi.com

SKILL.md:26

中危 外部 URL
https://kunlunyaochi.com/?route=services

SKILL.md:59

中危 外部 URL
https://kunlunyaochi.com/klyc-pmm/

SKILL.md:107

中危 外部 URL
https://kunlunyaochi.com/?route=onboard

SKILL.md:112

中危 外部 URL
https://kunlunyaochi.com/?route=pay&agent=xxx&tier=huhunfu

SKILL.md:223

中危 外部 URL
https://kunlunyaochi.com/api/klyc-pmm-pay/resource.php

SKILL.md:241

中危 外部 URL
https://skillhub.cn/skillpay

references/pay-skill-spec.md:3

中危 外部 URL
https://kunlunyaochi.com/klyc-pmm/...)

scripts/pmm_boot.sh:46

中危 外部 URL
https://kunlunyaochi.com/?route=recover

scripts/pmm_boot.sh:47

中危 外部 URL
https://kunlunyaochi.com/?route=join

scripts/pmm_boot.sh:49

中危 外部 URL
https://kunlunyaochi.com/klyc-pmm/...

scripts/pmm_boot.sh:56

依赖与供应链

包名版本来源漏洞备注
jq * apt/yum/brew 无版本锁定,建议 >=1.6
curl * apt/yum/brew 无版本锁定,建议 >=7.68
inotify-tools * apt/yum watch 模式可选依赖

文件构成

14 个文件 · 4253 行
Shell 8 个文件 · 3117 行Markdown 5 个文件 · 1081 行JSON 1 个文件 · 55 行
需关注文件 · 8
scripts/pmm_watch.sh Shell · 1941 行
https://kunlunyaochi.com/skills/klyc-pmm/scripts/pmm_watch.sh · https://kunlunyaochi.com/?route=recharge$ · https://kunlunyaochi.com/?route=dashboard · https://kunlunyaochi.com/?route=pay&agent=$ · https://kunlunyaochi.com/?route=klyc-pmm
SKILL.md Markdown · 674 行
运行时依赖无版本锁定 · https://kunlunyaochi.com。 · https://kunlunyaochi.com · https://kunlunyaochi.com/?route=services · https://kunlunyaochi.com/klyc-pmm/ · https://kunlunyaochi.com/?route=onboard · https://kunlunyaochi.com/?route=pay&agent=xxx&tier=huhunfu · https://kunlunyaochi.com/api/klyc-pmm-pay/resource.php
scripts/pmm_distill.sh Shell · 421 行
pmm_distill.sh 内嵌 PHP 直接操作服务器数据库 · LLM 蒸馏外传 DEEPSEEK_API_KEY · pmm_distill.sh 数据库操作涉及数据篡改 · https://api.deepseek.com/v1/chat/completions
scripts/oneclick.sh Shell · 217 行
昆仑令明文存储并云端同步
scripts/install-daemon.sh Shell · 198 行
install-daemon.sh 创建 systemd 服务
references/pay-skill-spec.md Markdown · 59 行
https://skillhub.cn/skillpay
scripts/pmm_boot.sh Shell · 59 行
https://kunlunyaochi.com/klyc-pmm/...) · https://kunlunyaochi.com/?route=recover · https://kunlunyaochi.com/?route=join · https://kunlunyaochi.com/klyc-pmm/...
scripts/pmm_recover.sh Shell · 44 行
https://kunlunyaochi.com/klyc-pmm/TOKEN · https://kunlunyaochi.com/api
其他文件 · pmm-full-architecture.md · CHANGELOG.md · pmm_backup_files.sh · quickstart.sh

安全亮点

核心记忆 push/search/recover 功能正常,API 层设计合理
退出码体系完整,自检功能( self-test)幂等安全
网络通信强制 HTTPS/TLS(--ssl-reqd),数据传输加密
昆仑令格式校验(v8.3.3),防止格式错误导致泄露
配额系统限制恶意滥用
X402 微信支付流程清晰,不越权扣款