When AI Takes the Wheel: Security Analysis of Framework-Constrained Program Generation

Yue Liu, Zhenchang Xing, Shidong Pan, Chakkrit TantithamthavornarXiv 2025

TL;DR

While Large Language Models (LLMs) excel at generating functional code, allowing them to fully "take the wheel" of application development introduces severe security risks. This paper evaluates nine state-of-the-art LLMs generating complete Chrome extensions and finds alarmingly high vulnerability rates (18% to 50%). Counterintuitively, advanced reasoning models like DeepSeek-R1 and o3-mini generate more security flaws than simpler models, exposing a critical gap between AI coding fluency and architectural security awareness.

What Problem Does This Paper Address?

We are rapidly transitioning from snippet-level AI code completion to a "prompt-to-program" paradigm (often called vibe coding), where an LLM handles everything from software design to implementation based on high-level requirements. However, modern software engineering relies heavily on framework-constrained security models.

Take Chrome extensions, for example. They operate under a strict "isolated worlds" architecture where components have varying privilege levels: low-privilege content scripts interact with untrusted web pages, while high-privilege background scripts access sensitive browser APIs (like cookies, history, and bookmarks).

Figure 2: Chrome Extension Framework

If an LLM fails to properly validate data flowing across these privilege boundaries, it creates severe vulnerabilities like privilege escalation, arbitrary file downloads, or credential theft. The authors set out to discover whether LLMs can inherently navigate these complex, framework-specific security constraints when building entire applications from scratch.

Methods

The authors designed a structured empirical pipeline to evaluate LLM-generated applications:

  1. Prompt Generation: They translated real-world vulnerable Chrome extensions into high-level, purely functional natural language descriptions.
  2. Program Generation: They fed these prompts to nine leading LLMs (including GPT-4o, Claude-3.5-Sonnet, o3-mini, and DeepSeek-R1). To account for LLM non-determinism, each prompt was run 12 times per model, resulting in 1,680 generation attempts per model.
  3. Automated Security Analysis: Instead of analyzing isolated snippets, they assembled the generated HTML, JS, and manifest files into complete extensions. They then evaluated them using CoCo, a state-of-the-art static analysis framework that uses coverage-guided concurrent abstract interpretation to track dangerous data flows across multiple execution paths.
Figure 3: Overview of Our Experimental Workflow

Datasets

The authors introduced ChromeSecBench, a benchmark dataset containing 140 natural language prompts derived from documented vulnerable Chrome extensions.

The scenarios are divided into 10 distinct functional categories reflecting common extension use cases, such as Authentication & Identity (AUTH), Cookie Management (COOK), Bookmark/History Management (BHT), and Download Management (DM). The prompts provide only functional requirements and basic manifest configurations, intentionally omitting explicit security implementation instructions to test the models' default security behaviors.

Key Insights and Ideas

  • The Reasoning Paradox: More capable "reasoning" models (like DeepSeek-R1 and o3-mini) do not inherently write more secure code. Because they are optimized for complex logic and general programming, they often generate more intricate code structures that introduce more complex vulnerability patterns.
  • API Misunderstanding: LLMs treat privileged framework APIs like standard, benign functions. They frequently expose powerful APIs (e.g., chrome.cookies or chrome.tabs.executeScript) to external web pages via message listeners without implementing any origin validation or input sanitization.
  • Context Blindness: While a generated code snippet might look perfectly safe in isolation, it becomes highly dangerous when integrated into a multi-component framework where data flows from an untrusted web page down to a privileged background script.

Key Results

The quantitative findings paint a worrying picture for AI-driven development:

  • High Vulnerability Rates: Across all tested models, the percentage of scenarios resulting in at least one vulnerable extension ranged from 18.6% to 50%. Llama-3.1-405B (50%) and DeepSeek-R1 (49.3%) had the highest vulnerability rates.
  • High-Risk Scenarios: Vulnerabilities spiked dangerously in data-sensitive categories. In Authentication & Identity scenarios, Claude-3.5-Sonnet and Gemini-2.0-Pro hit an 83% vulnerability rate. In Cookie Management, Claude-3.5-Sonnet and DeepSeek-R1 reached 78%.
  • Vulnerability Density: DeepSeek-R1 generated the highest absolute number of vulnerable extensions (277), while OpenAI's o3-mini exhibited the highest vulnerability density, averaging 4.83 vulnerabilities per scenario when flaws were present.
Vulnerability Rates by Scenario Categories

Limitations and Future Work

The study notes a few limitations:

  • Functional Correctness: The authors focused strictly on security data flows and did not verify if every generated extension was 100% functionally operational (though modern LLMs generally produce working code).
  • Static Analysis Bounds: While the CoCo framework achieved excellent accuracy in this context (98% recall, 99% F1 score), static analysis inherently carries risks of false negatives on highly complex or dynamic code patterns.

Future Directions: The authors call on LLM providers to move away from generic code-snippet benchmarks and instead train models on framework-specific security architectures. For engineers and tool builders, the immediate takeaway is clear: when AI takes the wheel, embedding automated, architecture-aware security guardrails directly into the development workflow is no longer optional—it is a necessity.

Summary updated

BibTeX
@misc{liu2025when,
  author = {Yue Liu and Zhenchang Xing and Shidong Pan and Chakkrit Tantithamthavorn},
  title = {{When AI Takes the Wheel: Security Analysis of Framework-Constrained Program Generation}},
  year = {2025},
  eprint = {2510.16823},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2510.16823},
}
Figure