EUVIMEDEUVIMED entdecken
Crossref

Prompting Techniques for Secure Code Generation: A Systematic Investigation

Catherine Tony, Nicolás E. Díaz Ferreyra, Markus Mutas, Salem Dhif, Riccardo Scandariato

ACM Transactions on Software Engineering and Methodology · 30.11.2025 · 34 (8) · 1-53

DOI: 10.1145/3722108 ↗

Kurz gefasst

Fachartikel in der Zeitschrift ACM Transactions on Software Engineering and Methodology, online erschienen am 04.10.2025. Verfasst von Catherine Tony und 4 weiteren Autor:innen. Die Arbeit wurde bisher 34-mal zitiert (Crossref) und nennt 132 Literaturangaben. Gefördert von: EU-funded project Sec4AI4Sec: Cybersecurity for AI-Augmented Systems.

AbstractBibliografische AngabenZitierenVerwandte Studien

Abstract (Originalsprache)

Large Language Models (LLMs) are gaining momentum in software development with prompt-driven programming enabling developers to create code from Natural Language (NL) instructions. However, studies have questioned their ability to produce secure code and, thereby, the quality of prompt-generated software. Alongside, various prompting techniques that carefully tailor prompts have emerged to elicit optimal responses from LLMs. Still, the interplay between such prompting strategies and secure code generation remains under-explored and calls for further investigations.

Objective

In this study, we investigate the impact of different prompting techniques on the security of code generated from NL instructions by LLMs.

Method

First, we perform a systematic literature review to identify the existing prompting techniques that can be used for code generation tasks. A subset of these techniques are evaluated on GPT-3, GPT-3.5, and GPT-4 models for secure code generation. For this, we used an existing dataset consisting of 150 NL security-relevant code generation prompts.

Results

Our work (i) classifies potential prompting techniques for code generation (ii) adapts and evaluates a subset of the identified techniques for secure code generation tasks, and (iii) observes a reduction in security weaknesses across the tested LLMs, especially after using an existing technique called Recursive Criticism and Improvement (RCI), contributing valuable insights to the ongoing discourse on LLM-generated code security.

Förderung

  • EU-funded project Sec4AI4Sec: Cybersecurity for AI-Augmented Systems

Zitieren

APA

Tony, C., Ferreyra, N. E. D., Mutas, M., Dhif, S., & Scandariato, R. (2025). Prompting Techniques for Secure Code Generation: A Systematic Investigation. ACM Transactions on Software Engineering and Methodology, 34(8), 1-53. https://doi.org/10.1145/3722108

Vancouver

Tony C, Ferreyra NED, Mutas M, Dhif S, Scandariato R. Prompting Techniques for Secure Code Generation: A Systematic Investigation. ACM Transactions on Software Engineering and Methodology. 2025;34(8):1-53. doi:10.1145/3722108

BibTeX
@article{Tony2025,
  author = {Tony, Catherine and Ferreyra, Nicolás E. Díaz and Mutas, Markus and Dhif, Salem and Scandariato, Riccardo},
  title = {Prompting Techniques for Secure Code Generation: A Systematic Investigation},
  journal = {ACM Transactions on Software Engineering and Methodology},
  year = {2025},
  volume = {34},
  number = {8},
  pages = {1--53},
  doi = {10.1145/3722108}
}
Kostenlos starten →