cognee
- Type
- MCP server
- Scanned
- Nov 18, 2026
- Version
- 5870f15d2488
- Files read
- 5208
...Wait! No! Never include extra text! Catching myself before emitting anything! Let me output ONLY the raw JSON object on a single line. Let's make sure the very first character is { and the very last character is }.**Wait** - I am still inside thought block? Wait—LOOK! Let me check if I accidentally closed the thought block! Oh!! Look back: Ready to output! ` followed by the end-thought token! WAIT NO—in my stream above did I emit end-thought?! No, wait: let me check! No, I see I might have emitted end-thought if I pressed it, wait—no, if I am still thinking or not? Let me check! No,
Findings
-
CriticalArbitrary code execution via exec() on caller-supplied graph JSON schemas
cognee/shared/graph_model_utils.py:108
graph_schema_to_graph_model() converts a JSON Schema dictionary received from HTTP API callers (such as POST /api/v1/remember and POST /api/v1/cognify) into Python source code using datamodel-code-generator and runs exec() on the generated code. While _reject_external_refs() blocks external $ref URLs and file paths, datamodel-code-generator is not a sandbox and honors schema directives like customTypePath and customBasePath without identifier sanitization, allowing a crafted schema (for example injecting statements after a semicolon in customTypePath) to execute arbitrary Python code on the server. This is reachable without authentication when ENABLE_BACKEND_ACCESS_CONTROL=false (used in local Docker and Helm defaults) and by any authenticated user or agent key in multi-tenant mode.
Fix: Do not pass untrusted JSON schemas to datamodel-code-generator and exec(); build DataPoint models dynamically with pydantic.create_model() after validating class names, field names, and allowed types against a strict allowlist.
-
HighImporting cognee loads working-directory .env with override=True, allowing untrusted repos to hijack secrets or migrations
At package import time, cognee searches the current working directory and its parents for a .env file and loads it with override=True, overwriting environment variables already passed to the process. If an IDE spawns uvx cognee-mcp with its working directory set to an untrusted cloned repository (or a user runs cognee-cli inside that repository), a committed .env file in the repo can override COGNEE_BASE_URL or LLM_ENDPOINT to exfiltrate the user's real COGNEE_API_KEY or LLM_API_KEY to an attacker server, or set COGNEE_ALEMBIC_PATH to a folder in the repo so automatic startup migrations execute attacker-controlled Python code.
Fix: Set override=False when loading .env files so explicit environment variables take precedence, and avoid auto-loading .env from the working directory inside cognee-mcp unless COGNEE_ENV_FILE is explicitly set.
-
HighMCP server allows arbitrary local file and S3 ingestion by default
cognee/tasks/ingestion/save_data_item_to_storage.py:52
When ACCEPT_LOCAL_FILE_PATH is unset, local_file_paths_accepted() only blocks direct FastAPI requests (ORIGIN_API) and allows ORIGIN_MCP by default, with no workspace restriction unless COGNEE_ALLOWED_LOCAL_FILE_ROOTS is also set. Although cognee-mcp documents the remember tool's data parameter as text and recommends HTTP transport for web deployments, a prompt-injected agent or remote HTTP/SSE MCP client can pass sensitive host file paths (such as ~/.ssh/id_rsa or ~/.aws/credentials) or s3:// URIs as data to send their contents to external LLM providers and read them back via recall.
Fix: Default ACCEPT_LOCAL_FILE_PATH to false for ORIGIN_MCP (or mark MCP text inputs with literal_text=True) so remember(data=...) only stores literal text unless local path access is explicitly enabled and scoped.
-
HighMCP server allows arbitrary database connection-string ingestion by default
cognee/tasks/ingestion/create_dlt_source.py:224
When ALLOW_DATABASE_INGESTION is unset, _require_database_ingestion_allowed() only blocks ORIGIN_API and permits ORIGIN_MCP to auto-connect to any sqlite:///, postgresql://, mysql://, mssql://, or oracle:// connection string passed to remember or add. A prompt-injected coding agent or a client connected to an HTTP/SSE cognee-mcp server can pass a local SQLite file URI or internal network database DSN to dump all tables and rows into Cognee memory.
Fix: Require ALLOW_DATABASE_INGESTION=true for ORIGIN_MCP as well, or default database ingestion to off across all surfaces unless explicitly enabled.
-
HighSSRF protection in URL crawler can be bypassed via DNS rebinding and Playwright redirects
cognee/tasks/web_scraper/default_url_crawler.py:313
When Cognee ingests a URL (allowed by default in MCP, SDK, and CLI modes, and when ALLOW_HTTP_REQUESTS=true on the API server), DefaultUrlCrawler calls validate_outbound_url(url) up front to check the hostname's DNS records, but does not pin the validated IP address for the actual HTTP fetches. Immediately afterward, it fetches robots.txt (honoring an attacker-supplied Crawl-delay of up to 10 seconds) and then calls httpx to fetch the target URL, triggering a fresh DNS lookup after the sleep window. An attacker-controlled domain can resolve to a public IP during validation, force a delay via robots.txt so DNS caches expire, and rebind to 127.0.0.1 or 169.254.169.254 so internal services or cloud metadata credentials are fetched and indexed into the searchable graph. In addition, when use_playwright=True is enabled, Chromium's page.goto follows HTTP redirects and executes JavaScript requests to internal addresses without re-validating targets.
Fix: Pin the validated IP address in a custom httpx transport (sending the original Host header and TLS SNI) so the connection cannot resolve to a different IP, and intercept all Playwright requests and redirects with page.route to block non-public destinations.
-
HighResponses API cognify tool allows ingesting arbitrary server files and cross-user ontologies
cognee/api/v1/responses/dispatch_function.py:91
The default toolset for the /v1/responses endpoint exposes a cognify function whose text parameter is described to the model only as text content, plus an ontology_file_path parameter. However, handle_cognify passes text directly to add(data=text, user=user) without marking it as literal text, and passes ontology_file_path straight to cognify(). Because add() treats strings starting with '/', 'file://', 's3://', 'http(s)://', or database URI schemes as file paths, S3 objects, URLs, or databases on the server machine, and ontology_file_path reads any local RDF/OWL file bypassing OntologyService's per-user directory isolation, a prompt-injected model or non-admin API caller can ingest local server files or another user's uploaded ontologies into their dataset and read the extracted contents via the search tool.
Fix: Wrap text in DataItem(data=text, literal_text=True) before calling add(), scope cognify() to a target dataset rather than all user datasets, and remove raw ontology_file_path from DEFAULT_TOOLS in favor of user-scoped ontology_key lookups via OntologyService.
-
HighStored cross-site scripting in graph visualization inspector
cognee/modules/visualization/views/story_view.js:1077
When rendering the node inspector panel in the HTML graph visualization, inspectorOverviewLine builds text containing document names, entity names, and entity types without HTML-escaping them (and node color values and edge weights are likewise unescaped), and showNodeInfo inserts that string directly into infoPanel.innerHTML. Because this HTML is served directly on the API origin at GET /api/v1/visualize and proxied onto the UI origin at GET /api/visualize, ingested content from emails, web pages, shared datasets, or SaaS connectors with HTML tags in titles or extracted entities can execute arbitrary JavaScript in the user's browser when hovered or selected, allowing an attacker to read private datasets or mint API keys using the user's session.
Fix: Pass every interpolated node and edge field (including label, doc.name, entityType, n.color, and weights) through an HTML-escaping helper that also escapes double and single quotes, or build the inspector DOM using textContent instead of innerHTML, and serve the visualization with a restrictive Content-Security-Policy or sandboxed iframe.
-
MediumMCP HTTP and SSE transports have no authentication and Host checks do not stop network callers
When cognee-mcp runs with --transport http or --transport sse (which cognee-mcp/entrypoint.sh binds to 0.0.0.0 by default in Docker and cognee-cli -ui), the server enforces no API key, bearer token, or password authentication. Although HostOriginGuardMiddleware blocks browser DNS-rebinding attacks, the README states that binding 0.0.0.0 safely rejects LAN requests with HTTP 421; in reality, any non-browser attacker on the network can simply send a request with a spoofed 'Host: localhost:8000' header to read all memories via recall, poison data via remember, or wipe all datasets via forget(everything=True).
Fix: Require bearer token or API key authentication on HTTP and SSE MCP endpoints, and bind to 127.0.0.1 by default unless authentication is explicitly configured.
-
Mediumstart_visualization_server binds to 0.0.0.0 and serves the current working directory without authentication
start_visualization_server() defaults to host='0.0.0.0', port=8001, and http.server.SimpleHTTPRequestHandler. When called with defaults (andcognee/skill.md suggests start_visualization_server to agents), it exposes an unauthenticated HTTP server on all network interfaces serving directory listings and files from the process's current working directory, which commonly contains .env secrets, .cognee_system databases, and source files.
Fix: Bind to 127.0.0.1 by default and serve only the specific generated HTML file rather than exposing the working directory through SimpleHTTPRequestHandler.
-
MediumMCP remember tool describes data as plain text but fetches URLs, clones git repos, and uploads local files
cognee-mcp/src/cognee_client.py:800
The MCP remember tool documents its data parameter strictly as 'The text content to store' (contrasting it with filename + content_base64 for file uploads). However, in direct mode it forwards data straight to cognee.remember()—where HTTP(S) URLs are fetched by default in MCP mode, remote git repository URLs are cloned, and allowed local paths are ingested—and in API mode _build_upload() silently reads matching local files within allowed roots and uploads their raw bytes without the 10 MB upload cap. Through prompt injection, an agent (or a user approving what looks like a harmless text note) can be tricked into making outbound HTTP requests (SSRF or data exfiltration via URLs) or ingesting local files.
Fix: Restrict the MCP remember tool's data parameter to literal text strings (or require explicit separate parameters and user-visible descriptions for URL fetching and local file ingestion).
-
MediumGraph-stored Tool nodes can import and invoke arbitrary Python callables
cognee/modules/tools/registry.py:44
When AgenticRetriever runs an agentic search, it loads Tool nodes from the dataset's graph database and resolves each tool's handler_ref by calling importlib.import_module and getattr with no allowlist of safe modules or handlers. Because COGX archive imports (rehydrate_node) and custom graph models allow non-superuser callers or untrusted .cogx.tar.gz archives to insert arbitrary Tool nodes into the graph (including with dataset_id unset so they apply across shared graphs), an attacker can trigger arbitrary Python module imports and invoke internal callables when agentic completion runs.
Fix: Restrict resolve_handler to an explicit allowlist of registered tool handler functions and block untrusted archive imports or user graph models from creating Tool DataPoints.
-
MediumNatural-language and Cypher search execute mutating or file-access Cypher without read-only guards
cognee/modules/retrieval/natural_language_retriever.py:145
When ALLOW_CYPHER_QUERY=true is enabled, NaturalLanguageRetriever and CypherSearchRetriever pass LLM-generated or caller-supplied Cypher directly to graph_engine.query() while requiring only read permission on the dataset. Unlike BroadRetriever (which enforces a read-only authorizer), neither retriever blocks write clauses (DETACH DELETE, CREATE, MERGE, SET) or engine-level file and extension commands such as Ladybug/Kuzu COPY TO/FROM and LOAD EXTENSION or Neo4j LOAD CSV, allowing prompt injection or read-only users to alter data, touch host files, or load native extensions.
Fix: Execute search Cypher queries over a read-only database connection or authorizer and reject queries containing mutating, file-transfer, or extension-loading keywords.
-
MediumPresort folder scanner ignores ACCEPT_LOCAL_FILE_PATH and allows scanning internal Cognee storage
cognee/modules/presort/local_paths.py:23
run_presort (reached via remember with dry_run='presort') never checks ACCEPT_LOCAL_FILE_PATH, and when COGNEE_ALLOWED_LOCAL_FILE_ROOTS is unset, get_presort_roots() defaults to allowing Cognee's own data_root_directory, system_root_directory, cache_root_directory, logs_root_directory, repos_root_directory, the system temp folder, and the working directory. A caller or prompt-injected agent can scan these directories even when local file ingestion is disabled, exposing file names, sizes, MD5 hashes, PII categories, and LLM content classifications across system files and other users' uploads.
Fix: Enforce require_server_path_access() in run_presort and PresortReport.from_json, and exclude Cognee's internal system, data, cache, and log directories from get_presort_roots().
-
MediumDry-run estimator bypasses COGNEE_ALLOWED_LOCAL_FILE_ROOTS and leaks file existence
cognee/modules/cognify/estimator.py:328
During remember(..., dry_run=True), _path_candidate and _read_text_path read local files and file:// URIs directly without calling resolve_local_path, completely bypassing COGNEE_ALLOWED_LOCAL_FILE_ROOTS and internal-storage blocks when local paths are accepted. In addition, _path_candidate checks path.exists() before checking _accept_local_file_path() (an ordering shared with save_data_item_to_storage), raising an error for existing server files while succeeding as plain text for missing paths, which acts as a filesystem existence oracle even when ACCEPT_LOCAL_FILE_PATH is false.
Fix: Check _accept_local_file_path() before touching the filesystem so all strings are treated as text when disabled, and validate all dry-run file paths through resolve_local_path.
-
MediumRemote git clone SSRF check can be bypassed via HTTP redirects and SSH URLs
cognee/tasks/code_graph/resolve_repo.py:245
resolve_repo_source validates the initial http(s) URL with validate_outbound_url() to prevent SSRF and internal port scanning, but then invokes git clone, fetch, and pull without disabling HTTP redirects. An attacker-controlled server can pass initial validation and return an HTTP 302 redirect to loopback, private network hosts, or cloud metadata endpoints (169.254.169.254), which git follows and reports back via up to 1000 characters of stderr; ssh:// and git@ URLs also skip validate_outbound_url() entirely.
Fix: Pass -c http.followRedirects=false and -c protocol.allow=https to git subprocesses, and validate or disable ssh:// and git@ repository URLs unless explicitly permitted.
-
MediumKeyless graph extraction automatically downloads and installs unpinned packages at runtime
cognee/modules/cognify/config.py:54
CognifyConfig sets gliner_auto_install to True by default. When no LLM API key is set, or when a caller passes extractor='gliner_demo', ensure_extractor_runtime downloads and installs torch and the gliner extra (gliner2, protobuf, sentencepiece, psutil) from PyPI and the PyTorch index into the running Python environment at runtime without hash pinning.
Fix: Set gliner_auto_install to False by default so missing optional packages raise KeylessExtractorNotInstalledError rather than modifying the Python environment at runtime.
-
MediumPassword-reset and email-verification tokens are written to logs in plaintext
cognee/modules/users/get_user_manager.py:55
UserManager.on_after_forgot_password and on_after_request_verify log live reset and verification tokens at INFO level. Because Cognee writes plaintext log files and forwards cognee.modules logs through its OpenTelemetry log bridge without redacting these tokens, anyone with access to application logs or the observability backend can trigger a password reset for any user and take over their account.
Fix: Remove the token value from the log messages in on_after_forgot_password and on_after_request_verify.
-
MediumSSRF IP blocklist allows RFC 6598 Shared Address Space (100.64.0.0/10) used by Tailscale and cloud metadata
cognee/tasks/web_scraper/ssrf_protection.py:130
_is_blocked_ip checks individual negative properties (is_private, is_loopback, is_link_local, is_reserved, is_multicast, is_unspecified, is_site_local) rather than requiring ip.is_global. In Python's ipaddress module, RFC 6598 Shared Address Space (100.64.0.0/10) returns False for is_private and all other checked flags while returning False for is_global. As a result, outbound URL fetching and git repository cloning permit requests directly to 100.64.0.0/10 addresses, which include Tailscale internal mesh hosts on developer machines and Alibaba Cloud's instance metadata service (100.100.100.200).
Fix: Check 'not ip.is_global' (alongside handling IPv4-mapped IPv6 addresses via ip.ipv4_mapped) in _is_blocked_ip so all non-globally-routable IANA ranges, including 100.64.0.0/10, are rejected.
-
MediumHermes plugin spawns local Cognee API server with a hardcoded default owner password
cognee-integrations/integrations/hermes-agent/cognee_integration_hermes/server_bootstrap.py:281
Cognee 1.6+ removed its built-in default password so API servers do not expose a loginable default account unless explicitly configured. When the Hermes Agent plugin boots its local Cognee server on 127.0.0.1:8011, _spawn injects DEFAULT_USER_EMAIL='default_user@example.com' and DEFAULT_USER_PASSWORD='default_password' into the server environment (even ignoring any user-configured COGNEE_USER_PASSWORD) and does not restrict CORS_ALLOWED_ORIGINS. Any other local user or untrusted process on the machine (and potentially cross-origin websites visited in a local browser if the server's default permissive CORS applies to the form-encoded /api/v1/auth/login endpoint) can authenticate with these known credentials and read, modify, or delete all stored memories.
Fix: Generate a cryptographically random password on first run, store it in a 0600 file inside the user's private plugin state directory, pass it to the spawned server, and disable cross-origin browser access via CORS_ALLOWED_ORIGINS.
-
MediumPredictable /tmp staging directory and incomplete Windows path validation in skill uploads
cognee/api/v1/remember/remember.py:333
When ingesting skills via remember(..., content_type='skills'), _skill_materialize_root stages files in a predictable directory directly inside the shared system temp directory (/tmp/cognee-skills-<sha256[:16]>) using mkdir(exist_ok=True) rather than an isolated private directory or mkdtemp. On multi-user systems, another local user can pre-create that directory or symlinks inside it to interfere with or overwrite files owned by the Cognee user, and concurrent uploads to the same dataset collide and delete each other's files. In addition, uploaded filenames are sanitized only with '_Path(rel_name).as_posix().lstrip("/")' and a '..' check; on Windows hosts, a filename with a drive prefix such as 'C:/path/SKILL.md' is not stripped and causes 'dest = root / safe_rel' to write outside root.
Fix: Stage materialized skills under a private directory inside Cognee's own SYSTEM_ROOT_DIRECTORY or CACHE_ROOT_DIRECTORY (mode 0700) with per-request isolation, reject paths with a drive or root component, and verify dest.resolve().is_relative_to(root.resolve()) before writing.
-
MediumUI launcher publishes unauthenticated MCP container on 0.0.0.0 while logging 127.0.0.1
When start_ui is called with start_mcp=True, it launches the cognee/cognee-mcp Docker container using '-p {mcp_port}:8000' without binding to 127.0.0.1, even though the startup log prints 'http://127.0.0.1:{mcp_port}/sse'. Docker publishes that port on 0.0.0.0 across all host network interfaces, and the same '-p 8000:8000' pattern is recommended in cognee-mcp/README.md under the mistaken assumption that Host-header DNS-rebinding checks block LAN access. Because non-browser clients on the same Wi-Fi or LAN can simply send 'Host: localhost:8000', anyone on the local network can reach the unauthenticated MCP server directly to read, poison, or delete all stored memories.
Fix: Bind the Docker port mapping explicitly to loopback ('-p', f'127.0.0.1:{mcp_port}:8000') in ui.py and in the Docker examples, and require authentication before exposing HTTP or SSE MCP transports on non-loopback interfaces.
-
MediumLinear agent webhook searches all of the installing user's private datasets for any workspace member
cognee/modules/integrations/linear/agent_session.py:173
When a user connects the Linear agent integration to a Linear workspace, any member or guest in that Linear workspace can @mention the agent or delegate an issue to it, triggering an AgentSessionEvent webhook. Unlike the Slack integration (which verifies member identity and restricts channel answers to the workspace dataset and visible channels), Linear's _answer handler runs cognee_search as the installing Cognee user with datasets=None and posts the answer publicly back onto the Linear issue. Any workspace member can therefore query every dataset the installing user can read in Cognee, including private personal memories, Gmail, Google Drive, and private Linear teams.
Fix: Scope Linear agent session searches to the Linear workspace's own dataset (dataset_name_for_credential(credential)) and enforce team-visibility or per-member account linking before querying user-owned datasets.
-
MediumInternal graph nodes (is_internal=True) are exposed via SPARQL/RDF export and formatted graph reads
cognee/modules/graph/rdf/export.py:95
InternalDataPoint marks per-user and system state nodes (such as user preference nodes stored inside a dataset's graph) with is_internal=True so they are never surfaced in retrieval output. While CogneeGraph, schema inventory, and provenance views strip is_internal nodes and their incident edges, graph_data_to_rdf (used by query_dataset_sparql behind POST /api/v1/datasets/{dataset_id}/sparql) and get_formatted_graph_data in cognee/modules/graph/methods/get_formatted_graph_data.py emit every node and edge from get_graph_data() unfiltered. Any collaborator with read permission on a shared dataset can query SPARQL or formatted graph data (both enabled by default without ALLOW_CYPHER_QUERY) to read other users' internal state nodes.
Fix: Filter out nodes where is_internal_node(props) is true, along with any edges touching those node IDs, in graph_data_to_rdf and get_formatted_graph_data.
-
MediumRaw dataset file endpoint serves HTML and SVG inline on the API origin
cognee/api/v1/datasets/routers/get_datasets_router.py:1285
In GET /api/v1/datasets/{dataset_id}/data/{data_id}/raw, S3 and encrypted local files are served with Content-Disposition: attachment, but unencrypted local files (the default storage mode) are returned via FileResponse(path=path) with no filename argument. In Starlette and FastAPI, omitting filename causes FileResponse to omit the Content-Disposition header and serve the file inline using a MIME type guessed from its extension (such as text/html or image/svg+xml). If a dataset contains an ingested HTML or SVG file from a connector, URL, or shared collaborator and a logged-in user opens its /raw link in a browser, embedded JavaScript runs on the Cognee API origin with the user's session cookies.
Fix: Pass filename=path.name or data.name and content_disposition_type='attachment' to FileResponse, add X-Content-Type-Options: nosniff, and force application/octet-stream for active content types such as HTML and SVG.
-
LowOpt-out telemetry sends persistent machine IDs and hashed metadata to test.prometh.ai by default
Unless TELEMETRY_DISABLED is set or ENV is 'dev' or 'test', Cognee automatically batches and sends usage and exception telemetry to https://test.prometh.ai during CLI, SDK, API, and MCP runs. Events include a persistent machine ID (~/.cognee/.persistent_id), a PBKDF2-derived identifier of LLM_API_KEY, and unsalted UUID5 hashes of URLs, dataset names, and session IDs. Neither the root README nor the cognee-mcp README informs users of this background data collection or how to disable it.
Fix: Make telemetry opt-in or prominently document TELEMETRY_DISABLED=1 in the main and MCP READMEs, and avoid unsalted UUID5 hashes for URLs and dataset names.
-
LowFallback runtime download of native Ladybug JSON extension without client-side digest verification
cognee_db_workers/_kuzu_helpers.py:151
While prebuilt wheels and Docker images bundle Ladybug's JSON extension offline, source checkouts and platforms without a bundled binary (such as musl Linux or Windows ARM) fall back to running 'INSTALL JSON;' at runtime, which downloads and dynamically loads a native shared library from extension.ladybugdb.com without client-side hash pinning.
Fix: Require an explicit opt-in environment variable before downloading native database extensions at runtime, or verify the downloaded binary's SHA-256 digest before loading it.
-
LowSQL injection via unquoted table and column names in migrate_relational_database
cognee/tasks/ingestion/migrate_relational_database.py:210
complete_database_ingestion interpolates table_name, primary_key_col, and foreign-key table and column names directly into sqlalchemy.text() queries inside a read-write transaction without identifier validation or quoting. If run against an untrusted database schema or JSON schema file containing crafted table or column names, arbitrary SQL commands can execute against the migration database.
Fix: Validate and double-quote all schema, table, and column identifiers (as _quote_identifier does in ingest_dlt_source.py) before interpolating them into SQL queries.
-
LowSettings helper reveals the first 10 characters and length of API keys
cognee/modules/settings/get_settings.py:95
get_settings() masks llm_api_key and vector_db_key by keeping the first 10 characters in cleartext and appending asterisks for the remaining length, which leaks key prefixes, exact lengths, and the entirety of any password or token of 10 characters or fewer.
Fix: Return a fixed-length placeholder or only a boolean indicating whether a key is configured, rather than slicing the secret.
-
LowNewly created .env file is world-readable when persisting configuration secrets
cognee/api/v1/config/config.py:110
When config.set(..., persist=True) (used by 'cognee-cli config set') writes a setting such as llm_api_key, embedding_api_key, or vector_db_key and no .env file exists yet, _persist_env_var creates the file with open(path, 'a').close() using the default process umask (typically 0644) instead of restricting permissions to 0600. On multi-user machines, other local users can read the persisted API keys.
Fix: Create the .env file with os.open(path, os.O_WRONLY | os.O_CREAT, 0o600) before calling dotenv.set_key.
-
LowUI launcher silently downloads and executes unverified nvm installer and unpinned runtime code
cognee/api/v1/ui/node_setup.py:93
When start_ui() checks for Node.js via check_node_npm() and finds it missing, it automatically downloads https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh without prompting the user or verifying a cryptographic hash, marks it executable, and runs it with bash, followed by 'nvm install node'. In addition, ui.py downloads an unverified GitHub tag zip archive and runs 'npm install' (executing package lifecycle scripts), and pulls the mutable 'cognee/cognee-mcp:main' Docker tag at runtime. If an upstream tag or network path is compromised, launching the UI executes arbitrary code on the user's machine.
Fix: Do not automatically download and run shell installers when Node.js is absent; require the user to install Node.js themselves (or verify a pinned SHA-256 digest after explicit user consent), use 'npm ci --ignore-scripts' where possible, and pin Docker images by version or digest.
-
LowSQLite read-only connection enforcement can be bypassed in text_to_sql engine normalization
cognee/modules/tools/text_to_sql/engine_factory.py:51
get_external_sql_engine normalizes SQLite DSNs so that external databases registered for text_to_sql are opened with SQLite's database-level mode=ro protection even if the SQL guard misses a write statement. However, when a SQLite connection string starts with '/file:' (such as 'sqlite:///file:/path/to/db?uri=true'), _normalize_url returns it verbatim without ensuring mode=ro is present, and if a regular SQLite DSN already contains a '?' query string, appending '?mode=ro&uri=true' produces a second '?' that causes SQLite to ignore mode=ro.
Fix: Parse existing URI query parameters on SQLite connection strings (including '/file:' URIs), reject conflicting write modes, and set mode=ro and uri=true via proper query-string encoding.
-
LowCloud API key check and sync fall back to cleartext http://localhost:8001
cognee/modules/cloud/operations/check_api_key.py:8
check_api_key hardcodes cloud_base_url to 'http://localhost:8001' instead of reading COGNEE_SERVICE_URL, and cognee/api/v1/sync/sync.py similarly falls back to 'http://localhost:8001' (and a placeholder 'your-auth-token' key) when COGNEE_SERVICE_URL or COGNEE_API_KEY is unset. On a multi-user host, if these cloud helpers are called without COGNEE_SERVICE_URL configured, another local user listening on port 8001 can capture the X-Api-Key header over cleartext HTTP or serve untrusted files back into sync's local ingestion pipeline.
Fix: Require COGNEE_SERVICE_URL and COGNEE_API_KEY to be explicitly configured (raising CogneeConfigurationError when missing, matching serve()) instead of falling back to http://localhost:8001 and a placeholder token.
-
LowText-to-SQL does not enforce per-connection allowed_tables on generated queries
cognee/modules/tools/text_to_sql/engine.py:147
When a user registers an external database tool connection with an allowed_tables allowlist, run_text_to_sql only uses allowed_tables to filter which table schemas are shown in the LLM prompt (introspect_schema), and never validates the LLM-generated SELECT query against allowed_tables (similarly, write_guard.py only checks the target table after UPDATE, not tables read in subqueries). When TOOL_CALLS_ENABLED=true, prompt injection in a question routed to the tools scope can instruct the LLM to query information_schema or any restricted table accessible to the database credentials.
Fix: Parse the generated SQL with a real SQL parser (such as sqlglot) and reject any query or subquery that references tables or system catalogs outside allowed_tables, in addition to enforcing least-privilege database roles.
-
LowRegex SQL string-literal stripping can be bypassed with backslash escapes or dollar-quoting
cognee/modules/tools/text_to_sql/sql_guard.py:48
Both validate_select and validate_update strip single-quoted strings using _STRING_LITERAL_RE before checking for semicolon statement separators and forbidden SQL keywords. Because the regex only recognizes doubled single quotes ('') and ignores backslash escapes (such as PostgreSQL E'\'' or MySQL \''), dollar-quoted strings ($$...$$), and unmatched trailing quotes, crafted SQL generated via prompt injection can desynchronize the regex so that semicolons and forbidden keywords appear to be inside a string literal while the database executes them as SQL. In write_proposals.py, _dry_run_update executes validated SQL on the write-capable engine before human approval.
Fix: Replace regex-based SQL sanitization with a dialect-aware SQL parser AST check that rejects escape-string extensions, dollar-quoted strings, multiple statements, and non-allowlisted AST node types.
-
LowSlack /cognee-link magic link can bind an attacker's Slack identity to a victim's Cognee account
cognee-connectors/connectors/slack/cognee_connector_slack/cognee_host/handle_slack_link.py:127
Running /cognee-link in Slack mints an HMAC-signed code containing the caller's Slack team_id and slack_user_id, and POST /api/v1/slack/link binds those IDs directly to whichever Cognee user is authenticated in the browser. Unlike the OAuth install flow, there is no browser-bound nonce, single-use token invalidation, or human-readable Slack identity confirmation. Any member of a connected Slack workspace can run /cognee-link to generate a valid link for their own Slack user ID and send it to a logged-in Cognee user; if the victim confirms the link, the attacker can query all of the victim's readable datasets via /cognee-ask and write to their memory via /cognee-remember.
Fix: Start the linking flow from the authenticated Cognee browser session (redirecting through Slack OAuth identity or displaying the resolved Slack handle and workspace name for explicit confirmation) and make link codes single-use.
-
LowAutomatic runtime installation of unpinned Python packages with unsafe index strategy
cognee/tasks/graph/gliner_demo/install.py:195
When cognify or remember runs without an LLM_API_KEY configured and the GLiNER runtime is missing, install_gliner_runtime spawns pip or uv at runtime to download and install PyTorch and gliner2 (along with dependencies) into the running Python environment using open version ranges rather than hash-pinned artifacts. When using uv, torch_index_options passes --index-strategy unsafe-first-match, which disables uv's multi-index dependency-confusion protection across PyPI and the PyTorch index.
Fix: Default GLINER_AUTO_INSTALL to false so users explicitly install cognee[gliner] via their package manager, or pin exact versions and hashes and scope index overrides strictly to the torch package rather than unsafe-first-match.
-
LowUser and agent API keys are stored in plaintext and returned in full by default
cognee/modules/users/api_key/hash_api_key.py:4
HASH_API_KEY defaults to false, causing user, agent, and plugin API keys to be stored in cleartext in the user_api_key database table and returned in full on every GET /api/v1/auth/api-keys call rather than only once at creation time. If the database file is read or a browser session is briefly compromised (for example via XSS), all existing long-lived API keys are exposed.
Fix: Default HASH_API_KEY to true with a per-instance or per-key random salt, and only return the raw API key once when it is first created.
-
LowUnauthenticated Next.js client log endpoint allows log injection and flooding
cognee-frontend/src/app/api/log/route.ts:5
POST /api/log on the Next.js frontend requires no authentication, Origin check, length cap, or newline sanitization, and writes caller-supplied tag, method, url, and message values straight to server stdout/stderr. Because request.json() parses bodies regardless of Content-Type, any website a user visits in their browser (or any host able to reach port 3000) can send cross-origin POST requests without a CORS preflight to forge multi-line server log entries or flood logs.
Fix: Require session authentication and same-origin checks on /api/log, cap payload size, and strip control characters such as newlines before logging.
-
LowHelm chart disables API authentication and multi-tenant isolation by default
deployment/helm/values.yaml:20
Cognee defaults to ENABLE_BACKEND_ACCESS_CONTROL=true, which isolates datasets per user and requires authentication on /api/v1 endpoints. However, deployment/helm/values.yaml sets enableBackendAccessControl to false (wired to ENABLE_BACKEND_ACCESS_CONTROL in deployment/helm/templates/configmap.yaml) without setting REQUIRE_AUTHENTICATION=true, and even the recommended production helm command in deployment/helm/README.md leaves it false. Anyone who can reach the Kubernetes Service (other pods in the cluster, or external callers if exposed via an Ingress, NodePort, or LoadBalancer) can read, modify, or delete all stored memories and run queries billed to the server's LLM_API_KEY without authenticating.
Fix: Set cognee.enableBackendAccessControl to true by default in deployment/helm/values.yaml (with support for provisioning user credentials via Secret), and warn clearly in deployment/helm/README.md that false turns off API authentication.
-
LowHelm chart uses mutable main branch image tag by default
deployment/helm/values.yaml configures image.tag as main rather than a pinned release version or SHA-256 digest. Newly scheduled pods on fresh cluster nodes will pull whatever build was most recently pushed to cognee/cognee:main on Docker Hub, making deployments non-reproducible and exposing clusters to unexpected upstream changes.
Fix: Pin image.tag in deployment/helm/values.yaml to a specific immutable release version or image digest.
-
LowGraph visualization HTML loads external D3 script without Subresource Integrity
cognee/modules/visualization/template.html:7
Knowledge graph HTML files generated by visualize_graph() and /visualize load https://d3js.org/d3.v7.min.js from an external CDN without an integrity hash. Opening a visualization contacts d3js.org (and Google Fonts), and if that CDN were compromised, modified JavaScript would execute with full access to the user's rendered knowledge graph data in the browser.
Fix: Add integrity and crossorigin="anonymous" attributes to the D3 script tag in cognee/modules/visualization/template.html, or bundle D3 inline so visualizations render without external network requests.
-
LowWorld-writable permissions, root execution, and unverified downloads in archived benchmark Dockerfile
evals/old/hotpot_qa_24_2025/src/modal_apps/Dockerfile.neo4j-custom:63
This archived benchmark Dockerfile grants world-writable permissions (777) across the Neo4j installation, plugins, data, and logs directories, configures Neo4j to listen on 0.0.0.0, never switches from root to the neo4j user it creates, and downloads the OpenJDK JRE, Neo4j tarball, and APOC JAR without checksum verification. Normal Cognee and Cognee MCP installations never build or run this file, so it only affects developers manually building the archived evaluation image.
Fix: Verify SHA-256 checksums for downloaded archives and JARs, use restrictive directory permissions (such as 750 or 755), set USER neo4j, or remove the archived Dockerfile if obsolete.
-
LowCompanion UI example starts local API with hardcoded password and default wildcard CORS
examples/cookbooks/self_hosted_companion/scripts/ui.py:28
When starting the local UI in the self-hosted companion cookbook, scripts/ui.py sets the default user password to 'default_password' whenever DEFAULT_USER_PASSWORD is unset, assuming that binding to localhost limits access to the local user. Because CORS_ALLOWED_ORIGINS defaults to '*' unless explicitly restricted, any website visited in the user's browser while this script is running (or another local user on a shared machine) can sign in to http://localhost:8000/api/v1/auth/login using the well-known password and read or modify stored memories.
Fix: Generate a random per-run password (or require DEFAULT_USER_PASSWORD to be set) and restrict CORS_ALLOWED_ORIGINS to http://localhost:3000 before importing cognee.api.client.
-
LowCookbook UI launcher sets a predictable hardcoded password for the default user
examples/cookbooks/company_brain/company_qa/scripts/ui.py:28
When this cookbook helper (also duplicated in examples/cookbooks/company_brain/follow_up_agent/scripts/ui.py and invoked when --ui is requested in the company-brain-company-qa skill) starts the local Cognee API server on port 8000, it sets default_user_password to 'default_password' whenever DEFAULT_USER_PASSWORD is not set, without restricting CORS origins. If a user runs the UI launcher, another local OS user on a shared host—or a website visited in the same browser if permissive CORS is active—can log in with the well-known default credentials and read or modify the ingested company data.
Fix: Require DEFAULT_USER_PASSWORD to be provided or generate a random per-session password printed locally, and restrict CORS_ALLOWED_ORIGINS to http://localhost:3000.
-
LowDOM XSS via unescaped innerHTML in session feedback demo UI
examples/demos/sessions/session_feedback_lifecycle_demo/frontend/app.js:179
In the standalone session-feedback demo frontend, renderSessionEntriesList and renderActivity interpolate entry.question, entry.answer, entry.qa_id, item.event, and item.detail directly into innerHTML without escaping HTML characters (unlike renderIngestedDocs in the same file). If a developer runs this demo and a question, ingested passage, or LLM response contains HTML or script markup, it will execute JavaScript in the browser.
Fix: Escape HTML special characters or populate child nodes with textContent instead of innerHTML in renderSessionEntriesList and renderActivity.
-
LowArchived Neo4j Modal test script opens unencrypted public tunnels and logs password
evals/old/hotpot_qa_24_2025/src/modal_apps/test_neo4j_server.py:65
This archived evaluation script exposes Neo4j's HTTP (7474) and Bolt (7687) ports to the public internet using modal.forward(..., unencrypted=True) and prints the plaintext NEO4J_AUTH password to stdout/logs. If a developer runs it, database traffic and credentials traverse the internet without TLS.
Fix: Remove unencrypted=True or use private Modal networking, and avoid printing plaintext passwords to logs.
