Skip to main content
Glama
vivashu27

SQL Injection MCP Server

by vivashu27

get_waf_bypass_payloads

Generate WAF bypass variants of SQL injection payloads to evade detection during security testing.

Instructions

Get all WAF bypass variants of a payload.

Args: payload: Original SQL injection payload

Returns: Dictionary of bypass techniques and their encoded payloads

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
payloadYes

Implementation Reference

  • The MCP tool handler for 'get_waf_bypass_payloads'. Decorated with @mcp.tool(), it delegates to get_waf_bypass_variants() and returns a dict with original payload, list of technique names, and the technique-to-payload mapping.
    @mcp.tool()
    def get_waf_bypass_payloads(payload: str) -> dict:
        """
        Get all WAF bypass variants of a payload.
        
        Args:
            payload: Original SQL injection payload
        
        Returns:
            Dictionary of bypass techniques and their encoded payloads
        """
        variants = get_waf_bypass_variants(payload)
        return {
            "original": payload,
            "techniques": list(variants.keys()),
            "variants": variants
        }
  • The WAFBypassTechnique enum defining all available bypass techniques (url_encode, double_url_encode, hex_encode, unicode, case_swap, comment_injection) used as input/output schema for the tool.
    class WAFBypassTechnique(str, Enum):
        """WAF bypass encoding techniques."""
        NONE = "none"
        URL_ENCODE = "url_encode"
        DOUBLE_URL_ENCODE = "double_url_encode"
        HEX_ENCODE = "hex_encode"
        UNICODE = "unicode"
        CASE_SWAP = "case_swap"
        COMMENT_INJECTION = "comment_injection"
  • The tool is registered via the @mcp.tool() decorator on the function definition in server.py, where mcp = FastMCP('SQLi-MCP').
    @mcp.tool()
    def get_waf_bypass_payloads(payload: str) -> dict:
  • Helper function that generates all WAF bypass variants by iterating over each WAFBypassTechnique and calling apply_waf_bypass(). Called by the tool handler.
    def get_waf_bypass_variants(payload: str) -> dict[str, str]:
        """
        Get all WAF bypass variants of a payload.
        
        Args:
            payload: Original payload
        
        Returns:
            Dictionary mapping technique name to encoded payload
        """
        variants = {}
        for technique in WAFBypassTechnique:
            if technique != WAFBypassTechnique.NONE:
                variants[technique.value] = apply_waf_bypass(payload, technique)
        return variants
  • Helper function that applies a specific WAF bypass encoding technique to a payload. Supports URL encode, double URL encode, hex encode, unicode, case swap, and comment injection.
    def apply_waf_bypass(payload: str, technique: WAFBypassTechnique) -> str:
        """
        Apply WAF bypass encoding to a payload.
        
        Args:
            payload: The original SQL injection payload
            technique: The bypass technique to apply
        
        Returns:
            Encoded payload string
        """
        if technique == WAFBypassTechnique.NONE:
            return payload
        
        elif technique == WAFBypassTechnique.URL_ENCODE:
            # URL encode special characters
            return urllib.parse.quote(payload, safe='')
        
        elif technique == WAFBypassTechnique.DOUBLE_URL_ENCODE:
            # Double URL encode
            return urllib.parse.quote(urllib.parse.quote(payload, safe=''), safe='')
        
        elif technique == WAFBypassTechnique.HEX_ENCODE:
            # Hex encode the payload (useful for some contexts)
            return ''.join(f'%{ord(c):02x}' for c in payload)
        
        elif technique == WAFBypassTechnique.UNICODE:
            # Unicode encoding for bypassing simple filters
            encoded = ""
            for char in payload:
                if char in " '\"=<>":
                    encoded += f"%u{ord(char):04x}"
                else:
                    encoded += char
            return encoded
        
        elif technique == WAFBypassTechnique.CASE_SWAP:
            # Alternate case for keywords to bypass case-sensitive filters
            keywords = ["SELECT", "UNION", "WHERE", "FROM", "AND", "OR", "ORDER", "BY", 
                       "INSERT", "UPDATE", "DELETE", "DROP", "NULL", "SLEEP", "WAITFOR",
                       "CONCAT", "VERSION", "DATABASE", "USER", "TABLE", "HAVING", "GROUP"]
            result = payload
            for keyword in keywords:
                # Apply mixed case: SeLeCt, uNiOn, etc.
                mixed = ""
                for i, c in enumerate(keyword):
                    mixed += c.lower() if i % 2 == 0 else c.upper()
                result = result.replace(keyword, mixed)
                result = result.replace(keyword.lower(), mixed)
            return result
        
        elif technique == WAFBypassTechnique.COMMENT_INJECTION:
            # Insert comments between SQL keywords to bypass filters
            # Replace spaces with inline comments
            return payload.replace(" ", "/**/")
        
        return payload
Behavior2/5

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

The description does not disclose behavioral traits beyond the basic operation. It does not mention whether the tool is read-only, requires authentication, has rate limits, or any side effects. The return type is mentioned but not the exact structure or potential errors.

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

Conciseness4/5

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

The description is concise and front-loaded with the main purpose. However, the docstring format (Args/Returns) adds structure but is slightly redundant given the brevity. It is efficient overall.

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

Completeness3/5

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

For a simple tool with one parameter and no output schema, the description provides the essential information: what it does and what the input is. However, it lacks details on output format, usage examples, or edge cases, making it minimally complete.

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?

With 0% schema description coverage, the description adds minimal value by labeling the parameter as 'Original SQL injection payload'. This clarifies the expected input type but does not provide format details or constraints.

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 retrieves WAF bypass variants of a given payload, with a specific verb and resource. It distinguishes from siblings like 'list_payloads' by focusing on bypass variants, though the term 'WAF bypass variants' could be more explicitly defined.

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?

No guidance is provided on when to use this tool versus alternatives such as 'test_payload' or 'list_payloads'. The description lacks any context about optimal use cases or filters.

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/vivashu27/SQLinjector_MCP'

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