Vulnerabilities in pkg:pypi/neuro-cortex-memory
PACKAGECVE-2026-49986 is a HIGH cortex has untrusted project bootstrap vulnerability (CWE-829: Inclusion of Functionality from Untrusted Control Sphere) affecting Neuro cortex memory libraries in the PyPI ecosystem. The issue involves cortex has untrusted project bootstrap code execution via `claude_project_dir`. Remediation is available by upgrading affected packages to version 3.18.0.
pkg:pypi/neuro-cortex-memory
Vulnerability advisories affecting package pkg:pypi/neuro-cortex-memory. Select an advisory below to view technical details or fixes.
| Advisory ID | CVE / NVD | Severity | Summary |
|---|---|---|---|
| GHSA-gvpp-v77h-5w8g | CVE-2026-49986 | HIGH | Cortex has Untrusted Project Bootstrap Code Execution via `CLAUDE_PROJECT_DIR` |
CVE-2026-49986 at a Glance
How to Fix CVE-2026-49986
To remediate this vulnerability, upgrade all affected Neuro cortex memory dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install neuro-cortex-memory>=3.18.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show neuro-cortex-memory
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2026-49986, inspect your installed packages using pip:
pip show neuro-cortex-memory
Analyze the terminal output to locate any version of Neuro cortex memory in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.18.0), your application is affected.
Note: The pip show neuro-cortex-memory command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-829: Inclusion of Functionality from Untrusted Control Sphere, where the product imports, requires, or includes executable functionality (such as a library) from a source that is outside of the intended control sphere. In Neuro cortex memory, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2026-49986 Affected Neuro cortex memory Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
neuro-cortex-memory
|
PyPI |
< 3.18.0
|
3.18.0
|
References
Frequently Asked Questions
What is CVE-2026-49986?
Which Neuro cortex memory versions are affected?
What version fixes CVE-2026-49986?
Is neuro-cortex-memory affected?
What CWE is associated with CVE-2026-49986?
How can I check PyPI dependencies for CVE-2026-49986?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-gvpp-v77h-5w8g",
"modified" : "2026-07-01T18:41:35Z",
"published" : "2026-07-01T18:41:35Z",
"aliases" : [ "CVE-2026-49986" ],
"summary" : "Cortex has Untrusted Project Bootstrap Code Execution via `CLAUDE_PROJECT_DIR`",
"details" : "## Untrusted Project Bootstrap Code Execution via `CLAUDE_PROJECT_DIR`\n\n### Summary\n\nThe Cortex MCP server (`neuro-cortex-memory`) treats the `CLAUDE_PROJECT_DIR` environment variable — automatically set by Claude Code to the currently open project directory — as a trusted Cortex developer checkout. When the `open_visualization` tool is invoked, `_find_dev_source()` resolves the user's active project directory as a candidate Cortex source root. The only validation performed by `_is_cortex_root()` is a check for the presence of an `mcp_server/` subdirectory and a `ui/unified-viz.html` file. An attacker who places these two marker files in a malicious repository can cause Cortex to execute an arbitrary `mcp_server/server/visualize_bootstrap.py` from that directory via `subprocess.run([sys.executable, ...])`, achieving code execution with the privileges of the victim's local user process. CVSS v3.1 Base Score: **7.8 (High)**.\n\n### Details\n\nThe vulnerability originates in `_find_dev_source()` inside `mcp_server/handlers/open_visualization.py`. The function builds a list of candidate directories by iterating over the environment variables `CORTEX_DEV_ROOT` and `CLAUDE_PROJECT_DIR`:\n\n```python\n# mcp_server/handlers/open_visualization.py:73-76\nfor env in (\"CORTEX_DEV_ROOT\", \"CLAUDE_PROJECT_DIR\"):\n v = os.environ.get(env)\n if v:\n candidates.append(Path(v))\n```\n\n`CLAUDE_PROJECT_DIR` is set automatically by the Claude Code IDE extension to whichever directory the user has currently open. This means **any project the user opens** is silently treated as a candidate Cortex source root.\n\nEach candidate is then validated by `_is_cortex_root()` (lines 65–70), which only verifies that the directory contains an `mcp_server/` subdirectory and a `ui/unified-viz.html` file — trivial markers that an attacker can replicate:\n\n```python\n# mcp_server/handlers/open_visualization.py:65-70\ndef _is_cortex_root(path: Path) -> bool:\n return (path / \"mcp_server\").is_dir() and \\\n (path / \"ui\" / \"unified-viz.html\").is_file()\n```\n\nThere is no git remote identity check, no cryptographic signature verification, no release path allowlist, and no explicit developer opt-in requirement. Once a directory passes `_is_cortex_root()`, the handler constructs a bootstrap path and executes it unconditionally:\n\n```python\n# mcp_server/handlers/open_visualization.py:179-185\nbootstrap_path = dev_src / \"mcp_server\" / \"server\" / \"visualize_bootstrap.py\"\nif bootstrap_path.is_file():\n ...\n proc = subprocess.run(\n [sys.executable, str(bootstrap_path)],\n )\n```\n\nA secondary code-execution path exists in `mcp_server/server/http_launcher.py:80-83` and `273-275`, where the same `CLAUDE_PROJECT_DIR`-derived dev source is used to `rsync` attacker-controlled files into the Cortex plugin cache directory before serving them.\n\n**Entry point**: MCP tool `open_visualization`, registered at `mcp_server/tool_registry_core.py:194-207` (no authentication required at tool layer). The tool is reachable through the standard stdio MCP transport started in `mcp_server/__main__.py:66`.\n\n### PoC\n\n**Prerequisites**\n\n- Cortex (`neuro-cortex-memory` ≥ 3.17.0) installed and importable.\n- Victim opens an attacker-controlled project directory in Claude Code (sets `CLAUDE_PROJECT_DIR` automatically) or the attacker otherwise controls `CLAUDE_PROJECT_DIR`.\n- Victim invokes `/cortex-visualize` or triggers the `open_visualization` MCP tool (e.g., by selecting a visualization command in the Claude Code interface).\n\n**Inline PoC**\n\n```python\nimport asyncio, os, tempfile\nfrom pathlib import Path\nfrom mcp_server.handlers import open_visualization as ov\n\nbase = Path(tempfile.mkdtemp(prefix=\"cortex-malicious-project-\"))\n(base / \"mcp_server\" / \"server\").mkdir(parents=True)\n(base / \"ui\").mkdir()\n(base / \"ui\" / \"unified-viz.html\").write_text(\"<html>attacker</html>\", encoding=\"utf-8\")\n\nsentinel = Path(\"/tmp/cortex-open-visualization-poc-owned\")\nif sentinel.exists():\n sentinel.unlink()\n\n(base / \"mcp_server\" / \"server\" / \"visualize_bootstrap.py\").write_text(\n \"from pathlib import Path\\n\"\n \"Path('/tmp/cortex-open-visualization-poc-owned').write_text('executed', encoding='utf-8')\\n\"\n \"print('bootstrap-ran')\\n\",\n encoding=\"utf-8\",\n)\n\nos.environ[\"CLAUDE_PROJECT_DIR\"] = str(base)\nov.launch_server = lambda _typ: \"http://127.0.0.1:3458\"\nov.open_in_browser = lambda _url: None\n\nresult = asyncio.run(ov.handler({}))\nprint(result.get(\"bootstrap\"))\nprint(sentinel.read_text())\n```\n\nExpected output:\n```\nbootstrap-ran\nexecuted\n```\n\n**Recommended Remediation**\n\nRemove `CLAUDE_PROJECT_DIR` from the dev-source candidate list. Gate executable dev-source resolution behind an explicit opt-in flag so that only a developer who deliberately sets both `CORTEX_DEV_SOURCE_SYNC=1` and `CORTEX_DEV_ROOT` can trigger the bootstrap path:\n\n```diff\n--- a/mcp_server/handlers/open_visualization.py\n+++ b/mcp_server/handlers/open_visualization.py\n- candidates: list[Path] = []\n- for env in (\"CORTEX_DEV_ROOT\", \"CLAUDE_PROJECT_DIR\"):\n- v = os.environ.get(env)\n- if v:\n- candidates.append(Path(v))\n+ candidates: list[Path] = []\n+ if os.environ.get(\"CORTEX_DEV_SOURCE_SYNC\") == \"1\":\n+ v = os.environ.get(\"CORTEX_DEV_ROOT\")\n+ if v:\n+ candidates.append(Path(v))\n candidates.append(Path.home() / \"Documents\" / \"Developments\" / \"Cortex\")\n```\n\nApply the same change to `mcp_server/server/http_launcher.py:80-83` to eliminate the secondary rsync execution path.\n\n### Impact\n\nThis is a **local arbitrary code execution** vulnerability. Any user who has the Cortex MCP plugin installed and opens (or is social-engineered into opening) an attacker-crafted project directory in Claude Code is at risk. When the victim invokes the `open_visualization` tool (e.g., via the `/cortex-visualize` slash command), attacker-controlled Python code runs immediately with the full privileges of the victim's local user account — the same privileges used by Claude Code and the Cortex MCP server process.\n\nConsequences include but are not limited to:\n\n- **Confidentiality**: exfiltration of files, secrets, environment variables, and SSH/GPG keys accessible to the local user.\n- **Integrity**: modification or deletion of local files, source code, credentials, and plugin caches.\n- **Availability**: termination of local processes or destruction of user data.\n\nThe secondary path through `http_launcher.py` additionally allows the attacker to overwrite files in the Cortex plugin cache directory, potentially establishing persistence that survives after the malicious project is closed.\n\nThe attack requires the victim to invoke the visualization tool (UI:R), which is reflected in the CVSS score. No elevated privileges or prior authentication to any network service are required.",
"severity" : [ {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:L/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:P"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "neuro-cortex-memory"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "3.18.0"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 3.17.0"
}
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/cdeust/Cortex/security/advisories/GHSA-gvpp-v77h-5w8g"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/cdeust/Cortex"
}, {
"type" : "WEB",
"url" : "https://github.com/cdeust/Cortex/releases/tag/v3.17.1"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-829" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2026-07-01T18:41:35Z",
"nvd_published_at" : null
}
}