DE

detecting-sql-injection-vulnerabilities

Scan and sanitize your application code to detect SQL injection vulnerabilities and enforce secure query patterns.

Install

mkdir -p .claude/skills/detecting-sql-injection-vulnerabilities && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/4800" && unzip -o skill.zip -d .claude/skills/detecting-sql-injection-vulnerabilities && rm skill.zip

Installs to .claude/skills/detecting-sql-injection-vulnerabilities

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Detect and analyze SQL injection vulnerabilities in application code
68 charsno explicit “when” trigger
Advanced

Key capabilities

  • Discover database interaction code
  • Identify user input surfaces
  • Trace data flows to SQL queries
  • Detect vulnerable SQL injection patterns
  • Generate remediation code for vulnerable queries

How it works

The skill scans application source code to detect SQL injection vulnerabilities by tracing user input through data flows into database query construction, identifying insecure patterns, and generating parameterized remediation code.

Inputs & outputs

You give it
Application source code
You get back
Vulnerability Report with findings, remediation summary, and defense recommendations

When to use detecting-sql-injection-vulnerabilities

  • Scanning codebase for SQL injection
  • Reviewing raw SQL query construction
  • Validating input sanitization logic
  • Identifying insecure ORM raw query usage

About this skill

Detecting SQL Injection Vulnerabilities

Overview

Scan application source code for SQL injection vulnerabilities (CWE-89, OWASP A03:2021) by tracing user input from entry points through data flows into database query construction. Detect string concatenation, format string interpolation, and inadequate parameterization across raw SQL, ORM raw query methods, stored procedure calls, and dynamic query builders.

Prerequisites

  • Application source code accessible in ${CLAUDE_SKILL_DIR}/
  • Database query files, ORM models, and repository/DAO layers available
  • Framework and language identified (Django, Rails, Express, Spring, Laravel, ASP.NET, Go, etc.)
  • Database type known (MySQL, PostgreSQL, SQLite, MSSQL, Oracle) for syntax-specific detection
  • Write permissions for reports in ${CLAUDE_SKILL_DIR}/security-reports/

Instructions

  1. Discover database interaction code: search for SQL keywords (SELECT, INSERT, UPDATE, DELETE, EXEC) and ORM raw query methods (raw(), execute(), createNativeQuery(), $wpdb->query()) across all source files.
  2. Identify input surfaces: map all user-controllable data entry points -- HTTP parameters, request bodies, URL path segments, headers, cookies, file uploads, and WebSocket messages.
  3. Trace data flows: follow each input surface through the code to determine whether user data reaches a SQL query. Flag any path where input is not passed through parameterized query binding.
  4. Detect vulnerable patterns:
    • String concatenation: "SELECT * FROM users WHERE id=" + userId
    • f-string/format interpolation: Python f-strings embedding variables directly into SQL strings
    • Template literals: `SELECT * FROM users WHERE id=${req.params.id}`
    • ORM raw queries without bindings: Model.objects.raw("SELECT * FROM t WHERE x='" + val + "'")
  5. Classify each finding: assign CVSS 3.1 score, identify attack type (classic injection, blind boolean/time-based, UNION-based exfiltration, second-order/stored injection), and document exploitability (authentication required, network access).
  6. Assess impact per finding: determine data exposure scope (authentication bypass, data exfiltration, data modification, OS command execution via xp_cmdshell or LOAD_FILE()).
  7. Generate remediation code: provide parameterized equivalents for each vulnerable query. Use framework-idiomatic patterns -- %s placeholders for Python DB-API, ? for Node.js, $1 for PostgreSQL, named parameters for Spring JPA.
  8. Recommend defense-in-depth measures: input validation (allowlists over denylists), stored procedures with parameterized calls, least-privilege database accounts, WAF rules, and ORM-only data access policies.
  9. Produce the vulnerability report at ${CLAUDE_SKILL_DIR}/security-reports/sqli-scan-YYYYMMDD.md with per-finding severity, CWE-89 mapping, file path and line number, vulnerable code snippet, attack vector demonstration, and remediated code.

See ${CLAUDE_SKILL_DIR}/references/implementation.md for the detection pattern library. See ${CLAUDE_SKILL_DIR}/references/critical-findings.md for example vulnerability write-ups with attack demonstrations.

Output

  • Vulnerability Report: ${CLAUDE_SKILL_DIR}/security-reports/sqli-scan-YYYYMMDD.md with all findings classified by severity
  • Finding Details: per-finding file path, line number, vulnerable code, attack vector, CVSS score, and remediation code
  • Remediation Summary: parameterized query replacements grouped by language/framework
  • Defense Recommendations: input validation rules, database privilege changes, and WAF configuration

Error Handling

ErrorCauseSolution
Unknown ORM or database frameworkCustom or uncommon data access libraryApply generic SQL injection pattern detection; note limited framework-specific guidance
Cannot analyze compiled/minified codeProduction bundles or bytecode instead of sourceRequest unminified source; document reduced detection accuracy
False positive on sanitized inputProper sanitization exists but not recognizedTrace sanitization implementation manually; whitelist verified-safe patterns
Complex dynamic query builder logicMulti-step query construction across modulesTrace full data flow manually; flag for manual security review
Cannot analyze stored procedure definitionsSQL source files not available in ${CLAUDE_SKILL_DIR}/Request .sql files or database schema exports; focus on application-layer code

Examples

  • "Scan the codebase for SQL injection risks in dynamic query construction, focusing on controllers and API handlers."
  • "Review these query snippets and propose parameterized equivalents with unit tests validating the fix."
  • "Detect second-order SQL injection in the user profile update flow where stored data is later used in admin queries."

Resources

When not to use it

  • When analyzing compiled or minified code
  • When SQL source files for stored procedures are unavailable
  • When the ORM or database framework is unknown or uncommon

Prerequisites

Application source code accessible in `${CLAUDE_SKILL_DIR}/`Database query files, ORM models, and repository/DAO layers availableFramework and language identifiedDatabase type known

Limitations

  • Cannot analyze compiled/minified code
  • May produce false positives on sanitized input if not recognized
  • Limited framework-specific guidance for unknown or uncommon ORMs

How it compares

This skill provides a structured approach to identify and remediate SQL injection vulnerabilities by tracing data flows and generating specific parameterized code, unlike manual code review.

Compared to similar skills

detecting-sql-injection-vulnerabilities side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
detecting-sql-injection-vulnerabilities (this skill)327dReviewAdvanced
sap-memory03moNo flagsAdvanced
backend-security-coder244moNo flagsIntermediate
security-audit36moReviewIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

More by jeremylongshore

View all by jeremylongshore

analyzing-logs

jeremylongshore

Analyze application logs to detect performance issues, identify error patterns, and improve stability by extracting key insights.

14123

ollama-setup

jeremylongshore

Configure auto-configure Ollama when user needs local LLM deployment, free AI alternatives, or wants to eliminate hosted API costs. Trigger phrases: "install ollama", "local AI", "free LLM", "self-hosted AI", "replace OpenAI", "no API costs". Use when appropriate context detected. Trigger with relevant phrases based on skill purpose.

1167

backtesting-trading-strategies

jeremylongshore

Backtest crypto and traditional trading strategies against historical data. Calculates performance metrics (Sharpe, Sortino, max drawdown), generates equity curves, and optimizes strategy parameters. Use when user wants to test a trading strategy, validate signals, or compare approaches. Trigger with phrases like "backtest strategy", "test trading strategy", "historical performance", "simulate trades", "optimize parameters", or "validate signals".

1071

generating-database-seed-data

jeremylongshore

Process this skill enables AI assistant to generate realistic test data and database seed scripts for development and testing environments. it uses faker libraries to create realistic data, maintains relational integrity, and allows configurable data volumes. u... Use when working with databases or data models. Trigger with phrases like 'database', 'query', or 'schema'.

1033

cursor-codebase-indexing

jeremylongshore

Execute set up and optimize Cursor codebase indexing. Triggers on "cursor index setup", "codebase indexing", "index codebase", "cursor semantic search". Use when working with cursor codebase indexing functionality. Trigger with phrases like "cursor codebase indexing", "cursor indexing", "cursor".

885

testing-mobile-apps

jeremylongshore

Execute mobile app testing on iOS and Android devices/simulators. Use when performing specialized testing. Trigger with phrases like "test mobile app", "run iOS tests", or "validate Android functionality".

810

You might also like

sap-memory

OOBE-PROTOCOL

|

00

backend-security-coder

sickn33

Expert in secure backend coding practices specializing in input validation, authentication, and API security. Use PROACTIVELY for backend security implementations or security code reviews.

2446

security-audit

ruvnet

Comprehensive security scanning and vulnerability detection. Includes input validation, path traversal prevention, CVE detection, and secure coding pattern enforcement. Use when: authentication implementation, authorization logic, payment processing, user data handling, API endpoint creation, file upload handling, database queries, external API integration. Skip when: read-only operations on public data, internal development tooling, static documentation, styling changes.

337

security-best-practices

openai

Perform language and framework specific security best-practice reviews and suggest improvements. Trigger only when the user explicitly requests security best practices guidance, a security review/report, or secure-by-default coding help. Trigger only for supported languages (python, javascript/typescript, go). Do not trigger for general code review, debugging, or non-security tasks.

732

ark-pentest-issue-resolver

mckinsey

Resolve common penetration testing issues in Ark. Use when fixing security vulnerabilities from pentest reports, security audits, or OWASP Top 10 issues.

18

damage-control

disler

Install, configure, and manage the Claude Code Damage Control security hooks system. Use when user mentions damage control, security hooks, protected paths, blocked commands, install security, or modify protection settings.

27

Search skills

Search the agent skills registry