Alta

Nautobot vulnerable to remote code execution via Jinja2 template rendering

  • Publicada: 21.02.2023
  • Actualizado: 11.10.2026 11:20

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.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 of jinja2.Template has been revised to utilize render_jinja2.

Patches

Has the problem been patched? What versions should users upgrade to?

Yes. Users should upgrade to Nautobot 1.5.7 or newer.

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:

python
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:

python
from jinja2 import Template

my_template = Template(template_code)
config = my_template.render(context)

We recommend that you replace it with this pattern:

python
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

Software afectado

Haz clic en una tecnología para ver todas sus vulnerabilidades.

PlataformaPaqueteVersiones vulnerablesCorregida en
Python (PyPI) nautobot < 1.5.7 1.5.7

Referencias

Puntuación CVSS 7.5/10
Vector CVSS
CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H
Debilidad (CWE)
CWE-94
Plataforma
Python (PyPI)
Paquete
nautobot
Publicada
21.02.2023
Actualizado
11.10.2026 11:20

Fuentes y licencias

OSV / GitHub Advisory Database - PYSEC-2023-37 - PyPA Advisory Database; CC BY 4.0

OSV / GitHub Advisory Database - GHSA-8mfq-f5wj-vw5m - CC BY 4.0

Historial de vulnerabilidades: nautobot

Todas las vulnerabilidades publicadas de este paquete (Python (PyPI)), de la más reciente a la más antigua. Muestra si es un fallo aislado o un paquete que hay que vigilar.

Todas (19) en el archivo
Entradas en total
19
Primera → última
02.2023 09.2026
Sin corrección
0
Explotada en ataques
0

Distribución por gravedad

  • Alta 9
  • Media 6
  • Baja 4

Divulgaciones por año

  1. 2023: 5
  2. 2024: 5
  3. 2025: 2
  4. 2026: 7
Gravedad:
  1. Alta · 7.1 CVE-2026-44798 >= 3.0.0a2, < 3.1.2, < 2.4.33 3.1.2, 2.4.33
  2. Alta · 8.5 CVE-2026-44797 >= 3.0.0a2, < 3.1.2, < 2.4.33 3.1.2, 2.4.33
  3. Alta · 7.5 CVE-2024-34707 < 1.6.22, >= 2.0.0, < 2.2.4 1.6.22, 2.2.4
  4. Alta · 7.5 CVE-2024-32979 >= 1.5.0, < 1.6.20, >= 2.0.0, < 2.2.3 1.6.20, 2.2.3
  5. Alta · 7.1 CVE-2024-23345 >= 2.0.0, < 2.1.2, < 1.6.10 2.1.2, 1.6.10
  6. Alta · 7.1 CVE-2023-48705 < 1.6.6, >= 2.0.0, < 2.0.5 1.6.6, 2.0.5
  7. Alta · 7.7 CVE-2023-46128 >= 2.0.0, < 2.0.3 2.0.3
  8. Nautobot vulnerable to remote code execution via Jinja2 template rendering esta entrada
    Alta · 7.5 CVE-2023-25657 < 1.5.7 1.5.7

Identifica las vulnerabilidades de tu aplicación

Con la integración de DockRay y el inventario de software activado, DockRay compara las versiones notificadas de los componentes con las vulnerabilidades conocidas y avisa de las coincidencias confirmadas. La cobertura depende de la tecnología compatible y de los avisos disponibles.

Conectar tu aplicación
Newsletter DockRay

La seguridad de tus aplicaciones en tu correo

Vulnerabilidades importantes, recomendaciones concretas y consejos prácticos para tus aplicaciones. Elige tus tecnologías y sigue lo que importa para tu proyecto.

  • Un resumen diario de nuevas vulnerabilidades, también las críticas.
  • Avisos sobre actualizaciones importantes.
  • Consejos prácticos sobre seguridad y monitorización de aplicaciones.

Déjalo vacío para recibir avisos de todas las tecnologías.

Suscripción gratuita. Date de baja con un clic en cualquier correo.