Navigating (in)Security of AI-Generated Code
The increasing use of large language models (LLMs) such as OpenAI's ChatGPT and Google's Bard in the software development industry raise questions about the security of generated code. Our research evaluates Java, C, and Python code samples that were generated by these LLMs. In our investigation, we assessed the consistency of code samples generated by each LLM, characterized the security of generated code, and asked both LLMs to evaluate and fix the weaknesses of their own generated code as well as the code of the other LLM. Using 133 unique prompts from Google Code Jam competitions, we produced 3,854 code samples across three distinct programming languages. We found that the code produced by these LLMs is frequently insecure and prone to weaknesses and vulnerabilities. This concerns human developers who must exercise caution while employing these LLMs.
Authors
- Norah Ridley (ORCID: https://orcid.org/0000-0001-7662-5160)
- Natalia Stakhanova (ORCID: https://orcid.org/0000-0003-1923-319X)
- Enrico Branca (ORCID: https://orcid.org/0000-0001-6316-7789)
- Sri Haritha Ambati
Institutions
- University of Saskatchewan (CA)
Publication Details
- Published
- 2024-09-02
- DOI
- https://doi.org/10.1109/csr61664.2024.10679468
- Citations
- 5
- Primary Topic
- Ethics and Social Impacts of AI
- Type
- article
- Field-Weighted Citation Impact
- 2.63