Summary
Workarounds
Is there a way for users to fix or remediate the vulnerability without upgrading?
Enabling Sandboxed Environments
For users that are unable to upgrade to the latest release of Nautobot, you may add the following setting to your nautobot_config.py to apply the sandbox environment enforcement:
TEMPLATES[1]["OPTIONS"]["environment"] = "jinja2.sandbox.SandboxedEnvironment"
After applying this change, you must restart all Nautobot services, including any Celery worker processes.
Note: Nautobot specifies two template engines by default, the first being “django” for the Django built-in template engine, and the second being “jinja” for the Jinja2 template engine. This recommended setting will update the second item in the list of template engines, which is the Jinja2 engine.
Restricting Jinja2 using Access Controls
For users that are unable to immediately update their configuration such as if a Nautobot service restart is too disruptive to operations, access to provide custom Jinja2 template values may be mitigated using permissions to restrict “change” (write) actions to the affected object types listed in the first section.
Note: This solution is intended to be stopgap until you can successfully update your nautobot_config.py or upgrade your Nautobot instance to apply the sandboxed environment enforcement.
Updating Existing App or Job Code
For Nautobot App (formerly plugin) authors or Job authors, additionally we recommend that if you have any custom code that may for example be using jinaj2.Template that you no longer use that. Instead, please always use our nautobot.utilities.utils.render_jinja2 function which will make sure that the centrally-provided Jinja2 template engine with sandboxing enforced is being utilized.
Anywhere you’ve been using this pattern:
from jinja2 import Template
my_template = Template(template_code)
config = my_template.render(context)
We recommend that you replace it with this pattern:
from nautobot.utilities.utils import render_jinja2
config = render_jinja2(template_code, context)
References
Are there any links users can visit to find out more?
Please see the Nautobot 1.5.7 release notes.
https://docs.nautobot.com/projects/core/en/stable/release-notes/version-1.5/#v157-2023-01-04
Impact
What kind of vulnerability is it? Who is impacted?
All users of Nautobot versions earlier than 1.5.7 are impacted.
In Nautobot 1.5.7 we have enabled sandboxed environments for the Jinja2 template engine used internally for template rendering for the following objects:
extras.ComputedFieldextras.CustomLinkextras.ExportTemplateextras.Secretextras.Webhook
While we are not aware of any active exploits, we have made this change as a preventative measure to protect against any potential remote code execution attacks utilizing maliciously crafted template code.
This change forces the Jinja2 template engine to use a SandboxedEnvironment on all new installations of Nautobot.
This addresses any potential unsafe code execution everywhere the helper function nautobot.utilities.utils.render_jinja2 is called. Additionally, our documentation that was previously suggesting the direct use of jinja2.Template has been revised to utilize render_jinja2.
Untrusted input is evaluated as executable code within the application's runtime environment. Typical impact: arbitrary code execution within the application's privilege context.
CVE-2023-25657 has a CVSS score of 7.5 (High). The vector is network-reachable, low privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (1.5.7); upgrading removes the vulnerable code path.
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Remediation advice
Has the problem been patched? What versions should users upgrade to?
Yes. Users should upgrade to Nautobot 1.5.7 or newer.
Frequently Asked Questions
- What is CVE-2023-25657? CVE-2023-25657 is a high-severity code injection vulnerability in nautobot (pip), affecting versions < 1.5.7. It is fixed in 1.5.7. Untrusted input is evaluated as executable code within the application's runtime environment.
- How severe is CVE-2023-25657? CVE-2023-25657 has a CVSS score of 7.5 (High). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
- Which versions of nautobot are affected by CVE-2023-25657? nautobot (pip) versions < 1.5.7 is affected.
- Is there a fix for CVE-2023-25657? Yes. CVE-2023-25657 is fixed in 1.5.7. Upgrade to this version or later.
- Is CVE-2023-25657 exploitable, and should I be worried? Whether CVE-2023-25657 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether CVE-2023-25657 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
- How do I fix CVE-2023-25657? Upgrade
nautobotto 1.5.7 or later.