Breaking the Chain: Wiz Uncovers a Signature Verification Bypass in Nuclei, the Popular Vulnerability Scanner (CVE-2024-43405)
Nuclei's signature verification for templates could be bypassed because the regex-based signature removal and the YAML parser disagreed on line breaks, allowing an attacker to inject unverified executable content into a signed template. An attacker could craft a malicious template that passes verification but executes arbitrary commands on the host running Nuclei.
Published on wiz.io
In our continuous effort to enhance cybersecurity, Wiz engineering team has identified and helped mitigate a significant vulnerability in Nuclei, a widely-used open-source security tool by ProjectDiscovery. This reflects our dedication to fortifying the entire security ecosystem, including the tools we and many others…
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the signature verification used a regex that treated only \n as a line break while the YAML parser also treated \r as a line break, and the verification only checked the first digest line but removed all digest lines, so injected content after a \r was not hashed but was parsed and executed.
Impact
An attacker could achieve arbitrary command execution, data exfiltration, or system compromise on hosts running Nuclei with untrusted templates, though the report notes that running Nuclei in an isolated environment mitigates the risk.
What the attacker needed
Ability to supply a template to Nuclei; Nuclei version before 3.3.2; template executed without isolation
The fix
The vulnerability was fixed in Nuclei 3.3.2 and later, and users should upgrade and run Nuclei in an isolated environment.
How it was found
- Craft a template with a valid signature on the first digest line.
- Add a second digest line containing a carriage return followed by YAML code that executes a command.
- The regex-based verification checks only the first digest line and removes all digest lines from the hashed content, so the injected code is not hashed.
- The YAML parser treats the carriage return as a line break and parses the injected code as part of the template.
- When the template is executed, the injected code runs on the host.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
Nuclei is a tool that runs small YAML files called templates to check for security problems. Each template is supposed to be digitally signed so you can trust it, but the code that checks the signature and the code that reads the template disagreed about where lines end. This let an attacker hide extra commands in a signed template that the signature check ignored but the template engine still ran.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.