Nuclei flaw lets malicious templates bypass signature verification

Share:

A now-fixed vulnerability in the open-source vulnerability scanner Nuclei could potentially allow attackers to bypass signature verification while sneaking malicious code into templates that execute on local systems.

Nuclei is a popular open-source vulnerability scanner created by ProjectDiscovery that scans websites for vulnerabilities and other weaknesses.

The project utilizes a template-based scanning system of over 10,000 YAML templates that scan websites for known vulnerabilities, misconfigurations, exposed configuration files, webshells, and backdoors.

The YAML templates also include a code protocol that can be used to execute commands or scripts locally on a device that extends the functionality of a template.

Each template is “signed” with a digest hash that Nuclei uses to verify that the template has not been modified to include malicious code.

This digest hash is added to the bottom of templates in the form of:

# digest: <hash>

Flaw bypasses Nuclei signature verification

A new Nuclei vulnerability tracked as CVE-2024-43405 was discovered by researchers at Wiz that bypasses Nuclei’s signature verification even if a template is modified to include malicious code.

The flaw is caused by a Go regex-based signature verification and how the YAML parser handles line breaks when verifying the signature.

When verifying a signature, Go’s verification logic treats \r as part of the same line. However, the YAML parser interprets it as a line break. This mismatch allows attackers to inject malicious content that bypasses verification but is still executed when processed by the YAML parser.

Another issue is how Nuclei handles multiple # digest: signature lines, as the process only checks the first occurrence of # digest: in a template, ignoring any additional ones found later in the template.

This can be exploited by adding additional malicious “# digest:” payloads after the initial valid digest that contain a malicious “code” section, which is then injected and executed when the template is used.

“Armed with the insights about mismatched newline interpretations, we crafted a template that exploits the disparity between Go’s regex implementation and the YAML parser,” explains Wiz researcher Guy Goldenberg.

“By using \r as a line break, we can include a second # digest: line in the template that evades the signature verification process but gets parsed and executed by the YAML interpreter.”

Example of how the different parsers parse a Nuclei template
Example of how the different parsers parse a Nuclei template
Source: Wiz

Wiz responsibly disclosed the flaw to ProjectDiscovery on August 14, 2024, and it was fixed in Nuclei v3.3.2 on September 4.

If you are using older versions of Nuclei, it is strongly advised that you update the latest version now that the technical details for this bug have been publicly disclosed.

Goldenberg also recommends that Nuclei be used in a virtual machine or isolated environment to prevent potential exploitation from malicious templates.

Source

Leave a Comment

Your email address will not be published. Required fields are marked *

loader-image
London, GB
7:47 am, Jan 15, 2025
weather icon 9°C
L: 8° | H: 10°
mist
Humidity: 95 %
Pressure: 1034 mb
Wind: 3 mph SW
Wind Gust: 0 mph
UV Index: 0
Precipitation: 0 mm
Clouds: 100%
Rain Chance: 0%
Visibility: 5 km
Sunrise: 7:59 am
Sunset: 4:20 pm
DailyHourly
Daily ForecastHourly Forecast
Today 9:00 pm
weather icon
8° | 10°°C 0 mm 0% 3 mph 98 % 1034 mb 0 mm/h
Tomorrow 9:00 pm
weather icon
5° | 9°°C 0 mm 0% 5 mph 96 % 1035 mb 0 mm/h
Fri Jan 17 9:00 pm
weather icon
3° | 7°°C 0 mm 0% 4 mph 93 % 1036 mb 0 mm/h
Sat Jan 18 9:00 pm
weather icon
2° | 7°°C 0 mm 0% 3 mph 89 % 1033 mb 0 mm/h
Sun Jan 19 9:00 pm
weather icon
2° | 6°°C 0 mm 0% 4 mph 89 % 1024 mb 0 mm/h
Today 9:00 am
weather icon
7° | 9°°C 0 mm 0% 3 mph 95 % 1034 mb 0 mm/h
Today 12:00 pm
weather icon
9° | 9°°C 0 mm 0% 2 mph 92 % 1034 mb 0 mm/h
Today 3:00 pm
weather icon
9° | 9°°C 0 mm 0% 3 mph 91 % 1033 mb 0 mm/h
Today 6:00 pm
weather icon
7° | 7°°C 0 mm 0% 3 mph 97 % 1034 mb 0 mm/h
Today 9:00 pm
weather icon
6° | 6°°C 0 mm 0% 3 mph 98 % 1034 mb 0 mm/h
Tomorrow 12:00 am
weather icon
6° | 6°°C 0 mm 0% 3 mph 96 % 1034 mb 0 mm/h
Tomorrow 3:00 am
weather icon
5° | 5°°C 0 mm 0% 3 mph 95 % 1033 mb 0 mm/h
Tomorrow 6:00 am
weather icon
5° | 5°°C 0 mm 0% 3 mph 96 % 1034 mb 0 mm/h
Name Price24H (%)
Bitcoin(BTC)
€94,344.36
2.56%
Ethereum(ETH)
€3,138.60
1.95%
XRP(XRP)
€2.77
13.50%
Tether(USDT)
€0.97
0.00%
Solana(SOL)
€184.28
2.43%
Dogecoin(DOGE)
€0.350495
5.40%
USDC(USDC)
€0.97
0.00%
Shiba Inu(SHIB)
€0.000021
1.18%
Pepe(PEPE)
€0.000016
1.69%
Peanut the Squirrel(PNUT)
€0.55
-5.59%
Scroll to Top