CVE-2024-43405
JSON

7.4high

Nuclei Template Signature Verification Bypass

Severity
7.4high CVSS:3.1 by GitHub_M
Exploit likelihood
1.11% (higher than 66% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-7h5p-mmpp-hgmmGO-2024-3114

Description

Nuclei is a vulnerability scanner powered by YAML based templates. Starting in version 3.0.0 and prior to version 3.3.2, a vulnerability in Nuclei's template signature verification system could allow an attacker to bypass the signature check and possibly execute malicious code via custom code template. The vulnerability is present in the template signature verification process, specifically in the `signer` package. 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. CLI users are affected if they execute custom code templates from unverified sources. This includes templates authored by third parties or obtained from unverified repositories. SDK Users are affected if they are developers integrating Nuclei into their platforms, particularly if they permit the execution of custom code templates by end-users. The vulnerability is addressed in Nuclei v3.3.2. Users are strongly recommended to update to this version to mitigate the security risk. As an interim measure, users should refrain from using custom templates if unable to upgrade immediately. Only trusted, verified templates should be executed. Those who are unable to upgrade Nuclei should disable running custom code templates as a workaround.

Affected

Product or packageVersionsReported by
projectdiscovery nuclei>= 3.0.0, < 3.3.2, from 3.0.0 before 3.3.2CVE List, NVD
github.com/projectdiscovery/nuclei/v3 (Go)from 3.0.0 before 3.3.2GitHub Advisory Database, Go Vulnerability Database
github.com/projectdiscovery/nuclei (Go)all versionsGo Vulnerability Database
github.com/projectdiscovery/nuclei/v2 (Go)all versionsGo Vulnerability Database

All scores

GitHub_M7.4high CVSS:3.1CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:C/C:H/I:H/A:N
GitHub7.4medium CVSS:3.1CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:C/C:H/I:H/A:N
GitHubmedium CVSS:4.0CVSS:4.0/AV:N/AC:H/AT:N/PR:N/UI:A/VC:N/VI:N/VA:N/SC:H/SI:H/SA:N
NVD7.8high CVSS:3.1CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H

Classification

CWE-78

SSVC (CISA-ADP): exploitation poc, automatable no, technical impact total.

What each source says

CVE List

Nuclei is a vulnerability scanner powered by YAML based templates. Starting in version 3.0.0 and prior to version 3.3.2, a vulnerability in Nuclei's template signature verification system could allow an attacker to bypass the signature check and possibly execute malicious code via custom code template. The vulnerability is present in the template signature verification process, specifically in the `signer` package. 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. CLI users are affected if they execute custom code templates from unverified sources. This includes templates authored by third parties or obtained from unverified repositories. SDK Users are affected if they are developers integrating Nuclei into their platforms, particularly if they permit the execution of custom code templates by end-users. The vulnerability is addressed in Nuclei v3.3.2. Users are strongly recommended to update to this version to mitigate the security risk. As an interim measure, users should refrain from using custom templates if unable to upgrade immediately. Only trusted, verified templates should be executed. Those who are unable to upgrade Nuclei should disable running custom code templates as a workaround.

GitHub Advisory Database

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

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 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 from Wiz who reported this to us via our security email, security@projectdiscovery.io.

Go Vulnerability Database

Nuclei Template Signature Verification Bypass in github.com/projectdiscovery/nuclei

NVD (es)

Nuclei es un escáner de vulnerabilidades que funciona con plantillas basadas en YAML. A partir de la versión 3.0.0 y antes de la versión 3.3.2, una vulnerabilidad en el sistema de verificación de firmas de plantillas de Nuclei podría permitir a un atacante eludir la verificación de firmas y posiblemente ejecutar código malicioso a través de una plantilla de código personalizada. La vulnerabilidad está presente en el proceso de verificación de firmas de plantillas, específicamente en el paquete `signer`. La vulnerabilidad se origina en una discrepancia entre cómo el proceso de verificación de firmas y el analizador YAML manejan los caracteres de nueva línea, combinado con la forma en que se procesan múltiples firmas. Esto permite a un atacante inyectar contenido malicioso en una plantilla mientras mantiene una firma válida para la parte benigna de la plantilla. Los usuarios de CLI se ven afectados si ejecutan plantillas de código personalizadas de fuentes no verificadas. Esto incluye plantillas creadas por terceros u obtenidas de repositorios no verificados. Los usuarios de SDK se ven afectados si son desarrolladores que integran Nuclei en sus plataformas, en particular si permiten la ejecución de plantillas de código personalizadas por parte de los usuarios finales. La vulnerabilidad se soluciona en Nuclei v3.3.2. Se recomienda encarecidamente a los usuarios que actualicen a esta versión para mitigar el riesgo de seguridad. Como medida provisoria, los usuarios deben abstenerse de utilizar plantillas personalizadas si no pueden actualizar de inmediato. Solo se deben ejecutar plantillas verificadas y confiables. Aquellos que no puedan actualizar Nuclei deben deshabilitar la ejecución de plantillas de código personalizadas como workaround.

References

Sources

SourceRecordLicence
CVE ListCVE-2024-43405 changed 2024-09-04CVE Terms of Use
GitHub Advisory DatabaseGHSA-7h5p-mmpp-hgmm changed 2024-10-14CC-BY-4.0
Go Vulnerability DatabaseGO-2024-3114 changed 2026-03-03CC-BY-4.0
NVDCVE-2024-43405 changed 2026-06-17Public domain