AI Is Writing Code Faster Than We Can Secure It: The New Software Security Paradox

Generating code is getting cheaper while reviewing, testing and owning it is not. This article separates what the research shows from what it does not, names the assurance bottlenecks, and proposes a way to measure whether your own team is ahead or behind.

In security programmes I have led, the most useful early question has never been "do you have a policy?" It has been "how many changes went to production last month, and how many of them did a second person actually understand?" Teams can usually answer the first number in seconds. The second takes an uncomfortable silence.

AI coding assistants have made that silence longer. A function that used to take an hour to write takes a minute to generate, and the review of that function still takes the time it takes. This is what I mean by the software security paradox: the tools that make us faster at producing software do not make us faster at establishing that the software is safe to run. They can even make the second job harder, because there is more of it and it arrives looking polished.

A note on how I will argue this. The research on AI and security is mixed, and I will present it that way. Where a point is my own analysis, I will label it. I will not give you an adoption statistic or a breach attribution I could not verify, and there are several things the public evidence cannot yet tell us.

Why this matters now

Three pressures arrive together.

First, volume. Assistants are now used for scaffolding, tests, refactoring, documentation and, increasingly, whole pull requests. Even if each individual suggestion were no worse than a human's, more suggestions mean more code to be reviewed, scanned and understood.

Second, accountability does not move. CISA and its international partners put the responsibility for security outcomes on the software producer in their secure-by-design principles 1. NIST's Secure Software Development Framework describes practices that are meant to be integrated into whatever lifecycle an organisation uses 2. Neither document contains an exception for code that a model wrote.

Third, attackers do not slow down because developers speed up. The 2026 Verizon Data Breach Investigations Report page states that 31% of breaches now begin with the exploitation of software vulnerabilities, which it describes as overtaking stolen passwords as the leading initial access method 3. I read that as context, not as a claim about AI: the report page does not say AI-generated code caused any of those breaches, and I am not suggesting it did. It does mean that every vulnerability we ship has a real chance of being used.

Background: what "faster" actually speeds up

It helps to split software delivery into producing and assuring.

Producing is writing, scaffolding and wiring up code. This is where assistants help most visibly, because the output is easy to see and the cost per unit has dropped.

Assuring is everything that gives you justified confidence that the thing does what it should and nothing it should not: threat modelling, review, testing, dependency vetting, release approval, monitoring, and knowing who owns the result. Assurance relies on attention, context and accountability, which are the resources that do not scale with a model's throughput.

The paradox is the mismatch. A pipeline is only as fast as its slowest stage, and if production gets ten times cheaper while assurance stays flat, the system either slows to the pace of assurance or quietly lets assurance degrade. In practice I see the second: review gets shallower, "looks fine" becomes the standard, and tests are generated by the same tool that generated the code. That observation is mine, drawn from programme work, not a measured finding.

Research analysis: what the evidence supports and what it does not

I will go through the main bodies of evidence and be explicit about their limits.

Is AI-generated code less secure?

An early study of GitHub Copilot examined code generated for scenarios tied to well-known weaknesses and found that around 40% of the generated programs were vulnerable 4. It tested one tool, in 2021, on a defined scenario set. It measures generated code, not shipped products.

A later empirical study looked at code snippets attributed to AI tools in real GitHub projects: 733 snippets from three tools. It reported that 29.5% of Python snippets and 24.2% of JavaScript snippets had security weaknesses, spanning 43 weakness categories, eight of which appeared in the 2023 CWE Top 25 list 5. The same study reported that, in its experiment, Copilot Chat could fix up to 55.5% of the security issues when given static analysis warnings 5. That last number matters for my argument, and I will come back to it.

A vendor report from Veracode states that AI-generated code introduced risky security flaws in 45% of tests, covering over 100 models and four languages 6. This is a vendor's own report, the page I read gives little methodological detail, and I treat it as indicative, not as settled.

Do assistants change how people behave?

A user study of programmers with and without an AI assistant found that participants with the assistant wrote less secure code and were more confident that their code was secure 7. It analysed 47 participants. It is the only study in this list that suggests a mechanism I find plausible and important: the risk is not only in the suggestion, it is in the relaxation of the reviewer.

Counter-evidence

Two other user studies point the other way. In one, 58 students writing C with an assistant had critical security bugs at a rate at most about 10% higher than controls, which the authors treat as a modest effect 8. In the other, 25 participants using Copilot produced more secure solutions on a harder problem and showed no effect on an easier one 9. These are small studies with specific populations and tasks.

My reading, as analysis: effects on security depend on the task, the tool, the user and, above all, the process around them. "AI code is insecure" and "AI code is as good as ours" are both too simple. The 55.5% figure in 5 is a good example of why: the same family of tools that can produce a weakness can also help repair it, when it is pointed at a scanner's output. The question is whether your pipeline has a scanner and a reviewer to point it at.

Is it making teams faster?

In a randomised trial, experienced open-source developers working in their own repositories took 19% longer with early-2025 AI tools while expecting to be faster 10. METR's page marks that result as out of date and points to a later update that I did not open, so I treat it as a data point about a period and a developer group, not as a verdict on AI tooling.

The DORA 2024 report's survey analysis associated higher AI adoption with a small negative estimate for delivery throughput and a larger negative estimate for delivery stability 11. It is correlational. The 2025 DORA report page describes AI's primary role as an amplifier, magnifying an organisation's existing strengths and weaknesses, and says the largest gains come from focusing on the underlying organisational system rather than the tools alone 12. I read only the report's landing page, not the full 2025 report, so I cite it for that framing and nothing more.

What this adds up to

QuestionWhat the sources supportWhat they do not support
Is generated code sometimes insecure?Yes, in several studies and one vendor report 456A universal rate; the figures vary by tool, language, year and method
Does assistance make people overconfident?One user study found it 7That every team or tool shows the effect
Is the effect always large?No: two studies found small or no effects 89That the effect is always small
Does AI make teams faster?Not uniformly: one trial found slower work for experienced developers 10That AI never helps; the trial's own page flags its age
Is delivery stability affected?A correlation with lower stability appeared in one survey 11A causal claim
Does the organisation matter?DORA frames AI as an amplifier of existing strengths and weaknesses 12A measured, universal effect size

Notice what is missing from the table: a study that measures, across organisations, the ratio of generation capacity to assurance capacity. I could not find one in the sources I verified. The paradox is therefore a hypothesis supported by mechanism and by scattered evidence, not an established fact. I think it is a good hypothesis, because each part of it is observable inside your own team. That is the thing worth doing.

Generation got cheap. Understanding, review and accountability did not, and the gap between them is where the risk now lives.
Akarsh N

Technical deep dive: where assurance capacity runs out

Here are the five places I see assurance capacity break first, in the order they usually fail.

  1. Reviewer attention. A reviewer reading a pull request is judging intent, edge cases and security properties. Fluent generated code reduces the visual cues that make a human slow down, such as odd naming or awkward structure. That connects to the confidence effect in 7. When pull request volume rises, review depth is the first thing to drop, and nobody measures it.
  1. Independent testing. If the assistant that wrote the code also writes its tests, both can inherit the same misreading of the requirement. The tests then assert what the code does, not what the system should do. I have seen this in review; I have no controlled study to cite, so read it as a hypothesis. The remedy is tests derived from requirements and abuse cases, written or reviewed by someone who did not generate the code.
  1. Design assumptions. OWASP's 2021 Top 10 draws a distinction I find useful: insecure design and insecure implementation are different problems with different fixes. A flawed design lacks the controls needed to stop certain attacks, so even perfect coding cannot repair it 13. Assistants are good at implementing what you describe and weaker at telling you which control your description left out. Threat modelling, which the Threat Modeling Manifesto frames around four questions (what are we working on, what can go wrong, what are we going to do about it, and did we do a good enough job) 14, remains a human activity because two of those four questions are about context and acceptable risk.
  1. Dependencies and provenance. Generated code pulls in libraries. Each library is a supply-chain decision that someone should have made on purpose. Article 03 goes deeper on this, including package names that models invent.
  1. Ownership. When a module was generated and merged under time pressure, the incident review six months later asks who understood it. If the answer is nobody, accountability has not been transferred to the tool; it has simply been lost.

A comparison: the same change in two pipelines

StagePipeline A: output-ledPipeline B: assurance-led
Change arrivesAssistant generates a feature in minutesSame
Design checkNone; the prompt was the designShort threat model for externally exposed features
ReviewOne approval, diff skimmedRisk-based depth; second reviewer for auth, payments and data handling
TestsGenerated alongside the codeRequirement- and abuse-case-driven, authored independently for high-risk areas
Automated checksLinter onlyStatic analysis, dependency and secret scanning gate the merge
EvidenceMerge commitPull request records AI involvement, reviewer and checks run
Time to mergeFastestSlower for high-risk changes, similar for low-risk ones

Pipeline B is not slower across the board. The point of risk-based depth is to spend assurance effort where it buys the most.

Real-world patterns (not incidents)

I am not citing named incidents, because I did not verify any for this article. These are patterns I would ask any team to look for in its own history.

Industry gaps

These are my analysis, drawn from the evidence above and from programme work.

  1. No standard measure of assurance capacity. Teams measure lines, commits and deployments. Few measure review depth, escaped defects per change or the share of code with a named human who can explain it.
  2. Vendor and academic findings are not comparable. Different tools, languages, years and methods produce different rates, so a single number is easy to cherry-pick in either direction 45689.
  3. Governance guidance lags practice. NIST has published an SSDF community profile for generative AI and dual-use foundation model development, which addresses building models rather than using coding assistants 2. The guidance for ordinary product teams using assistants is thinner.
  4. Control evidence ignores AI use. Audit evidence rarely records which changes involved generation and what validated them.

Practical recommendations

I would respond in proportion to risk and measure before spending.

Measure the paradox first

  1. Track review depth. Record median review time and comment count per pull request, split by risk class, and watch the trend against change volume.
  2. Track escaped defects. Count security defects found after merge per hundred changes. Direction matters more than the absolute number.
  3. Track explainability. For a sample of recent modules, ask whether a named engineer can explain it. Record the share that can.
  4. Track exceptions. Count open security exceptions and their age.

Then set controls by team size

TeamPriority controls
Early-stage startupSecond human reviewer for authentication, authorisation, payment and data handling; secret and dependency scanning in CI; a short written lifecycle that says where AI is used
Scaling companyRisk classes with review depth per class; static analysis as a merge gate; AI involvement recorded in pull request metadata; test authorship separated from code authorship for high-risk modules
EnterpriseMap SSDF practices 2 to existing controls and extend evidence to AI use; policy for permitted tools and data classes; a named human owner for every production component

Use AI on the assurance side, carefully

The result in 5 suggests assistants can help repair weaknesses when fed analyser output. I would use AI to triage scanner findings, draft test cases for a reviewer to correct and summarise large diffs for a human who still reads the risky parts. I would not let it approve its own output, and I would not treat a model's "no issues found" as evidence.

Key takeaways

Conclusion

I do not think the question is whether AI makes software less secure. The sources do not support a single answer, and the answer will differ by team. The better question is whether your assurance capacity is rising as fast as your output, and you can answer that with data you already have.

If review depth is falling, escaped defects are rising and fewer people can explain the code that runs in production, then you are living the paradox regardless of what any study says. If they are flat or improving, you have probably built the right controls around the tool. Either way, the work is the same: decide where human attention is the scarce resource, spend it on the changes that deserve it, and make the rest of the pipeline do the checking that people cannot.

Views are my own; examples are composites and do not describe any specific employer or client.

Key takeaways

References

  1. CISA with 17 U.S. and international partners. "Shifting the Balance of Cybersecurity Risk: Principles and Approaches for Secure by Design Software." 2023-10-25. https://www.cisa.gov/resources-tools/resources/secure-by-design — Supports: secure-by-design principles put security ownership on the software producer.
  2. NIST (CSRC). "Secure Software Development Framework (SSDF) Version 1.1: Recommendations for Mitigating the Risk of Software Vulnerabilities (NIST SP 800-218)." 2022-02. https://csrc.nist.gov/pubs/sp/800/218/final — Supports: SSDF practices are meant to be added to any SDLC. Limitations: the related generative AI profile (SP 800-218A) addresses model development, not use of coding assistants.
  3. Verizon. "Data Breach Investigations Report (2026 DBIR), landing page." 2026. https://www.verizon.com/business/resources/reports/dbir/ — Supports: page states 31% of breaches now start with software vulnerabilities, described as the top initial access method. Limitations: landing page only; does not attribute breaches to AI-generated code; the full report was not read.
  4. Pearce, Ahmad, Tan, Dolan-Gavitt, Karri (IEEE Symposium on Security and Privacy 2022; arXiv 2108.09293). "Asleep at the Keyboard? Assessing the Security of GitHub Copilot's Code Contributions." 2021-08. https://arxiv.org/abs/2108.09293 — Supports: about 40% of Copilot programs in security-relevant scenarios were vulnerable. Limitations: abstract only was read; one tool, 2021, defined scenarios.
  5. Fu, Liang, Tahir, Li, Shahin, Yu, Chen (ACM TOSEM, accepted; arXiv 2310.02059). "Security Weaknesses of Copilot-Generated Code in GitHub Projects: An Empirical Study." 2023-10 (v4 2025-02). https://arxiv.org/abs/2310.02059 — Supports: 733 snippets from three tools; 29.5% of Python and 24.2% of JavaScript snippets affected; 43 weakness categories, eight in the 2023 CWE Top 25; Copilot Chat fixed up to 55.5% of issues when given static analysis warnings. Limitations: abstract only was read; snippets attributed to AI tools in public projects.
  6. Veracode. "2025 GenAI Code Security Report." 2025. https://www.veracode.com/resources/analyst-reports/2025-genai-code-security-report/ — Supports: vendor page states AI-generated code introduced risky security flaws in 45% of tests, across over 100 models and four languages. Limitations: vendor report; landing page only, little methodological detail.
  7. Perry, Srivastava, Kumar, Boneh (ACM CCS 2023; arXiv 2211.03622). "Do Users Write More Insecure Code with AI Assistants?" 2022-11. https://arxiv.org/abs/2211.03622 — Supports: participants with an AI assistant wrote less secure code and were more confident in it. Limitations: user study, 47 analysed participants.
  8. Sandoval, Pearce, Nys, Karri, Garg, Dolan-Gavitt (USENIX Security 2023; arXiv 2208.09727). "Lost at C: A User Study on the Security Implications of Large Language Model Code Assistants." 2022-08. https://arxiv.org/abs/2208.09727 — Supports: counter-evidence, 58 students writing C had critical bugs at a rate at most about 10% higher than controls. Limitations: small student sample, one language.
  9. Asare, Nagappan, Asokan (ICSE 2024; arXiv 2308.06587). "A User-centered Security Evaluation of Copilot." 2023-08. https://arxiv.org/abs/2308.06587 — Supports: counter-evidence, 25 participants produced more secure solutions on a harder problem and showed no effect on an easier one. Limitations: small sample.
  10. METR. "Measuring the Impact of Early-2025 AI on Experienced Open-Source Developer Productivity." 2025-07-10. https://metr.org/blog/2025-07-10-early-2025-ai-experienced-os-dev-study/ — Supports: in a randomised trial, experienced developers took 19% longer with AI tools while expecting a speedup. Limitations: page flags the result as out of date and points to a later update that was not opened.
  11. Google Cloud, DORA. "Accelerate State of DevOps Report 2024." 2024. https://dora.dev/research/2024/dora-report/ — Supports: survey analysis associated higher AI adoption with a small negative throughput estimate and a larger negative stability estimate. Limitations: correlational survey data; exact release date unconfirmed.
  12. Google Cloud, DORA. "2025 DORA State of AI-assisted Software Development Report, landing page." 2025. https://dora.dev/research/2025/dora-report/ — Supports: describes AI's primary role as an amplifier of an organisation's existing strengths and weaknesses; largest gains come from the underlying system. Limitations: landing page only; adoption, throughput and instability findings and the release date were not confirmed.
  13. OWASP Top 10 project. "A04:2021 Insecure Design." 2021 edition. https://top10.owasp.org/2021/A04_2021-Insecure_Design — Supports: insecure design and insecure implementation are different; a flawed design cannot be fixed by perfect coding; recommends threat modelling for critical flows. Limitations: 2021 edition.
  14. Threat Modeling Manifesto authors. "Threat Modeling Manifesto." n.d. https://threatmodelingmanifesto.org/ — Supports: four key questions frame threat modelling.