CVE-2026-41646: Nuclei: Local File Read via require() Module Loader Bypass
A vulnerability in Nuclei's JavaScript protocol runtime allows JavaScript templates to read local .js and .json files through the require() function, bypassing the default local file access restriction.
Affected Component
The issue is in the JavaScript runtime's module loading system. The goja require() function used a default host filesystem loader without routing through the allow-local-file-access check.
Description
The goja require() function in Nuclei's JavaScript protocol runtime used the default host filesystem loader, which allowed JavaScript templates to import .js and .json files from anywhere on the host filesystem, ignoring the allow-local-file-access (-lfa) option that controls file access outside the template directory.
The impact is limited to .js and .json files, as goja's module loader only resolves those extensions. That said, this is still enough to expose sensitive data stored in JSON configuration files like package.json, credential stores, or cloud configuration files sitting on the host filesystem.
Affected Users
- CLI users running untrusted or third-party JavaScript templates. - SDK users who have integrated Nuclei into platforms where end-users can supply JavaScript templates, especially when relying on the default file access restriction to limit filesystem reads.
[!NOTE] The require() module loader only resolves .js and .json files. Other file types cannot be read through this vector.
Patches
- The vulnerability is fixed in Nuclei v3.8.0. Upgrading is strongly recommended. - Fix reference: #7332
Mitigation
Upgrade to Nuclei v3.8.0, where the require() registry is rebuilt per execution and file-backed module loads are routed through the same allow-local-file-access check as the rest of the filesystem operations.
In the meantime, avoid running JavaScript templates from unverified sources.
Workarounds
If upgrading is not an option, avoid running untrusted JavaScript templates entirely. There is no flag or configuration that mitigates this on affected versions.
Acknowledgments
Nuceli thanks @AkashHamal0x01 for reporting this issue through responsible disclosure via security@projectdiscovery.io
Other sources
Nuclei is a vulnerability scanner built on a simple YAML-based DSL. From version 3.0.0 to before version 3.8.0, a vulnerability in Nuclei's JavaScript protocol runtime allows JavaScript templates to read local .js and .json files through the require() function, bypassing the default local file access restriction. This issue has been patched in version 3.8.0.
— MITRE
Affected Software
Remediation
Patch Available
Event History
Frequently Asked Questions
What is the severity of CVE-2026-41646?
CVE-2026-41646 is considered a high-severity vulnerability due to its potential to expose local file content to unauthorized access.
How do I fix CVE-2026-41646?
To remediate CVE-2026-41646, upgrade the Nuclei framework to version 3.8.0 or later.
What component is affected by CVE-2026-41646?
CVE-2026-41646 affects the JavaScript protocol runtime in Nuclei's module loading system.
What type of files can be accessed through CVE-2026-41646?
The vulnerability allows access to local `.js` and `.json` files via the `require()` function.
Is there a workaround for CVE-2026-41646 if I cannot update?
A temporary workaround for CVE-2026-41646 is to disable the JavaScript execution feature if it's not necessary for your use case.