Security Vulnerabilities in AI-Generated JavaScript: A Comparative Study of Large Language Models

Large Language Models (LLMs) have been widely used in software development, yet the security of AI-generated code remains a critical concern. This research examines security vulnerabilities in JavaScript code generated by six LLMs, which are ChatGPT-4o, Claude v3.5 Sonnet, DeepSeek R1 70B, Llama 3.1 405B, Mistral Large 2, and Nova Pro. We propose a new approach to assess security vulnerabilities. Using 100 identical complex prompts, we systematically assessed vulnerabilities in AI-generated code and analyzed the most frequently occurring Common Weakness Enumeration (CWE) categories in different LLMs. Our results show that 275 of the 600 generated JavaScript code snippets contain vulnerabilities. We also identify $\mathbf{6 0 2}$ vulnerabilities from 28 CWEs. While all LLMs introduce vulnerabilities into generated code, their CWE and severity distribution vary significantly. We also introduce metrics to ensure a fair comparison of LLM capabilities, such as Vulnerabilities per Line of Code (V/LoC) and Weighted Security Risk per Line of Code (WSR/LoC) as evaluation metrics. Our research highlights the need for security measures to mitigate the security risks in AIgenerated code.

Authors

Institutions

Publication Details

Published
2025-08-04
DOI
https://doi.org/10.1109/csr64739.2025.11130176
Primary Topic
Artificial Intelligence in Healthcare and Education
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

Security Vulnerabilities in AI-Generated JavaScript: A Comparative Study of Large Language Models

Şerif Bahtıyar, Deniz Aydın
Artificial Intelligence in Healthcare and Education
article

Security Vulnerabilities in AI-Generated JavaScript: A Comparative Study of Large Language Models

Şerif Bahtıyar, Deniz Aydın
article en

Abstract

Large Language Models (LLMs) have been widely used in software development, yet the security of AI-generated code remains a critical concern. This research examines security vulnerabilities in JavaScript code generated by six LLMs, which are ChatGPT-4o, Claude v3.5 Sonnet, DeepSeek R1 70B, Llama 3.1 405B, Mistral Large 2, and Nova Pro. We propose a new approach to assess security vulnerabilities. Using 100 identical complex prompts, we systematically assessed vulnerabilities in AI-generated code and analyzed the most frequently occurring Common Weakness Enumeration (CWE) categories in different LLMs. Our results show that 275 of the 600 generated JavaScript code snippets contain vulnerabilities. We also identify $\mathbf{6 0 2}$ vulnerabilities from 28 CWEs. While all LLMs introduce vulnerabilities into generated code, their CWE and severity distribution vary significantly. We also introduce metrics to ensure a fair comparison of LLM capabilities, such as Vulnerabilities per Line of Code (V/LoC) and Weighted Security Risk per Line of Code (WSR/LoC) as evaluation metrics. Our research highlights the need for security measures to mitigate the security risks in AIgenerated code.

Istanbul Technical University (TR)
Reduced inequalities
Openalex Percentile: Top 84%
Artificial Intelligence in Healthcare and Education
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

Security Vulnerabilities in AI-Generated JavaScript: A Comparative Study of Large Language Models — Şerif Bahtıyar, Deniz Aydın · (2025) | TGRS Research Map | TGRS