arXiv:2508.17155cs.CRcs.AI2025-08

首次揭示大模型代理中的时间检查到使用漏洞,提出检测与防御方案。

Mind the Gap: Time-of-Check to Time-of-Use Vulnerabilities in LLM-Enabled Agents

  • 构建TOCTOU-Bench基准,涵盖66个真实用户任务
  • 自动检测准确率最高25%,攻击窗口减少95%
  • 适合关注AI安全与系统安全交叉领域的研究者

大语言模型(LLM)驱动的智能体在各类应用中快速兴起,但其部署引入了新的安全漏洞。尽管已有研究关注提示词攻击(如提示注入)和数据类威胁(如数据泄露),但时间检查到使用(TOCTOU)漏洞在此领域仍基本未被探索。当智能体验证外部状态(如文件或API响应)后,该状态在使用前被篡改,便可能引发恶意配置替换或载荷注入等实际攻击。本文首次系统研究了LLM智能体中的TOCTOU漏洞,提出TOCTOU-Bench基准,包含66个真实用户任务,用于评估此类漏洞。针对防御,我们从系统安全领域借鉴检测与缓解技术,并提出提示重写、状态完整性监控和工具融合三种方法。实验显示,自动化检测最高可达25%准确率,漏洞计划生成减少3%,攻击窗口缩小95%;三者结合使执行轨迹中的漏洞率从12%降至8%。研究揭示了智能体工作流特有的挑战,开辟了人工智能安全与系统安全交叉的新方向。

原文摘要 · Abstract (English)

Large Language Model (LLM)-enabled agents are rapidly emerging across a wide range of applications, but their deployment introduces vulnerabilities with security implications. While prior work has examined prompt-based attacks (e.g., prompt injection) and data-oriented threats (e.g., data exfiltration), time-of-check to time-of-use (TOCTOU) remain largely unexplored in this context. TOCTOU arises when an agent validates external state (e.g., a file or API response) that is later modified before use, enabling practical attacks such as malicious configuration swaps or payload injection. In this work, we present the first study of TOCTOU vulnerabilities in LLM-enabled agents. We introduce TOCTOU-Bench, a benchmark with 66 realistic user tasks designed to evaluate this class of vulnerabilities. As countermeasures, we adapt detection and mitigation techniques from systems security to this setting and propose prompt rewriting, state integrity monitoring, and tool-fusing. Our study highlights challenges unique to agentic workflows, where we achieve up to 25% detection accuracy using automated detection methods, a 3% decrease in vulnerable plan generation, and a 95% reduction in the attack window. When combining all three approaches, we reduce the TOCTOU vulnerabilities from an executed trajectory from 12% to 8%. Our findings open a new research direction at the intersection of AI safety and systems security.

AI安全系统安全漏洞检测

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。