Skip to main content
Glama

broser_url_reflected_xss

Test for reflected XSS vulnerabilities in URLs by injecting payloads into specified parameters to identify security weaknesses.

Instructions

Test whether the URL has an XSS vulnerability

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYes
paramNameNoParameter name for XSS testing

Implementation Reference

  • The handler function for the 'broser_url_reflected_xss' tool within the handleToolCall switch statement. It tests a list of XSS payloads by injecting them into the URL query parameters, navigates to each test URL, checks if the payload is reflected unescaped in the page content, and reports vulnerable payloads if found.
    case ToolName.BrowserUrlReflectedXss: {
      const baseUrl = args.url;
      const paramName = args.paramName || 'name';
      const xssPayloads = [
        "<script>alert(1)</script>",
        "\"><script>alert(1)</script>",
        "javascript:alert(1)",
        "<img src=x onerror=alert(1)>",
        "<svg onload=alert(1)>",
        "';alert(1);//"
      ];
      
      let vulnerablePayloads = [];
      
      for (const payload of xssPayloads) {
        const encodedPayload = encodeURIComponent(payload);
        const testUrl = `${baseUrl}${baseUrl.includes('?') ? '&' : '?'}${paramName}=${encodedPayload}`;
        
        try {
          await page.goto(testUrl);
          
          // 检查页面源代码中是否包含未编码的payload
          const content = await page.content();
          const decodedPayload = decodeURIComponent(payload);
          
          if (content.includes(decodedPayload)) {
            vulnerablePayloads.push({
              payload: payload,
              url: testUrl
            });
          }
          
          // 检查是否有JavaScript执行
          const hasXss = await page.evaluate((testPayload) => {
            return document.documentElement.innerHTML.includes(testPayload);
          }, payload);
          
          if (hasXss) {
            vulnerablePayloads.push({
              payload: payload,
              url: testUrl
            });
          }
        } catch (error) {
          console.error(`Error testing payload ${payload}: ${error}`);
        }
      }
      
      if (vulnerablePayloads.length > 0) {
        return {
          content: [{
            type: "text",
            text: `发现反射型XSS漏洞!\n\n可利用的Payload:\n${vulnerablePayloads.map(v => 
              `Payload: ${v.payload}\nURL: ${v.url}\n`
            ).join('\n')}`
          }],
          isError: false
        };
      } else {
        return {
          content: [{
            type: "text",
            text: "未发现明显的反射型XSS漏洞。"
          }],
          isError: false
        };
      }
    }
  • index.ts:74-85 (registration)
    Registration of the 'broser_url_reflected_xss' tool in the TOOLS array, including its name, description, and input schema definition.
    {
      name: ToolName.BrowserUrlReflectedXss,
      description: "Test whether the URL has an XSS vulnerability",
      inputSchema: {
        type: "object",
        properties: {
          url: { type: "string" },
          paramName: { type: "string", description: "Parameter name for XSS testing" },
        },
        required: ["url"],
      },
    },
  • index.ts:33-33 (registration)
    Enum definition for the tool name constant 'broser_url_reflected_xss' used throughout the code.
    BrowserUrlReflectedXss = "broser_url_reflected_xss",
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 states the tool tests for XSS vulnerabilities but doesn't explain how it behaves—e.g., whether it performs active scanning, returns detailed results, requires specific permissions, or has side effects like triggering alerts. This leaves critical operational details unclear for safe and effective use.

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, clear sentence with no wasted words, making it highly concise and front-loaded. It directly states the tool's purpose without unnecessary elaboration, which is efficient for quick understanding.

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 security testing, no annotations, no output schema, and low schema coverage, the description is incomplete. It doesn't cover behavioral aspects, parameter usage, or expected results, leaving significant gaps for an agent to understand how to invoke and interpret this tool effectively in context.

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 description doesn't mention any parameters, while the input schema has 2 parameters with 50% coverage (only 'paramName' has a description). Since schema coverage is low, the description should compensate but doesn't, leaving 'url' and the usage of 'paramName' poorly explained. However, with 2 parameters total, the baseline isn't the lowest, but the lack of added semantic value keeps it at an adequate level.

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

Purpose3/5

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

The description 'Test whether the URL has an XSS vulnerability' clearly states the action (test) and target (URL for XSS vulnerability), making the purpose understandable. However, it doesn't differentiate from sibling tools like 'browser_url_sql_injection' which also tests URL vulnerabilities, leaving some ambiguity about when to choose this specific XSS test over other security tests.

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. It doesn't mention prerequisites (e.g., needing a browser session), exclusions, or compare it to siblings like 'browser_url_sql_injection' for SQL testing. This lack of context makes it harder for an agent to select the right tool in a given scenario.

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/9olidity/MCP-Server-Pentest'

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