OS Command Injection Affecting github.com/projectdiscovery/nuclei/pkg/templates/signer package, versions >=3.0.0 <3.3.2
Threat Intelligence
Do your applications use this vulnerable package?
In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.
Test your applications- Snyk ID SNYK-GOLANG-GITHUBCOMPROJECTDISCOVERYNUCLEIPKGTEMPLATESSIGNER-7897405
- published 5 Sep 2024
- disclosed 4 Sep 2024
- credit Guy Goldenberg
Introduced: 4 Sep 2024
CVE-2024-43405 Open this link in a new tabHow to fix?
Upgrade github.com/projectdiscovery/nuclei/pkg/templates/signer
to version 3.3.2 or higher.
Overview
Affected versions of this package are vulnerable to OS Command Injection due to an improper template signature verification process in the tmpl_signer.go
component. An attacker can inject malicious content into a template while maintaining a valid signature for the benign part of the template by exploiting discrepancies between the signature verification process and the YAML parser's handling of newline characters, combined with the processing of multiple signatures.
Note: This is only exploitable if CLI users execute custom code templates from unverified sources, including templates authored by third parties or obtained from unverified repositories. SDK users are also at risk if they allow end-users to execute custom code templates.
Code templates are disabled as default; users have to explicitly enable them with the -code
option.
Workaround
This vulnerability can be mitigated by refraining from using custom templates if unable to upgrade immediately and by ensuring only trusted, verified templates are executed. Those who are unable to upgrade Nuclei should disable running custom code templates.
PoC
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