CVE-2026-41645: Nuclei Environment Variable Disclosure Vulnerability

MODERATE
Advisory Identifier: GHSA-jm34-66cf-qpvr
CVSS 5.3
CWE-94
Published
Advisory Summary

CVE-2026-41645 is a MODERATE (CVSS 5.3) environment variable disclosure vulnerability (CWE-94: Improper Control of Generation of Code ('Code Injection')) affecting Nuclei libraries in the Go ecosystem. The issue involves environment variable disclosure via response-derived dsl expressions. Remediation is available by upgrading affected packages to version 3.8.0.

CVE-2026-41645 at a Glance

CVE Identifier CVE-2026-41645
GHSA Identifier GHSA-jm34-66cf-qpvr
Severity MODERATE
CVSS v3.1 Base Score 5.3
CWE Classification CWE-94: Improper Control of Generation of Code ('Code Injection')
Affected Product Nuclei
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 5.3

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:N/A:N).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity None (I:N)
Availability None (A:N)

How to Fix CVE-2026-41645

To remediate this vulnerability, upgrade all affected Nuclei dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/projectdiscovery/nuclei/v3 fixed: 3.8.0
Upgrade github.com/projectdiscovery/nuclei/v3 to 3.8.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/projectdiscovery/nuclei/v3

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-41645, inspect your project dependencies for Nuclei:

inspect dependencies for github.com/projectdiscovery/nuclei/v3

Analyze the terminal output to locate any version of Nuclei in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.8.0), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-94: Improper Control of Generation of Code ('Code Injection'), where the product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. In Nuclei, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

A vulnerability in Nuclei's expression evaluation engine makes it possible for a malicious target server to inject and execute supported DSL expressions. This happens when HTTP response data containing helper/function syntax gets reused by multi-step templates. If the `-env-vars` / `-ev` option is explicitly enabled, this can expose host environment variables. That option is off by default, so standard configurations are not affected by the information disclosure risk. **Affected Component** The issue lives in `expressions.Evaluate()` at `pkg/protocols/common/expressions/` and in the unresolved-variable validation path (`hasLiteralsOnly()`). **Description** `expressions.Evaluate()` replaces placeholders first, then scans the substituted output for expressions. Because of this two-pass approach, response-derived values (including extractor output and response body content) can be reinterpreted as DSL/helper syntax on the second pass. When `-env-vars` (`-ev`) is enabled, environment variables get merged into the template variable map. A malicious target can return response data containing expressions like `{{env_var_name}}` which, when reused in a subsequent template request, resolve to actual environment variable values. This can expose sensitive host data like API keys, credentials, and tokens. Without `-ev` enabled (the default), injected DSL expressions may still trigger helper functions such as `{{md5("test")}}`, but this has no meaningful security impact beyond unexpected behavior. There is also a separate issue in `hasLiteralsOnly()`: it was evaluating helper expressions while deciding whether `{{...}}` contained unresolved variables, which caused validation logic to run side-effectful helpers even when the final request kept the value as a literal. > [!NOTE] The `-env-vars` / `-ev` option is off by default. Users who have not explicitly turned it on are not affected by the information disclosure aspect of this vulnerability. **Affected Users** - **CLI users** running multi-step templates (with extractors or flow-based request chaining) that reuse response-derived values against untrusted or attacker-controlled targets, with the `-ev` flag enabled. - **SDK users** who have integrated Nuclei into platforms where `EnvironmentVariables` is set to `true` and scan targets are not fully trusted. **Patches** - The vulnerability is fixed in Nuclei v3.8.0. Upgrading to this version is strongly recommended. - Relevant fix references: #7221, #7321. **Mitigation** Upgrade to Nuclei v3.8.0. The updated evaluation logic now collects expressions from the original template text before placeholder substitution and only evaluates those template-authored expressions. If you have `-ev` enabled, disable it when scanning untrusted targets to avoid environment variable disclosure. **Workarounds** If upgrading is not an option right now, make sure `-env-vars` / `-ev` is not enabled when running multi-step templates against untrusted targets. **Acknowledgments** Nuclei thanks @gnuletik for reporting this issue through responsible disclosure via security@projectdiscovery.io

CVE-2026-41645 Affected Nuclei Versions

1 component(s)
Fixed Versions:
3.8.0
Product / Package Ecosystem Affected Versions Fixed Version
github.com/projectdiscovery/nuclei/v3
Go
≥ 3.0.0
< 3.8.0
3.8.0

References

Frequently Asked Questions

What is CVE-2026-41645?
CVE-2026-41645 is a security vulnerability in Nuclei involving Environment variable disclosure via Response-Derived DSL Expressions under CWE-94: Improper Control of Generation of Code ('Code Injection').
Which Nuclei versions are affected?
Affected versions include releases prior to 3.8.0 across affected packages: github.com/projectdiscovery/nuclei/v3.
What version fixes CVE-2026-41645?
Upgrading to 3.8.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/projectdiscovery/nuclei/v3 affected?
Yes, github.com/projectdiscovery/nuclei/v3 is affected in releases prior to 3.8.0. Upgrade your dependency to 3.8.0 or later.
What is the CVSS score of CVE-2026-41645?
CVE-2026-41645 has a CVSS v3.1 base score of 5.3 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:N/A:N.
What CWE is associated with CVE-2026-41645?
CVE-2026-41645 is classified under CWE-94: Improper Control of Generation of Code ('Code Injection') (The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.).
How can I check Go dependencies for CVE-2026-41645?
Run the dependency tree command: 'inspect dependencies for github.com/projectdiscovery/nuclei/v3'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-jm34-66cf-qpvr",
  "modified" : "2026-05-11T13:30:34Z",
  "published" : "2026-04-22T19:59:14Z",
  "aliases" : [ "CVE-2026-41645" ],
  "summary" : "Nuclei: Environment variable disclosure via Response-Derived DSL Expressions",
  "details" : "A vulnerability in Nuclei's expression evaluation engine makes it possible for a malicious target server to inject and execute supported DSL expressions. This happens when HTTP response data containing helper/function syntax gets reused by multi-step templates. If the `-env-vars` / `-ev` option is explicitly enabled, this can expose host environment variables. That option is off by default, so standard configurations are not affected by the information disclosure risk.\n\n**Affected Component**\n\nThe issue lives in `expressions.Evaluate()` at `pkg/protocols/common/expressions/` and in the unresolved-variable validation path (`hasLiteralsOnly()`).\n\n**Description**\n\n`expressions.Evaluate()` replaces placeholders first, then scans the substituted output for expressions. Because of this two-pass approach, response-derived values (including extractor output and response body content) can be reinterpreted as DSL/helper syntax on the second pass.\n\nWhen `-env-vars` (`-ev`) is enabled, environment variables get merged into the template variable map. A malicious target can return response data containing expressions like `{{env_var_name}}` which, when reused in a subsequent template request, resolve to actual environment variable values. This can expose sensitive host data like API keys, credentials, and tokens.\n\nWithout `-ev` enabled (the default), injected DSL expressions may still trigger helper functions such as `{{md5(\"test\")}}`, but this has no meaningful security impact beyond unexpected behavior.\n\nThere is also a separate issue in `hasLiteralsOnly()`: it was evaluating helper expressions while deciding whether `{{...}}` contained unresolved variables, which caused validation logic to run side-effectful helpers even when the final request kept the value as a literal.\n\n> [!NOTE]\nThe `-env-vars` / `-ev` option is off by default. Users who have not explicitly turned it on are not affected by the information disclosure aspect of this vulnerability.\n\n**Affected Users**\n\n- **CLI users** running multi-step templates (with extractors or flow-based request chaining) that reuse response-derived values against untrusted or attacker-controlled targets, with the `-ev` flag enabled.\n- **SDK users** who have integrated Nuclei into platforms where `EnvironmentVariables` is set to `true` and scan targets are not fully trusted.\n\n**Patches**\n\n- The vulnerability is fixed in Nuclei v3.8.0. Upgrading to this version is strongly recommended.\n- Relevant fix references: #7221, #7321.\n\n**Mitigation**\n\nUpgrade to Nuclei v3.8.0. The updated evaluation logic now collects expressions from the original template text before placeholder substitution and only evaluates those template-authored expressions.\n\nIf you have `-ev` enabled, disable it when scanning untrusted targets to avoid environment variable disclosure.\n\n**Workarounds**\n\nIf upgrading is not an option right now, make sure `-env-vars` / `-ev` is not enabled when running multi-step templates against untrusted targets.\n\n**Acknowledgments**\n\nNuclei thanks @gnuletik for reporting this issue through responsible disclosure via security@projectdiscovery.io",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/projectdiscovery/nuclei/v3"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.0.0"
      }, {
        "fixed" : "3.8.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/projectdiscovery/nuclei/security/advisories/GHSA-jm34-66cf-qpvr"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-41645"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/projectdiscovery/nuclei/pull/7221"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/projectdiscovery/nuclei/pull/7321"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/projectdiscovery/nuclei/commit/6c803c74d193f85f8a6d9803ce493fd302cad0eb"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/projectdiscovery/nuclei/commit/d2217320162d5782ca7cb95bef9dda17063818f3"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/projectdiscovery/nuclei"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/projectdiscovery/nuclei/releases/tag/v3.8.0"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-94" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-04-22T19:59:14Z",
    "nvd_published_at" : "2026-05-08T04:16:18Z"
  }
}