CVE-2026-27629
Published: 25 February 2026
Description
InvenTree is an Open Source Inventory Management System. Prior to version 1.2.3, insecure server-side templates can be hijacked to expose secure information to the client. When generating custom batch codes, the InvenTree server makes use of a customizable jinja2 template,…
more
which can be modified by a staff user to exfiltrate sensitive information or perform code execution on the server. This issue requires access by a user with granted staff permissions, followed by a request to generate a custom batch code via the API. Once the template has been modified in a malicious manner, the API call to generate a new batch code could be made by other users, and the template code will be executed with their user context. The code has been patched to ensure that all template generation is performed within a secure sandboxed context. This issue has been addressed in version 1.2.3, and any versions from 1.3.0 onwards. Some workarounds are available. The batch code template is a configurable global setting which can be adjusted via any user with staff access. To prevent this setting from being edited, it can be overridden at a system level to a default value, preventing it from being edited. This requires system administrator access, and cannot be changed from the client side once the server is running. It is recommended that for InvenTree installations prior to 1.2.3 the `STOCK_BATCH_CODE_TEMPLATE` and `PART_NAME_FORMAT` global settings are overridden at the system level to prevent editing.
Mitigating Controls (NIST 800-53 r5)AI
Directly mitigates the vulnerability by requiring timely remediation of the Jinja2 template injection flaw through patching to version 1.2.3 or later, which sandboxes template execution.
Enforces secure configuration by overriding STOCK_BATCH_CODE_TEMPLATE and PART_NAME_FORMAT at the system level to prevent editable malicious templates, as recommended in the advisory.
Restricts staff users from modifying the customizable batch code Jinja2 template, blocking the initial step required for injecting malicious code.
Security SummaryAI
CVE-2026-27629 affects InvenTree, an open source inventory management system, in versions prior to 1.2.3. The vulnerability stems from insecure server-side Jinja2 templates used for generating custom batch codes. These templates are customizable and can be modified by users with staff permissions, allowing injection of malicious code that exposes sensitive server information to clients or enables server-side code execution. The issue is rated with a CVSS v3.1 base score of 5.9 (AV:A/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:L) and is associated with CWE-1336.
Exploitation requires initial access by a user with staff permissions to modify the batch code template maliciously. Subsequently, any user can trigger the vulnerability by making an API request to generate a custom batch code, causing the tampered template to execute in the context of the requesting user's permissions. Attackers can achieve exfiltration of sensitive information or arbitrary code execution on the server, though it demands adjacent network access, low attack complexity, low privileges, and user interaction.
The vulnerability has been patched in InvenTree version 1.2.3 and all versions from 1.3.0 onward, with template generation now restricted to a secure sandboxed context. Advisories recommend upgrading immediately. As a workaround for unpatched installations, system administrators can override the STOCK_BATCH_CODE_TEMPLATE and PART_NAME_FORMAT global settings at the system level to prevent client-side editing; this requires server access and cannot be altered post-deployment. Details are available in the GitHub Security Advisory at https://github.com/inventree/InvenTree/security/advisories/GHSA-cx85-vr3q-9x4m.
Details
- CWE(s)
Affected Products
MITRE ATT&CK Enterprise TechniquesAI
Why these techniques?
Direct server-side template injection (Jinja2) maps to T1221; web app vulnerability exploited via API for RCE/info disclosure maps to T1190.