{"id":"CVE-2025-48934","aliases":["CVE-2025-48934","GHSA-7w8p-chxq-2789"],"related":[],"kind":"vulnerability","state":"published","title":"Deno.env.toObject() ignores the variables listed in --deny-env and returns all environment variables","summary":"Deno is a JavaScript, TypeScript, and WebAssembly runtime. Prior to versions 2.1.13 and 2.2.13, the `Deno.env.toObject` method ignores any variables listed in the `--deny-env` option of the `deno run` command. When looking at the documentation of the `--deny-env` option this might lead to a false impression that variables listed in the option are impossible to read. Software relying on the combination of both flags to allow access to most environment variables except a few sensitive ones will be vulnerable to malicious code trying to steal secrets using the `Deno.env.toObject()` method. Versions 2.1.13 and 2.2.13 contains a patch.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Deno is a JavaScript, TypeScript, and WebAssembly runtime. Prior to versions 2.1.13 and 2.2.13, the `Deno.env.toObject` method ignores any variables listed in the `--deny-env` option of the `deno run` command. When looking at the documentation of the `--deny-env` option this might lead to a false impression that variables listed in the option are impossible to read. Software relying on the combination of both flags to allow access to most environment variables except a few sensitive ones will be vulnerable to malicious code trying to steal secrets using the `Deno.env.toObject()` method. Versions 2.1.13 and 2.2.13 contains a patch.","source":"cvelist"},{"lang":"en","text":"### Summary\nThe [Deno.env.toObject](https://docs.deno.com/api/deno/~/Deno.Env.toObject) method ignores any variables listed in the `--deny-env` option of the `deno run` command. When looking at the [documentation](https://docs.deno.com/runtime/fundamentals/security/#environment-variables) of the `--deny-env` option this might lead to a false impression that variables listed in the option are impossible to read.\n\n### PoC\n\n```\nexport AWS_SECRET_ACCESS_KEY=my-secret-aws-key\n\n# Works as expected. The program stops with a \"NotCapable\" error message\necho 'console.log(Deno.env.get(\"AWS_SECRET_ACCESS_KEY\"));' | deno run \\\n  --allow-env \\\n  --deny-env=AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY -\n\n# All enviroment variables are printed and the --deny-env list is completely disregarded\necho 'console.log(Deno.env.toObject());' | deno run \\\n  --allow-env \\\n  --deny-env=AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY -\n```\n\nThe first example using `get` exits with the following error:\n```\nerror: Uncaught (in promise) NotCapable: Requires env access to \"AWS_SECRET_ACCESS_KEY\", run again with the --allow-env flag\nconsole.log(Deno.env.get(\"AWS_SECRET_ACCESS_KEY\"));\n                     ^\n    at Object.getEnv [as get] (ext:deno_os/30_os.js:124:10)\n    at file:///$deno$stdin.mts:1:22\n```\n\nThe second example  using `toObject` prints all environment variables:\n```\n[Object: null prototype] {\n  ...\n  AWS_SECRET_ACCESS_KEY: \"my-secret-aws-key\",\n  ...\n}\n```\n\n### Impact\nSoftware relying on the combination of both flags to allow access to most environment variables except a few sensitive ones will be vulnerable to malicious code trying to steal secrets using the Deno.env.toObject() method.","format":"markdown","source":"ghsa"},{"lang":"es","text":"Deno es un entorno de ejecución de JavaScript, TypeScript y WebAssembly. En versiones anteriores a la 2.1.13 y la 2.2.13, el método `Deno.env.toObject` ignora las variables listadas en la opción `--deny-env` del comando `deno run`. Al consultar la documentación de la opción `--deny-env`, esto podría dar la falsa impresión de que las variables listadas en ella son imposibles de leer. El software que utiliza la combinación de ambos indicadores para acceder a la mayoría de las variables de entorno, excepto algunas sensibles, será vulnerable a código malicioso que intente robar secretos mediante el método `Deno.env.toObject()`. Las versiones 2.1.13 y 2.2.13 contienen un parche.","source":"nvd"}],"published":"2025-06-04T19:21:17.701Z","modified":"2026-09-10T03:50:24.980Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N/E:P","score":5.5,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N/E:P","score":5.5,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N","score":5.3,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N/E:P","rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N","score":5.3,"rating":"MEDIUM"}],"cwes":["CWE-201"],"affected":[{"ranges":[{"version":"< 2.1.13","status":"affected"},{"version":">= 2.2.0, < 2.2.13","status":"affected"}],"vendor":"denoland","product":"deno","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"2.1.13"}],"ecosystem":"crates.io","package":"deno","purl":"pkg:cargo/deno","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"2.2.0","status":"affected","fixed":"2.2.13"}],"ecosystem":"crates.io","package":"deno","purl":"pkg:cargo/deno","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"0.212.0"}],"ecosystem":"crates.io","package":"deno_runtime","purl":"pkg:cargo/deno_runtime","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"2.1.13"},{"status":"affected","introduced":"2.2.0","fixed":"2.2.13"}],"vendor":"deno","product":"deno","cpe":"cpe:2.3:a:deno:deno:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://github.com/denoland/deno/security/advisories/GHSA-7w8p-chxq-2789","tags":["exploit","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/denoland/deno/pull/29079","tags":["issue-tracking","patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/denoland/deno/commit/2959e083912420988066a001c2b2d6732a1b562f","tags":["patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/denoland/deno/commit/946ccda1aa19a00c478a5e6826b75053b050d753","tags":["patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://docs.deno.com/api/deno/~/Deno.Env.toObject","tags":["product","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://docs.deno.com/runtime/fundamentals/security/#environment-variables","tags":["product","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2025-48934","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/denoland/deno","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"yes","technicalImpact":"partial","date":"2025-06-04T19:32:01.410Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2025-48934","url":"https://www.cve.org/CVERecord?id=CVE-2025-48934","licence":"CVE Terms of Use","modified":"2025-06-04T19:32:14.582Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-7w8p-chxq-2789","url":"https://github.com/advisories/GHSA-7w8p-chxq-2789","licence":"CC-BY-4.0","modified":"2026-09-10T03:50:24.980Z"},{"source":"nvd","name":"NVD","id":"CVE-2025-48934","url":"https://nvd.nist.gov/vuln/detail/CVE-2025-48934","licence":"Public domain","modified":"2026-06-17T09:30:30.597Z"}],"updatedAt":"2026-11-25T22:58:58.762Z","epss":{"score":0.00444,"percentile":0.40391,"date":"2026-12-01T12:00:22.000Z"}}