TaiChu 威胁分析 v7

TaiChu(太初)小艺 · 鸿蒙多设备AI助手 · v7-fresh-2026-06-05 · 细粒度实体映射 35 条
细粒度映射(对象·属性·值·标签·evidence)
代码架构图
每行 = 本体论对象的一个属性 → TaiChu 真实属性名 → 值 + 标签 → evidence(源码位置)。这是功能驱动映射到属性·标签级的结果。
本体论对象 · 属性TaiChu 属性名值 + 标签evidence(源码位置)
L0
AgentCore
· definition_files 身份文件
meta_data/IDENTITY.md·SOUL.md·USER.md·MEMORY.md
本地FS扫描加载
Mutability-Static Sensitive-PersonalInfo
prompt_builder.rs:36
AgentCore
· is_injectable 注入可达
USER.md/MEMORY.md 经PCS/SaveMemory写入
可注入(记忆通道)
InjChannel-Memory
system_prompt.rs:82
L1
Model
· name/provider 模型
ModelPolicy.provider/model_id/api
GLM-5.1 (compat,可配 .taichu.json)
agent-framework/model.rs:17
Model
· native_role_tokens 原生token
GLM chat-template role token
<|user|> <|assistant|> <|observation|> <|system|>
InjChannel-SystemPrompt
llm-provider/types.rs
Workflow
· workflow_type/loop 工作流
run_loop 双循环(外follow-up/内tool+steering)
ReAct · stream→tool→steer→followup
agent-loop/agent_loop.rs:149
Workflow
· SAFETY_VALIDATE 安全步
(缺失)仅validate_tool_call JSON Schema
⚠无系统性安全步
Gap-NoOutputCheck
agent_loop.rs:850
PermissionPolicy
· permission_mode 门控
SkillLoad门控+SKILL.md参数白名单
软约束(模型遵守,非系统强制)
Perm-Tool-Invoke
skills/system/*/TOOLS.md
AgentConfig
· api_key 凭证
.taichu.json providers[].api_key
明文存储
Sensitive-Credential
.taichu.json / model_client.rs:14
AgentConfig
· jwt_secret 凭证
llm-router JWT secret
默认 'taichu-dev-secret-change-in-production'
Sensitive-Credential
llm-router/src/auth.rs:57
Memory(长时)
· retrieval_method 检索
LCM 树形摘要分层检索
按depth取全部active摘要(无向量过滤)
InjChannel-Memory
jiuwen/lcm/recall/expand.rs
Memory(长时)
· mutability 可变性
MEMORY.md / LCM append_message
可追加(无内容校验→可被LLM输出毒化)
Mutability-Appendable Persistence-CrossSession
jiuwen/lcm/storage/rusqlite.rs
PromptTemplate
· slots 槽位(靶心)
build_system_prompt 各章节
identity/context_files/skills/tools/工作区/设备
Affected-Context
agent-session/system_prompt.rs:74
PromptTemplate
· slot.ToolCallResult 主注入面
ToolResultMessage→ctx.messages
工具返回直接append(无sanitize)
SlotDynamics-Dynamic InjChannel-SyncToolReturn
agent_loop.rs:255
L2
ToolSpace
· registrability 可创建性(空间级)
toolSpace.registrability
集合可扩展:文件系统可写 → 带外创建恶意成员注入(无官方市场≠不可创建)
Mutability-Extensible
skills/system/(可写)
ToolSpace
· path_mutability 可修改性(空间级)
toolSpace.path_mutability
现有定义可改写:SKILL.md/depends_on_tools 无签名校验 → 篡改投毒
Mutability-Mutable Gap-ContextIntegrity
skills/system/*/SKILL.md
ToolSpace
· registration_source 官方渠道(空间级)
registration_source
无官方注册渠道;扩展/篡改均为带外文件写(unsanctioned)
无下载/市场代码
ToolSpace
· inventory 全量清单(空间级)
entry_tools/skills[]
9 执行入口 / 130+ API·CLI 操作(敏感性驱动穷举)
02_capability_inventory.json
SkillSpace
· registrability 可创建性(空间级)
skillSpace.registrability
集合可扩展:文件系统可写 → 带外创建恶意成员注入(无官方市场≠不可创建)
Mutability-Extensible
skills/system/(可写)
SkillSpace
· path_mutability 可修改性(空间级)
skillSpace.path_mutability
现有定义可改写:SKILL.md/depends_on_tools 无签名校验 → 篡改投毒
Mutability-Mutable Gap-ContextIntegrity
skills/system/*/SKILL.md
SkillSpace
· registration_source 官方渠道(空间级)
registration_source
无云端下载/插件市场;带外文件写注入(unsanctioned extensible)
无下载/市场代码
SkillSpace
· inventory 全量清单(空间级)
entry_tools/skills[]
16 系统技能 · risk_tier H8/M4/L3(N/A1)
02_capability_inventory.json
Tool
· tool_kind 类型
exec_os_api / exec_cli(bm/aa/ohos-*)
CodeExec开放执行(多Sink网关)
ActionSensitivity-Destructive
device/exec_os_api.rs
Tool(PCS)
· returns_untrusted 返回注入
PersonalContextSearch 返回
直接拼入LLM上下文(USER_MEMORY_DATA段)
Sensitive-PersonalInfo InjChannel-SyncToolReturn
PhoneCloud/TOOLS.md
Tool(searchMessage)
· sensitivity 数据敏感
searchMessage 短信检索
含验证码/银行通知→入上下文
Sensitive-Credential Sensitive-Communication
communication/SKILL.md
Skill
· source 来源/触发
SkillLoad 意图匹配 triggers
15内置 + 云端下载;触发词模糊可激活
Mutability-Extensible
skills/system/*/SKILL.md
L3
Channel
· 可信/不可信源
小艺对话(可信) / cloud relay(不可信)
relay跨设备消息进上下文
InjChannel-AsyncBackground
cloud-collab-relay-transport/src/client.rs:327
Gateway/SubAgent
· auth 鉴权
mailbox poll(participant_id明文)
无per-msg鉴权→越权读指令
Gap-GatewayAuth Gap-SubagentPriv
client.rs:326 / install.rs:248
L4
SecurityChecker
· coverage 检查能力
url_guard(SSRF) + validate_tool_call + 模型内生对齐
rule-based为主(可绕过)
Check-Rule-Path Check-Model-Approval
url_guard.rs:10 / agent_loop.rs:850
SecurityChecker
· action 命中动作
SessionToolHook.before_tool
⚠默认放行(RecordingHook无拦截)
CheckerAction-Log
session_tool_hook.rs:30
SecurityChecker
· gaps 盲区
LCM摘要/工具返回/cron/mailbox 无检查
exec无沙箱·无输出检查·记忆投毒
Gap-SemanticExec Gap-NoOutputCheck Gap-Cron
(多处缺失)
L6
ExecutionSandbox
· reachability/isolation
exec_os_api/exec_cli 直达host
⚠无沙箱隔离(爆炸半径=设备级)
Reachability-Reachable
device/exec_os_api.rs
Environment
· 云内网(InfraCompromise)
云测中控系统→华为云端
Agent驻留可作跳板(探测/扫描/漏洞)
Reachability-Conditional
cloud-collab/*
风险面
InjectionPoint
· USER_MEMORY_DATA(高信任)
PCS返回段·escaping LF→CRLF
候选PoisonEntry+Source0;token边界被CRLF破坏
InjChannel-Memory trust=High
AgentProfile_TaiChu_v2e.md §1
Sink
· action+intent+affected
exec_cli + SinkIntent-PrivEsc
Sink-SystemExec · 意图提权 · bm/aa
Sink-SystemExec SinkIntent-PrivEsc
app-management/SKILL.md
Harm
· victim×loss 危害
用户/运营方
User×PersonalInfo · Operator×InfraCompromise · Operator×Reputation
HarmVictim-Operator HarmLossType-InfraCompromise
00_business_context.md

一、代码架构图(模块×层)

graph TD APP["apps/ taichu-cli · phone-ui"] --> RT["taichu-core-sdk/runtime.rs<br/>Runtime / SessionManager"] RT --> SESS["L3 agent-session/session.rs<br/>AgentSession(编排:工具注册/重试/压缩)"] SESS --> PB["L2.5 agent-framework<br/>prompt_builder.rs · tool_assembly.rs · system_prompt.rs · model.rs · auth.rs"] PB --> AG["L2 agent-loop/agent.rs<br/>Agent(状态机:state/steering/follow_up/cancel)"] AG --> LOOP["L1 agent-loop/agent_loop.rs<br/>run_loop 双循环(无状态)"] LOOP --> LLM["llm-provider<br/>provider.rs(OpenAI/AS-gateway compat) · event_stream.rs"] LOOP --> TOOLS["BoxAgentTool 执行<br/>before/after hook · steering poll"] TOOLS --> SK["skills/system/* 15技能<br/>exec_os_api · exec_cli(bm/aa/ohos-*)"] SESS --> SUB["subagent/ · cloud-collab/<br/>SubagentRunner · RelayClient · listener/presence"] PB --> MEM["plugins/context_engine/jiuwen/lcm<br/>SQLite/file · 树形摘要RAG · compaction"] SESS --> STORE["services/java<br/>session-store · workspace-store"] TOOLS --> ENV["L6 设备/系统环境<br/>exec无沙箱 · 各App数据"]

二、实体对象关系图(本体论映射)

graph LR Agent["Agent(agent.rs:118)"] -->|持有| State["AgentState<br/>system_prompt/messages/tools"] Agent -->|run_loop| Loop["run_loop(agent_loop.rs:149)"] Loop -->|stream| Provider["LLM Provider(GLM compat)"] Loop -->|execute_tool_calls:665| Tool["AgentTool(trait)"] Tool -.子类.-> ExecOS["exec_os_api / exec_cli"] Tool -.子类.-> PCS["PCS/searchMessage/searchGallery"] PB["LocalFsPromptBuilder:36"] -->|build_system_prompt:74| Slots["槽位:IDENTITY/SOUL/USER/MEMORY/AGENTS/TOOLS/skills"] Slots -.不可信源.-> PCS Slots -.持久化注入.-> MEM["MEMORY.md / LCM摘要"] SecHook["SessionToolHook(默认无拦截!)"] -.before/after.-> Tool Sub["SubagentRunner"] -->|relay| Mailbox["mailbox(无per-msg鉴权!)"]

三、工作流图(用户视角 vs 系统视角)

sequenceDiagram participant U as 用户 participant A as Agent(L2) participant L as run_loop(L1) participant M as LLM participant T as Tool/设备 U->>A: prompt("关闭蓝牙") agent.rs:501 A->>L: run_loop(UserMsg) L->>L: ①ASSEMBLING 组装system_prompt(注入落点) :348 L->>M: ②stream_assistant_response :204 M-->>L: tool_calls L->>L: ③execute_tool_calls :665 Note over L: SkillLoad门控→validate(JSON Schema)→before_hook(默认放行) L->>T: ④tool.execute :1292 (exec_cli) T-->>L: 返回(拼进ctx.messages=注入面) L->>L: ⑤steering/follow_up · ⚠SAFETY_VALIDATE缺失 L-->>A: AgentEnd A-->>U: 结果

四、数据流图(信任域 + 注入面)

flowchart LR subgraph 不可信源 PCS_R["PCS/searchMessage返回"]:::u MEMmd["MEMORY.md/LCM摘要"]:::u RELAY["cloud relay消息(弱鉴权)"]:::u USERIN["用户输入(半可信)"]:::s end PCS_R --> CTX["ctx.messages / system_prompt<br/>(无sanitize直接拼接)"]:::u MEMmd --> CTX RELAY --> CTX USERIN --> CTX CTX --> LLM["LLM(GLM 内生安全对齐:敏感操作提醒)"]:::g LLM --> SINK["Sink: exec_os_api/exec_cli/sendSMS/cron"]:::r SINK --> ENV["设备/各App数据 + 华为云内网"]:::r SINK -.SaveMemory.-> MEMmd classDef u fill:#3a1212,stroke:#f87171,color:#fca5a5 classDef s fill:#2a2410,stroke:#d29922,color:#fcd34d classDef g fill:#0a2010,stroke:#34d399,color:#6ee7b7 classDef r fill:#1a0d12,stroke:#a855f7,color:#d8b4fe