{"answers":{"affected":"3 open source packages ship an affected version, including nautobot. It affects 1 product.","exploited":"There is no known exploitation of CVE-2023-25657 in the wild and no public exploit code.","fix":"Upgrade nautobot to 1.5.7 or later.","what":"CVE-2023-25657 is a high-severity vulnerability in nautobot, published on 21 Feb 2023."},"fix_prompt":"Check this codebase for CVE-2023-25657 and fix it if it is affected.\n\nWhat it is: CVE-2023-25657 is a high-severity vulnerability in nautobot, published on 21 Feb 2023. \nExploitation: There is no known exploitation of CVE-2023-25657 in the wild and no public exploit code.\n\nAffected packages and fixed versions:\n- nautobot (PyPI): affected all versions; fixed in 1.5.7\n- nautobot (PyPI): affected all versions; fixed in 1.5.7\n- nautobot (PyPI): affected all versions; fixed in 1.5.7\n\nTask:\n1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.\n2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.\n3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.\n4. Run the tests and summarise what changed and why.\n5. If nothing in the project is affected, say so and change nothing.\n\nReference: https://insights.sbomify.com/CVE-2023-25657/ (Markdown: https://insights.sbomify.com/CVE-2023-25657/index.md)","id":"CVE-2023-25657","markdown":"https://insights.sbomify.com/CVE-2023-25657/index.md","name":"CVE-2023-25657","record":{"aliases":["GHSA-8mfq-f5wj-vw5m","PYSEC-2023-37"],"analysis":null,"analysis_generated_by":null,"assigner":"GitHub_M","cpe":[{"product":"nautobot","vendor":"networktocode"}],"cvss":{"score":7.5,"severity":"high","source":"cna","vector":"CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H","version":"3.1"},"cwes":[{"id":"CWE-94","name":"Improper Control of Generation of Code"}],"description":"Nautobot is a Network Source of Truth and Network Automation Platform. All users of Nautobot versions earlier than 1.5.7 are impacted by a remote code execution vulnerability. Nautobot did not properly sandbox Jinja2 template rendering. In Nautobot 1.5.7 has 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 no active exploits of this vulnerability are known this change has been made 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, the documentation that had previously suggesting the direct use of `jinja2.Template` has been revised to suggest `render_jinja2`. Users are advised to upgrade to Nautobot 1.5.7 or newer. 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.* 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.*","ecosystems":["PyPI"],"exploits":{"exploitdb":0,"first_seen":null,"github_poc":0,"max_poc_stars":null,"metasploit":0,"nuclei":0,"refs":[],"tier":"none_known"},"has_fix":true,"headline":"Remote code execution in Jinja2 template rendering in Nautobot","id":"CVE-2023-25657","indexable":true,"kev":null,"kind":"cve","links":{"ecosystem":"PyPI","product":null,"products":[],"type":null,"year":"2023"},"n_packages":3,"n_references":3,"next":{"headline":"TensorFlow vulnerable to Out-of-Bounds Read in GRUBlockCellGrad","id":"CVE-2023-25658"},"packages":[{"ecosystem":"PyPI","fixed":["1.5.7"],"introduced":["0"],"last_affected":[],"package":"nautobot","purl":null,"source":"GHSA-8mfq-f5wj-vw5m"},{"ecosystem":"PyPI","fixed":["1.5.7"],"introduced":["0"],"last_affected":[],"package":"nautobot","purl":"pkg:pypi/nautobot","source":"GHSA-8mfq-f5wj-vw5m"},{"ecosystem":"PyPI","fixed":["1.5.7"],"introduced":["0"],"last_affected":[],"package":"nautobot","purl":"pkg:pypi/nautobot","source":"PYSEC-2023-37"}],"prev":{"headline":"notation-go has excessive memory allocation on verification","id":"CVE-2023-25656"},"products":["nautobot"],"published":"2023-02-21","related":[{"cvss_score":8.5,"headline":"Nautobot: Webhook definitions could be used for server-side request forgery (SSRF)","id":"CVE-2026-44797","kev_date_added":null,"published":"2026-05-28"},{"cvss_score":7.5,"headline":"Nautobot's BANNER_* configuration can be used to inject arbitrary HTML content into Nautobot pages","id":"CVE-2024-34707","kev_date_added":null,"published":"2024-05-13"},{"cvss_score":7.5,"headline":"Reflected Cross-site Scripting potential in all object list views in Nautobot","id":"CVE-2024-32979","kev_date_added":null,"published":"2024-05-01"},{"cvss_score":7.1,"headline":"Nautobot: GitRepository.current_head field should not be writable through REST API","id":"CVE-2026-44798","kev_date_added":null,"published":"2026-05-28"},{"cvss_score":7.1,"headline":"Nautobot has XSS potential in rendered Markdown fields","id":"CVE-2024-23345","kev_date_added":null,"published":"2024-01-22"},{"cvss_score":7.1,"headline":"nautobot has XSS potential in custom links, job buttons, and computed fields","id":"CVE-2023-48705","kev_date_added":null,"published":"2023-11-22"}],"sources":[{"class":"attribution","licence":"CVE Terms of Use (MITRE)","name":"CVE List","prefix":"CVE"},{"class":"attribution","licence":"CC BY 4.0","name":"GitHub Advisory Database","prefix":"GHSA"},{"class":"attribution","licence":"CC BY 4.0","name":"PyPA Advisory Database","prefix":"PYSEC"},{"class":"attribution","licence":"US public information, NVD API terms","name":"NVD"},{"class":"attribution","licence":"CWE Terms of Use","name":"CWE (MITRE)"},{"class":"attribution","licence":"FIRST CVSS licence","name":"CVSS (FIRST)"}],"ssvc":{"automatable":"no","exploitation":"none","technical_impact":"total"},"state":"PUBLISHED","updated":"2025-03-10","vendors":["nautobot"]},"summary":null,"url":"https://insights.sbomify.com/CVE-2023-25657/"}