This report was generated in Chinese. Some content may be in Chinese.
Suspicious — Risk Score 45/100
Last scan:4 hr ago Rescan
45 /100
layered-memory
基于 L0/L1/L2 三层结构的分层记忆管理系统,大幅减少 Token 消耗
代码引用 ~/clawd/scripts/ 下的外部脚本(memory-extractor.js, memory-archiver.js, generate-layers-simple.js, memory-reader.js)但这些脚本未打包在技能目录中;此外 SKILL.md 声明了 4 个命令但代码实际实现了 9 个(extract/archive/summary/dedupe 未声明)。
Skill Namelayered-memory
Duration57.0s
Enginepi
ClawHub Layered Memory v1.2.0 by yingdadaa
📥 227
ClawHub Verdict Suspicious dangerous_execllm_suspiciousvt_suspicious
Use with caution
1. 将依赖的脚本模块打包到技能目录内;2. 补全 SKILL.md 文档声明所有命令;3. 移除 test.js 中对 ~/clawd/scripts 的硬编码依赖检查。

Attack Chain 4 steps

Entry 用户安装 layered-memory 技能,读取 SKILL.md 理解其功能
SKILL.md:1
Escalation 技能代码 require ~/clawd/scripts/memory-extractor.js 等外部脚本
index.js:29
Escalation generate/read/search/stats 等方法通过 execSync 执行外部 JS 脚本
index.js:40
Impact 攻击者可将恶意脚本放置在 ~/clawd/scripts/ 下,技能运行时以同权限执行(条件:用户 ~/clawd/scripts/ 目录可写且无验证)
index.js:40

Findings 5 items

Severity Finding Location
High
外部脚本缺失导致功能不可用 Supply Chain
index.js 第 29-31 行 require ~/clawd/scripts/ 下的 memory-extractor.js 和 memory-archiver.js,第 40-58 行的 generate/read/search/stats 方法通过 execSync 调用 ~/clawd/scripts/ 下的 generate-layers-simple.js 和 memory-reader.js,但这 4 个脚本均未打包在技能目录中。运行时必然报错,除非用户在 ~/clawd/scripts/ 下自行准备这些脚本。
const MemoryExtractor = require(path.join(SCRIPTS_PATH, 'memory-extractor.js'));
const MemoryArchiver = require(path.join(SCRIPTS_PATH, 'memory-archiver.js'));
...
const output = execSync(`node "${script}" ...`, { encoding: 'utf-8' });
→ 将 memory-extractor.js, memory-archiver.js, generate-layers-simple.js, memory-reader.js 打包到 skills/layered-memory/scripts/ 目录内,并更新路径引用
index.js:29-58
High
SKILL.md 声明命令与实际不符 Doc Mismatch
SKILL.md 只声明了 generate、read、search、stats 四个命令,但 index.js 实际实现了 9 个 CLI 命令(generate、read、search、stats、maintain、extract、archive、summary、dedupe),其中 extractMemories、archiveOld、monthlySummary、deduplicate 为阴影功能。
case 'extract': ... memory.extractMemories(messages);
case 'archive': ... memory.archiveOld(archiveOptions);
case 'summary': ... memory.monthlySummary(year, month);
case 'dedupe': ... memory.deduplicate(args[1]);
→ 更新 SKILL.md,完整声明 extract、archive、summary、dedupe、maintain 命令及其功能
index.js:145-218
Medium
test.js 对外部路径存在性检查 Supply Chain
test.js 第 75-86 行检查 ~/clawd/scripts/generate-layers-simple.js 是否存在,并读取其内容验证 v2 功能。这意味着 test 依赖于用户环境中有该脚本,技能自身不完整。
const genScriptPath = path.join(home, 'clawd', 'scripts', 'generate-layers-simple.js');
assertExists(genScriptPath, 'generate-layers-simple.js should exist in ~/clawd/scripts/');
→ 移除对 ~/clawd/scripts 的外部依赖,或将该检查改为 mock 方式
test.js:75-86
Low
benchmark.js 包含硬编码用户路径 Doc Mismatch
benchmark.js 第 56-57 行硬编码了 /root/.openclaw/workspace/memory/ 路径,非可移植路径。
const files = ['/root/.openclaw/workspace/memory/MEMORY.md', '/root/.openclaw/workspace/memory/2026-03-13.md'];
→ 使用环境变量或相对路径替代硬编码路径
benchmark.js:56-57
Low
OpenClaw hook 未在 SKILL.md 中声明 Doc Mismatch
package.json 注册了 openclaw hooks (agent:bootstrap 事件注入记忆提醒),但 SKILL.md 未提及此行为。
"openclaw": { "hooks": [{ "events": ["agent:bootstrap"] }] }
→ 在 SKILL.md Capabilities 章节补充声明 OpenClaw 集成和行为
package.json:19-26
ResourceDeclaredInferredStatusEvidence
Filesystem READ WRITE ✗ Violation index.js:29-31 代码执行 fs.readFileSync/writeFileSync
Shell NONE WRITE ✗ Violation index.js:40-58 使用 execSync 调用外部脚本
Skill Invoke NONE WRITE ✓ Aligned index.js:29-31 require(~/clawd/scripts/memory-extractor.js) 等外部模块

File Tree

18 files · 64.8 KB · 2694 lines
Markdown 11f · 1766L JavaScript 5f · 878L JSON 2f · 50L
├─ 📁 hooks
│ └─ 📁 openclaw
│ ├─ 📜 handler.js JavaScript 73L · 1.9 KB
│ └─ 📝 HOOK.md Markdown 43L · 1001 B
├─ 📁 lib
│ └─ 📜 config-loader.js JavaScript 156L · 3.8 KB
├─ 📝 ANTI-DUPLICATE.md Markdown 119L · 2.3 KB
├─ 📝 AUTO-SAVE-GUIDE.md Markdown 303L · 5.9 KB
├─ 📝 AUTO-TRIGGER.md Markdown 349L · 6.4 KB
├─ 📜 benchmark.js JavaScript 88L · 2.5 KB
├─ 📝 CHANGELOG.md Markdown 67L · 1.9 KB
├─ 📋 config.example.json JSON 23L · 459 B
├─ 📝 CONTRIBUTING.md Markdown 48L · 1.0 KB
├─ 📜 index.js JavaScript 405L · 11.5 KB
├─ 📝 INTEGRATION.md Markdown 301L · 5.8 KB
├─ 📋 package.json JSON 27L · 839 B
├─ 📝 PRACTICAL-SOLUTION.md Markdown 157L · 3.6 KB
├─ 📝 README.md Markdown 220L · 4.6 KB
├─ 📝 SKILL.md Markdown 31L · 960 B
├─ 📜 test.js JavaScript 156L · 6.7 KB
└─ 📝 UPGRADE_PLAN.md Markdown 128L · 3.7 KB

Dependencies 4 items

PackageVersionSourceKnown VulnsNotes
memory-extractor.js N/A ~/.clawd/scripts/ (external, not bundled) No 高风险:外部脚本未打包,依赖用户环境存在
memory-archiver.js N/A ~/.clawd/scripts/ (external, not bundled) No 高风险:外部脚本未打包,依赖用户环境存在
generate-layers-simple.js N/A ~/.clawd/scripts/ (external, not bundled) No 高风险:外部脚本未打包,依赖用户环境存在
memory-reader.js N/A ~/.clawd/scripts/ (external, not bundled) No 高风险:外部脚本未打包,依赖用户环境存在

Security Positives

✓ 无恶意代码:无 base64 编码、eval、混淆或反向 shell
✓ 无凭证收割:未遍历环境变量匹配敏感关键字
✓ 无数据外泄:无 POST 请求或 C2 通信
✓ 无硬编码凭证或密钥
✓ MIT 许可证声明清晰
✓ benchmark.js 使用字符数估算 token(无外部 API 调用)
✓ OpenClaw hook 行为仅为注入文本提醒,无危害操作