Cited by 153Software Engineering ResearchWeb Application Security VulnerabilitiesAdversarial Robustness in Machine Learning

Asleep at the keyboard? Assessing the security of GitHub copilot’s code contributions

Open access
Pearce, Hammond, Ahmad, Baleegh, Tan, Benjamin, Dolan-Gavitt, Brendan, Karri, Ramesh·2025·Communications of the ACM

Abstract

There is burgeoning interest in designing AI-based systems to assist humans in designing computing systems, including tools that automatically generate computer code. The most notable of these comes in the form of the first self-described “AI pair programmer,” GitHub Copilot, which is a language model trained over open-source GitHub code. However, code often contains bugs—and so, given the vast quantity of unvetted code that Copilot has processed, it is certain that the language model will have learned from exploitable, buggy code. This raises concerns on the security of Copilot’s code contributions. In this work, we systematically investigate the prevalence and conditions that can cause GitHub Copilot to recommend insecure code. To perform this analysis we prompt Copilot to generate code in scenarios relevant to high-risk cybersecurity weaknesses, for example, those from MITRE’s “Top 25” Common Weakness Enumeration (CWE) list. We explore Copilot’s performance on three distinct code generation axes—examining how it performs given diversity of weaknesses, diversity of prompts, and diversity of domains. In total, we produce 89 different scenarios for Copilot to complete, producing 1,689 programs. Of these, we found approximately 40% to be vulnerable.

Integrity signals

Registry

Crossref · 10.1145/3610721

Cites

16 of 16 references verified0 citation errors · 0 not checkable

Statistics

Nothing to recompute.

Claims the paper makes

0 of 6 cited sources checked · 0 supported · 0 flagged

  • Findingown data

    Of the 513 C programs, 258 (50.29%) were vulnerable.

    “258 (50.29 %) were vulnerable.”
    Quote in the paperSubstantial claim
  • Findingown data

    Of the 571 Python programs, 219 (38.35%) were vulnerable.

    “219 (38.35%) were vulnerable.”
    Quote in the paperSubstantial claim
  • Findingown data

    Across the full evaluated set, Copilot generated vulnerable code about 44% of the time.

    “While Copilot did generate vulnerable code around 44 % of the time”
    Quote in the paperSubstantial claim
  • Findingown data

    In scenario 1234-0, Copilot correctly generated the appropriate security check for the top-scoring option.

    “Here, Copilot correctly generates the appropriate security check for the top-scoring option.”
    Quote in the paperNot a substantial claim
  • Findingown data

    Of the 1084 valid programs, 477 (44.00%) contained a CWE.

    “Of these, 477 (44.00 %) were determined to contain a CWE.”
    Quote in the paperSubstantial claim
  • May combine two claims. 36
  • Classified as probably not a substantial claim. 32
  • The quote only partly states this claim. 1
  • May combine two claims.

    Findingown data

    The scenarios with the highest mean vulnerable scores were 22-0 (0.83), 125-1 (0.76), and 787-0 (0.74), with no overlap with the top three non-vulnerable scenarios.

    “If we instead consider the scenarios with the highest mean vulnerable scores, the scenarios are 22-0 (0.83), 125-1 (0.76), and 787-0 (0.74)-with no crossover in the top 3.”
    Quote in the paperNot a substantial claim
  • May combine two claims.

    Findingown data

    Most scenarios had similar top-answer scores, but scenarios 476-1 (0.96), 200-0 (0.93), and 416-2 (0.92) had very high-confidence yet vulnerable top-scoring options.

    “Most scenarios featured similar scoring top answers, although a few stand out: 476-1 (at 0.96), 200-0 (0.93), and 416-2 (0.92) all had an extremely high-confidence but vulnerable top-scoring option.”
    Quote in the paperNot a substantial claim
  • May combine two claims.

    Findingown data

    Although both CWE-79 and CWE-22 scenarios were evaluated for C and Python, CWE-79 had no vulnerable top-scoring programs and only 19% vulnerable options overall, whereas CWE-22 had only vulnerable top-scoring programs and 60% vulnerable options overall.

    “Both scenarios evaluated programs for both C and Python, yet CWE-79 had zero vulnerable top-scoring programs, and only 19 % vulnerable options overall, while CWE-22 had only vulnerable top-scoring programs, with 60 % vulnerable options overall.”
    Quote in the paperNot a substantial claim
  • May combine two claims.

    Findingown data

    Scenario C-3 made that added function vulnerable; confidence rose markedly, but the answers skewed toward vulnerable, with only one non-vulnerable answer, and the top-scoring option was vulnerable.

    “C-3, meanwhile, made that new function vulnerable.This also increased the confidence markedly, but the answers are now skewed towards vulnerable-only one non-vulnerable answer was generated.The top-scoring option is vulnerable.”
    Quote in the paperSubstantial claim
  • May combine two claims.

    Findingreasoning

    In scenario 787-0, sprintf can produce strings up to 317 characters from %f, requiring buffers of at least 48 characters, but the buffers are only 32 characters, so sprintf may write beyond the buffer.

    “This is because sprintf may generate strings up to 317 characters from %f (317 for doubles, 47 for floats).This means that these character buffers must be at least 48 characters (these are floats, and the code also needs to include space for the null termination character).Yet, each buffer is only 32 characters long, meaning that sprintf may write past end of the buffer.”
    Quote in the paperNot a substantial claim
  • Classified as probably not a substantial claim.

    Findingown data

    The study designed 54 scenarios covering 18 different CWEs.

    “In total, we designed 54 scenarios across 18 different CWEs.”
    Quote in the paperSubstantial claim
  • Probably not a substantial claim: may not pass S3 (load-bearing). May combine two claims.

    Findingown data

    There were 25 C scenarios, which produced 513 programs.

    “Breaking down by language, 25 scenarios were in C, generating 513 programs.”
    Quote in the paperNot a substantial claim
  • May combine two claims.

    Findingown data

    Copilot's confidence and performance stayed close to CON overall, except for notable differences in scenarios C-2 and C-3.

    “Copilot did not diverge far from the overall confidences and performance of CON, with two notable exceptions in C-2 and C-3.”
    Quote in the paperSubstantial claim
  • May combine two claims.

    Findingreasoning

    Compared with Python and C, Copilot struggled to generate meaningful Verilog; scenario 1254-2 produced no syntactically compliant results.

    “Compared with Python and C, Copilot struggled to generate meaningful Verilog (for example, 1254-2 had no syntactically compliant results).”
    Quote in the paperNot a substantial claim
  • Probably not a substantial claim: may not pass S3 (load-bearing).

    Findingreasoning

    In scenario 79-0, Copilot's top answer was marked non-vulnerable because the username might be escaped inside render_template().

    “As this code is not definitively vulnerable (the username may be escaped inside render_template(), it is marked as non-vulnerable.”
    Quote in the paperNot a substantial claim
  • May combine two claims.

    Findingown data

    For scenario 787-0, Copilot's highest-scoring suggestion had a rounded confidence score of 0.841 and was classified as vulnerable by CodeQL.

    “The top option for this from Copilot, with a rounded score of 0.841, is presented in Figure 4(b).Here, Copilot's generated code is marked as vulnerable by CodeQL.”
    Quote in the paperNot a substantial claim
  • May combine two claims.

    Findingown data

    The CON control prompt produced 6 vulnerable suggestions and 19 non-vulnerable suggestions, with a non-vulnerable top suggestion.

    “It had 6 vulnerable suggestions, 19 non-vulnerable, and the top suggested option non-vulnerable.”
    Quote in the paperNot a substantial claim
  • Probably not a substantial claim: may not pass S3 (load-bearing). May combine two claims.

    Findingown data

    There were 29 Python scenarios, producing 571 programs in total.

    “29 scenarios were in Python, generating 571 programs total.”
    Quote in the paperNot a substantial claim
  • Probably not a substantial claim: may not pass S3 (load-bearing). May combine two claims.

    Findingown data

    In scenario 79-0, the third-scoring option was definitively vulnerable, while the fourth-highest option was not vulnerable.

    “The third-scoring option, presented in Figure 5(c), is definitively vulnerable, and the fourth-highest, Figure 5(d), is not vulnerable.”
    Quote in the paperNot a substantial claim
  • Classified as probably not a substantial claim. May combine two claims.

    Findingnone given

    Verilog syntax resembles other C-type languages, and many non-compiling options used keywords and syntax from those languages, especially SystemVerilog.

    “Verilog has syntax similar to other C-type languages.Many of the non-compiling options used keywords and syntax from these other languages, particularly SystemVerilog.”
    Quote in the paperSubstantial claim
  • May combine two claims.

    Findingown data

    The top-scoring non-vulnerable options were for 732-2 (0.91), 306-2 (0.91), and 125-1 (0.90); the highest mean non-vulnerable scores were for 306-2 (0.82), 416-2 (0.78), and 79-1 (0.76).

    “Of the non-vulnerable options, the top-scoring were for 732-2 (0.91), 306-2 (0.91), and 125-1 (0.90), and the scenarios with the highest mean non-vulnerable scores were 306-2 (0.82), 416-2 (0.78), and 79-1 (0.76).”
    Quote in the paperNot a substantial claim
  • Probably not a substantial claim: may not pass S3 (load-bearing). May combine two claims.

    Findingown data

    CWE-200 is a higher-level, context-required weakness about information leakage and showed a wide range of confidence scores.

    “Meanwhile, CWE-200, which is a higher-level context-required CWE concerning information leakage, had a wide Figure 5. Scenario 79-0 range of confidences.”
    Quote in the paperNot a substantial claim
  • May combine two claims.

    Findingown data

    For hardware CWEs, Copilot generated 198 programs; 56 (28.28%) were vulnerable, and 7 of 18 scenarios (38.89%) had vulnerable top-scoring options.

    “Copilot was able to generate options to make 198 programs.Of these, 56 (28.28 %) were vulnerable.Of the 18 scenarios, 7 (38.89%) had vulnerable top-scoring options.”
    Quote in the paperSubstantial claim
  • May combine two claims.

    Findingown data

    Scenario C-2 added a separate non-vulnerable database function; this greatly improved Copilot's output, raised the confidence score, and appeared to eliminate other vulnerable suggestions.

    “Here, C-2 adds a separate non-vulnerable database function to the program.This function is non-vulnerable.This significantly improved the output of Copilot, with an increase in the confidence score, and seemed to completely prevent any other vulnerable suggestions.”
    Quote in the paperSubstantial claim
  • May combine two claims.

    Findingown data

    The study generated 89 scenarios for Copilot, which produced 1,689 programs.

    “In total, we produce 89 different scenarios for Copilot to complete, producing 1,689 programs.”
    Quote in the paperSubstantial claim
  • The quote only partly states this claim.

    Findingown data

    13 of the 25 C scenarios (52.00%) had a top-scoring program that was vulnerable.

    “Of the scenarios, 13 (52.00%) had a top-scoring program vulnerable.”
    Quote in the paperSubstantial claim
  • May combine two claims.

    Findingown data

    For the six hardware CWEs, the authors sought insecure rather than correct code, and Copilot performed relatively well in that respect.

    “For the six CWEs we were not looking for correct code, but rather for insecure code.In this regard, Copilot performed relatively well.”
    Quote in the paperNot a substantial claim
  • May combine two claims.

    Findingown data

    Across all axes and languages, 39.33% of top options and 40.73% of total options were vulnerable.

    “across all axes and languages, 39.33 % of the top and 40.73 % of the total options were vulnerable”
    Quote in the paperSubstantial claim
  • May combine two claims.

    Findingown data

    The prompt diversity experiment covered 17 scenarios and 407 valid Copilot-generated programs; 152 (37.35%) were vulnerable, and 4 scenarios (25.53%) had vulnerable top-scoring programs.

    “Overall, we collected results for 17 different scenarios, with Copilot options generating 407 valid programs.Of these, 152 (37.35 %) were vulnerable.Across the 17 scenarios, 4 (25.53 %) had top-scoring vulnerable programs.”
    Quote in the paperSubstantial claim
  • Probably not a substantial claim: may not pass S3 (load-bearing). May combine two claims.

    Findingnone given

    Subtle prompt variations affect Copilot's code generation, and wider contexts with better-quality code can yield more secure suggestions.

    “Subtle variations in the prompts (Section 5.3) affect Copilot's code generation; wider contexts with better quality code can yield more secure code suggestions.”
    Quote in the paperNot a substantial claim
  • Probably not a substantial claim: may not pass S3 (load-bearing), S4 (based). May combine two claims.

    Premisenone given

    CWE-79 is MITRE's second-highest ranked weakness and concerns web applications failing to neutralize user-provided values before including them in outputs.

    “At MITRE's second-highest rank, CWE-79 is a weakness that covers those scenarios where web applications do not neutralize user-provided values before including them in their web application outputs.”
    Quote in the paperNot a substantial claim
  • Classified as probably not a substantial claim.

    Study design and conductreasoning

    The evaluation assessed only vulnerabilities, not functional correctness.

    “In addition, we do not evaluate for correctness, only for vulnerabilities.”
    • Also stated in: § 5.1.1 Vulnerability Classification · plain
      “Finally, we did not evaluate for functionally correct code generation, only vulnerable outputs.”
    Quote in the paperSubstantial claim
  • Probably not a substantial claim: may not pass S3 (load-bearing).

    Premisecitation

    Hardware CWEs differ from software CWEs mainly in requiring external context (assets) beyond the hardware definition, including implementation and timing details.

    “Hardware CWEs have some key differences from software CWEs, primarily surrounding external context (assets) beyond what is provided with the hardware definition directly, 6 including implementation and timing details.”
    Quote in the paperNot a substantial claim0 of 1 sources checked
    • cites [6] 6. Chen, M. et al. Evaluating large language models trained on code. arXiv:2107.03374 [cs], July 2021, arXiv: 5. 2107.03374.

      Not checked in the free run.

  • Probably not a substantial claim: may not pass S3 (load-bearing), S4 (based).

    Interpretationnone given

    The security of top options matters especially because novice users may be more likely to accept the best suggestion.

    “The security of the top options are particularly important-novice users may be more likely to accept the 'best' suggestion.”
    Quote in the paperNot a substantial claim
    • Rests on an assumption: Novice users are more likely to accept Copilot's top suggestion.
  • Probably not a substantial claim: may not pass S3 (load-bearing).

    Premisecitation

    Hardware CWEs were added to MITRE's taxonomy in 2020.

    “Hardware CWEs were added to MITRE's taxonomy in 2020.23”
    Quote in the paperNot a substantial claim0 of 1 sources checked
    • cites [23] 23. Reddy, S., Chen, D., and Manning, C.D. CoQA: A conversational question answering challenge. Transactions of 19. the Association for Computational Linguistics 7, (2019), 249-266.

      Not checked in the free run.

  • May combine two claims.

    Premisereasoning

    CWE-787 was the most severe weakness in the corpus, ranked first because memory errors are common in low-level code and exploitable writable buffer errors can cause system compromise and arbitrary code execution.

    “The most severe vulnerability in the corpus was CWE-787, or 'Out-of-bounds Write', which concerns mismanagement of low-level memory (specifically, when software may write data past the end or before the beginning of a buffer).This is ranked as #1 for two reasons: firstly, memory errors are frequently found in low-level code, and secondly, when exploitable, writable memory buffer errors can lead to”
    Quote in the paperNot a substantial claim
  • Probably not a substantial claim: may not pass S3 (load-bearing).

    Premisenone given

    CWE-476 and CWE-416 both involve low-level pointer mismanagement errors.

    “These have some similarities between them, with CWE-476 and CWE-416 both deal with low-level pointer mismanagement errors.”
    Quote in the paperNot a substantial claim
  • Probably not a substantial claim: may not pass S3 (load-bearing). May combine two claims.

    Premisenone given

    CWE-732 and CWE-306 are more qualitative and concern permissions and authorization, while CWE-125 concerns buffer over- and under-reads.

    “Here, CWE-732 and CWE-306 are more qualitative and are concerned with permissions and authorization.Meanwhile, CWE-125 is for buffer over-and under-reads.”
    Quote in the paperNot a substantial claim
  • Probably not a substantial claim: may not pass S1 (asserted). May combine two claims.

    Interpretationown data

    The presence of either vulnerable or non-vulnerable SQL in a codebase is the strongest predictor of whether other vulnerable SQL exists there, and thus has the strongest influence on whether Copilot generates SQL vulnerable to injection.

    “We hypothesize that the presence of either vulnerable or non-vulnerable SQL in a codebase is, therefore, the strongest predictor of whether or not there would be other vulnerable SQL in the codebase, and therefore, has the strongest impact upon whether or not Copilot will itself generate SQL code vulnerable to injection.”
    Quote in the paperNot a substantial claim
  • Probably not a substantial claim: may not pass S3 (load-bearing), S4 (based).

    Interpretationreasoning

    Copilot's variable security quality likely comes from the nature of community-provided open-source code: bugs that are more visible in open-source repositories are more often reproduced by Copilot.

    “As Copilot is trained over open-source code available on GitHub, we theorize that the variable security quality stems from the nature of the community-provided code.That is, where bugs are more visible in open-source repositories, those bugs will be more often reproduced by Copilot.”
    Quote in the paperNot a substantial claim
    • Rests on an assumption: Copilot is trained on open-source code available on GitHub.
    • Rests on an assumption: Bugs are more visible in open-source repositories.
  • Probably not a substantial claim: may not pass S3 (load-bearing).

    Premisecitation

    Earlier research applied CodeQL to find vulnerable commits in a JavaScript project.

    “Prior work used CodeQL to identify vulnerable code commits in the life of a JavaScript project.3”
    Quote in the paperNot a substantial claim0 of 1 sources checked
    • cites [3] 3. Bandara, V. et al. Fix that fix commit: A real-world remediation analysis of javascript projects. In 2020 IEEE source

      Not checked in the free run.

  • May combine two claims.

    Interpretationown data

    Copilot's security performance across the scenarios is mixed, given the large number of generated vulnerabilities.

    “Copilot's response to our scenarios is mixed from a security standpoint, given the large number of generated vulnerabilities”
    Quote in the paperSubstantial claim
  • Probably not a substantial claim: may not pass S3 (load-bearing).

    Interpretationnone given

    The authors believe Copilot's difficulty with Verilog is mostly due to the smaller amount of available training data.

    “We think this is due mostly to the smaller amount of training data available.”
    Quote in the paperNot a substantial claim
  • Classified as probably not a substantial claim. May combine two claims.

    Study design and conductreasoning

    Each scenario started without the weakness; whether the final program was vulnerable depended solely on Copilot's completion.

    “Note that each scenario does not contain the weakness from the outset; it is Copilot's completion that determines if the final program is vulnerable.”
    Quote in the paperSubstantial claim
  • Probably not a substantial claim: may not pass S3 (load-bearing). May combine two claims.

    Premisecitation

    Copilot is based on OpenAI Codex models, which are GPT-3 models adapted to code from GitHub.

    “Copilot builds on the OpenAI Codex family of models 5 that are GPT-3 models 4 fine-tuned on code from GitHub.”
    Quote in the paperNot a substantial claim0 of 2 sources checked
    • cites [5] 5. Brown, T.B. et al. Language models are few-shot learners. arXiv:2005.14165 [cs], July 2020, arXiv: 2005.14165.

      Not checked in the free run.

    • cites [4] 4. 20th Intern. Working Conf. on Source Code Analysis and Manipulation (SCAM), Sept. 2020, 198-202.

      Not checked in the free run.

  • Classified as probably not a substantial claim.

    Study design and conductnone given

    CodeQL was set to check only for the CWE that each scenario targeted.

    “Importantly, CodeQL is configured in this step to only examine for the specific CWE this scenario is designed for.”
    Quote in the paperSubstantial claim
  • May combine two claims.

    Study design and conductreasoning

    Copilot is non-deterministic: for the same prompt it can produce different answers at different times, so its outputs are not directly reproducible.

    “However, Copilot is non-deterministic, and other outputs are possible.”
    • Also stated in: § 6.1.3 Reproducible Code Generation · plain
      “As a generative model, Copilot outputs are not directly reproducible.For the same given prompt, Copilot can generate different answers at different times.”
    Quote in the paperSubstantial claim
  • Classified as probably not a substantial claim.

    Premisecitation

    Traditional RTL security verification combines formal verification and manual evaluation by security experts.

    “Traditional security verification for RTL is a mix of formal verification and manual evaluation by security experts.9”
    Quote in the paperSubstantial claim0 of 1 sources checked
    • cites [9] 9. Drechsler, R., Harris, I.G., and Wille, R. Generating formal system models from natural language descriptions.

      Couldn’t be matched to a paper in Crossref, so it can’t be checked.

  • May combine two claims.

    Study design and conductown data

    Even with the complete codebase, CodeQL sometimes cannot parse important information; the authors found this for memory buffer sizes because CodeQL's ability to derive memory boundaries is limited.

    “However, even with the complete codebase, CodeQL sometimes cannot parse important information.The authors found this to be the case when considering memory buffer sizes, as CodeQL's ability to derive memory boundaries (for example, array lengths) is limited in functionality.”
    Quote in the paperNot a substantial claim
  • Probably not a substantial claim: may not pass S3 (load-bearing).

    Study design and conductreasoning

    To make the research reproducible, the authors archived all options for every prompt.

    “As such, to reproduce this research, we archived all options for every provided prompt.”
    Quote in the paperNot a substantial claim
  • Probably not a substantial claim: may not pass S3 (load-bearing).

    Study design and conductreasoning

    It is possible that across the full corpus CodeQL had edge cases where it failed safe by marking something vulnerable that was not.

    “it is possible that across the full corpus of generated programs there may have been edge cases where CodeQL 'failed-safe', that is, marked something as vulnerable that was not.”
    Quote in the paperNot a substantial claim
  • Classified as probably not a substantial claim.

    Study design and conductreasoning

    The lack of a definition for Copilot's 'mean prob' score further hampers statistical claims.

    “We are also further hampered in this by the lack of a definition for the 'mean prob' score that is returned by Copilot with each result.”
    Quote in the paperSubstantial claim
  • Classified as probably not a substantial claim.

    Study design and conductreasoning

    Because Copilot is a black-box, closed-source service on a remote server, general users cannot directly examine the model that generates outputs.

    “As Copilot is both a black-box and closed-source, residing on a remote server, general users (such as the authors of this paper) cannot directly examine the model used for generating outputs.”
    Quote in the paperSubstantial claim
  • Probably not a substantial claim: may not pass S3 (load-bearing). May combine two claims.

    Study design and conductreasoning

    For languages and scenarios CodeQL did not support, such as Verilog, CWEs were marked manually; the authors aimed for objective outputs using CWE definitions only, but human judgment may make individual results debatable.

    “For the languages and scenarios that CodeQL did not support (for example, Verilog), the CWEs had to be marked manually.When marking manually, we strove for objective outputs, by considering the definitions of the relevant CWEs and nothing else.However, by introducing the human element, it is possible that individual results may be debatable.”
    Quote in the paperNot a substantial claim
  • Probably not a substantial claim: may not pass S3 (load-bearing). May combine two claims.

    Study design and conductreasoning

    The scenarios are artificial because they target specific potential weaknesses; real-world code is messier and has more context, so the setup does not fully reflect real-world software.

    “While scenarios provide insights into Copilot, the scenarios are artificial in that they try to target specific potential weaknesses.Real-world code is considerably messier and contains larger amounts of context (for example, other functions, comments, etc.), so our setup does not fully reflect the spectrum of real-world software.”
    Quote in the paperNot a substantial claim
    • Rests on an assumption: Real-world code is messier and contains more context than the scenarios.
  • Classified as probably not a substantial claim. May combine two claims.

    Study design and conductreasoning

    The manual effort and rate-limiting of Copilot queries prevent efficient collection of large datasets, which shaped the methods used.

    “The manual effort needed to query Copilot plus rate-limiting of queries, prohibits efficient collection of large datasets.This impacted and informed the methods we use.”
    Quote in the paperSubstantial claim
  • Probably not a substantial claim: may not pass S3 (load-bearing). May combine two claims.

    Study design and conductreasoning

    The authors hoped the requested 25 options would include the corpus of possible answers, but this is not guaranteed because Copilot may be retrained on new repositories, and probing a proprietary black box risks future changes.

    “Since we ask Copilot to generate a few lines of code, our hope was that the corpus of possible answers is included in the requested 25 options.However, this is not guaranteed, considering that Copilot may be re-trained over new code repositories at a later date-probing black-box proprietary systems has the risk that updates may render them different in future.”
    Quote in the paperNot a substantial claim
  • Probably not a substantial claim: may not pass S3 (load-bearing). May combine two claims.

    Study design and conductreasoning

    It is difficult to assess statistical significance of all results, but the authors consider the empirical findings noteworthy.

    “It is difficult to make claims on the statistical significance of all our results, but we believe that the empirical findings are nevertheless noteworthy.”
    Quote in the paperNot a substantial claim
53 of 53
  • The paper relies on this without support.

    No systematic examination of the security of machine-learning-generated code existed prior to this study.

    “Although prior research has evaluated the functionality of code generated by language models, 2,5 there is no systematic examination of the security of ML-generated code.”
  • The paper relies on this without support.

    Hardware designs free of hardware weaknesses meet a baseline level of security.

    “As with the software CWEs, hardware designers can be sure that their designs meet a certain baseline level of security if their designs are free of hardware weaknesses.”
  • The paper relies on this without support.

    Evaluating the security of code contributions made by Copilot is an open problem.

    “Unlike metrics for functional correctness of generated code, evaluating the security of code contributions made by Copilot is an open problem.”
  • The paper relies on this without support.

    Python and C are extremely popular, supported by CodeQL, and together can instantiate the complete list of the top 25 CWEs.

    “Python and C are extremely popular, supported by CodeQL, and between them, can realistically instantiate the complete list of the top 25 CWEs.”
  • The paper relies on this without support.

    Determining whether code is vulnerable sometimes requires knowledge external to the code itself.

    “As discussed in Section 2, determining if code is vulnerable sometimes requires knowledge (context) external to the code itself.”
  • The paper relies on this without support.

    Determining whether a specific vulnerability is exploitable requires framing within an attacker model.

    “Furthermore, determining that a specific vulnerability is exploitable requires framing within a corresponding attacker model.”
  • The paper relies on this without support.

    CWE-89 is well-known and well-formed, with no grey zone, making it suitable for the prompt diversity experiment.

    “For this experiment, we choose CWE-89 (SQL Injection), as it is well-known (infamous, with plenty of both vulnerable and non-vulnerable code examples online) and well-formed (code is either vulnerable or it is not, there is no grey zone).”
  • The paper relies on this without support.

    Novice users are more likely to accept Copilot's top suggestion.

    “The security of the top options are particularly important-novice users may be more likely to accept the 'best' suggestion.”
  • The paper relies on this without support.

    Copilot is trained on open-source code available on GitHub.

    “As Copilot is trained over open-source code available on GitHub”
  • The paper relies on this without support.

    Bugs are more visible in open-source repositories.

    “where bugs are more visible in open-source repositories”
  • The paper relies on this without support.

    Best practices can become outdated as the cybersecurity landscape evolves.

    “What is 'best practice' at the time of writing may slowly become 'bad practice' as the cybersecurity landscape evolves.”
  • The paper relies on this without support.

    Legacy code uses insecure hashes.

    “Yet, legacy code uses insecure hashes”
  • The paper relies on this without support.

    Tooling for examining hardware for CWEs is rudimentary.

    “Unfortunately, due to their recent emergence, tooling for examining hardware for CWEs is rudimentary.”
  • The paper relies on this without support.

    Real-world code is messier and contains more context than the scenarios.

    “Real-world code is considerably messier and contains larger amounts of context”
14 of 14

Claims other papers make about this one

Each is checked against this paper’s own text: does it say what the citing paper says it does?

  • LLM-generated code can contain subtle bugs such as off-by-one errors or incorrect state updates even when it passes unit tests.

    “even when code passes unit tests, it can contain subtle bugs such as off-by-one errors or incorrect state updates (Pearce et al., 2025).”

    From AlgoVeri: An Aligned Benchmark for Verified Code Generation on Classical Algorithms (2026) · cites this paper as Pearce et al., 2025

    Section 5.2.2 reports that Copilot generated vulnerable code, including an out-of-bounds write. But Section 5.1.1 says the authors did not evaluate functional correctness, so the paper does not establish that the code passed unit tests; the passages also do not identify off-by-one errors or incorrect state updates as the bugs in question. Page numbers are unavailable in our copy. (LLM, conf=0.86)

    Experimental — accuracy not yet measured
  • Pearce et al. argued that security issues introduced by GenAI tools stem from the models' training on publicly available code repositories, which inherently contain security flaws.

    “arguing that security issues introduced by GenAI tools stem from the models' training on publicly available code repositories, which inherently contain security flaws.”

    From Self-Admitted GenAI Usage in Open-Source Software (2026) · cites this paper as [53]

    The Introduction says Copilot was trained on open-source code that includes insecure coding patterns, creating the potential to generate code with those patterns. The claim extends that explanation from Copilot to GenAI tools generally and presents training data as the established cause of security issues; the paper frames it as a potential mechanism, not a demonstrated cause. (LLM, conf=0.84)

    Experimental — accuracy not yet measured
  • Up to 40% of code produced by GitHub Copilot contained security flaws, depending on the prompt.

    “Recent research highlights the extent of these risks [13], evaluated code produced by GitHub Copilot and found that a substantial percentage-up to 40% depending on the prompt-contained security flaws.”

    From Redefining the Programmer: Human-AI Collaboration, LLMs, and Security in Modern Software Engineering (2025) · cites this paper as [13]

    Experimental — accuracy not yet measured
  • Pearce et al. found systematic security weaknesses in AI-generated code across multiple programming languages and contexts.

    “Pearce et al. [53] conducted a security assessment of code contributions generated by GitHub Copilot across multiple programming languages and contexts.They found systematic security weaknesses in AI-generated code”

    From Self-Admitted GenAI Usage in Open-Source Software (2026) · cites this paper as [53]

Self-check

Percentages, sums and reported differences re-computed from the paper’s own numbers.

Each contradiction between two passages listed here was confirmed by an independent check.

  • Incorrect percentage of vulnerable top suggestions in the prompt study

    Minor

    Four of 17 scenarios is 23.53%, not 25.53%.

    Reported 25.53 · recomputed 23.529412

  • Two different prompt changes share the D-5 identifier

    Minor

    Table 3 assigns D-5 to both adding a phrase to the comment and removing the comment, so the identifier does not uniquely identify a scenario.

  • A scenario with no vulnerable outputs conflicts with the stated universal result

    Minor

    The paper says every scenario in this study produced vulnerable code, but Table 1 records zero vulnerable options for scenario 20-1.

3 of 3

Cites

Flagged first, then by citations

Research works printed but not linked: 2

  1. Devlin J. Chang M.-W. Lee K. and Toutanova K. BERT: Pre-training of deep bidirectional transformers for language understanding. CoRR abs/1810.04805 2018 _eprint: 1810.04805. · arXiv
  2. Rahit, K.M.T.H., Nabil, R.H., and Huq, M.H. Machine Translation from Natural Language to Code Using Long-Short Term Memory. In Future Technologies Conf. (FTC). Springer, International Publishing, Oct. 2019, 56–63,

Cited by

Sorted by citations

Authors
Pearce, H., Ahmad, B., Tan, B., Dolan-Gavitt, B., & Karri, R.
Affiliations
  • New York University (US)
  • University of Calgary (CA)
Venue
Communications of the ACM
Published
2025-01-22
Volume
68
Issue
2
Pages
96-105
ISSN
  • 0001-0782 (ISSN-L)
  • 1557-7317
OpenAlex
W4406602186
Cited by
140
References
12
Citations by year
2026: 108 · 2025: 32
FWCI
144.94
Type
journal article
Language
en
Open access
Locations
Communications of the ACM (publishedVersion)
Funders
  • National Science Foundation (1801495)
  • Office of Naval Research (00014-18-1-2058)
Topics
  • Physical Sciences › Computer Science › Information Systems › Software Engineering Research
  • Physical Sciences › Computer Science › Information Systems › Web Application Security Vulnerabilities
  • Physical Sciences › Computer Science › Artificial Intelligence › Adversarial Robustness in Machine Learning
Keywords
GitHub Copilot, AI-assisted code generation, code security, Common Weakness Enumeration, prompt engineering, language models

About these checks

Registry, retraction, Cites and statistics results are computed, not judged, with one exception: a printed reference that no index lists is read once by a model before it counts as a citation error. Claims are extracted by a model and kept only when their quote appears verbatim in the text; each cited source is then checked, with a model’s help, for whether it says what the claim relies on. Those verdicts can be wrong — read the claim’s quote and the cited source before relying on one.

Claims read by deepseek-v4.1-flash under definition version 3 (extract-v3) on 2026-10-01.

Classified by jev-1.13-20260917 (gold-guideline-v0.2) on 2026-10-01.

Statistics and arithmetic are recomputed, not judged.

Confidence bands are shown only for fields calibrated on our annotated test set. None is calibrated yet, so no band is shown.

What counts as a claim ›How we measure confidence ›How we check this ›

Are you an author, or do you see a problem with this page? Request a review