Puls Dane publiczne, aktualizowane automatycznie
arXiv – nowe publikacje publikacja

Prompt Structure Redistributes, Not Reduces: An Empirical Analysis of Security-Weaknesses in LLM-Generated Python Code

[Kryptografia i bezpieczeństwo] Autorzy: Maitreyee Das Urmi, Jessica Pourleyli, Fabio Santos i 1 więcej

Large Language Models (LLMs) increasingly generate code from natural-language prompts, making prompt engineering a key mechanism for shaping the security of generated software. Structured and security-oriented prompts are widely used to encourage safer code, yet their effects extend beyond whether detected weaknesses are simply present or absent. Using 424 security-sensitive Python tasks, we generate solutions with GPT-4o and LLaMA 3.1-8B under five prompt variants that progressively add structural and security guidance, and evaluate them with Bandit and CodeQL along two axes: generation compliance and security weakness prevalence, severity, and CWE distributions. Structured prompting substantially reduces refusals (e.g., GPT-4o invalid outputs drop from 338 of 424 to 37-52), enabling large-scale analysis, but security-oriented refinements do not consistently reduce overall weakness pre…

Kategoria arxiv
cs.CR
Kategoria
Kryptografia i bezpieczeństwo
Pdf
https://arxiv.org/pdf/2608.24857v1

Otwórz oryginał w źródle ↗

Więcej z tego źródła

Wszystkie