Replies: 2 comments
-
This has been published as a security advisory on GitHub and has been assigned CVE ID See: GHSA-8mfq-f5wj-vw5m |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hi, I'm surprised to see there's no link to this thread, nor mention of the CVE, nor mentions to the security implication in https://github.com/nautobot/nautobot/releases/tag/v1.5.7 nor https://docs.nautobot.com/projects/core/en/stable/release-notes/version-1.5/#v157-2023-01-04 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
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.ComputedField
extras.CustomLink
extras.ExportTemplate
extras.Secret
extras.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 ofjinja2.Template
has been revised to utilizerender_jinja2
.Updating Existing Deployments
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: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.If you need to take this approach, we recommend creating a new permission restricted to the “view” action and associate the permission to a group.
Note that if you have any other permissions that overlap with the view-only permission for these objects that provide “change” access, you will need to remove the affected object types from those other permissions providing “change” access.
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 ournautobot.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:
We recommend that you replace it with this pattern:
Beta Was this translation helpful? Give feedback.
All reactions