← Lab /AI/ML

Security-aware prompts halve confirmed vulnerabilities in generated web apps

Appending a security-requirements section to prompts reduces confirmed findings from 51 to 24 and eliminates Critical/High issues

AI/ML arXiv 21 Aug 2026 Measurement Prototype evidence

Published as “Vibe Coding and Web Application Security: A Twin-Prompt Study”

Why it matters

A simple, untuned security-requirements addition to the prompt can substantially improve the security posture of LLM-generated web applications, suggesting an easy mitigation for practitioners.

Summary

Security-aware prompting cut the number of confirmed vulnerabilities in half, from 51 findings in the baseline variants to 24 in the security-aware variants, and eliminated all Critical and High-severity issues. The study examined twelve LLM-generated web apps (six pairs) using static, dependency, dynamic and manual analyses, and found that the prompt was the only systematic difference between each pair. Evidence is limited to a single generation per variant and a small, bespoke corpus, so the results are descriptive rather than statistically proven.

What they found 2

  1. Security-aware prompting reduced confirmed findings from 51 to 24 across the corpus, halving the mean per app from 8.5 to 4.0.

    “The security-aware variant produced fewer confirmed findings than its baseline twin in every application: 51 across the A variants against 24 across the B variants, a mean of 8.5 against 4.0 per application (Table 5).”

  2. No Critical or High-severity findings remained in the security-aware variants, whereas all such findings were present in the baseline variants.

    “The B variants contain no Critical- or High-severity confirmed finding, whereas the A variants account for both Critical findings and all eleven High findings (Fig. 1).”

Caveats 5

  • Each variant was generated exactly once and LLM output is non-deterministic, so part of any A-B difference may be run-to-run variation rather than an effect of the prompt.
  • Because of the small sample we report descriptive figures only and apply no significance test; with six pairs and one observation per cell, no inferential procedure would carry meaningful power.
  • The corpus is small and bespoke: six applications, two languages, three frameworks, all generated by one assistant and one model version, from tasks written by the author rather than taken from a public benchmark.
  • Functional parity between the members of a pair was established at smoke-test level rather than by a shared test suite, so residual functional differences within a pair cannot be excluded.
  • Severity ratings and OWASP/CWE mappings were assigned by a single analyst and are partly subjective, and the decision to de-duplicate by vulnerability class rather than by tool alert determines the counts.

What’s new here 4

  • Introduces a twin-prompt experimental design that isolates the prompt as the sole variable between generated applications.
  • Applies a multi-method analysis pipeline (SAST, DAST, SCA, manual testing) to whole, deployable web applications rather than isolated functions.
  • Provides a verified, deduplicated findings dataset mapped to OWASP and CWE for the generated apps.
  • Demonstrates that a single, untuned security-requirements section can remove all Critical and High-severity findings in this setting.