next-ai-draw-io
- Type
- MCP server
- Scanned
- Nov 17, 2026
- Version
- 9534a668e3bd
- Files read
- 624
Next AI Draw.io lets you and AI coding assistants create and edit draw.io diagrams through a web app, desktop app, or live browser preview. The biggest risk is that the web app is open to anyone on your network without a password and can reach private internal addresses by default, while the coding plugins automatically download and run new releases from npm and tricked AI agents can leak data through image links.
What it can reach
- Files
- Reads and writes diagram and image files (.drawio, .png, .svg, and .drawio.svg) at requested paths, saves session history and reads custom instructions in ~/.next-ai-drawio/, and reads or writes app settings in data/settings.json and .env files.
- Network
- Runs a local preview server on your machine (127.0.0.1) and a web server open to all network interfaces (0.0.0.0) by default, downloads the server package from npm when started via plugins, and connects out to AI providers, custom API endpoints, user-provided web URLs, Langfuse, AWS DynamoDB, and models.dev.
- Browser
- Opens your default web browser to a local preview page and communicates with the open tab to sync edits, inspect selected shapes, and generate diagram screenshots and image exports.
- Secrets
- Reads AI provider API keys, AWS credentials, Langfuse keys, admin passwords, and access codes from environment variables and data/settings.json, and stores user-entered API keys in browser local storage.
Findings
-
HighPrivate and internal URLs are allowed by default in custom model endpoints (SSRF)
The /api/chat, /api/validate-model, and /api/provider-models routes only block private IP addresses, localhost, and HTTP redirects to internal hosts when allowPrivateUrls() returns false. Because allowPrivateUrls() returns true whenever ALLOW_PRIVATE_URLS is unset, anyone who can reach the web server can supply a dummy API key and a custom baseUrl pointing to 127.0.0.1, private LAN services, internal containers, local keyless LLM servers such as Ollama, or cloud metadata endpoints like 169.254.169.254, and read up to 500 characters of upstream error messages.
Fix: Default allowPrivateUrls() to false (return process.env.ALLOW_PRIVATE_URLS === "true") so requests and redirects to private or loopback addresses are blocked unless explicitly enabled.
-
MediumWeb server binds to all network interfaces without authentication or Host checks by default
When running the Next.js web app via npm run dev, npm run start, or Docker, the server binds to 0.0.0.0 while ACCESS_CODE_LIST is unset by default, causing checkAccessCode() to allow every request. In addition, rejectCrossSite() in the same file only checks the Host header against DNS rebinding when NEXT_AI_DRAWIO_DESKTOP is set to "1", so anyone on the same local network or any website using DNS rebinding against a local web instance can call /api/chat and /api/validate-diagram and spend the user's configured AI provider credits.
Fix: Bind local dev and start scripts to 127.0.0.1 by default, validate the Host or Origin header even outside Electron, and warn at startup when server AI credentials are active without ACCESS_CODE_LIST.
-
MediumPrompt injection can exfiltrate data through external image URLs in diagrams
packages/mcp-server/src/http-server.ts:1312
If an AI agent reads untrusted text (such as an issue, web page, or repository file) containing prompt injection, it can be tricked into calling create_new_diagram, edit_diagram, or add_page (or display_diagram in the web app) with sensitive data encoded in an external URL inside style="shape=image;image=https://...", backgroundImage, or an HTML <img> tag in a cell label (since html=1 is added automatically to every cell). Although the web chat specifically blocks Markdown images to stop prompt-injection exfiltration, neither the XML validator nor the Content-Security-Policy header restricts img-src on the preview or /drawio/ pages, so the browser automatically fetches the attacker's URL as soon as the diagram renders.
Fix: Add img-src 'self' data: blob: to the Content-Security-Policy header on preview and /drawio/ responses, and strip or reject external http/https image URLs in diagram XML unless explicitly allowed.
-
MediumLocal MCP preview server auto-redirects to the active session and exposes its API token
packages/mcp-server/src/http-server.ts:856
When start_session runs, the embedded HTTP server on 127.0.0.1 redirects unauthenticated requests to / straight to the most recent session ID and serves HTML containing the X-Drawio-Token secret in plaintext. On shared machines or remote Linux SSH hosts (which the MCP server explicitly supports via headless detection), any other local user or untrusted local process can request http://127.0.0.1:6002/, obtain both the session ID and API token, read private architecture diagrams, and push modified diagram XML that the victim's AI agent reads back via get_diagram.
Fix: Require an unguessable per-session token in the preview URL before serving HTML containing the API token, remove the automatic redirect from / to getMostRecentSessionId(), and write auto-saved files in ~/.next-ai-drawio with 0o600 permissions.
-
LowServer quota limits can be bypassed via X-Forwarded-For spoofing or "anonymous" user IDs
When DynamoDB quota enforcement is enabled, /api/chat, /api/validate-diagram, and /api/validate-model identify users via getUserIdFromRequest() and skip quota checks altogether whenever userId is "anonymous". Unless CLIENT_IP_HEADER and ORIGIN_SECRET are manually configured via environment variables (neither is shown in the /admin Quota settings), getUserIdFromRequest() reads the first entry of X-Forwarded-For, allowing any client to rotate fake IPs or send X-Forwarded-For: anonymous (and causing direct deployments without a proxy to default every visitor to "anonymous"), completely bypassing rate and token limits.
Fix: Enforce quota limits on "anonymous" requests rather than skipping them, warn in the admin panel when CLIENT_IP_HEADER and ORIGIN_SECRET are unset, and never trust the leftmost client-supplied X-Forwarded-For entry.
-
LowPlugin and extension manifests download and run @latest from npm at runtime
packages/claude-plugin/.mcp.json:5
The Claude Code plugin (.mcp.json), Gemini extension (gemini-extension.json), and DSH plugin run npx @next-ai-drawio/mcp-server@latest on startup rather than pinning an exact package version. If the npm package or publisher account were ever compromised, existing plugin installations would automatically download and execute the new code without user action.
Fix: Pin @next-ai-drawio/mcp-server to the exact version matching each plugin release instead of using @latest.
-
LowAdmin password and access code checks lack rate limiting and leak password length
When ADMIN_PASSWORD is enabled, checkAdminAuth() compares buffer lengths before calling timingSafeEqual(), leaking the byte length of the password via timing, and applies no rate limiting or lockout against brute-force guesses on /api/admin/*. Likewise, checkAccessCode() in lib/access-code.ts uses a non-constant-time array check with no rate limiting on /api/verify-access-code.
Fix: Compare fixed-length SHA-256 digests of the provided and expected secrets with timingSafeEqual() for both admin passwords and access codes, and add rate limiting on failed authentication attempts.
-
LowCI auto-format workflow interpolates branch name into shell command and runs npx in untrusted checkout
.github/workflows/auto-format.yml:56
This repository CI workflow never runs on an end user's machine, but it interpolates github.head_ref directly into a bash command in a job with contents: write permissions, allowing shell injection via crafted branch names on same-repo pull requests. It also runs npx inside an untrusted pull request checkout, where a modified .npmrc on a fork PR could redirect package downloads to an attacker-controlled registry on the CI runner.
Fix: Pass github.head_ref through an environment variable instead of inline expression interpolation, and pass --userconfig /dev/null or install dependencies before checking out untrusted PR code.
-
LowMCP release workflow downloads and executes mcp-publisher without checksum verification
.github/workflows/publish-mcp.yml:129
During release publishing in GitHub Actions, the workflow downloads and runs the mcp-publisher binary tarball without verifying a SHA-256 hash inside a job with OIDC publishing permissions. This script never runs on an installed user's machine, so it is a release-pipeline hardening issue rather than a runtime flaw.
Fix: Verify the downloaded mcp-publisher_linux_amd64.tar.gz archive against a pinned SHA-256 checksum before extracting and running ./mcp-publisher.
