ZT4AI Self-Audit
Audit your agent's skills, workspace, and configuration against Zero Trust for AI principles.
Background
AI agents process instructions and data as indistinguishable tokens in a context window. This means:
- - Skill files loaded into context can inject behavioral instructions
- Workspace files (SOUL.md, AGENTS.md) are both operating instructions AND attack surface
- External inputs (web content, emails, ClawHub skills) can contain prompt injection
- Credentials in plaintext config files have no access scoping or rotation
This skill applies three frameworks:
- 1. Microsoft ZT4AI — Verify explicitly, least privilege, assume breach
- "Caging the Agents" (arXiv:2603.17419) — Four-layer defense: workload isolation, credential proxy, network egress, prompt integrity
- OWASP Agentic AI Top 10 — Trust boundary violations, privilege escalation, resource exhaustion
Audit Process
Step 1: Inventory Skills
Scan all three skill locations:
CODEBLOCK0
Step 2: Classify Each Skill
Assign every skill to a risk category using the classification guide in references/risk-classification.md.
Categories:
- - Behavioral modifiers (🔴 highest risk) — Skills that change how you think, override safety instincts, or inject decision-making patterns into your context
- Credential handlers (🟡 elevated risk) — Skills that read, write, or transmit API keys, tokens, passwords
- System modifiers (🟡 elevated risk) — Skills that write to config files, modify system state, or execute with elevated privileges
- Tool wrappers (🟢 standard risk) — Skills that wrap external tools with well-scoped inputs/outputs
- Read-only (🟢 low risk) — Skills that only read data and produce reports
Step 3: Audit Each Skill Against ZT4AI Principles
For each skill, evaluate against the checklist in references/audit-checklist.md.
Quick reference — the three questions:
- 1. Verify explicitly: Does this skill verify identity/authorization before acting? Does it distinguish owner from non-owner input?
- Least privilege: Does this skill request only the access it needs? Could its scope be narrowed?
- Assume breach: If this skill were compromised (poisoned update, prompt injection in its files), what's the worst outcome? How would you detect it?
Step 4: Check Scripts and Executables
Find all executable code in skills:
CODEBLOCK1
For each script, check:
- - Does it access credentials? (
grep -li "API_KEY\|SECRET\|TOKEN\|PASSWORD" <file>) - Does it make network calls? (
grep -li "curl\|wget\|requests\|fetch\|http" <file>) - Does it write to system config? (
grep -li "openclaw.json\|\.env\|/etc/" <file>) - Does it execute arbitrary input? (
grep -li "eval\|exec\|subprocess\|system(" <file>)
Step 5: Generate Integrity Baseline
Create SHA256 checksums of all skill files for future drift detection:
CODEBLOCK2
To verify against an existing baseline:
CODEBLOCK3
Any output indicates modified files — investigate before trusting.
Step 6: Assess Workspace File Security
Check the self-modification surface:
- - Can the agent modify its own SOUL.md / AGENTS.md? (Yes by default — flag it)
- Are memory files loaded into context? (Yes — they're instruction vectors)
- Is MEMORY.md loaded in non-owner contexts? (Should NOT be — data leak risk)
- Are there credentials in workspace files? (
grep -rli "api_key\|password\|secret" ~/.openclaw/workspace/)
Step 7: Check Network Egress
Assess outbound network restrictions:
CODEBLOCK4
If the agent has unrestricted outbound access, flag as a security gap — a compromised agent could exfiltrate data to any destination.
Step 8: Produce Report
Generate a structured report using the template in references/report-template.md. Include:
- - Risk classification for each skill
- Specific findings with severity ratings
- Recommended remediations with priority
- Action tier assignments (see references/action-tiers.md)
Save report to memory/zt4ai-audit-YYYY-MM-DD.md.
Ongoing Monitoring
After the initial audit:
- 1. Re-verify integrity after any skill install/update (
sha256sum -c against baseline) - Re-audit behavioral skills whenever they're updated — these are the highest risk
- Update baseline after intentional skill modifications
- Schedule periodic audits via cron (monthly recommended)
References
- -
references/risk-classification.md — Detailed classification criteria with examples - INLINECODE11 — Per-skill audit checklist
- INLINECODE12 — Graduated trust model for agent actions
- INLINECODE13 — Audit report template
ZT4AI 自我审计
根据零信任AI原则审计您的智能体技能、工作空间和配置。
背景
AI智能体将指令和数据作为上下文窗口中不可区分的令牌进行处理。这意味着:
- - 加载到上下文中的技能文件可能注入行为指令
- 工作空间文件(SOUL.md、AGENTS.md)既是操作指令也是攻击面
- 外部输入(网页内容、电子邮件、ClawHub技能)可能包含提示注入
- 明文配置文件中的凭据没有访问范围界定或轮换机制
本技能应用三个框架:
- 1. 微软ZT4AI — 显式验证、最小权限、假设被攻破
- Caging the Agents(arXiv:2603.17419)— 四层防御:工作负载隔离、凭据代理、网络出口、提示完整性
- OWASP Agentic AI Top 10 — 信任边界违规、权限提升、资源耗尽
审计流程
步骤1:盘点技能
扫描所有三个技能位置:
bash
echo === 系统 === && ls /usr/lib/node_modules/openclaw/skills/ 2>/dev/null
echo === 用户 === && ls ~/.openclaw/skills/ 2>/dev/null
echo === 工作空间 === && ls ~/.openclaw/workspace/skills/ 2>/dev/null
步骤2:分类每个技能
使用references/risk-classification.md中的分类指南将每个技能分配到风险类别。
类别:
- - 行为修改器(🔴 最高风险)— 改变思维方式、覆盖安全本能、或将决策模式注入上下文的技能
- 凭据处理器(🟡 较高风险)— 读取、写入或传输API密钥、令牌、密码的技能
- 系统修改器(🟡 较高风险)— 写入配置文件、修改系统状态、或以提升权限执行的技能
- 工具封装器(🟢 标准风险)— 封装外部工具且输入/输出范围明确的技能
- 只读(🟢 低风险)— 仅读取数据并生成报告的技能
步骤3:根据ZT4AI原则审计每个技能
对每个技能,根据references/audit-checklist.md中的检查清单进行评估。
快速参考 — 三个问题:
- 1. 显式验证:此技能在执行前是否验证身份/授权?是否区分所有者与非所有者输入?
- 最小权限:此技能是否仅请求其所需的访问权限?其范围能否缩小?
- 假设被攻破:如果此技能被攻破(中毒更新、其文件中的提示注入),最坏结果是什么?您将如何检测?
步骤4:检查脚本和可执行文件
查找技能中所有可执行代码:
bash
find ~/.openclaw/skills/ ~/.openclaw/workspace/skills/ \
-type f \( -name .sh -o -name .py -o -name *.js \) \
2>/dev/null | sort
对每个脚本,检查:
- - 是否访问凭据?(grep -li API_KEY\|SECRET\|TOKEN\|PASSWORD )
- 是否进行网络调用?(grep -li curl\|wget\|requests\|fetch\|http )
- 是否写入系统配置?(grep -li openclaw.json\|\.env\|/etc/ )
- 是否执行任意输入?(grep -li eval\|exec\|subprocess\|system( )
步骤5:生成完整性基线
创建所有技能文件的SHA256校验和,用于未来漂移检测:
bash
find ~/.openclaw/skills/ ~/.openclaw/workspace/skills/ \
-type f \( -name .md -o -name .sh -o -name .py -o -name .js -o -name *.json \) \
-exec sha256sum {} \; | sort -k2 > memory/skill-integrity-baseline.md
对照现有基线进行验证:
bash
sha256sum -c memory/skill-integrity-baseline.md 2>&1 | grep -v : OK$
任何输出都表示文件已被修改 — 在信任前进行调查。
步骤6:评估工作空间文件安全性
检查自我修改面:
- - 智能体能否修改自身的SOUL.md / AGENTS.md?(默认可以 — 标记它)
- 内存文件是否加载到上下文中?(是 — 它们是指令向量)
- MEMORY.md是否在非所有者上下文中加载?(不应该 — 存在数据泄露风险)
- 工作空间文件中是否存在凭据?(grep -rli api_key\|password\|secret ~/.openclaw/workspace/)
步骤7:检查网络出口
评估出站网络限制:
bash
检查防火墙规则
iptables -L OUTPUT -n 2>/dev/null || echo 无iptables访问权限
ufw status 2>/dev/null || echo 无UFW
检查智能体可以访问什么
curl -s -o /dev/null -w %{http_code} https://httpbin.org/get --max-time 5
如果智能体具有不受限制的出站访问权限,标记为安全漏洞 — 被攻破的智能体可能将数据泄露到任何目的地。
步骤8:生成报告
使用references/report-template.md中的模板生成结构化报告。包括:
- - 每个技能的风险分类
- 带有严重性评级的特定发现
- 带有优先级的推荐修复措施
- 行动层级分配(参见references/action-tiers.md)
将报告保存到memory/zt4ai-audit-YYYY-MM-DD.md。
持续监控
初始审计后:
- 1. 重新验证完整性 — 在任何技能安装/更新后(对照基线运行sha256sum -c)
- 重新审计行为技能 — 每当它们被更新时,这些是最高风险的
- 更新基线 — 在有意修改技能后
- 安排定期审计 — 通过cron(建议每月一次)
参考资料
- - references/risk-classification.md — 带有示例的详细分类标准
- references/audit-checklist.md — 每个技能的审计检查清单
- references/action-tiers.md — 智能体行动的分级信任模型
- references/report-template.md — 审计报告模板