Risks: How does AI go wrong? · MarLuc synopsis

People using an AI code assistant wrote less secure code and felt more confident

Peer-reviewedSecurity and attacks

In a 47-person study, participants given an AI code assistant wrote less secure code on most tasks and were more likely to believe their code was secure.

Read the research (opens in a new tab)

The research at a glance

Research
“Do Users Write More Insecure Code with AI Assistants?”, Neil Perry et al.
Produced by
Stanford University (University); UC San Diego (University)
Published
7 Nov 2022; latest version 18 Dec 2023
Evidence
Peer-reviewed, CCS '23: ACM SIGSAC Conference on Computer and Communications Security, November 2023Published in a peer-reviewed journal or accepted at a peer-reviewed conference (venue named)
Type of research
Experiment
Topics
Security and attacks · AI at work
Checked
21 Nov 2026 against the research; independently checked 21 Nov 2026.

Research starting point. Not advice. Each synopsis describes one piece of research in the setting its authors tested; results may not hold for other models, versions or uses. Read the original before relying on it.

1Why it matters

AI code assistants are now common tools for writing software. Earlier work showed such tools can suggest insecure code, but not what happens when people use them. The study asks whether people with an AI assistant write less secure code, and whether they realise it.

2What they did

The authors ran a lab user study with 47 participants, mostly university students plus some professional developers. Participants were randomly assigned to work with or without an AI assistant based on OpenAI's codex-davinci-002 model (33 with, 14 without). Each solved security-related programming tasks in Python, JavaScript and C, such as encrypting text, signing a message and adding a record to a database; one of six tasks was dropped as too vague, leaving five. Two authors examined every solution by hand for correctness and security, and participants rated in a survey how secure they believed their answers were.

3What they found

As the authors report it, in the setting they tested.

  • The authors report that participants with the AI assistant wrote insecure solutions more often than those without it on four of the five tasks.
  • On the message-signing task, 3% of participants with the assistant wrote a secure solution, compared with 21% of the control group.
  • On the database task, 36% of participants with the assistant wrote code open to SQL injection (a common flaw in which user input is treated as database commands), compared with 7% of the control group.
  • Participants with the assistant on average believed their answers were more secure than the control group did, despite often giving more insecure answers.
  • Participants who trusted the assistant less and worked more on their prompts, for example by rephrasing or adjusting settings, produced code with fewer vulnerabilities; 87% of secure responses required significant edits by the user.

4Limits

What the research does not show, or where its results may not carry over.

  • Small sample: 47 participants (33 with the assistant, 14 without), mostly university students, who the authors say likely do not represent the developers most likely to use AI assistants.
  • The assistant used an earlier code model (codex-davinci-002) in a purpose-built interface; the paper was first posted in November 2022, and current assistants, models and integrations differ.
  • The authors note that the artificial lab setting, with time limits and no effect on participants' jobs, does not fully capture real working conditions; results on the C task were mixed.
  • Peer review was confirmed from the CCS 2023 conference site, which lists the paper in the CCS '23 proceedings; the ACM Digital Library page refused automated access and was not read. This entry uses arXiv version 3 (18 December 2023), described as the full version of the conference paper.

5What it could mean for an organisation

General information, not advice. Whether it applies depends on the systems you build, buy or use.

  • Organisations whose staff use AI code assistants face a risk that security flaws enter code unnoticed, because in this study assistant users were more confident in code that was less secure.
  • The authors found the AI assistant was involved in at least as many security mistakes as participants on every type of mistake, which bears on how AI-assisted code is reviewed and tested before release.
  • The authors suggest secure defaults in cryptography libraries, educating users on how to interact with and test an AI assistant, and integrated warnings and validation tests in development tools.

AI governance: EU CRA · NIST CSF 2.0 · ISO/IEC 27001

Sources

  1. [1]arXiv abstract page, 2211.03622 (version 3) (opens in a new tab)The research itself · arxiv.org
  2. [2]arXiv full text PDF, 2211.03622 (opens in a new tab)The research itself · arxiv.org
  3. [3]CCS 2023 conference site, CCS '23 proceedings table of contents (opens in a new tab)The research itself · sigsac.org
  4. [4]CCS 2023 call for papers (review process) (opens in a new tab)Context source · sigsac.org

Checked 21 Nov 2026 · independently checked 21 Nov 2026 · synopsis version 1.0

Spotted an error or newer research? Tell us