Skip to content

SecDrift: Measuring Sector-Conditioned Security Drift in AI-Generated Code

Jul 2026 · arXiv.org · Vol abs/2607.25225 · 0 citations · 14 references
Computer Science

TL;DR

SecDrift, a benchmark measuring sector-conditioned security drift, is presented: the change in static-analysis vulnerability rates when prompts are conditioned on industry contexts versus neutral baselines and model selection has a large and consistent effect.

Abstract

LLMs are increasingly used for code generation in critical infrastructure, yet the security effect of domain-specific prompting is understudied. We present SecDrift, a benchmark measuring sector-conditioned security drift: the change in static-analysis vulnerability rates when prompts are conditioned on industry contexts versus neutral baselines. We evaluate 7 LLMs (6 producing analyzable code) across 8 CISA critical infrastructure sectors and 9 CWE categories with 5 replicates (5,355 evaluations), using a 5-dimension transformation with a matched-baseline condition that holds the task fixed while substituting only domain terminology. Industry prompts naively appear more secure (14.0% vs. 11.4%, -2.7pp), but the gap is not statistically significant (Fisher's exact p = 0.24, Cohen's h = -0.08) and is a composition artifact of two CWE categories: excluding CWE-502 and CWE-22 eliminates and slightly reverses it (+0.4pp, p = 1.00). A mixed-effects logistic regression confirms sector identity is not a moderator and localizes the only detectable condition effect to those two vulnerability types. 0 of 8 sectors show drift distinguishable from baseline, corrected or uncorrected (|h|<0.15). A placebo on two non-CISA sectors (e-commerce, online education) reproduces the CISA industry rate almost exactly (10.5% vs. 11.4%, p = 0.63): the small pooled pattern reflects generic industry-framing specificity, not critical-infrastructure identity. In contrast, model selection has a large and consistent effect: among full-output models vulnerability rates range from 11.6% to 16.1%, and these differences persist across conditions. Model choice, not prompt framing, is the more reliable security lever. We release the framework, prompts, generated code, findings, human-validation verdicts, and analysis scripts.

View source

Similar papers

#artificial intelligence Preprint Aug 2026

Compared to What? A Human-Anchored Security Benchmark for LLM-Generated Infrastructure-as-Code

GenIaC-SecBench is introduced, a benchmark of 100 deployment scenarios stratified by architectural complexity, evaluated across 12 model configurations from four vendors, producing 1,196 IaC artifacts scanned by three independent policy engines (Checkov, Trivy, KICS).

Animesh Shaw · 1 citation
Preprint Aug 2026

A Case-Control Measurement Study of OSINT Source Effectiveness for Critical Infrastructure Defense

Across 54 confirmed CI cyberattacks from 2010 through 2024 spanning twelve named CI sectors plus a cross-sector category, paired with 12 null-control vulnerability cases drawn from the same source space, this work audit per-source attack coverage, null-case contamination, and signal lead time for ten public OSINT sourc...

E. Emeksiz, Jeel Piyushkumar Khatiwala, Divyangkumar Patel et al. · 1 citation
#small language model Preprint Sep 2026

PrivEscalate: Measuring and Augmenting the Threat of LLM-Automated Linux Privilege Escalation

PrivEscalate is presented, a large-scale benchmark for Linux privilege escalation, comprising 531 Dockerized scenarios spanning 14 sub-categories and PrivEscalate, a domain-specialized wrapper that augments a generic ReAct agent with deterministic enumeration, category matching, and step planning that improves over pri...

Yi-Xuan Liu, Zi-Long Zhen, Yin Wu et al. · 0 citations
Review Open access Aug 2026

Defensive Reverse Engineering of LLM Applications: A Black-Box Framework for Security Risk Scoring and Mitigation

D-RELLM is presented, a defensive reverse-engineering framework for black-box security assessment of deployed LLM applications that treats the deployed application as a socio-technical system whose risk depends on instruction hierarchy, retrieval trust, authorization, tool agency, output handling, monitoring, and opera...

Bhavesh B. Prajapati, Bhavya Shah · 0 citations

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.