REVIEW 4 major objections 5 minor 1 cited by
Explicit Vulnerability Generation with LLMs: An Investigation Beyond Adversarial Attacks
T0 review · 4 major / 5 minor · reviewed 2026-08-06 · deepseek-v4-flash
Pith's one-line read Open-source 7B LLMs frequently generate specific vulnerabilities when explicitly asked, with buffer-overflow correctness reaching 98.6% under template prompting.
desk verdict Useful conditional-correctness data on explicit vulnerability solicitation, but the abstract oversells it as absolute success rates. read the letter →
The pith
A machine-rendered reading of the paper's core claim, the machinery that carries it, and where it could break.
The reading
What carries the argument
The experimental machinery has three load-bearing parts. Dynamic Prompting systematically combines four controlled variables—vulnerability type, user persona, application context, and prompt directness—into 2,040 structured prompts that explicitly ask for vulnerable code. Reverse Prompting uses a commercial LLM to convert 1,250 vulnerable C programs from the FormAI-v2 dataset into natural-language developer prompts, and records the cyclomatic complexity of the source code as a covariate. Correctness is judged by compiling the generated code and running ESBMC, a static analyzer that identifies the presence and type of each of the five vulnerability classes; the rates reported in the paper are computed over outputs that already contain a detectable vulnerability. That last detail matters: ESBMC serves as the oracle for both "vulnerability presence" and "type alignment", and the cyclomatic complexity bins drive the non-linear accuracy curve the paper reports.
What would settle it
Take the same 2,040 Dynamic and 1,250 Reverse prompts, compile each generated program, and add a dynamic check that feeds crafted inputs (for example, oversized strings for buffer overflows) to see whether the flagged vulnerability actually triggers a crash or memory error; if the dynamically confirmed rates do not reproduce the paper's per-type ordering, especially Gemma's 98.6% buffer-overflow figure, the central claim would be falsified.
Extended reading notes
Core claim
On its own terms, this paper establishes that explicit, non-adversarial prompts are sufficient to obtain targeted vulnerable code from three open-source 7B-parameter code models. The authors report that under Dynamic Prompting, correctness for memory-safety vulnerabilities is high—Gemma reaches 98.6% for buffer overflows and 97.1% for dereference failures—while arithmetic and temporal flaws such as integer overflow and use-after-free are rarely reproduced (often below 10%). Professional personas consistently raise success rates, and the effect of direct versus indirect phrasing is inverted across the two prompting strategies. Misalignment analysis shows that when a model fails to produce the requested vulnerability, it falls back to Null Pointer Dereference under Dynamic Prompting and to a scanf-based Buffer Overflow under Reverse Prompting, which the authors read as signatures of pattern recall. The authors thus claim that current safety alignments are brittle against plausible professional framing.
Load-bearing premise
The reported rates assume the static analyzer used to label generated code identifies the presence and type of each vulnerability correctly; if those labels are wrong or systematically biased, every per-type, per-persona, and per-complexity comparison in the paper could change, especially since the paper never verifies runtime exploitability.
Editorial extensions
If this is right
- If the rates hold, any user with local access to a 7B open-source model can obtain targeted memory-safety bugs on demand without adversarial prompting techniques.
- Professional personas (DevOps Engineer, Software Engineer, Pen Tester) turn out to be a reliable compliance lever, suggesting enterprise-style framing bypasses existing safety filters more easily than student-style requests.
- The direct/indirect phrasing inversion implies that no single prompt style is universally risky; effectiveness depends on whether the prompt is template-generated or derived from real code.
- The fallback patterns (Null Pointer Dereference under Dynamic, scanf-based Buffer Overflow under Reverse) mean failed attempts still produce a plausible vulnerability, just not the requested one.
- Vulnerability reproduction is most accurate for moderate code complexity (cyclomatic complexity 20–30), suggesting reverse-prompt risk is highest for mid-size snippets.
Reading between the lines
- A natural extension would replace the static-analysis oracle with dynamic exploit checks (e.g., feeding crafted inputs to the generated programs) to see whether the 98.6% buffer-overflow rate translates into actually crash-triggering code; this is the paper's own stated validity limitation.
- The pattern-recall interpretation suggests a testable prediction: fine-tuning on a small set of vulnerability-free memory-safety examples should sharply reduce the scanf-based fallback, while leaving the persona effect intact—something the paper does not run.
- The persona effect could extend beyond code generation to other safety domains (e.g., phishing emails or exploit scripts), where "professional role" framing might similarly disarm alignment; nothing in the paper's mechanism limits the effect to C programs.
- The cyclomatic complexity curve implies that benchmark designers should stratify reverse-prompt datasets by complexity; otherwise, a dataset heavy at CC 20–30 could inflate apparent compliance rates.
Editorial analysis
A structured set of objections, weighed in public.
Referee Report
Summary. This paper reports an empirical study of whether three open-source 7B-parameter LLMs (Qwen2-7B, Mistral-7B, Gemma-7B) generate C code containing five requested vulnerability classes when explicitly prompted. It introduces Dynamic Prompting, which varies vulnerability type, persona, and directness across 2,040 structured templates per model, and Reverse Prompting, which derives 1,250 natural-language prompts from FormAI-v2 vulnerable code samples via Gemini 1.5. Outputs are compiled (with missing headers repaired) and analyzed with ESBMC; the paper reports vulnerability presence and type correctness, persona and directness effects, complexity effects, and misalignment fallback patterns. The evaluation tables condition on outputs that already contain a detectable vulnerability, and Section V acknowledges that ESBMC is not supplemented by dynamic exploit verification.
Significance. If the headline results hold after reanalysis, the paper makes a useful contribution: it documents that locally runnable open-weight models are willing to produce explicit memory-safety vulnerabilities under non-adversarial professional framing, and it shows systematic type-dependent and persona-dependent variation. The dual-prompt design, the use of structured templates, and the public replication package are genuine strengths, as is the attention to misalignment fallback patterns rather than only aggregate compliance. However, the paper's current presentation overstates per-prompt success rates, and the absence of uncertainty quantification and oracle validation means the comparative claims are not yet established at the paper's stated confidence. The work is within the scope of empirical software engineering and AI safety, and with the required reanalysis it could be a solid reference point for further studies.
major comments (4)
- [Section IV, paragraph before RQ1] The manuscript explicitly states that all subsequent tables use as denominator only instances containing any detectable vulnerability (the sum of Correct and Wrong in Figure 5). Therefore Table I's 98.6% buffer-overflow rate for Gemma under Dynamic Prompting is 424/430 outputs that already triggered some ESBMC finding, not the probability that a buffer-overflow prompt yields a correct vulnerable program. The same conditioning applies to Tables II and III, so the abstract's "frequently generate" and the claim that professional personas "consistently elicit higher success rates" are not established as absolute per-prompt frequencies: a model that rarely produces vulnerable code but is type-accurate when it does would look identical in these tables. Please report per-condition absolute rates with the full per-prompt denominator, or present a joint analysis of vulnerability presence and type alignment, and re-derive the persona and directness conclusions from those rates.
- [Section IV, RQ2 (Tables II and III)] The persona and directness comparisons are presented without any uncertainty quantification. Many cells have small denominators, e.g., Table I Reverse Dereference Failure shows 8/17 for Mistral and 19/38 for Gemma, and Table II Reverse Student shows 20/49 for Mistral. The claimed "consistently" persona ordering and the direct/indirect inversion could be within sampling noise. Please add confidence intervals or exact tests (for example Fisher's exact test) for the relevant pairwise comparisons, and state how multiple comparisons are handled.
- [Section V, Internal Validity] ESBMC is the single oracle for vulnerability presence and type, and Section V concedes that there is no dynamic exploit verification. Because Tables I-III and Figure 5 are built entirely from ESBMC categories, systematic per-type misclassification (for example, confusion between buffer overflows and out-of-bounds accesses, or null-dereference false positives) could change the per-type rankings, the direct/indirect inversion, and the fallback analysis in Table IV. Please validate the oracle on a random sample of outputs in each category, ideally with runtime checkers such as AddressSanitizer/UBSan on compilable outputs, and report ESBMC precision and recall per vulnerability class.
- [Section IV, RQ4 and Figure 6] The non-linear complexity claim depends on arbitrary cyclomatic-complexity bucket boundaries and on very small samples in the high-complexity buckets, which the authors themselves flag (e.g., N=14 at [35,40) and N=3 at [50,100)). With no sensitivity analysis over binning, the claimed peak at CC [20,30) may be an artifact of the chosen boundaries. Please provide per-sample values or an alternative binning, and report the number of observations in every bucket for every model.
minor comments (5)
- [Section III vs. Section IV] The methodology defines RQ3 as the persona/directness analysis, but Section IV labels that subsection RQ2 and then jumps to RQ4; the RQ numbering should be made consistent.
- [Table IV] The asterisk on Gemma's 91 Arithmetic-Overflow-to-Buffer-Overflow count has no corresponding footnote; either add one or remove the marker.
- [Contributions vs. Section V] The contribution list describes Reverse Prompting as deriving prompts from "existing vulnerable code samples," while Section V clarifies that the samples come from the synthetic FormAI-v2 dataset; the earlier wording should be aligned with that limitation.
- [Section V, Reliability] The Reliability paragraph mentions "inherent stochasticity," but the evaluation uses greedy decoding; the reproducibility statement should clarify that greedy decoding was used and that the release contains the exact templates and scripts.
- [Section III, Experimental Pipeline] The procedure for "missing headers added when necessary" should be specified in more detail (which headers, by what rule), since manual repair can affect both compilability and ESBMC results.
Circularity Check
No circularity found: the study is an empirical measurement whose correctness labels come from an independent static analyzer, and the reverse-prompting loop is disclosed and does not force the reported outcomes.
full rationale
The paper contains no derivation chain that reduces to its own inputs. It is an empirical measurement: prompts are constructed either from fixed templates or generated by Gemini from FormAI-v2 samples, then three open-source models (none of which is Gemini) are queried, and outputs are classified by the external ESBMC static analyzer. Correctness is operationally defined as compiling and containing the requested vulnerability type, or matching the source sample's vulnerability type in the reverse-prompting condition; this definition does not make any reported rate true by construction. The only mildly self-referential element is that Gemini derives reverse prompts from the same FormAI-v2 samples whose vulnerability labels later define correctness, but the evaluated models are different from the prompt generator and the labels come from ESBMC, not from the prompt-generation process, so the loop does not force the result. The conditional denominator (only outputs already found vulnerable) is explicitly disclosed in Section IV and weakens absolute-frequency interpretations, but that is a statistical framing issue, not circular reasoning. There are no self-citations to the authors' prior work, no imported uniqueness theorem, no fitted parameter renamed as a prediction, and no ansatz smuggled in via citation. The 'pattern recall' conclusion is an interpretation of the observed fallback distributions, not a premise used to derive those distributions. Therefore, the paper is self-contained against external benchmarks and receives a score of 0.
Assumptions & free parameters
free parameters (1)
- Cyclomatic complexity bucket boundaries =
[0-5), [5-10), ..., [50,100)
assumptions (3)
- domain assumption ESBMC static analysis correctly identifies the presence and type of the five targeted vulnerability classes in generated C code, including after manual header repair.
- domain assumption Reverse prompts generated by Gemini 1.5 from FormAI-v2 code samples are representative of how real developers would ask for the vulnerable functionality.
- domain assumption Greedy decoding with the prompt templates reflects typical or safety-relevant use of these models.
Cite this review
Pith. "Pith review of Explicit Vulnerability Generation with LLMs: An Investigation Beyond Adversarial Attacks." pith.science (2026). https://pith.science/paper/WCMCXVDN
@misc{pith2026250710054,
author = {Pith},
title = {Pith review of: Explicit Vulnerability Generation with LLMs: An Investigation Beyond Adversarial Attacks},
year = {2026},
howpublished = {\url{https://pith.science/paper/WCMCXVDN}},
note = {Machine review of arXiv:2507.10054}
}
read the original abstract
Large Language Models (LLMs) are increasingly used as code assistants, yet their behavior when explicitly asked to generate insecure code remains poorly understood. While prior research has focused on unintended vulnerabilities, this study examines a more direct threat: open-source LLMs generating vulnerable code when prompted. We propose a dual experimental design: (1) Dynamic Prompting, which systematically varies vulnerability type, user persona, and prompt phrasing across structured templates; and (2) Reverse Prompting, which derives natural-language prompts from real vulnerable code samples. We evaluate three open-source 7B-parameter models (Qwen2, Mistral, Gemma) using static analysis to assess both the presence and correctness of generated vulnerabilities. Our results show that all models frequently generate the requested vulnerabilities, though with significant performance differences. Gemma achieves the highest correctness for memory vulnerabilities under Dynamic Prompting (e.g., 98.6% for buffer overflows), while Qwen2 demonstrates the most balanced performance across all tasks. We find that professional personas (e.g., "DevOps Engineer") consistently elicit higher success rates than student personas, and that the effectiveness of direct versus indirect phrasing is inverted depending on the prompting strategy. Vulnerability reproduction accuracy follows a non-linear pattern with code complexity, peaking in a moderate range. Our findings expose how LLMs' reliance on pattern recall over semantic reasoning creates significant blind spots in their safety alignments, particularly for requests framed as plausible professional tasks.
Figures
Figures from the paper (3 more)
Forward citations
Cited by 1 Pith paper
-
Probabilistic Concept-Aware Steering for Trustworthy LLM Inference
PCS improves steering direction accuracy by adaptively sampling the intervention coefficient from a cosine-similarity-conditioned Gaussian, but its evaluation is partly circular because the optimal coefficient is chos...
Reference graph
Works this paper leans on
-
[1]
Large language models for software engineering: Sur- vey and open problems,
A. Fan, B. Gokkaya, M. Harman, M. Lyubarskiy, S. Sengupta, S. Yoo, and J. M. Zhang, “Large language models for software engineering: Sur- vey and open problems,” in 2023 IEEE/ACM International Conference on Software Engineering: Future of Software Engineering (ICSE-FoSE). IEEE, 2023, pp. 31–53
2023
-
[2]
Large language models for software engi- neering: A systematic literature review,
X. Hou, Y . Zhao, Y . Liu, Z. Yang, K. Wang, L. Li, X. Luo, D. Lo, J. Grundy, and H. Wang, “Large language models for software engi- neering: A systematic literature review,” ACM Transactions on Software Engineering and Methodology , vol. 33, no. 8, pp. 1–79, 2024
2024
-
[4]
A. Haque, S. Siddique, M. M. Rahman, A. R. Hasan, L. R. Das, M. Kamal, T. Masura, and K. D. Gupta, “Sok: Exploring hallucinations and security risks in ai-assisted software development with insights for llm deployment,” arXiv preprint arXiv:2502.18468 , 2025
work page Pith review arXiv 2025
-
[5]
Do users write more insecure code with ai assistants?
N. Perry, M. Srivastava, D. Kumar, and D. Boneh, “Do users write more insecure code with ai assistants?” in Proceedings of the 2023 ACM SIGSAC Conference on Computer and Communications Security. ACM, Nov. 2023, p. 2785–2799. [Online]. Available: http://dx.doi.org/10.1145/3576915.3623157
arXiv 2023
-
[6]
How secure is ai-generated code: a large-scale comparison of large language models,
N. Tihanyi, T. Bisztray, M. A. Ferrag, R. Jain, and L. Cordeiro, “How secure is ai-generated code: a large-scale comparison of large language models,” Empirical Software Engineering , vol. 30, no. 47,
-
[7]
Large language model for vulnerability detection and repair: Literature review and the road ahead,
X. Zhou, S. Cao, X. Sun, and D. Lo, “Large language model for vulnerability detection and repair: Literature review and the road ahead,” ACM Transactions on Software Engineering and Methodology , 2024
work page 2024
-
[8]
Promptbench: Towards evaluating the robustness of large language models on adversarial prompts,
K. Zhu et al. , “Promptbench: Towards evaluating the robustness of large language models on adversarial prompts,” arXiv preprint arXiv:2306.04528, 2023
arXiv 2023
-
[9]
Codeattack: Code-based adversarial attacks for pre-trained programming language models,
A. Jha and C. Reddy, “Codeattack: Code-based adversarial attacks for pre-trained programming language models,” in Proceedings of the AAAI Conference on Artificial Intelligence , vol. 37, 2023, pp. 14 892–14 900
work page 2023
Show all 27 references
-
[10]
Universal and transferable adversarial attacks on aligned language models,
A. Zou, Z. Wang, N. Carlini, M. Nasr, J. Z. Kolter, and M. Fredrikson, “Universal and transferable adversarial attacks on aligned language models,” arXiv preprint arXiv:2307.15043 , 2023
2023 arXiv
-
[11]
Code red! on the harmfulness of applying off-the-shelf large language models to programming tasks,
A. Al-Kaswan, S. Deatc, B. Koc ¸, A. van Deursen, and M. Izadi, “Code red! on the harmfulness of applying off-the-shelf large language models to programming tasks,” arXiv preprint arXiv:2504.01850 , 2025
2025 arXiv
-
[12]
Smoke and mirrors: Jailbreaking llm-based code generation via implicit malicious prompts,
S. Ouyang, Y . Qin, B. Lin, L. Chen, X. Mao, and S. Wang, “Smoke and mirrors: Jailbreaking llm-based code generation via implicit malicious prompts,” arXiv preprint arXiv:2503.17953 , 2025
2025 arXiv
-
[13]
Rmcbench: Benchmarking large language models’ resistance to malicious code,
J. Chen, Q. Zhong, Y . Wang, K. Ning, Y . Liu, Z. Xu, Z. Zhao, T. Chen, and Z. Zheng, “Rmcbench: Benchmarking large language models’ resistance to malicious code,” in Proceedings of the 39th IEEE/ACM International Conference on Automated Software Engineering, 2024, pp. 995–1006
2024
-
[14]
Prompting techniques for secure code generation: A systematic investigation,
C. Tony, N. E. D. Ferreyra, M. Mutas, S. Dhiff, and R. Scandariato, “Prompting techniques for secure code generation: A systematic investigation,” 2025. [Online]. Available: https://arxiv.org/abs/2407. 07064
2025
-
[15]
Insights and current gaps in open-source llm vulnerability scanners: A comparative analysis,
J. Brokman et al. , “Insights and current gaps in open-source llm vulnerability scanners: A comparative analysis,” arXiv preprint arXiv:2410.16527, 2024. [Online]. Available: https://doi.org/10.48550/ arXiv.2410.16527
-
[16]
Large language models and code security: A systematic literature review,
Basic and A. Giaretta, “Large language models and code security: A systematic literature review,” arXiv preprint arXiv:2412.15004 , Dec
-
[17]
Do llms consider security? an empirical study on responses to programming questions,
A. Sajadi, B. Le, A. Nguyen, K. Damevski, and P. Chatterjee, “Do llms consider security? an empirical study on responses to programming questions,” Empirical Software Engineering , vol. 30, no. 3, p. 101,
-
[18]
Attribution-guided adversarial code prompt generation for code completion models,
X. Li, G. Meng, S. Liu, L. Xiang, K. Sun, K. Chen, X. Luo, and Y . Liu, “Attribution-guided adversarial code prompt generation for code completion models,” in Proceedings of the 39th IEEE/ACM International Conference on Automated Software Engineering , 2024, p. 1460–1471. [Onl...
2024
-
[19]
Survey of vulnerabilities in large language models revealed by adversarial attacks,
E. Shayegani, M. A. A. Mamun, Y . Fu, P. Zaree, Y . Dong, and N. Abu-Ghazaleh, “Survey of vulnerabilities in large language models revealed by adversarial attacks,” 2023. [Online]. Available: https://arxiv.org/abs/2310.10844
2023 arXiv
-
[20]
Available: https://doi.org/10.1007/s10664-025-10658-6
[Online]. Available: https://doi.org/10.1007/s10664-025-10658-6
-
[21]
Secreevalbench: A multi-turned security resilience evaluation benchmark for large language models,
H. Cui and W. Liu, “Secreevalbench: A multi-turned security resilience evaluation benchmark for large language models,” 2025. [Online]. Available: https://arxiv.org/abs/2505.07584
2025
-
[22]
Vulgen: Realistic vulnerability generation via pattern mining and deep learning,
Y . Nong, Y . Ou, M. Pradel, F. Chen, and H. Cai, “Vulgen: Realistic vulnerability generation via pattern mining and deep learning,” in 2023 IEEE/ACM 45th International Conference on Software Engineering (ICSE). IEEE, 2023, pp. 2527–2539
2023
-
[23]
Analysing safety risks in llms fine-tuned with pseudo-malicious cyber security data,
A. ElZemity, B. Arief, and S. Li, “Analysing safety risks in llms fine-tuned with pseudo-malicious cyber security data,” 2025. [Online]. Available: https://arxiv.org/abs/2505.09974
2025
-
[24]
A prompt pattern catalog to enhance prompt engineering with chatgpt,
J. White, Q. Fu, S. Hays, M. Sandborn, C. Olea, H. Gilbert, A. El- nashar, J. Spencer-Smith, and D. C. Schmidt, “A prompt pattern catalog to enhance prompt engineering with chatgpt,” arXiv preprint arXiv:2302.11382, 2023
2023 arXiv
-
[25]
ESBMC: Efficient SMT-Based Context-Bounded Model Checker,
ESBMC Developers, “ESBMC: Efficient SMT-Based Context-Bounded Model Checker,” https://github.com/esbmc/esbmc, 2024, accessed: 2025-05-20
2024
-
[26]
Vgx: Large-scale sample generation for boosting learning-based software vul- nerability analyses,
Y . Nong, R. Fang, G. Yi, K. Zhao, X. Luo, F. Chen, and H. Cai, “Vgx: Large-scale sample generation for boosting learning-based software vul- nerability analyses,” in Proceedings of the IEEE/ACM 46th International Conference on Software Engineering , 2024, pp. 1–13
2024
-
[2024]
Available: https://doi.org/10.48550/arXiv.2412.15004
[Online]. Available: https://doi.org/10.48550/arXiv.2412.15004
-
[2025]
Available: https://doi.org/10.1007/s10664-024-10590-1
[Online]. Available: https://doi.org/10.1007/s10664-024-10590-1
Reviewed August 6, 2026 · model on record in the stance chip above.
Discussion (0). Sign in to comment.