{"id":"CVE-2026-47211","aliases":["CVE-2026-47211","GHSA-c4m7-2gwp-vw76","PYSEC-2026-2857"],"related":[],"kind":"vulnerability","state":"published","title":"Ouroboros: Remote Code Execution via Untrusted Project-Directory .env","summary":"Ouroboros is a local-first runtime for AI coding agents that records their actions and applies user-defined policies to constrain behavior. In versions prior to 0.39.0, if a user clones a malicious repository and runs Ouroboros commands within that directory, it can lead to arbitrary code execution and potential system takeover. The vulnerability stems from Ouroboros loading the .env file from the current working directory. Execution-affecting environment variables such as OUROBOROS_CLI_PATH, OPENCODE_CLI_PATH, and other backend selectors are accepted directly from this local .env. An attacker can include a malicious script in the repository and point the CLI path variable to it (e.g., OUROBOROS_CLI_PATH=./malicious_script.sh). When the user executes a command like ouroboros init or any command that instantiates the adapter, the malicious script is executed instead of the intended CLI. This issue has been fixed in version 0.39.0.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Ouroboros is a local-first runtime for AI coding agents that records their actions and applies user-defined policies to constrain behavior. In versions prior to 0.39.0, if a user clones a malicious repository and runs Ouroboros commands within that directory, it can lead to arbitrary code execution and potential system takeover. The vulnerability stems from Ouroboros loading the .env file from the current working directory. Execution-affecting environment variables such as OUROBOROS_CLI_PATH, OPENCODE_CLI_PATH, and other backend selectors are accepted directly from this local .env. An attacker can include a malicious script in the repository and point the CLI path variable to it (e.g., OUROBOROS_CLI_PATH=./malicious_script.sh). When the user executes a command like ouroboros init or any command that instantiates the adapter, the malicious script is executed instead of the intended CLI. This issue has been fixed in version 0.39.0.","source":"cvelist"},{"lang":"en","text":"### Impact\nA Remote Code Execution (RCE) vulnerability was discovered in Ouroboros. If a user clones a malicious repository and runs Ouroboros commands within that directory, it can lead to arbitrary code execution and potential system takeover.\n\nThe vulnerability (CWE-426: Untrusted Search Path & CWE-15: External Control of System Setting) stems from Ouroboros loading the `.env` file from the current working directory. Prior to the patch, execution-affecting environment variables such as `OUROBOROS_CLI_PATH`, `OPENCODE_CLI_PATH`, and other backend selectors were accepted directly from this local `.env`. An attacker could include a malicious script in the repository and point the CLI path variable to it (e.g., `OUROBOROS_CLI_PATH=./malicious_script.sh`). When the user executes a command like `ouroboros init` or any command that instantiates the adapter, the malicious script is executed instead of the intended CLI.\n\n### Patches\nThe vulnerability has been patched in version 0.39.0 via PR #1078.\nThe fix establishes a strict trust boundary by applying a denylist to project-local `.env` loading. It blocks execution-affecting environment variables (such as runtime selectors and CLI path overrides) from being loaded from the project directory. Explicit constructor overrides and trusted user-owned home configurations (`~/.ouroboros/.env`) remain fully functional. \n\nUsers are strongly advised to upgrade to version 0.39.0 or later.\n\n### Workarounds\nIf upgrading is not immediately possible, users must carefully inspect any `.env` file inside cloned repositories before running Ouroboros commands to ensure it does not contain unexpected `OUROBOROS_*_CLI_PATH` or `OPENCODE_CLI_PATH` overrides.\n\n### References\n- GitHub PR: https://github.com/Q00/ouroboros/pull/1078","format":"markdown","source":"ghsa"},{"lang":"es","text":"Ouroboros es un entorno de ejecución (runtime) local-first para agentes de codificación de IA que registra sus acciones y aplica políticas definidas por el usuario para restringir el comportamiento. En versiones anteriores a la 0.39.0, si un usuario clona un repositorio malicioso y ejecuta comandos de Ouroboros dentro de ese directorio, puede llevar a la ejecución de código arbitrario y a una posible toma de control del sistema. La vulnerabilidad se origina en que Ouroboros carga el archivo .env desde el directorio de trabajo actual. Las variables de entorno que afectan la ejecución, como OUROBOROS_CLI_PATH, OPENCODE_CLI_PATH y otros selectores de backend, se aceptan directamente de este .env local. Un atacante puede incluir un script malicioso en el repositorio y apuntar la variable de ruta de la CLI hacia él (por ejemplo, OUROBOROS_CLI_PATH=./malicious_script.sh). Cuando el usuario ejecuta un comando como ouroboros init o cualquier comando que instancie el adaptador, el script malicioso se ejecuta en lugar de la CLI prevista. Este problema ha sido solucionado en la versión 0.39.0.","source":"nvd"}],"published":"2026-05-29T21:22:41.000Z","modified":"2026-10-23T21:10:00.157Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:A/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","score":8.4,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:A/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","score":8.4,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","rating":"HIGH"},{"scorer":"PyPA Advisory Database","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N"}],"cwes":["CWE-426"],"affected":[{"ranges":[{"version":"< 0.39.0","status":"affected"}],"vendor":"Q00","product":"ouroboros","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"0.39.0"}],"ecosystem":"PyPI","package":"ouroboros-ai","purl":"pkg:pypi/ouroboros-ai","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"0.39.0"}],"ecosystem":"PyPI","package":"ouroboros-ai","purl":"pkg:pypi/ouroboros-ai","source":"pysec"}],"references":[{"url":"https://github.com/Q00/ouroboros/security/advisories/GHSA-c4m7-2gwp-vw76","tags":["web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/Q00/ouroboros/pull/1078","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/Q00/ouroboros/commit/4e70b760b4eb157469b58645339ba831f6513d37","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/Q00/ouroboros","tags":["package"],"sources":["ghsa","pysec"]},{"url":"https://pypi.org/project/ouroboros-ai","tags":["package"],"sources":["pysec"]},{"url":"https://github.com/advisories/GHSA-c4m7-2gwp-vw76","tags":["advisory"],"sources":["pysec"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-47211","tags":["advisory"],"sources":["pysec"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"total","date":"2026-08-03T21:06:50.835Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-47211","url":"https://www.cve.org/CVERecord?id=CVE-2026-47211","licence":"CVE Terms of Use","modified":"2026-08-03T21:19:05.967Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-c4m7-2gwp-vw76","url":"https://github.com/advisories/GHSA-c4m7-2gwp-vw76","licence":"CC-BY-4.0","modified":"2026-09-10T03:50:46.526Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-47211","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-47211","licence":"Public domain","modified":"2026-10-23T21:10:00.157Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2026-2857","url":"https://osv.dev/vulnerability/PYSEC-2026-2857","licence":"CC-BY-4.0","modified":"2026-07-13T16:32:34.219Z"}],"updatedAt":"2026-11-25T22:59:30.892Z","epss":{"score":0.00171,"percentile":0.06806,"date":"2026-12-01T12:00:22.000Z"}}