CVE-2026-27629

5.9 MEDIUM

📋 TL;DR

InvenTree versions before 1.2.3 have a server-side template injection vulnerability that allows staff users to modify Jinja2 templates for batch code generation. This can lead to sensitive information disclosure or remote code execution when other users trigger batch code generation. The vulnerability requires staff-level access to initially modify the template.

💻 Affected Systems

Products:
  • InvenTree
Versions: All versions prior to 1.2.3
Operating Systems: All
Default Config Vulnerable: ⚠️ Yes
Notes: Vulnerability requires staff user permissions to initially modify templates. Versions 1.3.0+ are also patched.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Full server compromise through remote code execution, allowing attacker to access all data, modify system files, or pivot to other systems.

🟠

Likely Case

Sensitive information disclosure including database credentials, API keys, or user data through template injection.

🟢

If Mitigated

Limited impact if proper access controls restrict staff permissions and template editing is disabled at system level.

🌐 Internet-Facing: MEDIUM - Exploitation requires staff credentials but can be triggered by any user once template is modified.
🏢 Internal Only: HIGH - Internal staff users with template editing permissions can exploit this to escalate privileges or exfiltrate data.

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ✅ No
Complexity: MEDIUM

Exploitation requires two steps: 1) Staff user modifies template maliciously, 2) Any user triggers batch code generation. No public exploit code known.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 1.2.3 or 1.3.0+

Vendor Advisory: https://github.com/inventree/InvenTree/security/advisories/GHSA-cx85-vr3q-9x4m

Restart Required: Yes

Instructions:

1. Backup your InvenTree database and configuration. 2. Update to version 1.2.3 or higher using pip: 'pip install --upgrade inventree==1.2.3'. 3. Restart the InvenTree service. 4. Verify the update completed successfully.

🔧 Temporary Workarounds

Override template settings at system level

all

Prevent editing of vulnerable template settings by overriding them at system configuration level

Set STOCK_BATCH_CODE_TEMPLATE and PART_NAME_FORMAT in system configuration files to prevent client-side modification

🧯 If You Can't Patch

  • Restrict staff permissions to only trusted users who require template editing capabilities
  • Monitor and audit all template modifications and batch code generation API calls

🔍 How to Verify

Check if Vulnerable:

Check InvenTree version: if version < 1.2.3, system is vulnerable

Check Version:

python -c "import inventree; print(inventree.__version__)"

Verify Fix Applied:

Verify version is 1.2.3 or higher and test that template editing is properly sandboxed

📡 Detection & Monitoring

Log Indicators:

  • Unusual template modifications by staff users
  • Multiple batch code generation requests with unusual patterns
  • Error logs containing template execution errors

Network Indicators:

  • API calls to /api/stock/batch-code/generate/ with unusual parameters
  • Outbound connections from server following batch code generation

SIEM Query:

source="inventree" AND (event="template_modified" OR event="batch_code_generated") | stats count by user

🔗 References

📤 Share & Export