SecCodePLT:一个统一的平台,用于评估 Code GenAI 的安全性。
SecCodePLT: A Unified Platform for Evaluating the Security of Code GenAI
October 14, 2024
作者: Yu Yang, Yuzhou Nie, Zhun Wang, Yuheng Tang, Wenbo Guo, Bo Li, Dawn Song
cs.AI
摘要
现有研究已建立了多个基准,以突显与代码生成人工智能(Code GenAI)相关的安全风险。这些风险主要体现在两个方面:模型生成不安全代码的潜力(不安全编码)以及其在网络攻击中的实用性(网络攻击帮助)。尽管这些基准已取得重大进展,但仍存在进一步改进的机会。例如,许多当前的基准往往更注重模型提供攻击建议的能力,而非其生成可执行攻击的能力。此外,大多数基准严重依赖静态评估指标,这些指标可能不如动态指标(如通过测试案例)精确。相反,虽然专家验证的基准提供高质量数据,但往往规模较小。为弥补这些差距,我们开发了SecCodePLT,这是一个统一而全面的评估平台,用于评估代码生成人工智能风险。对于不安全代码,我们引入了一种结合专家和自动生成的数据创建新方法。我们的方法确保了数据质量,同时实现了大规模生成。我们还将样本与测试案例相关联,以进行与代码相关的动态评估。对于网络攻击帮助,我们建立了一个真实环境,并构建样本以促使模型生成实际攻击,同时在我们的环境中使用动态指标。我们进行了大量实验,并展示SecCodePLT在安全相关性方面优于最先进的基准CyberSecEval。此外,它更好地识别了最先进模型在不安全编码和网络攻击帮助方面的安全风险。最后,我们将SecCodePLT应用于最先进的代码代理Cursor,并首次确定了这一先进编码代理中的非平凡安全风险。
English
Existing works have established multiple benchmarks to highlight the security
risks associated with Code GenAI. These risks are primarily reflected in two
areas: a model potential to generate insecure code (insecure coding) and its
utility in cyberattacks (cyberattack helpfulness). While these benchmarks have
made significant strides, there remain opportunities for further improvement.
For instance, many current benchmarks tend to focus more on a model ability to
provide attack suggestions rather than its capacity to generate executable
attacks. Additionally, most benchmarks rely heavily on static evaluation
metrics, which may not be as precise as dynamic metrics such as passing test
cases. Conversely, expert-verified benchmarks, while offering high-quality
data, often operate at a smaller scale. To address these gaps, we develop
SecCodePLT, a unified and comprehensive evaluation platform for code GenAIs'
risks. For insecure code, we introduce a new methodology for data creation that
combines experts with automatic generation. Our methodology ensures the data
quality while enabling large-scale generation. We also associate samples with
test cases to conduct code-related dynamic evaluation. For cyberattack
helpfulness, we set up a real environment and construct samples to prompt a
model to generate actual attacks, along with dynamic metrics in our
environment. We conduct extensive experiments and show that SecCodePLT
outperforms the state-of-the-art (SOTA) benchmark CyberSecEval in security
relevance. Furthermore, it better identifies the security risks of SOTA models
in insecure coding and cyberattack helpfulness. Finally, we apply SecCodePLT to
the SOTA code agent, Cursor, and, for the first time, identify non-trivial
security risks in this advanced coding agent.Summary
AI-Generated Summary