CVE-2024-43405: Github.com/projectdiscovery/nuclei/v3 Nuclei Template Signature Verification Bypass Vulnerability

MODERATE
Advisory Identifier: GHSA-7h5p-mmpp-hgmm
CVSS 7.4
CWE-78
Published
Advisory Summary

CVE-2024-43405 is a MODERATE (CVSS 7.4) nuclei template signature verification bypass vulnerability (CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')) affecting Github.com/projectdiscovery/nuclei/v3 libraries in the Go ecosystem. The issue involves nuclei template signature verification bypass. Remediation is available by upgrading affected packages to version 3.3.2.

CVE-2024-43405 at a Glance

CVE Identifier CVE-2024-43405
GHSA Identifier GHSA-7h5p-mmpp-hgmm
Severity MODERATE
CVSS v3.1 Base Score 7.4
CWE Classification CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
Affected Product Github.com/projectdiscovery/nuclei/v3
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 7.4

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

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

How to Fix CVE-2024-43405

To remediate this vulnerability, upgrade all affected Github.com/projectdiscovery/nuclei/v3 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.3.2
Upgrade github.com/projectdiscovery/nuclei/v3 to 3.3.2
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-2024-43405, inspect your project dependencies for Github.com/projectdiscovery/nuclei/v3:

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

Analyze the terminal output to locate any version of Github.com/projectdiscovery/nuclei/v3 in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.3.2), 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-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'), where the product constructs all or part of an os command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended os command when it is sent to a downstream component. In Github.com/projectdiscovery/nuclei/v3, 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

## Summary A vulnerability has been identified in Nuclei's template signature verification system that could allow an attacker to bypass the signature check and possibly execute malicious code via custom code template. ## Affected Component The vulnerability is present in the template signature verification process, specifically in the `signer` package. ## Description The vulnerability stems from a discrepancy between how the signature verification process and the YAML parser handle newline characters, combined with the way multiple signatures are processed. This allows an attacker to inject malicious content into a template while maintaining a valid signature for the benign part of the template. ### Affected Users 1. **CLI Users:** Those executing **custom code templates** from unverified sources. This includes templates authored by third parties or obtained from unverified repositories. 2. **SDK Users:** Developers integrating Nuclei into their platforms, particularly if they permit the execution of **custom code templates** by end-users. > [!NOTE] > Code templates are disabled as default, users have to explicitly enable with `-code` option. ## Proof of Concept ```yaml id: example-template info: name: Example Template # Other benign content... # digest: <valid_signature_for_benign_content> # digest: <another_signature>\r code:\r - engine:\r - sh\r - bash\r source: |\r id\r ``` ### Patches 1. The vulnerability is addressed in Nuclei v3.3.2 Users are strongly recommended to update to this version to mitigate the security risk. 2. Fix reference - https://github.com/projectdiscovery/nuclei/commit/0da993afe6d41b4b1b814e8fad23a2acba13c60a ### Mitigation - **Immediate Upgrade**: The primary recommendation is to upgrade to Nuclei v3.2.0, where the vulnerability has been patched. - **Avoid Unverified Templates**: As an interim measure, users should refrain from using custom templates if unable to upgrade immediately. Only trusted, [verified templates](https://github.com/projectdiscovery/nuclei-templates) should be executed. ### Workarounds If you are unable to upgrade nuclei, disable running custom code templates as workaround. ## Acknowledgments We would like to thank [Guy Goldenberg](https://github.com/GuyGoldenberg) from Wiz who reported this to us via our security email, [security@projectdiscovery.io](mailto:security@projectdiscovery.io).

CVE-2024-43405 Affected Github.com/projectdiscovery/nuclei/v3 Versions

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

References

Frequently Asked Questions

What is CVE-2024-43405?
CVE-2024-43405 is a security vulnerability in Github.com/projectdiscovery/nuclei/v3 involving Nuclei Template Signature Verification Bypass under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').
Which Github.com/projectdiscovery/nuclei/v3 versions are affected?
Affected versions include releases prior to 3.3.2 across affected packages: github.com/projectdiscovery/nuclei/v3.
What version fixes CVE-2024-43405?
Upgrading to 3.3.2 (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.3.2. Upgrade your dependency to 3.3.2 or later.
What is the CVSS score of CVE-2024-43405?
CVE-2024-43405 has a CVSS v3.1 base score of 7.4 (MODERATE) with vector string CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:C/C:H/I:H/A:N.
What CWE is associated with CVE-2024-43405?
CVE-2024-43405 is classified under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') (The product constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.).
How can I check Go dependencies for CVE-2024-43405?
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-7h5p-mmpp-hgmm",
  "modified" : "2024-10-14T14:19:19Z",
  "published" : "2024-09-04T17:38:24Z",
  "aliases" : [ "CVE-2024-43405" ],
  "summary" : "Nuclei Template Signature Verification Bypass",
  "details" : "## Summary\nA vulnerability has been identified in Nuclei's template signature verification system that could allow an attacker to bypass the signature check and possibly execute malicious code via custom code template.\n\n## Affected Component\nThe vulnerability is present in the template signature verification process, specifically in the `signer` package.\n\n## Description\nThe vulnerability stems from a discrepancy between how the signature verification process and the YAML parser handle newline characters, combined with the way multiple signatures are processed. This allows an attacker to inject malicious content into a template while maintaining a valid signature for the benign part of the template.\n\n### Affected Users\n1. **CLI Users:** Those executing **custom code templates** from unverified sources. This includes templates authored by third parties or obtained from unverified repositories.\n2. **SDK Users:** Developers integrating Nuclei into their platforms, particularly if they permit the execution of **custom code templates** by end-users.\n\n> [!NOTE]\n> Code templates are disabled as default, users have to explicitly enable with `-code` option. \n\n## Proof of Concept\n\n```yaml\nid: example-template\ninfo:\n  name: Example Template\n# Other benign content...\n# digest: <valid_signature_for_benign_content>\n# digest: <another_signature>\\r\ncode:\\r\n  - engine:\\r\n      - sh\\r\n      - bash\\r\n    source: |\\r\n      id\\r\n```\n### Patches\n1. The vulnerability is addressed in Nuclei v3.3.2 Users are strongly recommended to update to this version to mitigate the security risk.\n2. Fix reference - https://github.com/projectdiscovery/nuclei/commit/0da993afe6d41b4b1b814e8fad23a2acba13c60a\n\n### Mitigation\n- **Immediate Upgrade**: The primary recommendation is to upgrade to Nuclei v3.2.0, where the vulnerability has been patched.\n- **Avoid Unverified Templates**: As an interim measure, users should refrain from using custom templates if unable to upgrade immediately. Only trusted, [verified templates](https://github.com/projectdiscovery/nuclei-templates) should be executed.\n\n### Workarounds\nIf you are unable to upgrade nuclei, disable running custom code templates as workaround.\n\n## Acknowledgments\n\nWe would like to thank [Guy Goldenberg](https://github.com/GuyGoldenberg) from Wiz who reported this to us via our security email, [security@projectdiscovery.io](mailto:security@projectdiscovery.io).",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:C/C:H/I:H/A:N"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:H/AT:N/PR:N/UI:A/VC:N/VI:N/VA:N/SC:H/SI:H/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/projectdiscovery/nuclei/v3"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.0.0"
      }, {
        "fixed" : "3.3.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/projectdiscovery/nuclei/security/advisories/GHSA-7h5p-mmpp-hgmm"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-43405"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/projectdiscovery/nuclei/commit/0da993afe6d41b4b1b814e8fad23a2acba13c60a"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/projectdiscovery/nuclei"
  }, {
    "type" : "WEB",
    "url" : "https://pkg.go.dev/vuln/GO-2024-3114"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-78" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-09-04T17:38:24Z",
    "nvd_published_at" : "2024-09-04T16:15:06Z"
  }
}