AI-assisted coding is becoming more widespread, with developers increasingly relying on large language models (LLMs) to perform a variety of tasks. This trend is often referred to as vibe coding. It emphasizes rapid development by allowing developers to describe functionality in natural language and then rely on AI to generate the implementation. While this approach can significantly improve development velocity, it also introduces vibe coding security risks. This article examines whether vibe coding is safe and evaluates the key points security practitioners should consider when adopting this development approach.

Why Adding Security Prompts Doesn’t Fix the Problem

Many developers assume that adding security guidance to prompts improves the safety and security of AI-generated code. For example, developers usually strive to include instructions such as:

  • Write secure code.
  • Avoid OWASP vulnerabilities.
  • Follow security best practices.

While these instructions appear sensible from a coding perspective, this prompt-level security guidance alone does little to eliminate vibe coding security risks. This is because large language models (LLMs) generate code based on statistical patterns learned during training. Therefore, even when prompts include security instructions, AI models may still produce insecure patterns. This is particularly true if those patterns were common in their training data.

In most cases, security prompts simply encourage AI models to add superficial safeguards. They do not address deeper architectural weaknesses in the code. As a result, developers may gain a false sense of security while the underlying code security vulnerabilities remain largely unresolved. Security teams, therefore, should not rely solely on prompt engineering. Instead, they should ensure that security validation mechanisms are integrated directly into development workflows.

Which Vulnerabilities Keep Appearing Across Models and Frameworks

Regarding AI code security risks, certain vulnerability patterns tend to recur across multiple models and development environments. As AI models become more advanced, the following vulnerabilities remain common:

  • Injection vulnerabilities: AI-generated code often fails to properly sanitize user input. This ultimately creates opportunities for injection vulnerabilities such as SQL injection, command injection, and template injection.
  • Broken authentication: Authentication logic generated by AI models may rely on insecure session management practices and insufficient password validation. This creates a vulnerability that attackers may exploit.
  • Insecure data handling: Generated code often lacks a proper encryption process during storage and transfer. Organizations sometimes also fail to implement secure storage for sensitive data. This provides ripe avenues for code security vulnerabilities.
  • Dependency vulnerabilities: AI coding assistants frequently suggest or even use third-party libraries. These decisions are often driven by the user prompt or abstracted away by the platform itself, leaving users with limited visibility into their actual dependency footprint. As a result, libraries may be introduced without proper validation of their security posture or version status, increasing the risk of vulnerable code.

These recurring risks illustrate that vibe coding security vulnerabilities can persist across different development frameworks and AI models. These vulnerabilities often mirror patterns present in training data, clearly demonstrating that improvements in model capability alone do not guarantee secure AI code output. Recent benchmarks, such as SUSVIBES, have evaluated the security posture of AI-generated code across multiple models and frameworks. The results consistently show the presence of common vulnerabilities, such as injection flaws and insecure authentication patterns.

What Secure AI Coding Actually Requires

For security teams, addressing vibe coding security risks requires more than improving prompts or relying solely on introducing newer AI models. Instead, organizations must apply the same level of scrutiny to AI-generated code as to human-written code. This entails the adoption and implementation of the following practices, which are essential for maintaining strong vibe coding security:

  • Secure code review: All AI-generated code, just like human-generated code, should undergo rigorous security-focused peer review before being deployed in production environments. This addresses most of the vulnerabilities associated with improper coding.
    • Automated security scanning: It is crucial to ensure that static analysis tools and vulnerability scanners are integrated into development pipelines. This will help to detect potential AI code security risks early in the SDLC.
  • Secure dependency management: Developers should verify the security posture of any third-party libraries, especially those that are recommended by AI coding tools. This approach helps reduce the emergence of new AI code security risks stemming from the supply chain.
    • Context-aware development: This approach advocates evaluating AI-generated code in the context of the application’s architecture and threat model. This typically produces improved results by devising solutions that fit the code’s context.
  • Developer security education: Developers should be trained to understand the limitations of AI coding assistants. This also allows them to be knowledgeable and responsible for validating generated outputs without assistance from security specialists.

When these best practices are implemented together, they often significantly reduce the likelihood that vibe coding security vulnerabilities will reach production systems. Ultimately, for security teams, the objective should not be to eliminate AI-assisted development entirely. More efforts should be directed toward ensuring that AI-generated code is treated as untrusted input until it is verified and proven secure.

Frequently Asked Questions (FAQs)

1. What does the SUSVIBES benchmark reveal about vibe coding security?

The SUSVIBES benchmark reveals the security posture of AI-generated code across a variety of AI models and frameworks. The results obtained will show that AI coding assistants frequently generate code containing common vulnerabilities. Typical vulnerabilities that are within the benchmark include injection flaws and insecure authentication patterns. These help highlight persistent vibe coding security risks across the organizational environment.

2. Why do LLMs keep introducing OWASP Top 10 vulnerabilities even in newer models?

LLMs continue to introduce OWASP Top 10 vulnerabilities, even in recent models, because they typically learn from existing code repositories. These repositories often contain insecure patterns, hence the persistent coverage. As a result, new models sometimes reproduce coding security vulnerabilities in their training data. Improvements in model size and architecture do not automatically eliminate any inherited vulnerability patterns.

3. Does adding security guidance to prompts improve the quality of AI-generated code?

Yes, but with limitations. While security-focused prompts can sometimes reduce obvious mistakes, they rarely eliminate deeper vulnerabilities. This is because AI models rely on statistical generation rather than security reasoning and are typically optimized, trained, and evaluated for functional correctness rather than for secure outcomes. As a result, they are not inherently incentivized to produce secure code. Therefore, prompt instructions alone are often insufficient to guarantee secure output. Ultimately, the goal should not be to entirely eliminate AI-assisted development but to treat AI-generated code in line with zero-trust principles.

4. Which CWEs are most commonly missed by AI coding agents?

Some of the CWEs that are commonly missed by AI coding agents include injection flaws (CWE-89), improper authentication (CWE-287), and insecure deserialization (CWE-502). Other reported vulnerabilities are concentrated around inadequate input validation (CWE-20) and hard-coded credentials (CWE-798). Security practitioners should understand that these weaknesses are not isolated. They frequently appear in AI-generated code in various programming languages and frameworks.

5. How should security teams treat AI-generated code in production environments?

Security teams should treat AI-generated code as untrusted until it is verified, in line with the principle of zero trust. Such code should undergo rigorous review, testing, and automated security analysis before deployment. AI-generated code should also follow the same secure development lifecycle practices as human-written code for enhanced security. Vibe coding security best practices should be implemented to maintain robust security standards.

Conclusion

Using vibe coding, AI-generated code is increasingly developed without deep contextual awareness of the application’s architecture, threat model, or deployment environment. As a result, the code produced through vibe coding workflows can introduce recurring security vulnerabilities. These issues contribute to broader AI code security risks that security teams should monitor and address. To mitigate these risks, security teams must always treat AI-generated code as untrusted and enforce rigorous code review. They should also integrate automated security testing, validate all dependencies and external integrations, and strengthen developer awareness. These measures help improve the security posture and enable the safe adoption of AI-driven development.

References

  1. Lei Li Lab. (n.d.). SUSVIBES: Benchmark for evaluating security of AI-generated code. GitHub.
    https://github.com/LeiLiLab/susvibes
  2. Open Worldwide Application Security Project. (2023). Top 10 risks for large language model applications.
    https://owasp.org/www-project-top-10-for-large-language-model-applications/
  3. National Institute of Standards and Technology. (2023). Artificial Intelligence Risk Management Framework (AI RMF 1.0).
    https://nvlpubs.nist.gov/nistpubs/ai/NIST.AI.100-1.pdf
  4. Veracode. (2025). State of GenAI code security report.
  5. ENISA. (2024). ENISA Threat Landscape 2024.
    https://www.enisa.europa.eu/publications/enisa-threat-landscape-2024