CVE-2025-48934: Deno.env.toObject() ignores the variables listed in --deny-env and returns all environment variables

Published Jun 4, 2025
·
Updated

Summary 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.

PoC

export AWSSECRETACCESSKEY=my-secret-aws-key

Works as expected. The program stops with a "NotCapable" error message echo 'console.log(Deno.env.get("AWSSECRETACCESSKEY"));' | deno run \ --allow-env \ --deny-env=AWSACCESSKEYID,AWSSECRETACCESSKEY -

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=AWSACCESSKEYID,AWSSECRETACCESSKEY -

The first example using get exits with the following error: error: Uncaught (in promise) NotCapable: Requires env access to "AWSSECRETACCESSKEY", run again with the --allow-env flag console.log(Deno.env.get("AWSSECRETACCESSKEY")); ^ at Object.getEnv [as get] (ext:denoos/30os.js:124:10) at file:///$deno$stdin.mts:1:22

The second example using toObject prints all environment variables: [Object: null prototype] { ... AWSSECRETACCESSKEY: "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.

Other sources

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.

— MITRE

Affected Software

6 affected componentsFixes available
Deno Deno<2.1.13, <2.2.13
rust/deno_runtime<0.212.0
0.212.0
rust/deno>=2.2.0<2.2.13
2.2.13
rust/deno<2.1.13
2.1.13
Deno Deno<2.1.13
Deno Deno>=2.2.0<2.2.13

Event History

Jun 4, 2025
CVE Published
via MITRE·07:21 PM
Data Sourced
via MITRE·07:21 PM
DescriptionWeakness
Data Sourced
via NVD·08:15 PM
RemedyDescriptionSeverityWeaknessAffected Software
Advisory Published
via GitHub·09:18 PM
Data Sourced
via GitHub·09:18 PM
DescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

What is the severity of CVE-2025-48934?

CVE-2025-48934 is considered a moderate severity vulnerability due to its potential exposure of sensitive environment variables.

2

How do I fix CVE-2025-48934?

To fix CVE-2025-48934, upgrade to Deno version 2.1.13 or 2.2.13 or later.

3

What is the impact of CVE-2025-48934?

The impact of CVE-2025-48934 includes the unintended leakage of environment variables that should be restricted.

4

Which versions of Deno are affected by CVE-2025-48934?

Versions of Deno prior to 2.1.13 and 2.2.13 are affected by CVE-2025-48934.

5

What does the `Deno.env.toObject` method do in relation to CVE-2025-48934?

In relation to CVE-2025-48934, the `Deno.env.toObject` method improperly ignores security restrictions from the `--deny-env` option.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203