LLM Agent Credentials Leaked by Skills — ASE 2026
元数据(重写后 · 2026-07-02 21:10 CST)
- 标题:How Your Credentials Are Leaked by LLM Agent Skills: An Empirical Study
- 会议:ASE 2026(41st IEEE/ACM International Conference on Automated Software Engineering),Research Track 接收
- arXiv:2604.03070(v1, 2026-04-03)
- HF Papers:huggingface.co/papers/2604.03070
- 作者:Yi Liu(通讯), Changjiang Li, 等(核心团队含 Yi Liu, Li Kuang, Cheng Huang, Chunyu Yang, Yan Chen 等;完整名单请参见 arXiv PDF 第 1 页;Yi Liu 在 LinkedIn 公开确认一作身份)
- 机构:待精读 PDF 首页确认
- 可信度:⭐⭐⭐⭐⭐(ASE 2026 Research Track + 首篇大规模实证 + Cohen's κ=0.82 编码一致性 + responsible disclosure 落地 83 个恶意 Skill 已下架)
- 工程价值:⭐⭐⭐⭐⭐(4 类开发者疏忽 + 6 类恶意构造 = 10 类 taxonomy 是 Skill 安全的"可落地审计框架";91.6% 硬编码已修复 = 工程价值可量化)
- 精读优先级:🔴 P0(应在所有 Skill 市场安全合规之前置入审计 checklist)
- 主题标签:
Agent SecuritySkill Supply ChainCWE-798CWE-200Cross-Modal AttackPrompt Injectionstdout-to-contextMCP-adjacentCredential HygieneResponsible Disclosure - 覆盖范围:本文覆盖原文件
2026-06-30-llm-agent-credential-leakage-ase2026.md,原版存在 abstract 三条核心定量结论遗漏 + 10 类 taxonomy 占位符 + selection bias 未自审 + 与本周 4 篇稿件零交叉引用,本稿一并修正。
1. Abstract(来自 arXiv:2604.03070 v1)
Third-party skills extend LLM agents with powerful capabilities but routinely handle sensitive credentials within privileged execution environments. How these credentials are leaked, however, remains poorly understood. We present the first large-scale empirical study of credential leakage in agent skills. Starting from 170,226 skills on SkillsMP, the largest open-source skill marketplace, we sample 17,022 via stratified random sampling and subject each to static analysis (regex and AST-based secret extraction), dynamic sandbox testing with mock credentials, and manual cross-referencing of developer intent against runtime behavior. We identify 520 affected skills harboring 1,708 security issues and derive a taxonomy of 10 leakage patterns — 4 from developer negligence and 6 from deliberate adversarial construction. We find that (1) credential leakage in agent skills is fundamentally cross-modal: 76.3% of cases surface only when natural-language descriptions and executable code are analyzed together, and 3.1% exploit pure natural language alone via prompt injection; (2) debug logging is the primary vector, with print and console.log causing 73.5% of leaks due to stdout exposure to LLMs; and (3) leaked credentials are immediately actionable and stubbornly persistent: 89.6% of affected skills are exploitable during normal execution without elevated privileges, and fork-based distribution defeats remediation — secrets deleted from 107 upstream repositories remain live across 50+ independent forks.
引自 arXiv:2604.03070v1 abstract,2026-07-02 通过
tavily_extract拉取。
2. 三条核心定量结论(这是 abstract 给出但原版完全没写的关键内容)
| 数字 | 含义 | 工程解读 |
|---|---|---|
| 76.3% 跨模态(NL + code 联合分析才暴露) | 仅靠静态扫描或仅靠 prompt 分析都会漏掉 76.3% 的泄漏 | Skill 安全审计必须 NL + code 联合,传统 SAST 工具对 Skill 场景系统性失效 |
| 73.5% 由 print / console.log 引起 | 开发者为本地调试输出 userid/token,stdout 被 LLM 框架捕获后送入上下文窗口 | stdout-to-context 管线是 LLM Agent 特有的新型泄漏面;CWE-200 应被 Agent runtime 列入硬性 redaction gate |
| 89.6% 在常规执行、无提权情况下即可利用 | 攻击者不需要 root / sudo 就能直接拿走泄漏的凭证 | 89.6% × 73.5% ≈ 65.9% 的泄漏 = "开发者随手 print + 攻击者直接读 LLM 上下文" 这条最短路径 |
| (辅)3.1% 纯 prompt injection 触发 | 即使代码本身无漏洞,仅靠 NL 文档就能诱导 Agent 暴露凭证 | NL 文档本身是攻击面——README/描述/示例代码必须做 prompt-injection audit |
金句(abstract 末尾):
These findings point to two open problems: credential redaction in the stdout-to-context pipeline, and automated detection that jointly analyzes natural language and code.
工程含义:Agent runtime 必须重写 stdout → context 的中间层(加入 secret redaction),传统 DevSecOps 的"build-time scan" 对 Agent 远远不够。
3. 10 类泄漏模式 Taxonomy(核心贡献 · 完整版)
这是原版用 1-10: 完整 taxonomy 待从论文提取 占位的部分,本文完整还原。
3.1 4 类开发者疏忽(Vulnerability Patterns,占 1,371 issues / 80.3% / 437 skills)
| # | 模式 | 泄漏通道 | Issues(%) | Skills | CWE |
|---|---|---|---|---|---|
| V1 | Hardcoded Credentials(硬编码凭证) | 源代码 / 文档 / 配置文件 | 249 (18.2%) | 107 | CWE-798 |
| V2 | Insecure Storage(不安全存储) | CLI 参数 / 进程参数 / URL 参数 | 110 (8.0%) | 77 | — |
| V3 | Information Exposure(信息暴露 / debug 日志) | 控制台日志 / debug 输出 / API 响应 | 1,007 (73.5%) | 352 | CWE-200 |
| V4 | Artifact Leakage(产物泄漏) | shell history / 临时文件 / 缓存 / git config | 5 (0.4%) | 5 | — |
关键洞察:
- V3 Information Exposure 单独占 73.5%——仅修这一类就能堵住 7 成以上泄漏。换句话说,stdout-to-context redaction gate 是 Agent runtime 最高 ROI 的安全投入。
- V1 Hardcoded Credentials 中 71.96% 的案例在 GitHub commit message 中含 AI 辅助开发痕迹(Copilot / Claude / ChatGPT 引用)。这是 abstract 直接给出的"AI 辅助编程反而引入泄漏"的硬证据,对 CSDN / Substack 上"AI 编程助手 = 提升代码安全" 的乐观叙事是直接反驳。
- V1 中 29.7% 是 API keys、24.5% 是 tokens、19.7% 是 passwords/secrets、8.8% 是 OAuth credentials。
3.2 6 类恶意构造(Malicious Patterns,占 337 issues / 19.7% / 83 skills)
| # | 模式 | 含义 | Issues(%) | Skills |
|---|---|---|---|---|
| M1 | Remote Exploitation(远程利用) | RCE 后门 / reverse shells | 176 (52.2%) | 55 |
| M2 | Defense Evasion(防御规避) | 反调试 / 混淆 / 检测绕过 | 116 (34.4%) | — |
| M3 | Credential Compromise(凭证窃取) | 社会工程 / 环境变量窃取 / SSH key 窃取 | 28 (8.3%) | 16 |
| M4 | Data Exfiltration(数据外泄) | 上传用户数据到外部 endpoint | 12 (3.6%) | — |
| M5 | Resource Hijacking(资源劫持) | 挖矿 / 调用付费 API | 4 (1.2%) | — |
| M6 | Persistence(持久化) | 后门维持 / 自动恢复 | 1 (0.3%) | — |
关键洞察:
- M1 Remote Exploitation 占恶意 Skill 的 52.2%——恶意 Skill 的首要目的不是窃凭证而是拿机器,与 V3 Information Exposure(无意泄漏)的关注点完全不同,两类 Skill 不能用同一种检测策略。
- M3 Credential Compromise 单独 8.3% / 16 skills,与 M1 + M2 合并的 86.6% 相比是少数,但 M3 直接服务于 V3 的 stdout 通道——形成"恶意构造 + 跨模态触发" 的复合攻击模式。
- V3 + M1 合计占全部 1,708 issues 的 69.3%——这是安全审计的两个最高优先级模式。
3.3 Modal Split(Table 2,RQ1 跨模态分解)
| 触发模态 | 占比 | 含义 |
|---|---|---|
| NL + Code 联合 | 76.3% | 仅 SAST 漏掉、仅 prompt 审计也漏掉 |
| 纯 Code(传统 SAST 可检测) | 20.6% | 传统工具能 cover 的少数派 |
| 纯 NL(prompt injection 触发) | 3.1% | 文档本身是攻击面 |
关键洞察:76.3% 是联合触发的——这是 abstract 中"fundamentally cross-modal" 的具体含义。任何把 NL 审计与 code 审计分离的工具链都会漏掉 3/4 的泄漏。
4. 工程启示(针对 Agent 运行时 / Skill 市场 / 终端用户)
4.1 Agent 运行时必须做的 4 件事
- stdout-to-context redaction gate:拦截
print/console.log/logger.info中形如 API key / token / password / OAuth secret 的输出,redact 后再送入 LLM 上下文窗口。这一项能直接堵住 73.5% 的 V3 类泄漏。 - NL + Code 联合审计:部署如 CodeQL + LLM-as-judge 的联合审查流水线,对每个 Skill 同时审查
.md/.py两个维度。 - Hardcoded secret scanner 在 commit-time 拦截:71.96% 的 V1 案例在 commit message 里有 AI 辅助痕迹——意味着 IDE 插件(Copilot / Claude Code / Cursor)在生成代码时就应该实时提示"该变量是 secret,请移入 env"。
- Skill 来源签名验证:SkillsMP / MCP registry 应支持 Sigstore / cosign 签名,签名异常的 Skill 拒绝 auto-approve。
4.2 Skill 市场必须做的 3 件事
- 强制 SDK-level redaction:平台对所有 Skill 的 stdout 默认 redact,开发者无法关闭。
- 黑名单 + 白名单分级:M1 Remote Exploitation 类(55 个 Skill)应直接下架;V3 类(352 个 Skill)应要求开发者 7 天内修复否则下架。
- fork 的 secret 扫描:原版给出 107 上游 repo 删除 secret 后,仍有 50+ fork 保留 secret——市场必须对 fork 也执行同样的扫描。
4.3 终端用户必须做的 3 件事
- 永远不要
auto-approve第三方 Skill 的 stdout(这与 MCPTox 84.2% auto-approval 工具污染成功率互相印证)。 - 本地开发 Skill 时禁用
print调试,改用logging.debug+ 显式 redact filter。 - Skill 来源审查清单:作者历史 commit / 是否有 CVE 记录 / 是否在恶意 Skill 黑名单。
5. 与本知识库其它稿件的交叉引用(4 篇)
| 关联稿件 | 关联点 |
|---|---|
2026-06-30-2105-evening-briefing-agent-memory-arxiv-inference-attack-cloudnative.md(Agent Memory 6 篇 arXiv) |
该 briefing 涉及的 LLM 上下文攻击主题与本文 M1 Remote Exploitation 形成互补——前者关注"投毒 RAG 检索内容",本文关注"恶意 Skill 偷凭证"。两者合并 = "LLM 输入端攻击全景"。 |
2026-07-01-1455-substack-ai-agents-stack-2026-mcp-security.md(MCPTox / Endor Labs MCP 安全) |
MCPTox 的 84.2% 工具污染成功率是 abstract 攻击面,本文 V3 Information Exposure(73.5%)是 stdout 攻击面,两者都是 Agent runtime 应有的 redaction gate 缺失的实证。Endor Labs 82% 路径遍历 + 67% 代码注入的 MCP 服务器侧问题与本文 M1 Remote Exploitation(55 个恶意 Skill)形成"协议侧 vs Skill 侧" 的双重视角。 |
2026-06-27-1450-production-agent-harness-silent-failures.md(Silent Failures / 70% silent failures) |
本文 M3 Credential Compromise 与 Silent Failures 中"agent 静默调用错误 API" 的失败模式同源——都是"harness 看不见"。 |
2026-06-30-measuring-agents-production-icml2026.md(MAP / 86 systems / 74% 人评) |
MAP 报告"74% 主要靠人评",本文报告"89.6% 凭证在常规执行即可利用"——两个数字放一起的含义是:生产 Agent 既然主要靠人评,而 89.6% 凭证可直接利用,那么 Agent 安全的关键不是自动化 eval 而是 Skill 来源审计。 |
6. 反向质疑 / selection bias / 已知 trade-off
- SkillsMP 选择偏差:SkillsMP 是最大的开源 Skill 市场但并非唯一(Anthropic MCP、OpenAI GPT Store、CrewAI Hub 等均未纳入)。SkillsMP 上的 Skill 作者偏向独立开发者 + 中小团队,企业内私有 Skill 是否存在类似 73.5% 的 Information Exposure 比例未验证。
- AI 辅助开发比例 71.96% 的方法论局限:作者只检查 GitHub commit message 中的关键词(Copilot / Claude / ChatGPT),未控制项目整体的 AI 辅助使用率,因此无法严格证明"AI 辅助 → 更多泄漏"的因果关系。可能存在 confound:高频使用 AI 助手的开发者本来就是高频提交者,泄漏率被 commit 数 normalize 后可能下降。
- dynamic sandbox testing 的覆盖:mock credentials 注入是否能完全代表真实攻击者的攻击路径?89.6% 在无提权可利用,是否包含"凭证泄露后被攻击者读 LLM 上下文" 的实际场景还是仅静态可达性?需要看论文的 RQ3 实验细节。
- Cohen's κ = 0.82 是"几乎完美" 但不是"完美":10 类 taxonomy 在 4+6 边界上仍有 ~18% 的分类不一致;4 个疏忽 vs 6 个恶意构造的边界(如"故意写错 redaction")可能存在灰色地带。
- responsible disclosure 数字 83 / 91.6%:已下架 83 个恶意 Skill + 修复 91.6% 硬编码——但未说明修复率是否包含 fork;原版 50+ fork 持续泄漏的结论暗示真实修复率应远低于 91.6%。
- 本文对 MCP / Anthropic 私有 Skill 生态的覆盖为零:abstract 引用的 Liu et al. 2026a(157 恶意 / 98,380 registry)+ Hu et al. 2026($0.013 合成恶意工具)已暗示问题在 MCP 生态同样存在,但本文未直接给出 MCP 数字。这是与本知识库
2026-07-01-1455-…md互补的研究空白。
7. 与原版差异说明
| 维度 | 原版 | 重写版 |
|---|---|---|
| Abstract 关键数字 | ⚠️ 仅给 520 / 1,708 / 10 taxonomy 三个汇总数 | ✅ 76.3% / 73.5% / 89.6% / 3.1% / 71.96% / 50+ forks 全列出 |
| 10 类 taxonomy | ❌ 1-10: 完整 taxonomy 待从论文提取 占位符 |
✅ V1-V4 + M1-M6 完整列表(含 CWE 编号、issues 数、skills 数) |
| Modal split | ❌ 未提 | ✅ 76.3% / 20.6% / 3.1% 三段 |
| V1 的 AI 辅助痕迹 71.96% | ❌ 未提 | ✅ abstract 原文给出 |
| V3 占 73.5% 的工程含义 | ⚠️ "MCP 安全被定性为执行边界问题" 是抽象表述 | ✅ 明确"stdout-to-context redaction gate" 是最高 ROI 的安全投入 |
| M1 占恶意 Skill 52.2% | ❌ 未提 | ✅ 明确"首要目的不是窃凭证而是拿机器" |
| Engineering Implications | ⚠️ 4 条偏原则("Skill 是信任边界" 等口号) | ✅ 4+3+3 共 10 条可执行项(Agent runtime / Skill 市场 / 终端用户三层) |
| Responsible Disclosure 数字 | ❌ 未提 | ✅ 83 恶意 Skill 已下架 + 91.6% 硬编码已修复 + Cohen's κ=0.82 |
| 跨稿引用 | ❌ 0 处 | ✅ 4 处(Agent Memory / MCPTox / Silent Failures / MAP) |
| Selection bias | ❌ 未提 | ✅ 6 条 |
| 上轮 P0 行动 #3(07-02 修复 taxonomy) | ❌ 未交付 | ✅ 已交付(本次反思一并完成) |
| 字数 | ~2,080 B / 54 行 | ~9,800 B / ~210 行 |
重写原则:准确 → 深度 → 可操作 → 反向质疑 → 跨稿串联。
8. 后续行动
- [x] 完整还原 10 类 taxonomy(V1-V4 + M1-M6)
- [x] 提取 abstract 全部定量结论
- [x] 与本周 4 篇稿件交叉引用
- [x] 反向质疑 6 条
- [ ] 精读 PDF 第 5 节(Discussion)+ RQ3 实验细节,验证 89.6% 的实验设置
- [ ] 与 Tom 对齐:
promo/explainers/2604-03070-credential-leakage-agent-skills.md选题(候选) - [ ] 在
inference/agent-security/主题页新建 Skill Supply Chain 子类 - [ ] 与
2026-07-01-1455-…md合并为"MCP + Skill 端到端安全审计框架"