performing-second-order-sql-injection

Detect and exploit second-order SQL injection via stored payloads triggered in later queries.

954|172|Updated Mar 13, 2026
One-click install
npx skills add https://github.com/xalgord/xalgorix --skill performing-second-order-sql-injection
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: performing-second-order-sql-injection
Source: https://github.com/xalgord/xalgorix/tree/main/internal/tools/skills/data/web-application-security/performing-second-order-sql-injection
Command: npx skills add https://github.com/xalgord/xalgorix --skill performing-second-order-sql-injection

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Second-order SQL injection hides behind proper input sanitization: payloads are stored safely but executed later when another query reuses the stored data unsafely. Standard scanners and first-order tests miss these flaws, leaving exploitable vulnerabilities undetected.

Core Features & Use Cases

  • Storage/Trigger Mapping: Systematically identify where user input is stored (registration, profiles, comments) and where it resurfaces in unsafe queries (admin panels, exports, reports).
  • Confirmation Methodology: Prove vulnerabilities with time-based, boolean, and out-of-band payloads that only manifest at the trigger point, avoiding false negatives from clean storage responses.
  • SQLMap Automation: Use --second-url and --second-req flags to automate the store-then-fire exploitation loop.
  • Use Case: Register a user with a SQL payload as the username, then confirm injection when an admin views the user list and the stored payload executes in the admin panel's query.

Quick Start

Test the target application for second-order SQL injection by storing payloads in profile fields and triggering them through the admin user listing page.

Frequently Asked Questions about performing-second-order-sql-injection

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I test for second-order SQL injection?

Store a SQL payload through an input like registration or profile update, then exercise every endpoint that reuses that data such as admin panels or exports. Confirm the injection by observing errors, time delays, or out-of-band callbacks at the trigger point, not the storage point.

How to use SQLMap for second-order SQL injection?

Use the --second-url flag to specify the trigger endpoint where the stored payload executes, for example sqlmap -u with the storage request plus --second-url pointing to the profile page. For complex triggers, use --second-req with a saved HTTP request file.

Why does second-order SQL injection bypass input sanitization?

The application parameterizes the INSERT query so the payload is stored harmlessly, but a later query retrieves the value and concatenates it unsafely. Developers wrongly assume database-stored data is trusted and skip parameterization on reads.

What tools detect second-order SQL injection vulnerabilities?

SQLMap supports second-order attacks via --second-url and --second-req flags. Burp Suite tracks requests across storage and trigger endpoints, while out-of-band confirmation uses collaborators like Burp Collaborator for DNS callbacks.

When should I not conclude an application is safe from second-order injection?

Do not conclude safety until you have tested multiple storage fields, cross-user contexts like admin views of your data, and deferred triggers such as scheduled reports. A clean response at storage time is expected and proves nothing.