arXiv:2504.00018cs.CRcs.LG2025-04被引 10

为测试大模型生成代码的安全性,构建了模拟攻击的沙箱评估工具

SandboxEval: Towards Securing Test Environment for Untrusted Code

  • 设计手动构造的测试用例,模拟真实场景下的恶意代码行为
  • 在Dyff框架上验证发现多类安全漏洞,包括信息泄露和文件系统越权
  • 适合关注AI安全评估基础设施的开发者和研究者使用

尽管大语言模型在编程任务中表现强大,但可能生成恶意代码。测试此类代码对执行未受信任代码的评估基础设施构成重大风险。为此,本文聚焦于评估测试环境的安全与保密性,降低大模型生成代码对评估系统的威胁。我们提出SandboxEval,一个包含手工构造测试用例的测试套件,用于模拟大模型评估环境中未受信任代码执行的真实安全场景。该套件评估敏感信息泄露、文件系统操作、外部通信及其他潜在危险行为的风险。通过在开源版Dyff(一个成熟的AI评估框架)上部署SandboxEval,我们验证了其有效性:首先,测试结果准确反映了大模型在指令下生成恶意代码时所受限制;其次,测试结果为开发者加固评估基础设施、识别大模型执行风险提供了关键洞察。

原文摘要 · Abstract (English)

While large language models (LLMs) are powerful assistants in programming tasks, they may also produce malicious code. Testing LLM-generated code therefore poses significant risks to assessment infrastructure tasked with executing untrusted code. To address these risks, this work focuses on evaluating the security and confidentiality properties of test environments, reducing the risk that LLM-generated code may compromise the assessment infrastructure. We introduce SandboxEval, a test suite featuring manually crafted test cases that simulate real-world safety scenarios for LLM assessment environments in the context of untrusted code execution. The suite evaluates vulnerabilities to sensitive information exposure, filesystem manipulation, external communication, and other potentially dangerous operations in the course of assessment activity. We demonstrate the utility of SandboxEval by deploying it on an open-source implementation of Dyff, an established AI assessment framework used to evaluate the safety of LLMs at scale. We show, first, that the test suite accurately describes limitations placed on an LLM operating under instructions to generate malicious code. Second, we show that the test results provide valuable insights for developers seeking to harden assessment infrastructure and identify risks associated with LLM execution activities.

AI安全沙箱测试大模型评估

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