detecting-sql-injection-vulnerabilities

0
0
Source

Detect and analyze SQL injection vulnerabilities in application code and database queries. Use when you need to scan code for SQL injection risks, review query construction, validate input sanitization, or implement secure query patterns. Trigger with phrases like "detect SQL injection", "scan for SQLi vulnerabilities", "review database queries", or "check SQL security".

Install

mkdir -p .claude/skills/detecting-sql-injection-vulnerabilities && curl -L -o skill.zip "https://mcp.directory/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

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

svg-icon-generator

jeremylongshore

Svg Icon Generator - Auto-activating skill for Visual Content. Triggers on: svg icon generator, svg icon generator Part of the Visual Content skill category.

6814

d2-diagram-creator

jeremylongshore

D2 Diagram Creator - Auto-activating skill for Visual Content. Triggers on: d2 diagram creator, d2 diagram creator Part of the Visual Content skill category.

2412

performing-penetration-testing

jeremylongshore

This skill enables automated penetration testing of web applications. It uses the penetration-tester plugin to identify vulnerabilities, including OWASP Top 10 threats, and suggests exploitation techniques. Use this skill when the user requests a "penetration test", "pentest", "vulnerability assessment", or asks to "exploit" a web application. It provides comprehensive reporting on identified security flaws.

379

designing-database-schemas

jeremylongshore

Design and visualize efficient database schemas, normalize data, map relationships, and generate ERD diagrams and SQL statements.

978

performing-security-audits

jeremylongshore

This skill allows Claude to conduct comprehensive security audits of code, infrastructure, and configurations. It leverages various tools within the security-pro-pack plugin, including vulnerability scanning, compliance checking, cryptography review, and infrastructure security analysis. Use this skill when a user requests a "security audit," "vulnerability assessment," "compliance review," or any task involving identifying and mitigating security risks. It helps to ensure code and systems adhere to security best practices and compliance standards.

86

django-view-generator

jeremylongshore

Generate django view generator operations. Auto-activating skill for Backend Development. Triggers on: django view generator, django view generator Part of the Backend Development skill category. Use when working with django view generator functionality. Trigger with phrases like "django view generator", "django generator", "django".

15

You might also like

flutter-development

aj-geddes

Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.

643969

drawio-diagrams-enhanced

jgtolentino

Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.

591705

ui-ux-pro-max

nextlevelbuilder

"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."

318398

godot

bfollington

This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.

339397

nano-banana-pro

garg-aayush

Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.

451339

fastapi-templates

wshobson

Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.

304231

Stay ahead of the MCP ecosystem

Get weekly updates on new skills and servers.