# CVE-2026-27629: InvenTree Vulnerable to Server Side Template Injection (SSTI)

> Staff users can inject malicious Jinja2 templates into batch code generation, leading to server-side code execution and sensitive data exposure.

- **Severity:** Medium 5.9 (`CVSS:3.1/AV:A/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:L`)
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Local or same network only
- **Victim action needed:** A user has to click or open something
- **Fix available:** No
- **Published:** 25 Feb 2026
- **Updated:** 26 Feb 2026
- **Also known as:** GHSA-cx85-vr3q-9x4m

## What is CVE-2026-27629?

CVE-2026-27629 is a medium-severity code injection vulnerability in InvenTree, published on 25 Feb 2026. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.

### Official 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.

Weakness: CWE-1336 (Improper Neutralization of Special Elements Used in a Template Engine)

## Which versions are affected by CVE-2026-27629?

It affects 1 product.


Products: Inventree Project Inventree.

## How do I fix CVE-2026-27629?

No fix has been published for CVE-2026-27629 yet. Limit exposure of the affected software until one is available.

## Is CVE-2026-27629 being exploited?

There is no known exploitation of CVE-2026-27629 in the wild and no public exploit code.

## Other vulnerabilities in InvenTree

- [CVE-2022-2111](https://insights.sbomify.com/CVE-2022-2111/): Unrestricted Upload of File with Dangerous Type in inventree/inventree (critical 9.0)
- [CVE-2022-2112](https://insights.sbomify.com/CVE-2022-2112/): Improper Neutralization of Formula Elements in a CSV File in inventree/inventree (critical 9.0)
- [CVE-2022-2113](https://insights.sbomify.com/CVE-2022-2113/): Cross-site Scripting (XSS) - Stored in inventree/inventree (high 8.4)
- [CVE-2026-35478](https://insights.sbomify.com/CVE-2026-35478/): InvenTree has Arbitrary API Token Creation (high 8.3)
- [CVE-2022-3355](https://insights.sbomify.com/CVE-2022-3355/): Cross-site Scripting (XSS) - Stored in inventree/inventree (high 8.2)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-27629 and fix it if it is affected.

What it is: CVE-2026-27629 is a medium-severity code injection vulnerability in InvenTree, published on 25 Feb 2026. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2026-27629 in the wild and no public exploit code.

Affected product: InvenTree. No package-level version data is available, so check the vendor advisory linked from the reference page.

Task:
1. 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.
2. 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.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2026-27629/ (Markdown: https://insights.sbomify.com/CVE-2026-27629/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2026-27629
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-27629
- OSV: https://osv.dev/vulnerability/CVE-2026-27629

---
From sbomify Insights: https://insights.sbomify.com/CVE-2026-27629/
Summaries are generated and may contain mistakes; the official description above is the record.
