Skip to main content
Glama

Detectar riesgo de SSRF (Server-Side Request Forgery) en una herramienta

detect_ssrf_risk

Analiza el código fuente de una herramienta MCP que hace una petición HTTP a una URL (traer una página, llamar un webhook, un scraper) en busca de señales de riesgo de SSRF: una llamada HTTP (fetch, axios, requests, urlopen, curl_exec, y equivalentes) cuya URL depende de una variable/entrada externa sin ninguna validación reconocible cerca (lista de hosts permitidos, chequeo de IP privada, o una librería conocida contra SSRF), una referencia directa a una IP privada/loopback o a un endpoint de metadata de la nube (AWS/GCP/Azure — el patrón real usado para robar credenciales temporales de la nube) dentro de la propia llamada, verificación de certificado TLS desactivada junto con una petición externa, seguir redirecciones automáticamente sin revalidar el destino final, y ausencia de restricción de esquema (http/https) aunque sí se valide la IP. Motivada por un censo real de 2026 sobre 9.695 servidores MCP escaneados: SSRF fue el 8.5% de los 4.982 problemas encontrados, dentro de un 60% de servidores con algún problema de seguridad. Es un análisis estático por patrones de texto (no ejecuta el código) — mismo enfoque que detect_poisoned_tool_descriptions. Requiere una llave de acceso válida (usos gratis o créditos) — ver POST /crear-llave.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "codigo": "<codigo>"
    },
    "name": "detect_ssrf_risk"
  }
}

Input Schema

NameRequiredDescriptionDefault
codigoYesEl código fuente de la función/herramienta que hace la petición HTTP, en texto plano.
lenguajeNoSolo informativo (ej. "javascript", "python") — la detección ya cubre varios lenguajes a la vez, este campo no cambia el resultado.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A3.6/5.0
Behavior4/5

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

With no annotations provided, the description carries the full behavioral burden and does most of it: it declares this is static pattern-matching over text that does not execute the code, and it states that a valid access key with free uses or credits is required with a pointer to POST /crear-llave. That is exactly the kind of operational context annotations would otherwise supply. What is missing is the response shape and any notion of confidence or false-positive behavior, which matters for a heuristic scanner.

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

Conciseness3/5

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

The purpose and the non-execution guarantee are front-loaded, which is good. But the middle is a single run-on sentence with a long comma-chained list of detection signals, and the closing census statistics (2026 scan, 8.5% of 4,982 findings, 60% of servers affected) are motivational filler that does not help an agent decide or invoke correctly.

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 two-parameter scan tool with no output schema and no annotations, the detection criteria are unusually thorough, so an agent knows what will be found. But nothing describes what comes back (per-finding entries, severity, locations, or a single verdict), and there is no note on input size limits, which is a real gap for a source-code-consuming tool.

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

Parameters4/5

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

Schema coverage is 100%, so both parameters are already documented, and the description mostly leaves them alone. It does add one useful framing beyond the schema by repeatedly framing the input as the code of the function that performs the HTTP call, reinforcing what to paste in. The lenguaje field's non-effect is covered by the schema itself, so no extra credit there.

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?

States a specific verb and object (analyze the source code of an MCP tool that makes HTTP requests) and enumerates the exact SSRF signals it looks for (external-controlled URL, private IP/cloud metadata endpoints, disabled TLS verification, auto-follow redirects, missing scheme restriction). This is far more than a restatement of the name. It stops short of 5 because the closest sibling, detect_output_schema_ssrf_risk, is never distinguished, and the only comparison drawn (detect_poisoned_tool_descriptions) is about methodology, not scope.

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

Usage Guidelines3/5

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

It implies the use case well by naming the tool shapes it targets (fetching a page, calling a webhook, a scraper) and by prescribing the input (the function's source text). However, there is no explicit when-not-to-use guidance, no statement on how it differs from the near-identical detect_output_schema_ssrf_risk, and no note about what happens when a tool does HTTP calls indirectly through a library.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources