CVE-2026-27629
Received Received - Intake
Server-Side Template Injection in InvenTree Batch Code Generation

Publication date: 2026-02-25

Last updated on: 2026-02-27

Assigner: GitHub, Inc.

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, 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.
CVSS Scores
EPSS Scores
Probability:
Percentile:
Meta Information
Published
2026-02-25
Last Modified
2026-02-27
Generated
2026-05-07
AI Q&A
2026-02-25
EPSS Evaluated
2026-05-05
NVD
EUVD
Affected Vendors & Products
Showing 1 associated CPE
Vendor Product Version / Range
inventree_project inventree to 1.2.3 (exc)
Helpful Resources
Exploitability
CWE
CWE Icon
KEV
KEV Icon
CWE ID Description
CWE-1336 The product uses a template engine to insert or process externally-influenced input, but it does not neutralize or incorrectly neutralizes special elements or syntax that can be interpreted as template expressions or other code directives when processed by the engine.
Attack-Flow Graph
AI Powered Q&A
Can you explain this vulnerability to me?

[{'type': 'paragraph', 'content': 'CVE-2026-27629 is a Server Side Template Injection (SSTI) vulnerability in InvenTree versions prior to 1.2.3. It occurs because the InvenTree server uses customizable Jinja2 templates to generate custom batch codes. Staff users with permission can modify these templates maliciously to exfiltrate sensitive information or execute arbitrary code on the server.'}, {'type': 'paragraph', 'content': "Exploitation requires a staff user to alter the batch code template and then trigger batch code generation via the API. Once the template is compromised, other users' API requests to generate batch codes will execute the malicious template code in their user context."}, {'type': 'paragraph', 'content': 'The vulnerable global settings involved are STOCK_BATCH_CODE_TEMPLATE and PART_NAME_FORMAT. The issue has been fixed in version 1.2.3 and later by sandboxing template generation to prevent unauthorized code execution.'}] [1]


How can this vulnerability impact me? :

This vulnerability can lead to exposure of sensitive information or allow arbitrary code execution on the InvenTree server.

Since the malicious template code executes in the context of other users making API requests, it can compromise the confidentiality, integrity, and availability of the system.

The CVSS v3.1 base score is 5.9 (Moderate), indicating a moderate impact with potential for low confidentiality, integrity, and availability losses.


How does this vulnerability affect compliance with common standards and regulations (like GDPR, HIPAA)?:

I don't know


How can this vulnerability be detected on my network or system? Can you suggest some commands?

Detection of this vulnerability involves checking if your InvenTree installation is running a version prior to 1.2.3 and if the global settings STOCK_BATCH_CODE_TEMPLATE or PART_NAME_FORMAT have been modified by a staff user.

Since exploitation requires a staff user to modify the Jinja2 templates and then generate batch codes via the API, monitoring API requests for batch code generation and auditing changes to these global settings can help detect potential exploitation.

Specific commands are not provided in the available resources, but general steps include:

  • Check the InvenTree version to confirm if it is prior to 1.2.3.
  • Audit the global settings STOCK_BATCH_CODE_TEMPLATE and PART_NAME_FORMAT for unauthorized or suspicious modifications.
  • Review API logs for batch code generation requests, especially those initiated by staff users.

What immediate steps should I take to mitigate this vulnerability?

To mitigate this vulnerability immediately, upgrade your InvenTree installation to version 1.2.3 or later, where the issue has been patched by sandboxing template generation.

If upgrading is not immediately possible, apply the workaround by overriding the STOCK_BATCH_CODE_TEMPLATE and PART_NAME_FORMAT global settings at the system level to default values. This prevents staff users from editing these templates and requires system administrator access.

This override cannot be changed from the client side once the server is running, providing a secure mitigation until an upgrade can be performed.


Ask Our AI Assistant
Need more information? Ask your question to get an AI reply (Powered by our expertise)
0/70
EPSS Chart