← MCP server and skill grades

graphify

Graphify-Labs/graphify

F
Type
MCP server
Scanned
Nov 18, 2026
Version
340268a70a83
Files read
1254

Graphify scans folders of source code, documents, PDFs, images, and videos to build a searchable knowledge graph that AI coding assistants can use through skills, hooks, or a local server. The biggest risk is that running it on an untrusted project folder lets crafted files or links inside that project run attacker-chosen commands or overwrite files anywhere on your computer.

What it can reach

Files
Reads code, documents, PDFs, Office files, images, and media in scanned folders, and writes graph files, caches, logs, cloned repos, git hooks, and AI assistant settings in project folders and your home directory.
Network
Sends documents and images to configured AI services, downloads web pages, GitHub repos, media URLs, and Python packages, connects to optional databases (PostgreSQL, Neo4j, FalkorDB), and can run an HTTP server.
Shell commands
Runs command-line tools (including bash, PowerShell, Python, pip, uv, git, cpp, gh, claude, gws, opencode, and pi), installs automatic git and editor hooks, and directs AI assistants to run commands.
Secrets
Reads AI API keys, cloud credentials, database passwords, and server keys from environment variables, and uses existing logins from tools like the GitHub, Claude, and Google Workspace CLIs.

Findings

2 critical3 high5 medium8 low
  1. CriticalSkill subcommands run any command placed in repo-local graphify-out/.graphify_python

    graphify/skill.md:762

    Graphify encourages committing graphify-out to shared repositories, and the installed skill stores the Python interpreter path in graphify-out/.graphify_python inside the project folder. For subcommands like --update and --cluster-only, the interpreter guard only writes that file when it is missing, and later steps run $(cat graphify-out/.graphify_python) unquoted in bash. A stranger's repository that includes a crafted graphify-out/.graphify_python will execute arbitrary commands on the user's machine when those subcommands run.

    Fix: Never read an executable path from the repository working tree; resolve the Python interpreter fresh on each run or store it in a user-owned directory under ~/.cache/graphify, and always quote the variable.

  2. CriticalAtomic output writer follows symlinks in graphify-out and overwrites arbitrary files

    graphify/paths.py:173

    Although the file scanner blocks symlinks that escape the repository when reading source files, _atomic_replace resolves symlinks with os.path.realpath before writing output files. If a cloned repository contains git-tracked symlinks inside graphify-out (such as manifest.json, graph.json, or cache/last_query_stamp pointing to ~/.bashrc or ~/.claude/settings.json), running graphify extract, update, or even a read-only graphify query overwrites the external target file and creates missing parent folders.

    Fix: Refuse to write through symlinks in graphify-out whose targets resolve outside the configured output directory, and replace symlinks directly instead of resolving them first.

  3. HighClaude CLI backend runs inside the target repository without disabling tools or local repo settings

    graphify/llm.py:2037

    When naming communities in cluster-only or label without an API key (where claude-cli is auto-selected if claude is installed) or running extract --backend claude-cli, graphify spawns claude -p in the current working directory and feeds it untrusted node labels or document contents. Because it does not disable tools or local project settings, claude -p loads repository CLAUDE.md, AGENTS.md, .mcp.json, and .claude/settings.json hooks from the working directory and can invoke any globally permitted Claude Code tools if steered by prompt injection.

    Fix: Pass --tools "" (or --tools Read only when extracting images) and --setting-sources user, or run claude -p from an empty temporary directory, and wrap community label prompts in untrusted-data delimiters.

  4. HighC preprocessor #include filter in Fortran extractor can be bypassed to read host files

    graphify/extractors/fortran.py:56

    When scanning .F, .F90, .F95, .F03, or .F08 files, extract_fortran pipes the file into the system C preprocessor (cpp -w -P -nostdinc -I /dev/null) after calling _strip_include_directives to prevent arbitrary host file inclusion (GHSA-pcc4-rvhr-2pr8). However, _strip_include_directives only blanks single lines matching spaces or tabs followed by '#' and the word 'include'. A crafted Fortran file in an untrusted repository can bypass this check using C preprocessor backslash-newline line continuations, block comments before or after '#', form-feed or vertical-tab whitespace, or alternate directives accepted by cpp such as #import, #include_next, or #embed (with warnings silenced by -w). This lets cpp inline readable files from the user's machine into the parsed stream—where attacker-defined macros can reshape tokens into Fortran symbols saved into graph.json and GRAPH_REPORT.md—or read special files such as /dev/urandom to exhaust memory.

    Fix: Avoid invoking the external cpp binary on untrusted source files, or strip backslash-newline continuations and comments first and blank every '#' preprocessor line except a strict allowlist of safe conditional and macro directives (#ifdef, #ifndef, #if, #elif, #else, #endif, #define, #undef).

  5. HighUnescaped placeholder interpolation in skill bash and Python snippets allows command injection

    graphify/skills/claude/references/query.md:179

    The skill reference templates instruct the agent to substitute untrusted or model-generated values directly into double-quoted bash strings, unquoted arguments, and inline python -c single-quoted literals. In query.md, ORIGINAL_QUESTION and ANSWER are placed inside double-quoted bash strings (where backticks and $() execute shell commands—even ordinary code explanations routinely contain backticks), NODE1 NODE2 are left unquoted, and the inline Python fallbacks embed 'NODE_A', 'NODE_B', and 'NODE_NAME' inside -c "..."; add-watch.md similarly embeds 'URL', 'AUTHOR', and 'CONTRIBUTOR' inside -c "...". Prompt-injected inputs or crafted node labels in an untrusted corpus can break out of these quotes and run arbitrary commands.

    Fix: Pass dynamic text on stdin via single-quoted heredocs (<<'EOF') or structured JSON files instead of interpolating placeholders into python -c strings, and require shell-quoting (such as shlex.quote) for all CLI arguments.

  6. MediumGit hooks execute untrusted interpreter path from graphify-out/.graphify_python

    graphify/hooks.py:50

    The generated post-commit, post-checkout, post-merge, and post-rewrite git hooks fall back to reading graphify-out/.graphify_python from the repository working tree whenever the install-time pinned Python path is empty (such as on Snap-packaged editors) or no longer valid after a Python upgrade. Because relative paths like ./scripts/evil pass the character allowlist, checking out or pulling an untrusted branch containing graphify-out/.graphify_python and a matching executable script runs that script automatically.

    Fix: Remove the graphify-out/.graphify_python probe from git hooks, or require an absolute path outside the repository root that resolves to a real Python interpreter.

  7. MediumHTTP MCP server disables DNS-rebinding and Origin protection when bound to 0.0.0.0

    graphify/serve.py:3683

    When the HTTP MCP server binds to 0.0.0.0 (which is the default CMD in the Dockerfile) without an API key, _build_http_app sets enable_dns_rebinding_protection=False, turning off Host and Origin header checks. Even if a user maps the Docker container port only to 127.0.0.1 on the host, any website visited in their browser can make cross-origin or DNS-rebinding requests to localhost:8080/mcp to read the knowledge graph, Markdown sections, and GitHub PR metadata; if exposed on a network interface without --api-key, anyone on the network can do the same.

    Fix: Require --api-key (or GRAPHIFY_API_KEY) whenever binding to 0.0.0.0 or :: unless explicitly overridden, and keep Origin/Host allowlist validation enabled by configurable hostnames.

  8. MediumUnanchored URL check and path traversal in graphify clone

    graphify/cli.py:1926

    _clone_repo validates GitHub URLs with an unanchored re.search at the end of the string and builds the destination path ~/.graphify/repos/<owner>/<repo> without rejecting '..' or Windows backslashes. If an agent is tricked into passing a crafted URL such as http://internal-host/github.com/a/b or https://evil.example/github.com/..\..\target, git clone fetches from non-GitHub or internal hosts and can write outside ~/.graphify/repos.

    Fix: Parse the URL and enforce scheme in ('https', 'http') with hostname strictly equal to github.com, and validate owner and repo against ^[A-Za-z0-9._-]+$ while rejecting '.' and '..'.

  9. Mediumgraphify update trusts repo-controlled .graphify_root outside the current repository

    graphify/cli.py:3541

    Unlike the git hooks and section reader, which verify that graphify-out/.graphify_root stays inside the project, running graphify update with no path argument reads .graphify_root directly and scans whatever path it names. A malicious repository with a committed graphify-out/.graphify_root pointing to another folder on the user's machine (such as .. or ~/work) causes graphify update to index that external directory into the repository's graph outputs.

    Fix: Validate that the resolved .graphify_root path is the current working directory or a subdirectory within it before using it as watch_path.

  10. MediumUnescaped Python and shell string interpolation in Aider and Devin monolithic skills

    graphify/skill-devin.md:1160

    Although INPUT_PATH interpolation was removed in v0.9.104 to prevent code injection, the monolithic skills graphify/skill-devin.md and graphify/skill-aider.md still instruct the agent to paste QUESTION, NODE_A, NODE_B, NODE_NAME, URL, AUTHOR, and CONTRIBUTOR directly into single-quoted Python string literals inside double-quoted bash python -c blocks for query, path, explain, and add. Any single quote, double quote, backtick, or $(...) in a queried symbol, suggested question from GRAPH_REPORT.md, or ingested URL breaks out of the Python or bash string and executes arbitrary code.

    Fix: Replace the inline python -c blocks for query, path, explain, and add in skill-devin.md and skill-aider.md with CLI subcommands receiving arguments safely via stdin or quoted heredocs, without interpolating text into Python source.

  11. LowStored XSS in callflow-html export via Mermaid loose security mode

    graphify/callflow_html.py:1843

    write_callflow_html configures Mermaid with securityLevel: 'loose' and htmlLabels: true. Because Mermaid decodes HTML entities inside .mermaid blocks before rendering and skips DOMPurify sanitization in loose mode, an untrusted repository with HTML such as <img src=x onerror=...> in a Markdown heading, test name, or comment will execute JavaScript in the user's browser when the exported callflow HTML file is opened.

    Fix: Set securityLevel to 'strict' (which still permits simple formatting like <br/> via DOMPurify) or disable htmlLabels, and pin the CDN Mermaid script with a Subresource Integrity hash.

  12. LowGoogle Workspace shortcut export passes unvalidated Drive file IDs from scanned files to gws

    graphify/google_workspace.py:136

    When --google-workspace or GRAPHIFY_GOOGLE_WORKSPACE=1 is enabled, scanning an untrusted folder reads doc_id or file_id from any .gdoc, .gsheet, or .gslides JSON file and passes it directly to gws drive files export using the user's Google credentials. A planted shortcut file can supply path-traversal characters in fileId or point to any private Google Drive document the user can read, exporting its text into graphify-out/converted and the resulting graph.

    Fix: Validate file_id against Google Drive's identifier character set (^[A-Za-z0-9_-]{10,}$) and warn before exporting shortcuts whose IDs come from untrusted repositories.

  13. LowSkill mandates general-purpose subagents with Bash and Write access when reading untrusted documents

    graphify/skill.md:282

    During semantic extraction of documents, PDFs, images, and ingested web pages, the skill instructs the host assistant to dispatch general-purpose subagents with full Write and Bash access rather than read-only subagents. Prompt injection inside a scanned document or fetched web page can steer a subagent into running shell commands or modifying arbitrary files.

    Fix: Have read-only subagents return extracted JSON in their responses so the parent process validates and writes the chunk files, avoiding Bash access during untrusted document ingestion.

  14. LowSkill silently installs or upgrades unpinned graphifyy from PyPI with --break-system-packages

    graphify/skill.md:98

    Step 1 of the skill automatically runs uv tool install --upgrade graphifyy or pip install graphifyy --break-system-packages if importing graphify fails at runtime, downloading unpinned code and potentially modifying system Python packages without confirmation.

    Fix: Stop with an error instructing the user to install or repair graphifyy explicitly rather than running unpinned package installs with --break-system-packages at runtime.

  15. LowAudio URL downloader bypasses validate_url on redirects and lacks size or timeout caps

    graphify/transcribe.py:84

    download_audio calls validate_url(url) once to block non-HTTP schemes and private IP addresses, then passes the URL to yt_dlp.YoutubeDL.extract_info(url, download=True). Because yt-dlp performs its own DNS resolution and follows HTTP redirects and streaming manifests (such as HLS .m3u8 playlists) without re-running validate_url, an attacker URL passed to '/graphify add' can redirect yt-dlp to internal or loopback services or bypass the check via DNS rebinding. In addition, ydl_opts sets neither socket_timeout nor max_filesize, allowing a malicious server to stall transcription or fill local disk space.

    Fix: Configure yt-dlp with strict socket_timeout, max_filesize, and a custom request/redirect handler or proxy hook that validates every resolved IP and redirect hop against private, loopback, and link-local ranges.

  16. LowBash extractor leaks host file existence and symlink paths outside the scan root

    graphify/extractors/bash.py:328

    While variable-based 'source' statements in extract_bash use _within_tree to avoid probing paths outside the repository, literal relative or absolute paths starting with '.' or '/' (such as 'source /etc/passwd' or 'source ../../../../Users/alice/.ssh/id_ed25519') resolve symlinks and call resolved.exists() without checking that the target stays inside the scan root. When the target exists on the host, extract_bash emits an imports_from edge whose node ID encodes the resolved host path, acting as an existence and symlink-target oracle if graph.json is shared or queried.

    Fix: Constrain resolved 'source' and script-invocation targets (including literal paths in _bash_assignment_base) to active_scan_root() or the script's project tree before probing the filesystem or recording target_file.

  17. LowCollapsible tree HTML export loads D3 from an unpinned CDN URL without Subresource Integrity

    graphify/tree_html.py:398

    Unlike the main vis-network graph.html exporter (which pins an exact package version and verifies a sha384 Subresource Integrity hash), tree_html.py embeds https://d3js.org/d3.v7.min.js as a floating major-version script tag with no integrity attribute. If d3js.org is compromised or intercepted, opening the generated tree HTML file in a browser would execute attacker-controlled JavaScript in the context of the local file.

    Fix: Pin D3 to a specific release version and add an integrity sha384 hash and crossorigin="anonymous" attribute matching the main HTML exporter.

  18. LowWorked example HTML loads unpinned vis-network script from unpkg without SRI

    worked/rsl-siege-manager/graph.html:6

    The pre-generated example visualization loads vis-network.min.js from https://unpkg.com/vis-network/standalone/umd/vis-network.min.js with no version pin and no Subresource Integrity (integrity) attribute. This file is an example in the repository and is not shipped in the installed Python package, so it only affects someone who opens the example HTML in a browser.

    Fix: Pin vis-network to a specific version and add integrity and crossorigin="anonymous" attributes, or bundle the script locally.