Cyber Security News

Security Flaws Found in Every Script Generated by ChatGPT, Copilot, and Gemini

A new academic study from Beacom College of Computer & Cyber Sciences has revealed that every automation script generated by leading AI models ChatGPT, Microsoft Copilot, and Google Gemini contained exploitable security vulnerabilities.

As enterprises increasingly rely on AI tools to accelerate development workflows, these findings highlight serious risks associated with deploying unreviewed AI-generated code directly into production environments.

To evaluate the security quality of AI-generated code without prompt bias, researchers issued identical, standardized prompts across ChatGPT, Microsoft Copilot, and Google Gemini. The test suite focused on three common enterprise tasks:

  • Web Scraping: Automated data collection scripts.
  • Email Automation: Automated messaging and notification handlers.
  • File Workflow Automation: File-system monitoring and management tools.

In total, nine Python scripts were generated. The researchers evaluated the code using Anthropic’s Claude Code to simulate how a non-expert user might realistically vet AI-written scripts.

This automated review process surfaced 45 individual security findings, which were deduplicated into 17 distinct vulnerability classes. Each vulnerability was scored under the CVSS 3.1 framework, mapped to the OWASP Top 10, and cross-referenced with the MITRE ATT&CK framework.

Security Flaws Found in Every Script Generated

The research demonstrates that security flaws are systemic rather than brand-specific. Vulnerability counts remained remarkably consistent across platforms: ChatGPT’s scripts contained 13 vulnerabilities, Copilot’s contained 14, and Gemini’s had 12, with statistically negligible variance.

CVSS base score totals and average findings per AI platform (Image Source:arxiv.org/)

Out of the 17 unique vulnerability classes identified, 9 appeared in code generated by all three AI models (a 53% overlap), and 14 were present in at least two platforms (an 82% overlap).

This indicates that security risks are inherently tied to the nature of the requested task rather than the choice of AI provider.

Vulnerability overlap matrix across ChatGPT, Copilot, and Gemini (Image Source:arxiv.org/)

Primary Vulnerabilities Observed Across Platforms:

  • Server-Side Request Forgery (SSRF): Unvalidated URL parameters in every web scraper script, allowing potential attackers to probe internal networks.
  • Path Traversal: Unsanitized file paths across scraper, email, and file-watcher scripts.
  • Injection Flaws: Email header and template injection in every email automation script, enabling message tampering or phishing.
  • Symlink Vulnerabilities: Flaws in all file-watcher scripts leading to arbitrary file manipulation.
  • Broad Exception Handling: Overly broad try-except blocks that silently swallow security-critical errors.

The researchers cataloged 17 distinct vulnerability classes across the generated codebase.

Catalog of the 17 unique vulnerability classes identified in the study (Image Source:arxiv.org/)

The detailed CVSS 3.1 breakdown illustrates that critical flaws span network handling, file systems, and input parsing logic:

Complete CVSS 3.1 scoring table and severity distribution (Image Source:arxiv.org/)

As detailed in the published research paper, a Pareto analysis revealed that just 11 of the 17 vulnerability classes account for roughly 80% of total weighted risk. Critical issues such as SSRF, template injection, email header injection, and path traversal top the list.

Mapped against the Lockheed Martin Cyber Kill Chain, these flaws cover initial access, execution, credential access, and lateral movement.

Automation scripts inherently run with the permissions of the executing user or host environment. An unvetted script can interact with corporate shared drives, internal SMTP servers, and local subnets without needing secondary privilege escalation.

These risks compound when combined with broader threats in the AI ecosystem, such as AI prompt injection attacks targeting automated code tools or AI workflow vulnerabilities that expose underlying enterprise services to exploitation.

Organizations should establish clear guardrails around AI-assisted software development:

  • Mandate Code Reviews: Enforce security reviews for all AI-written code prior to production deployment, regardless of script complexity.
  • Restrict Execution Permissions: Block LLM-generated scripts from running with elevated permissions or unrestricted access to shared network drives.
  • Prioritize High-Severity Fixes: Utilize CVSS, OWASP, and MITRE ATT&CK mappings to remediate SSRF, path traversal, and injection flaws first.
  • Educate Staff: Remind developers and non-technical employees that functional code does not equate to secure code.

 Strengthen Your SOC by Accelerating Threat Detection & Rapid Investigations. -> Integrate ANY.RUN With Your SOC Now.

Guru Baran

Gurubaran KS is a cybersecurity analyst, and Journalist with a strong focus on emerging threats and digital defense strategies. He is the Co-Founder and Editor-in-Chief of Cyber Security News, where he leads editorial coverage on global cybersecurity developments.

Recent Posts

Google Chrome 153 Update Fixes 42 Security Flaws, Including 3 Critical Ones

Google has released an important Chrome 153 security update that fixes 42 vulnerabilities across the…

3 hours ago

CISA and NIST Release Technical Checklist for Safeguarding Identity Tokens From Theft and Misuse

The Cybersecurity and Infrastructure Security Agency (CISA) and the National Institute of Standards and Technology…

13 hours ago

CISA Shares 17 Techniques Used by Hackers to Compromise Active Directory Environments

CISA and five international cybersecurity agencies have released detailed guidance describing 17 common techniques hackers…

14 hours ago

Apple Rolls Out Massive Security Update Fixing 273 Vulnerabilities Across Its Devices

Apple has released one of its largest coordinated security rollouts, addressing 273 distinct critical vulnerabilities…

15 hours ago

How to Keep Malware’s Rotating Infrastructure From Becoming a Detection Gap

You can’t detect today's attacks with yesterday’s threat intelligence; that’s how you could briefly formulate…

15 hours ago

Microsoft Bans Its AI Models From Launching Cyberattacks or Escalating Their Own Access

Microsoft has published a draft Humanist AI Code of Conduct that would prohibit its in-house…

15 hours ago