Skip to main content
Glama
mohdhaji87

JWT Auditor MCP Server

by mohdhaji87

jwt_bruteforce

Bruteforce HS256/HS384/HS512 JWT secrets using common or custom wordlists to test token security and identify weak keys.

Instructions

Bruteforce the secret for HS256/HS384/HS512 JWTs using a common wordlist or a custom one.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tokenYes
wordlistNo

Implementation Reference

  • The jwt_bruteforce tool handler, decorated with @server.tool() for registration. Implements JWT secret bruteforce for HS256/HS384/HS512 algorithms using a provided or default wordlist of common secrets. Parses the token, recomputes signatures with each secret, and checks for match.
    @server.tool()
    def jwt_bruteforce(token: str, wordlist: Optional[list] = None) -> dict:
        """Bruteforce the secret for HS256/HS384/HS512 JWTs using a common wordlist or a custom one."""
        import hmac
        import hashlib
        import base64
        import json
        import time
        # Default wordlist (short for demo; in production, use a large list)
        common_secrets = [
            'secret', 'password', '123456', 'admin', 'jwtsecret', 'letmein', 'qwerty', 'iloveyou', 'welcome', 'monkey',
            'abc123', '1q2w3e4r', 'test', 'changeme', 'default', 'passw0rd', 'supersecret', 'trustno1', 'hunter2', 'root'
        ]
        secrets = wordlist if wordlist else common_secrets
        try:
            header_b64, payload_b64, signature_b64 = token.split(".")
            def b64decode(data):
                rem = len(data) % 4
                if rem:
                    data += '=' * (4 - rem)
                return base64.urlsafe_b64decode(data.encode())
            def b64encode(data):
                return base64.urlsafe_b64encode(data).rstrip(b'=').decode()
            header = json.loads(b64decode(header_b64))
            alg = header.get("alg", "").upper()
            if alg not in ["HS256", "HS384", "HS512"]:
                return {"error": f"Bruteforce only supported for HS256/HS384/HS512, got {alg}"}
            hash_alg = {"HS256": hashlib.sha256, "HS384": hashlib.sha384, "HS512": hashlib.sha512}[alg]
            signing_input = f"{header_b64}.{payload_b64}".encode()
            for secret in secrets:
                sig = hmac.new(secret.encode(), signing_input, hash_alg).digest()
                sig_b64 = b64encode(sig)
                if sig_b64 == signature_b64:
                    return {"result": "success", "secret": secret}
            return {"result": "not found", "tested": len(secrets)}
        except Exception as e:
            return {"error": str(e)}
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. While it mentions the brute-force method and wordlist options, it doesn't disclose critical behavioral traits like computational intensity, time requirements, potential rate limiting, ethical considerations, or what happens when a secret is found. For a security testing tool with zero annotation coverage, this represents significant gaps.

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 perfectly concise with a single sentence that front-loads the core purpose. Every word earns its place with no wasted language, making it immediately understandable while covering the essential what and how.

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 this is a security testing tool with no annotations, no output schema, and 0% schema description coverage, the description is insufficiently complete. It doesn't explain what happens when the tool succeeds or fails, what output to expect, error conditions, or important constraints. For a tool performing cryptographic attacks, more contextual information is needed.

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

Parameters2/5

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

With 0% schema description coverage for both parameters, the description must compensate but only partially succeeds. It mentions 'token' and 'wordlist' but doesn't explain what format the JWT token should be in, what constitutes a valid wordlist, or how the wordlist array should be structured. The description adds minimal semantic value beyond parameter names.

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?

The description clearly states the specific action ('Bruteforce the secret') and target resource ('for HS256/HS384/HS512 JWTs'), distinguishing it from siblings like jwt_analyze, jwt_decode, and jwt_generate. It precisely communicates the cryptographic attack method and JWT algorithm targets.

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 provides clear context about when to use this tool (for brute-forcing JWT secrets with specific algorithms), but doesn't explicitly state when NOT to use it or mention alternatives. It implies usage for security testing scenarios but lacks explicit exclusions or comparison with sibling tools.

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/mohdhaji87/JWTAuditorMCP'

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