Work

Security Flaws In Generative AI Code : Evaluating Prompt Strategies and Model Parameters in Python

Year: 2025
Type: dissertation
Abstract: This study further investigates security risks in code generated by LLMs, focused on how adjusting prompt design and model parameters can influence the occurrence of security vulnerabilities in the output. By generating Python functions with prompts using OpenAI's API call, and analyzing the output with Bandit, a static analysis tool for Python code. The findings suggest that adopting prompt strategies had a very noticeable impact on the reduction of security risks appearing in the code, at roughly tenfold less than the counterpart i.e. not adopting prompt strategies. While prompt engineering had a profound effect, the same thing didn’t apply for adjusting the models parameter; there were some small differences, but not large enough variability to draw a definite conclusion. Despite generating code throughout over dozen of different categories with their unique distinct prompt style coupled with parameter settings. Security risks still appeared on all batches of categories. This emphasizes that code output needs for continued human or security tool analysis review before deployment, as generative AI isn’t at a point for being to flawlessly produce perfect code, yet.
Authors: Trieu Hung Tran, Elvis, Diep, Erik
Language: English
Open Access status: green
OpenAlex ID: W7033932835
Cites: 27
Cited by:
Related to: 10