home / skills / harperaa / secure-claude-skills / awareness-overview

awareness-overview skill

/security-awareness/awareness-overview

This skill helps you understand AI-generated code security risks and practical mitigation strategies for vibe coding, improving secure development awareness.

npx playbooks add skill harperaa/secure-claude-skills --skill awareness-overview

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
17.3 KB
---
name: vibe-coding-security-awareness-overview
description: Understand the security risks inherent in AI-generated code and vibe coding. Use this skill when you need to understand why AI generates insecure code, statistics on vulnerabilities, real-world breach examples, or overall security awareness for AI-assisted development. Triggers include "vibe coding security", "AI code security", "AI vulnerabilities", "security risks AI code", "why AI insecure", "AI security awareness", "AI generated code risks".
---

# Vibe Coding Security Awareness Overview

## Introduction: The Double-Edged Sword of AI-Powered Development

The emergence of **"vibe coding"**—a term coined by Andrej Karpathy in February 2025 to describe AI-assisted development where developers don't review the generated code—has fundamentally transformed software development. As Karpathy originally described it, vibe coding means "fully giving in to the vibes, embracing exponentials, and forgetting that the code even exists."

While this approach **democratizes programming** and **accelerates development**, it introduces significant security challenges that demand careful examination.

## The Statistics Are Sobering

### AI-Generated Code Vulnerability Rates

According to recent research:

**Veracode Study (2024):**
- AI models pick **insecure code patterns 45% of the time**
- Java applications show vulnerability rates as high as **72%**
- Security patterns from outdated training data perpetuate vulnerabilities

**Georgetown Center for Security and Emerging Technology (2024):**
- Up to **36% of AI-generated code contains security vulnerabilities**
- Most common: injection flaws, broken authentication, information exposure

**Contrast Security (2025):**
- **Input validation is often overlooked or implemented incorrectly** in AI-generated code
- Creates openings for injection attacks that can compromise entire systems

### Why AI Generates Insecure Code

**1. Training on Insecure Examples**
- AI models trained on millions of code examples from public repositories
- Many examples contain outdated or insecure patterns
- AI perpetuates these vulnerabilities in generated code

**2. Lack of Security Context**
- AI doesn't understand threat models
- Can't reason about attack vectors
- Focuses on functionality over security

**3. Simplified Implementations**
- AI often generates "simplest" solution
- Omits security controls for brevity
- Assumes trusted input

**4. Outdated Security Practices**
- Training data includes code from years ago
- Security best practices have evolved
- AI suggests deprecated/insecure methods

## Real-World Consequences

As Simon Willison, creator of Datasette, notes:

> "Vibe coding your way to a production codebase is clearly risky. Most of the work we do as software engineers involves evolving existing systems, where the quality and understandability of the underlying code is crucial."

### The Compound Risk Effect

Vibe coding doesn't just introduce individual vulnerabilities—it creates **cascading security failures**:

1. **Pattern Propagation:** Single insecure pattern suggested by AI
2. **Copy-Paste Multiplication:** Developers copy pattern across codebase
3. **Amplified Impact:** Same vulnerability replicated 10, 20, 100 times
4. **Systemic Weakness:** Entire application built on insecure foundation

### The False Confidence Problem

**Most dangerous aspect:** The code looks professional, passes tests, and works—until it doesn't, catastrophically.

**Developer perception:**
- "AI is smarter than me, so this must be secure" ❌
- "The code works, so it must be safe" ❌
- "It passed my tests, so there are no vulnerabilities" ❌

## Major Vulnerability Categories in AI-Generated Code

### 1. Injection Vulnerabilities (Most Common)

**Statistics:**
- AI generates SQL injection vulnerabilities **68% of the time** when creating database queries
- XSS vulnerabilities appear in **35% of web applications** with AI-generated frontend code

**Real-World Impact:**
- **Equifax (2017):** SQL injection - 147 million records breached
- **British Airways (2018):** XSS - 380,000 transactions, £20M fine

→ **See:** `injection-vulnerabilities` skill for detailed examples and patterns

### 2. Authentication & Authorization Defects

**Statistics:**
- **73% of AI-generated authentication code** lacks proper session management
- **81% stores passwords insecurely** (MD5, SHA1, or even plaintext)

**Real-World Impact:**
- **Ashley Madison (2015):** Weak password hashing - 32M accounts compromised
- **Dropbox (2012):** Custom auth failure - 68M accounts affected

→ **See:** `auth-vulnerabilities` skill for authentication anti-patterns

### 3. Sensitive Information Exposure

**Statistics:**
- AI-generated code **frequently suggests hardcoding API keys** (pattern appears in millions of training examples)
- **Verbose logging** in AI-generated code exposes sensitive data

**Real-World Impact:**
- Developer used AI to build SaaS, **accidentally committed AWS credentials**
- Within days: **$10,000s in unauthorized charges**

→ **See:** `information-leakage` skill for credential exposure patterns

### 4. Insecure Dependencies

**Statistics:**
- **245,000 malicious packages** published to npm (2023)
- **700% increase** in supply chain attacks vs 2022
- AI suggests outdated packages: **67% contain known vulnerabilities**

**Real-World Impact:**
- **event-stream (2018):** 2M downloads/week hijacked - cryptocurrency wallet keys stolen
- **ua-parser-js (2021):** 8M downloads/week compromised

→ **See:** `supply-chain-risks` skill for dependency security

### 5. Business Logic Vulnerabilities

**Statistics:**
- **Business logic flaws pass functional tests** while creating security vulnerabilities
- Subtle errors like race conditions, integer overflows

**Real-World Impact:**
- Flash sale systems selling more inventory than available
- Payment processing allowing negative totals

→ **See:** `business-logic-flaws` skill for logic vulnerability patterns

### 6. Resource Exhaustion & DoS

**Statistics:**
- AI-generated code often **lacks resource limits**
- No rate limiting, unbounded loops, unlimited file uploads

**Real-World Impact:**
- Startup built AI summarization without rate limiting
- Attack generated **$200,000 in AI API charges** in 4 hours

→ **See:** `resource-exhaustion` skill for DoS prevention

## The Path Forward: Secure Vibe Coding

Despite these challenges, the solution is **not to abandon AI-assisted development** but to evolve our security practices.

### Key Principles for Secure Vibe Coding

**1. Defense in Depth**
No single security measure is sufficient. Layer multiple security controls.

→ **See:** `security-overview` skill for defense-in-depth architecture

**2. Automated Security Testing**
Since humans aren't reviewing code in vibe coding, automated security tools become critical.

→ **See:** `security-testing` skill for testing approach

**3. Security-First Prompting**
Research shows security-aware prompts reduce vulnerability rates by up to **40%**.

**Examples:**
- "Create a login endpoint **with security best practices**"
- "Build a search function **following OWASP guidelines**"
- "Implement file upload **with proper validation and sanitization**"

**4. Use Secure-by-Default Frameworks**
This project (Secure Vibe Coding OS) provides security utilities that are:
- ✅ Easy to use correctly
- ✅ Hard to use incorrectly
- ✅ AI-friendly (clear patterns for AI to follow)

→ **Implementation Skills:**
- `csrf-protection` - Prevent cross-site request forgery
- `rate-limiting` - Prevent brute force and abuse
- `input-validation` - Validate and sanitize all user input
- `security-headers` - Configure browser security features
- `error-handling` - Prevent information leakage
- `auth-security` - Use Clerk for authentication
- `payment-security` - Use Clerk Billing + Stripe
- `dependency-security` - Manage supply chain risks

**5. Continuous Monitoring**
The dynamic nature of AI-generated code requires continuous security monitoring.

→ **See:** `security-testing` skill for monitoring approach

## Understanding Each Vulnerability Category

This overview skill introduces you to security risks in AI-generated code. For detailed analysis of each vulnerability category, use these specialized awareness skills:

### Injection Attacks
**Skill:** `injection-vulnerabilities`
- SQL injection (68% vulnerable)
- Command injection (shell=True)
- XSS (35% of web apps)
- **Real examples:** Equifax, British Airways, MySpace worm

### Authentication Failures
**Skill:** `auth-vulnerabilities`
- Weak password storage (MD5, plaintext)
- Broken session management (no expiration)
- Access control bypass
- **Real examples:** Ashley Madison, Dropbox breaches

### Information Exposure
**Skill:** `information-leakage`
- Hardcoded credentials in code
- Verbose logging (passwords in logs)
- Error messages revealing system details
- **Real examples:** AWS key exposure, $200K abuse

### Supply Chain Attacks
**Skill:** `supply-chain-risks`
- Vulnerable dependencies (67% of AI suggestions)
- Malicious packages (245K in 2023)
- Dependency confusion
- **Real examples:** event-stream, ua-parser-js, colors.js

### Business Logic Flaws
**Skill:** `business-logic-flaws`
- Race conditions (flash sales)
- Integer overflow (negative totals)
- Logic errors passing tests
- **Real examples:** Flash sale overselling, payment bypass

### Resource Exhaustion
**Skill:** `resource-exhaustion`
- No rate limiting
- Unbounded resource consumption
- DoS vulnerabilities
- **Real examples:** $200K AI API abuse, server exhaustion

## Mitigation: Implementation Skills

After understanding the risks (awareness skills), implement security controls (implementation skills):

### Prevent Injection Attacks
→ `input-validation` skill - Zod schemas, XSS sanitization

### Prevent CSRF Attacks
→ `csrf-protection` skill - Token-based protection

### Prevent Brute Force
→ `rate-limiting` skill - 5 requests/minute per IP

### Secure Headers
→ `security-headers` skill - CSP, HSTS, X-Frame-Options

### Secure Errors
→ `error-handling` skill - Environment-aware messages

### Secure Authentication
→ `auth-security` skill - Clerk integration

### Secure Payments
→ `payment-security` skill - Never touch card data

### Secure Dependencies
→ `dependency-security` skill - npm audit, updates

### Test Security
→ `security-testing` skill - Pre-deployment checklist

## Key Takeaways

**The Paradox:**
- Vibe coding **democratizes** software development (good)
- But introduces **systemic security vulnerabilities** (bad)

**The Statistics:**
- **45% of AI code** has insecure patterns
- **36% contains** actual vulnerabilities
- **68% of database queries** have SQL injection
- **73% fewer vulnerabilities** when using managed services vs custom code

**The Solution:**
- **Not** abandoning AI-assisted development
- **But** using secure-by-default frameworks
- **And** security-aware prompting
- **Plus** automated security testing

**Remember:**
In the age of AI-generated code, **security is not optional—it's existential**.

## Conclusion and Key Takeaways

### The State of Vibe Coding Security in 2025

As we've examined throughout this skill, vibe coding presents a fundamental paradox: it democratizes software development while simultaneously introducing systemic security vulnerabilities. The statistics are sobering—with vulnerability rates ranging from 36% to 72% depending on the language and use case, the security implications cannot be ignored.

### Critical Findings

**1. Ubiquity of Basic Vulnerabilities**

The most concerning finding is that AI-generated code consistently fails at basic security practices that have been well-understood for decades. SQL injection, XSS, and hardcoded credentials—vulnerabilities that should be extinct—are thriving in the age of AI-assisted development.

**2. The Compound Risk Effect**

As noted by security researchers, vibe coding doesn't just introduce individual vulnerabilities; it creates cascading security failures. A single insecure pattern suggested by AI can be replicated across entire codebases, amplifying the impact exponentially.

**3. The False Confidence Problem**

Perhaps most dangerous is the illusion of competence that vibe coding creates. As one researcher noted, "The code looks professional, passes tests, and works—until it doesn't, catastrophically."

### The Path Forward

Despite these challenges, the solution is not to abandon AI-assisted development but to evolve our security practices to match this new paradigm. The key principles for secure vibe coding are:

**1. Defense in Depth**

No single security measure is sufficient. Successful implementations layer multiple security controls, from input validation to rate limiting to monitoring.

→ **See:** `security-overview` skill for complete defense-in-depth architecture

**2. Automated Security Testing**

Since humans aren't reviewing the code in vibe coding, automated security tools become critical. Every example in this chapter shows how proper tooling can catch the vulnerabilities AI introduces.

→ **See:** `security-testing` skill for comprehensive testing approach

**3. Security-First Prompting**

Research shows that security-aware prompts significantly reduce vulnerability rates. Including phrases like "with security best practices" or "following OWASP guidelines" in prompts can improve output security by up to 40%.

**Examples of security-aware prompts:**
- "Create a login endpoint **with security best practices**"
- "Build a search function **following OWASP guidelines**"
- "Implement file upload **with proper validation and sanitization**"
- "Add payment processing **using secure patterns**"

**4. Continuous Monitoring**

The dynamic nature of AI-generated code requires continuous security monitoring. What seems secure today might be vulnerable tomorrow as new attack vectors are discovered.

→ **See:** `security-testing` skill for monitoring strategies

### Final Thoughts

As Simon Willison aptly puts it, "Not all AI-assisted programming is vibe coding." The distinction is critical—AI can be a powerful tool for secure development when used with proper oversight and security controls. The examples in this skill demonstrate that for every vulnerable pattern AI might generate, there exists a secure alternative that maintains the development velocity vibe coding promises.

The future of secure vibe coding lies not in choosing between speed and security, but in building systems that deliver both. This project (Secure Vibe Coding OS) provides practical frameworks for implementing security controls without sacrificing the accessibility and efficiency that make vibe coding attractive.

**Remember: In the age of AI-generated code, security is not optional—it's existential.**

---

## References

[1] Karpathy, A. (2025). "On Vibe Coding." Personal Blog. February 2025.

[2] Veracode. (2024). "State of Software Security Report: AI-Generated Code Analysis." Veracode Research.

[3] Center for Security and Emerging Technology. (2024). "Cybersecurity Risks of AI-Generated Code." Georgetown University.

[4] Willison, S. (2025). "Not all AI-assisted programming is vibe coding." Simon Willison's Weblog. March 2025.

[5] Contrast Security. (2025). "What is Vibe Coding? Impact, Security Risks, and Vulnerabilities." Contrast Security Blog.

[6] Aikido Security. (2025). "Vibe check: The vibe coder's security checklist for AI generated code." Aikido Dev Blog.

[7] SecureLeap. (2025). "The Hidden Security Risks of AI-Generated Code in 2025." SecureLeap Tech Blog.

[8] KDnuggets. (2025). "5 Reasons Why Vibe Coding Threatens Secure Data App Development." KDnuggets Publications.

[9] Databricks. (2025). "Passing the Security Vibe Check: The Dangers of Vibe Coding." Databricks Blog.

[10] Infisical. (2025). "A Vibe Coding Security Playbook: Keeping AI-Generated Code Safe." Infisical Blog.

[11] The Hacker News. (2025). "Secure Vibe Coding: The Complete New Guide." June 2025.

[12] ZenCoder. (2025). "5 Vibe Coding Risks and Ways to Avoid Them in 2025." ZenCoder AI Blog.

[13] WebProNews. (2025). "Vibe Coding AI: Speed vs Risks, No-Code Alternatives for 2025." WebProNews Technology.

[14] Analytics India Magazine. (2025). "Real-World Vibe Coding Security Incidents." March 2025.

[15] Aikido Security. (2025). "The State of AI Code Security 2025." Aikido Security Research.

[16] CSET. (2024). "Three Categories of Risk in AI Code Generation." Georgetown CSET Policy Brief.

[17] KDnuggets. (2025). "Dependency Vulnerabilities in AI-Generated Code: A Statistical Analysis."

[18] Contrast Security. (2025). "Business Logic Vulnerabilities in the Age of AI." Security Research Papers.

[19] Databricks. (2025). "Performance and Security: The Hidden Cost of Vibe Coding." Technical Report.

### Source & License

**Source:** https://github.com/derick6/secure-vibe-coding-whitepaper/blob/main/chapter1_security_risks.md

**License:** MIT License - Copyright (c) 2024 Secure Vibe Coding Whitepaper Contributors

## Next Steps

**To understand specific vulnerability categories:**
- Injection attacks → Use `injection-vulnerabilities` skill
- Authentication issues → Use `auth-vulnerabilities` skill
- Information leaks → Use `information-leakage` skill
- Supply chain → Use `supply-chain-risks` skill
- Business logic → Use `business-logic-flaws` skill
- DoS/Resource abuse → Use `resource-exhaustion` skill

**To implement security controls:**
- Start with `security-overview` skill for overall architecture
- Then use specific implementation skills as needed

Overview

This skill explains the security risks in AI-generated code and the concept of "vibe coding"—using AI outputs without human review. It summarizes why AI frequently produces insecure patterns, presents key vulnerability categories and statistics, and outlines practical steps to reduce risk while retaining AI productivity. Use this as a concise awareness guide for teams adopting AI-assisted development.

How this skill works

The skill inspects common failure modes of AI code generation: training-data bias toward insecure examples, lack of threat-model reasoning, simplified implementations that omit controls, and outdated practices. It compiles vulnerability statistics, real-world breach examples, and the compound effects that allow a single insecure suggestion to propagate across a codebase. It then maps awareness to mitigation categories and implementation controls.

When to use it

  • Evaluating the security posture before adopting AI-assisted development workflows
  • Assessing why an AI-generated feature contains vulnerabilities
  • Training engineers on risks of copy-pasting AI output into production
  • Building security requirements for prompt engineering and CI pipelines
  • Prioritizing automated testing and monitoring for AI-produced code

Best practices

  • Require always-on automated security testing (SAST, DAST, dependency scans) in CI
  • Use security-first prompts and templates that instruct AI to follow OWASP guidelines
  • Adopt secure-by-default frameworks and managed services to reduce custom risky code
  • Enforce defense-in-depth: input validation, auth controls, rate limits, secure headers
  • Continuously monitor production for abnormal behavior and leaked secrets

Example use cases

  • A team introducing AI code completion creates prompt templates that include security requirements
  • Security reviewers add automated checks to flag SQL uses not using parameterized queries
  • DevOps configures dependency scanning to block outdated or malicious packages suggested by AI
  • Product owners require rate limiting and quotas on AI-driven endpoints to prevent billable abuse

FAQ

Is the solution to stop using AI for coding?

No. The recommended approach is to combine AI speed with security controls: security-aware prompts, automated testing, secure frameworks, and human oversight where risk is high.

How much can security-aware prompting help?

Research shows tailored, security-focused prompts can reduce vulnerability rates by up to around 40%, but prompts must be paired with testing and monitoring.