CVE-2025-48934
mediumpriority · track · 21EPSS 0.004 · 37 %ileEUUSEPSS · scored 2026-10-27
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.
cvss
Technical severity, 0–10. One row per scoring source.
base score 0–10 · higher = more severe · hover a vector to decode⚠ sources disagree · low–medium · 2.7–5.5
ssvc
A stakeholder decision — act, attend, or track — from exploitation and impact.
weaknesses
The CWE weakness classes this flaw belongs to.
affected products (7)
Products and version ranges known to be affected.
advisories (1)
Vendor and ecosystem advisories describing this.
- GHSA-7w8p-chxq-2789Deno.env.toObject() ignores the variables listed in --deny-env and returns all environment variables2025-06-04ghsa · osvUS
### Summary The [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. ### PoC ``` export AWS_SECRET_ACCESS_KEY=my-secret-aws-key # Works as expected. The program stops with a "NotCapable" error message echo 'console.log(Deno.env.get("AWS_SECRET_ACCESS_KEY"));' | deno run \ --allow-env \ --deny-env=AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY - # All enviroment variables are printed and the --deny-env list is completely disregarded echo 'console.log(Deno.env.toObject());' | deno run \ --allow-env \ --deny-env=AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY - ``` The first example using `get` exits with the following error: ``` error: Uncaught (in promise) NotCapable: Requires env access to "AWS_SECRET_ACCESS_KEY", run again with the --allow-env flag console.log(Deno.env.get("AWS_SECRET_ACCESS_KEY")); ^ at Object.getEnv [as get] (ext:deno_os/30_os.js:124:10) at file:///$deno$stdin.mts:1:22 ``` The second example using `toObject` prints all environment variables: ``` [Object: null prototype] { ... AWS_SECRET_ACCESS_KEY: "my-secret-aws-key", ... } ``` ### Impact 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.
also known as (3)
Other names and identifiers for this entity.
sources
Which sources assert this record, and when.
references (19)
External citations — patches, advisories, analysis.
- https://deno.com/Patchcnnvd
- https://docs.deno.com/api/deno/~/Deno.Env.toObjectcnnvd
- https://docs.deno.com/runtime/fundamentals/security/#environment-variablescnnvd
- https://github.com/denoland/deno/commit/2959e083912420988066a001c2b2d6732a1b562fcnnvd
- https://github.com/denoland/deno/commit/946ccda1aa19a00c478a5e6826b75053b050d753cnnvd
- https://github.com/denoland/deno/pull/29079cnnvd
- https://github.com/denoland/deno/security/advisories/GHSA-7w8p-chxq-2789cnnvd
- https://docs.deno.com/api/deno/~/Deno.Env.toObjectenisa_euvd
Attackers weaponise vulnerabilities like this against internet-exposed services. See what is exposed on your perimeter with a free passive scan.
Free scan