Skip to main content
Glama

training.get_csrf_patterns

Extract CSRF exploitation patterns from training data to identify security vulnerabilities in web applications.

Instructions

Get all CSRF exploitation patterns from training data

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
techniqueNoSpecific CSRF techniqueall

Implementation Reference

  • Handler function that filters and returns CSRF training patterns based on the specified technique or all patterns.
    async ({ technique = 'all' }: any): Promise<ToolResult> => {
      try {
        let patterns = CSRF_TRAINING_DATA;
        if (technique !== 'all') {
          patterns = patterns.filter((p) => p.sourceId.includes(technique));
        }
    
        return formatToolResult(true, {
          patterns,
          count: patterns.length,
          techniques: patterns.map((p) => p.contextData.technique),
        });
      } catch (error: any) {
        return formatToolResult(false, null, error.message);
      }
    }
  • Input schema and description for the training.get_csrf_patterns tool.
    {
      description: 'Get all CSRF exploitation patterns from training data',
      inputSchema: {
        type: 'object',
        properties: {
          technique: {
            type: 'string',
            enum: ['basic', 'content-type', 'method', 'token-bypass', 'referrer', 'all'],
            description: 'Specific CSRF technique',
            default: 'all',
          },
        },
      },
  • Registration of the training.get_csrf_patterns tool using server.tool(), including schema and handler.
    server.tool(
      'training.get_csrf_patterns',
      {
        description: 'Get all CSRF exploitation patterns from training data',
        inputSchema: {
          type: 'object',
          properties: {
            technique: {
              type: 'string',
              enum: ['basic', 'content-type', 'method', 'token-bypass', 'referrer', 'all'],
              description: 'Specific CSRF technique',
              default: 'all',
            },
          },
        },
      },
      async ({ technique = 'all' }: any): Promise<ToolResult> => {
        try {
          let patterns = CSRF_TRAINING_DATA;
          if (technique !== 'all') {
            patterns = patterns.filter((p) => p.sourceId.includes(technique));
          }
    
          return formatToolResult(true, {
            patterns,
            count: patterns.length,
            techniques: patterns.map((p) => p.contextData.technique),
          });
        } catch (error: any) {
          return formatToolResult(false, null, error.message);
        }
      }
    );
  • Pre-loaded CSRF training data array used by the tool handler to provide patterns.
    const CSRF_TRAINING_DATA = [
      {
        source: 'intigriti',
        sourceId: 'csrf-basic',
        vulnerabilityType: 'CSRF',
        targetPattern: '/api/profile/update',
        payloadPattern: '<form method="POST"',
        successPattern: 'email updated|profile updated|success',
        failurePattern: 'error|invalid|unauthorized',
        contextData: {
          technique: 'Basic CSRF',
          description: 'Simple form-based CSRF attack',
          example: '<form method="POST" action="https://app.example.com/api/profile/update">',
        },
        score: 7,
      },
      {
        source: 'intigriti',
        sourceId: 'csrf-content-type',
        vulnerabilityType: 'CSRF',
        targetPattern: '/api/',
        payloadPattern: 'enctype="text/plain"',
        successPattern: 'success|updated',
        failurePattern: 'error|invalid content-type',
        contextData: {
          technique: 'Content-Type Bypass',
          description: 'Bypass JSON-only APIs using text/plain',
          example: 'enctype="text/plain" with JSON-like payload',
        },
        score: 8,
      },
      {
        source: 'intigriti',
        sourceId: 'csrf-method',
        vulnerabilityType: 'CSRF',
        targetPattern: '/api/',
        payloadPattern: 'method="POST"|_method=PUT',
        successPattern: 'success|updated',
        failurePattern: 'method not allowed|cors error',
        contextData: {
          technique: 'Method-based CSRF',
          description: 'Change HTTP method to bypass CORS',
          example: 'Use POST instead of PUT/PATCH',
        },
        score: 7,
      },
      {
        source: 'intigriti',
        sourceId: 'csrf-token-bypass',
        vulnerabilityType: 'CSRF',
        targetPattern: '/api/',
        payloadPattern: 'csrf_token=|anti-csrf',
        successPattern: 'success|updated',
        failurePattern: 'invalid token|csrf required',
        contextData: {
          technique: 'Token Validation Bypass',
          description: 'Bypass anti-CSRF tokens',
          methods: ['remove token', 'blank value', 'random value', 'hardcoded valid token'],
        },
        score: 9,
      },
      {
        source: 'intigriti',
        sourceId: 'csrf-referrer',
        vulnerabilityType: 'CSRF',
        targetPattern: '/api/',
        payloadPattern: 'no-referrer',
        successPattern: 'success|updated',
        failurePattern: 'invalid referrer|referrer required',
        contextData: {
          technique: 'Referrer-based Bypass',
          description: 'Bypass referrer validation',
          example: '<meta name="referrer" content="no-referrer">',
        },
        score: 8,
      },
    ];
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions retrieving data but lacks details on permissions, rate limits, data format, or potential side effects. This is inadequate for a tool that accesses training data, leaving the agent uncertain about its behavior.

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 with no wasted words. It's front-loaded with the core action and resource, making it easy to parse quickly.

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 no annotations and no output schema, the description is incomplete. It doesn't explain what 'patterns' entail, their format, or how they're returned. For a tool with one parameter but complex data retrieval, more context is needed to guide the agent effectively.

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?

Schema description coverage is 100%, so the schema fully documents the 'technique' parameter with enum values and default. The description adds no additional meaning beyond implying retrieval of patterns, which is already covered by the tool's purpose. Baseline 3 is appropriate as the schema handles parameter documentation.

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 action ('Get') and resource ('all CSRF exploitation patterns from training data'), making the purpose understandable. However, it doesn't differentiate from sibling tools like 'training.get' or 'training.extract_from_writeup', which also retrieve training data, so it's not fully specific.

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. Sibling tools like 'security.test_csrf' or 'training.match' might overlap in context, but the description offers no explicit when/when-not instructions or prerequisites 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/telmon95/VulneraMCP'

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