The vulnerability (GHSA-wjw6-95h5-4jpx / CVE-2025-49142) in Nautobot stemmed from an insufficient security configuration of its Jinja2 templating engine. This allowed certain Python methods of objects, available in the template rendering context, to be called directly from user-provided template code (e.g., in computed fields, custom links). These methods were not originally intended to be exposed this way.
This had two primary impacts:
- Secrets Exposure: Methods like
Secret.get_value() or SecretsGroup.get_secret_value() could be called, leaking sensitive credential information.
- Data Manipulation: A wide range of methods that alter object state or database records (e.g.,
Device.create_components(), UserConfig.set_config(), BaseModel.validated_save()) could be invoked, bypassing normal application workflows, permission checks, and business logic.
The provided patches (e.g., in commits 4091a7d1bb4ed22169815447e4710315c3cf2a91 and 10a02b233bc4bd7a267b7562abae8a9e738122ac) mitigate this by applying security controls to the affected methods. These controls include:
@jinja2.sandbox.unsafe: Marks a function as unsafe, preventing it from being called in a sandboxed Jinja2 environment.
do_not_call_in_templates = True: A Django attribute that prevents the method from being called in Django templates (Nautobot's Jinja2 setup also respects this).
alters_data = True: A Django attribute indicating the method modifies data; such methods are typically restricted from template calls.
The functions listed in vulnerable_functions are those that had these protective attributes/decorators added by the patch. Before the patch, these functions were callable from templates, making them the runtime indicators of this vulnerability being triggered or exploited. An attacker could craft a Jinja2 template that, when rendered by Nautobot, would call one or more of these functions on an accessible object, leading to information disclosure or data modification.