Capability Thresholds and Sanitisation Blind Spots in LLM-Assisted Vulnerability Detection: A Factorial Prompt Study on a Reconstructed PHP Benchmark
Abstract
Prompt engineering is widely assumed to improve large language model (LLM) performance on code security tasks, yet the conditions under which it can do so remain uncharacterised. We evaluate a fully crossed $5\times 2$ prompt factorial, five structural variants with and without category naming, on a reconstructed 360-sample PHP benchmark drawn from the NIST Software Assurance Reference Dataset, balanced 180/180 across OS command injection (CWE-78), SQL injection (CWE-89) and remote file inclusion (CWE-98). First, a task-specific capability threshold: GPT-3.5-turbo and GPT-4o-mini classify almost every sample as vulnerable (specificity at most 0.067, Matthews correlation near zero) and no pairwise comparison between prompt conditions is significant for either model, whereas GPT-5.5 discriminates (specificity 0.700 to 0.922, Matthews correlation up to 0.612). Below the threshold, prompt structure has no measurable effect. Second, above it, every elaboration we tested shifts verdicts toward Safe: the composite framework trades 21 missed vulnerabilities for 9 avoided false positives, and naming the category costs up to 64 detections while avoiding 35. Decomposition shows that taint-analysis instruction and chain-of-thought each produce this loss independently while the persona does not; the observed behaviour is consistent with the model treating a sanitiser’s presence as sufficient for safety rather than checking its fit to the sink. No condition improves on the unmodified baseline. Third, a systematic blind spot: the frontier model clears 94.3 percent of samples protected by type coercion or whitelisting but only 20.4 percent of those protected by escaping. We further document two benchmark defects that invert conclusions if uncorrected.