Skip to main content
Glama

Escudo de Secuestro de Sesión

detect_session_hijack_risk

Analiza el código fuente que busca o genera sesiones de un cliente, en busca de (1) una sesión resuelta SOLO por el identificador que trae la petición (sessions[id]/.get(id)/.findOne({id})), sin comparar después ningún campo de dueño/principal (userId/owner/accountId) contra quien hace la petición ahora — quien consiga ese ID hereda la sesión de otro cliente por completo (CWE-384); y (2) un identificador de sesión generado con poca entropía (Math.random(), Date.now()/time.time() solo, o un contador incremental) en vez de un generador criptográficamente seguro (crypto.randomBytes/randomUUID, secrets.token_hex), adivinable por fuerza bruta. El mismo patrón detrás de CVE-2026-52869. Es un análisis estático por patrones de texto (no ejecuta el código) — mismo enfoque que detect_missing_auth_risk y detect_token_passthrough_risk. 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_session_hijack_risk"
  }
}

Input Schema

NameRequiredDescriptionDefault
codigoYesEl código fuente que busca o genera sesiones, 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

A4.1/5.0
Behavior4/5

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

With no annotations supplied, the description carries the burden well: it discloses the detection method (static text-pattern matching, code is NOT executed), the concrete weakness classes covered (CWE-384, low-entropy IDs), and the authentication/credit requirement plus where to get a key. It does not describe the response shape or any size/rate limits, which leaves a gap for a tool with no output schema.

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?

Purpose is front-loaded in the opening clause and the two detection patterns are numbered, which aids scanning. The single sprawling sentence and the CVE-2026-52869 and 'mismo enfoque que...' asides add color but are largely decorative rather than actionable.

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

Completeness4/5

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

For a two-parameter static analyzer with no annotations and no output schema, the description covers method, scope, limitations, and the access-key prerequisite, which is enough to invoke it correctly. The main omission is any hint of what the analysis returns (findings list, severity, line references).

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%, and the schema already states that 'lenguaje' is informative only and does not change results, so the description adds little beyond it. It does clarify the intended input for 'codigo' (session lookup/generation code), which is a marginal gain. Baseline 3 is appropriate.

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

Purpose5/5

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

States a specific verb and target ('Analiza el código fuente que busca o genera sesiones de un cliente') and enumerates the two exact vulnerability patterns it looks for, including concrete code shapes (sessions[id]/.get(id), Math.random(), crypto.randomBytes). An agent can distinguish this from the many sibling detect_* tools without opening the schema.

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

Usage Guidelines4/5

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

The description makes the trigger condition clear: call this when auditing code that looks up or generates session identifiers, and it explicitly frames the tool as static pattern analysis rather than execution. It also names the prerequisite of a valid access key. It stops short of explicit when-not-to-use or routing rules against the closely related detect_sampling_hijack_risk / detect_token_passthrough_risk siblings.

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