Correct Code, Vulnerable Dependencies: A Large Scale Measurement Study of LLM-Specified Library Versions
Not on the map. Why?
Abstract (arXiv)
Large language models (LLMs) are now largely involved in software development workflows, and the code they generate routinely includes third-party library (TPL) imports annotated with specific version identifiers. These version choices can carry security and compatibility risks, yet they have not been systematically studied. We present the first large-scale measurement study of version-level risk in LLM-generated Python code, evaluating 10 LLMs on PinTrace, a curated benchmark of 1,000 Stack Overflow programming tasks. LLMs tend to specify version identifiers when directly prompted at 26.83%-95.18%, while down to 6.45%-59.19% in creating a manifest file directly. Among the specified versions, 36.70%-55.70% of tasks contain at least one known CVE, and 62.75%-74.51% of them carry Critical or High severity ratings. In 72.27%-91.37% of cases, the associated CVEs were publicly disclosed before the model's knowledge cutoff. The statistics show all models converge on the same small set of risky release versions, indicating a systemic bias rather than isolated model error. Static compatibility rates range from 19.70% to 63.20%, with installation failure as the dominant cause. The dynamic test cases confirm the pattern by 6.49%-48.62% pass rates. Further experiments confirm that these failures are attributable to version selection rather than code quality, and that externally anchored version constraints substantially reduce both vulnerability exposure and compatibility failures. Our findings reveal LLM version selection as a first-class, previously overlooked risk surface in LLM-based development. We disclosed these findings to the community of the evaluated models, and several confirmed the issue. All the code and dataset have been released for open science at https://github.com/dw763j/PinTrace.
Key facts. Cited by 1 paper in the map (data through 7 Oct 2026). Builds on 36 of its 72 references that are in the map. First posted on arXiv 7 May 2026.
Builds on
36 of 72 references.
References · 36
- 2024A Survey on Large Language Models for Code Generationcited by 646
- 2024BigCodeBench: Benchmarking Code Generation with Diverse Function Calls and Complex Instructionscited by 527
- 2024LLM Hallucinations in Practical Code Generation: Phenomena, Mechanism, and Mitigationcited by 92
- 2024Instruction Tuning for Secure Code Generationcited by 63
- 2024We Have a Package for You! A Comprehensive Analysis of Package Hallucinations by Code Generating LLMscited by 61
- 2023A Survey on Large Language Models for Software Engineeringcited by 58
- 2022Taxonomy of Attacks on Open-Source Software Supply Chainscited by 57
- 2025FEA-Bench: A Benchmark for Evaluating Repository-Level Code Generation for Feature Implementationcited by 57
- 2023Security Weaknesses of Copilot-Generated Code in GitHub Projects: An Empirical Studycited by 36
- 2024Constrained Decoding for Secure Code Generationcited by 35
- 2024LLMs Meet Library Evolution: Evaluating Deprecated API Usage in LLM-based Code Completioncited by 29
- 2017Do Developers Update Their Library Dependencies? An Empirical Study on the Impact of Security Advisories on Library Migrationcited by 23
24 more
- 2024Large Language Model Supply Chain: A Research Agendacited by 23
- 2024On Mitigating Code LLM Hallucinations with API Documentationcited by 21
- 2024CodeUpdateArena: Benchmarking Knowledge Editing on API Updatescited by 18
- 2025Give LLMs a Security Course: Securing Retrieval-Augmented Code Generation via Knowledge Injectioncited by 15
- 2024VersiCode: Towards Version-controllable Code Generationcited by 14
- 2022Automating Dependency Updates in Practice: An Exploratory Study on GitHub Dependabotcited by 12
- 2024LibEvolutionEval: A Benchmark and Study for Version-Specific Code Generationcited by 11
- 2025Rethinking the Evaluation of Secure Code Generationcited by 10
- 2025Teaching an Old LLM Secure Coding: Localized Preference Optimization on Distilled Preferencescited by 10
- 2022Demystifying the Vulnerability Propagation and Its Evolution via Dependency Trees in the NPM Ecosystemcited by 8
- 2025Do LLMs Consider Security? An Empirical Study on Responses to Programming Questionscited by 8
- 2024GitChameleon: Unmasking the Version-Switching Capabilities of Code Generation Modelscited by 6
- 2023Empirical Analysis of Vulnerabilities Life Cycle in Golang Ecosystemcited by 5
- 2025Wolves in the Repository: A Software Engineering Analysis of the XZ Utils Supply Chain Attackcited by 5
- 2021A Comparative Study of Vulnerability Reporting by Software Composition Analysis Toolscited by 4
- 2025Pinning Is Futile: You Need More Than Local Dependency Versioning to Defend against Supply Chain Attackscited by 4
- 2025A Survey of Bugs in AI-Generated Codecited by 4
- 2025AI Code in the Wild: Measuring Security Risks and Ecosystem Shifts of AI-Generated Code in Modern Softwarecited by 4
- 2026Environment-Aware Code Generation: How far are We?cited by 4
- 2023Characterizing Deep Learning Package Supply Chains in PyPI: Domains, Clusters, and Disengagementcited by 3
- 2022Are your dependencies code reviewed?: Measuring code review coverage in dependency updatescited by 2
- 2025How Robust are LLM-Generated Library Imports? An Empirical Study using Stack Overflowcited by 2
- 2026A Large Scale Empirical Analysis on the Adherence Gap between Standards and Tools in SBOMcited by 2
- 2025Addressing Popularity Bias in Third-Party Library Recommendations Using LLMscited by 1
Built on by
Citing papers per year: 2026: 1.
1 paper.