Skip to main content
Glama

sqlmap_scan

Detect SQL injection vulnerabilities in web applications by testing target URLs with optional POST data and session cookies for authorized security assessments.

Instructions

Test for SQL injection vulnerabilities

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesTarget URL
dataNoPOST data (optional)
cookieNoSession cookie (optional)

Implementation Reference

  • Core handler function that executes sqlmap CLI command, handles parameters (url, data, cookie), parses output, and returns structured ScanResult.
    async sqlmapScan(url: string, data?: string, cookie?: string): Promise<ScanResult> {
      try {
        let command = `sqlmap -u "${url}" --batch --risk=1 --level=1`;
        
        if (data) {
          command += ` --data="${data}"`;
        }
        
        if (cookie) {
          command += ` --cookie="${cookie}"`;
        }
        
        // Add safety flags
        command += ' --answers="extending=N,follow=N,other=N" --timeout=10 --retries=1';
        
        console.error(`Executing: ${command}`);
        
        const { stdout, stderr } = await execAsync(command, { 
          timeout: 600000 // 10 min timeout
        });
        
        const sqlInjectionResults = this.parseSqlmapOutput(stdout, url);
        
        return {
          target: url,
          timestamp: new Date().toISOString(),
          tool: 'sqlmap',
          results: {
            sql_injection_points: sqlInjectionResults,
            total_found: sqlInjectionResults.length,
            raw_output: stdout
          },
          status: 'success'
        };
      } catch (error) {
        return {
          target: url,
          timestamp: new Date().toISOString(),
          tool: 'sqlmap',
          results: {},
          status: 'error',
          error: error instanceof Error ? error.message : String(error)
        };
      }
    }
  • Helper function to parse sqlmap output and extract SQL injection vulnerabilities into structured format.
    private parseSqlmapOutput(output: string, target: string): VulnerabilityResult[] {
      const vulnerabilities: VulnerabilityResult[] = [];
      
      if (output.toLowerCase().includes('injectable') || 
          output.toLowerCase().includes('sql injection')) {
        
        const lines = output.split('\n');
        let currentPayload = '';
        let currentParameter = '';
        
        for (const line of lines) {
          if (line.includes('Parameter:')) {
            currentParameter = line.split('Parameter:')[1]?.trim() || '';
          }
          
          if (line.includes('Type:') || line.includes('Payload:')) {
            currentPayload = line.trim();
          }
          
          if (line.toLowerCase().includes('injectable')) {
            vulnerabilities.push({
              id: `sqlmap-${vulnerabilities.length + 1}`,
              name: 'SQL Injection',
              severity: 'high',
              description: `SQL injection vulnerability found in parameter: ${currentParameter}. ${currentPayload}`,
              solution: 'Use parameterized queries and input validation',
              affected_url: target,
              cve: 'CWE-89'
            });
          }
        }
      }
      
      return vulnerabilities;
    }
  • MCP tool schema definition including input parameters and descriptions for validation.
      name: "sqlmap_scan",
      description: "Test for SQL injection vulnerabilities",
      inputSchema: {
        type: "object",
        properties: {
          url: { type: "string", description: "Target URL" },
          data: { type: "string", description: "POST data (optional)" },
          cookie: { type: "string", description: "Session cookie (optional)" }
        },
        required: ["url"]
      }
    },
  • src/index.ts:524-525 (registration)
    Tool dispatch/registration in the main switch handler that maps tool call to VulnScanTools.sqlmapScan execution.
    case "sqlmap_scan":
      return respond(await this.vulnScanTools.sqlmapScan(args.url, args.data, args.cookie));
  • Validation whitelist including sqlmap_scan for allowed tool execution.
    'nmap_scan', 'subdomain_enum', 'tech_detection', 'directory_bruteforce',
    'nuclei_scan', 'nikto_scan', 'sqlmap_scan', 'metasploit_search',
    'exploit_attempt', 'auto_pentest', 'suggest_next_steps', 'generate_report'
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool 'Test[s] for SQL injection vulnerabilities,' which implies a scanning or probing action, but doesn't describe what the tool actually does (e.g., sends payloads, analyzes responses), potential impacts (e.g., might trigger alerts, could be intrusive), rate limits, or authentication needs. For a security testing tool with zero annotation coverage, this is a significant gap in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence: 'Test for SQL injection vulnerabilities.' It's front-loaded with the core purpose, has zero wasted words, and is appropriately sized for a tool with a straightforward name and schema. Every part of the sentence earns its place by clearly stating the action and target.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of a security testing tool with no annotations and no output schema, the description is incomplete. It doesn't explain what the tool returns (e.g., vulnerabilities found, logs, errors), behavioral traits like intrusiveness or speed, or how it fits into broader workflows. For a tool that likely has significant operational implications, this minimal description leaves too many gaps for effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with clear parameter descriptions (e.g., 'Target URL' for 'url'). The description doesn't add any meaning beyond what the schema provides—it doesn't explain how parameters interact (e.g., 'data' for POST requests) or provide usage examples. Since schema coverage is high, the baseline score of 3 is appropriate, as the description doesn't compensate but also doesn't detract.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Test for SQL injection vulnerabilities.' It specifies the verb ('Test') and resource ('SQL injection vulnerabilities'), making it easy to understand what the tool does. However, it doesn't distinguish this from sibling tools like 'test_web_application' or 'burp_active_scan', which might also test for vulnerabilities including SQL injection.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. With many sibling tools available for security testing (e.g., 'nmap_scan', 'nikto_scan', 'test_web_application'), it doesn't specify if this is for initial scanning, deep testing, or when SQL injection is suspected. There's no mention of prerequisites, exclusions, or typical contexts for usage.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/adriyansyah-mf/mcp-pentest'

If you have feedback or need assistance with the MCP directory API, please join our Discord server