CVE-2024-27920: Github.com/projectdiscovery/nuclei/v3 Nuclei Allows Unsigned Code Template Vulnerability

HIGH
Advisory Identifier: GHSA-w5wx-6g2r-r78q
CVSS 7.4
CWE-78
Published
Advisory Summary

CVE-2024-27920 is a HIGH (CVSS 7.4) nuclei allows unsigned code template 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 allows unsigned code template execution through workflows. Remediation is available by upgrading affected packages to version 3.2.0.

CVE-2024-27920 at a Glance

CVE Identifier CVE-2024-27920
GHSA Identifier GHSA-w5wx-6g2r-r78q
Severity HIGH
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-27920

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.2.0
Upgrade github.com/projectdiscovery/nuclei/v3 to 3.2.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-2024-27920, 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.2.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-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

### Overview A significant security oversight was identified in Nuclei v3, involving the execution of unsigned code templates through workflows. This vulnerability specifically affects users utilizing custom workflows, potentially allowing the execution of malicious code on the user's system. This advisory outlines the impacted users, provides details on the security patch, and suggests mitigation strategies. ### Affected Users 1. **CLI Users:** Those executing custom workflows from untrusted sources. This includes workflows 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 workflows by end-users. ### Security Patch The vulnerability is addressed in Nuclei v3.2.0. Users are strongly recommended to update to this version to mitigate the security risk. ### Mitigation - **Immediate Upgrade:** The primary recommendation is to upgrade to Nuclei v3.2.0, where the vulnerability has been patched. - **Avoid Untrusted Workflows:** As an interim measure, users should refrain from using custom workflows if unable to upgrade immediately. Only trusted, verified workflows should be executed. ### Details The vulnerability stems from an oversight in the workflow execution mechanism, where unsigned code templates could be executed, bypassing the security measures intended to authenticate the integrity and source of the templates. This issue is isolated to workflow executions and does not affect direct template executions. ### Workarounds The only effective workaround, aside from upgrading, is to avoid the use of custom workflows altogether. This approach limits functionality but ensures security until the upgrade can be performed. ### Acknowledgements We extend our sincere gratitude to @gpc1996 for their diligence in identifying and reporting this vulnerability. ### References - Security Patch Pull Request: [GitHub PR #4822](https://github.com/projectdiscovery/nuclei/pull/4822) - Workflows Overview: [Nuclei Workflows Documentation](https://docs.projectdiscovery.io/templates/workflows/overview) - Code Template Reference: [Nuclei Code Protocols Documentation](https://docs.projectdiscovery.io/templates/protocols/code) - Template Signing Reference: [Nuclei Template Signing Documentation](https://docs.projectdiscovery.io/templates/reference/template-signing)

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

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

References

Frequently Asked Questions

What is CVE-2024-27920?
CVE-2024-27920 is a security vulnerability in Github.com/projectdiscovery/nuclei/v3 involving Nuclei allows unsigned code template execution through workflows 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.2.0 across affected packages: github.com/projectdiscovery/nuclei/v3.
What version fixes CVE-2024-27920?
Upgrading to 3.2.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.2.0. Upgrade your dependency to 3.2.0 or later.
What is the CVSS score of CVE-2024-27920?
CVE-2024-27920 has a CVSS v3.1 base score of 7.4 (HIGH) 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-27920?
CVE-2024-27920 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-27920?
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-w5wx-6g2r-r78q",
  "modified" : "2024-08-20T14:57:52Z",
  "published" : "2024-03-15T18:44:28Z",
  "aliases" : [ "CVE-2024-27920" ],
  "summary" : "Nuclei allows unsigned code template execution through workflows",
  "details" : "### Overview\nA significant security oversight was identified in Nuclei v3, involving the execution of unsigned code templates through workflows. This vulnerability specifically affects users utilizing custom workflows, potentially allowing the execution of malicious code on the user's system. This advisory outlines the impacted users, provides details on the security patch, and suggests mitigation strategies.\n\n### Affected Users\n1. **CLI Users:** Those executing custom workflows from untrusted sources. This includes workflows 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 workflows by end-users.\n\n### Security Patch\nThe vulnerability is addressed in Nuclei v3.2.0. Users are strongly recommended to update to this version to mitigate the security risk.\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 Untrusted Workflows:** As an interim measure, users should refrain from using custom workflows if unable to upgrade immediately. Only trusted, verified workflows should be executed.\n\n### Details\nThe vulnerability stems from an oversight in the workflow execution mechanism, where unsigned code templates could be executed, bypassing the security measures intended to authenticate the integrity and source of the templates. This issue is isolated to workflow executions and does not affect direct template executions.\n\n### Workarounds\nThe only effective workaround, aside from upgrading, is to avoid the use of custom workflows altogether. This approach limits functionality but ensures security until the upgrade can be performed.\n\n### Acknowledgements\nWe extend our sincere gratitude to @gpc1996 for their diligence in identifying and reporting this vulnerability.\n\n### References\n- Security Patch Pull Request: [GitHub PR #4822](https://github.com/projectdiscovery/nuclei/pull/4822)\n- Workflows Overview: [Nuclei Workflows Documentation](https://docs.projectdiscovery.io/templates/workflows/overview)\n- Code Template Reference: [Nuclei Code Protocols Documentation](https://docs.projectdiscovery.io/templates/protocols/code)\n- Template Signing Reference: [Nuclei Template Signing Documentation](https://docs.projectdiscovery.io/templates/reference/template-signing)",
  "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:L/AT:P/PR:N/UI:A/VC:H/VI:H/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.2.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/projectdiscovery/nuclei/security/advisories/GHSA-w5wx-6g2r-r78q"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-27920"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/projectdiscovery/nuclei/pull/4822"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/projectdiscovery/nuclei/commit/e86f38299765b82ad724fdb701557e0eaff3884d"
  }, {
    "type" : "WEB",
    "url" : "https://docs.projectdiscovery.io/templates/protocols/code"
  }, {
    "type" : "WEB",
    "url" : "https://docs.projectdiscovery.io/templates/reference/template-signing"
  }, {
    "type" : "WEB",
    "url" : "https://docs.projectdiscovery.io/templates/workflows/overview"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/projectdiscovery/nuclei"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-78" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-03-15T18:44:28Z",
    "nvd_published_at" : "2024-03-15T20:15:09Z"
  }
}