LLM Security Guard for Code

Arya Kavian,Mohammad Mehdi Pourhashem Kallehbasti,Sajjad Kazemi,Ehsan Firouzi,Mohammad Ghafari
DOI: https://doi.org/10.1145/3661167.3661263
2024-05-04
Abstract:Many developers rely on Large Language Models (LLMs) to facilitate software development. Nevertheless, these models have exhibited limited capabilities in the security domain. We introduce LLMSecGuard, a framework to offer enhanced code security through the synergy between static code analyzers and LLMs. LLMSecGuard is open source and aims to equip developers with code solutions that are more secure than the code initially generated by LLMs. This framework also has a benchmarking feature, aimed at providing insights into the evolving security attributes of these models.
Software Engineering,Cryptography and Security
What problem does this paper attempt to address?
The paper primarily focuses on the security issues of large language models (LLMs) in code generation. Specifically, although LLMs like ChatGPT are widely used in software development activities such as coding and design understanding, these models have limited performance in the security domain, particularly in identifying and generating secure code. The paper introduces a framework called LLMSecGuard, which aims to improve the security of generated code by combining the capabilities of static code analyzers with LLMs. The main contributions of LLMSecGuard include: 1. **Enhancing Code Security**: By passing the code generated by LLMs to static code analysis tools for security checks and guiding LLMs to generate more secure code versions based on the detected issues. 2. **LLMs Security Benchmarking**: Providing a mechanism to evaluate the performance of different LLMs in terms of code security and to benchmark them so that developers can understand the security differences between various models. The paper also details the workflow of LLMSecGuard, including how to set it up, configure it, and its use cases (e.g., security benchmarking and secure code generation). Additionally, the paper mentions future research directions, such as evaluating the effectiveness of LLMSecGuard in actual development and integrating it into mainstream integrated development environments (IDEs) to improve user experience.