/

CVE-2026-35478

Severity:

HIGH RISK

(8.3)

Improper Authorization in InvenTree API

CVE-2026-35478

Analyzed

Vulnerability type

Category:

Improper Authorization

CWE:

CWE-639

Impact:

Authentication Bypass and Privilege Escalation via Token Impersonation

Severity:

HIGH RISK

(8.3)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

InvenTree's API allows any authenticated user to create API tokens on behalf of other users by specifying an arbitrary user ID in token-creation requests.

This enables impersonation of administrators and superusers, granting full API access as the target account from any location without additional interaction.

Affected context

This vulnerability occurs in InvenTree deployments where API authentication relies on user tokens created via the /api/user/tokens/ endpoint.

The issue manifests when the backend accepts a user identifier from the client and applies it directly to the new token without verifying that the caller is allowed to create tokens for that specific account.

Any environment that exposes the API to authenticated users and treats tokens as equivalent to full user identity is affected, regardless of network location, because issued tokens can be used from anywhere.

Exploit preconditions

  • Attack surface: HTTP(S) API endpoint POST /api/user/tokens/
  • Required access: Any valid authenticated InvenTree user account (even low-privileged)
  • Trigger point: Sending a token creation request that includes another user's ID in the user field
  • Why exploitation is possible: The server trusts the client-supplied user identifier and does not enforce that the token owner matches the authenticated principal or that the caller has delegated-administration rights over the specified user

Why this happens

The underlying flaw is a missing authorization check when binding new API tokens to user accounts.

Instead of deriving the token owner from the authenticated session (or verifying that the caller is permitted to act on behalf of the specified user), the implementation uses a client-controlled user field to select the account.

This aligns with CWE-639: Insecure Direct Object Reference (IDOR) for Authorization, where access to a protected object (in this case, the ability to create tokens for a user account) is controlled solely by user-supplied identifiers without adequate permission checks.

Conceptually, the system exposes an administrative action—impersonation-level token issuance—on a multi-tenant object (user account) but bases authorization on trust of the incoming parameter rather than the authenticated identity.

Potential impact

  • An attacker may create valid API tokens for administrator or superuser accounts.
  • An attacker can perform any API operation that the impersonated user is allowed to perform, including configuration changes and data access.
  • The attacker may exfiltrate sensitive inventory and operational data accessible to privileged users.
  • The attacker can perform destructive actions such as modifying or deleting records under a trusted identity, complicating forensic analysis.
  • Compromised tokens can be used from arbitrary network locations, enabling persistent unauthorized access until revoked.

General mitigation guidance

Effective mitigation focuses on enforcing strict authorization semantics around token creation and ownership:

  • Bind token ownership to the authenticated principal by default; ignore or remove any client-supplied user identifier for self-service token creation.
  • Where delegated administration is necessary, implement explicit role-based checks before allowing one user to create tokens for another, and constrain this to narrowly defined roles.
  • Centralize authorization logic for user-related actions so that user ID parameters are always checked against the caller's identity and permissions.
  • Reduce token privileges and lifetime by default (e.g., short-lived, scoped tokens) so that misuse has a smaller blast radius.
  • Log all token creation events with the authenticated actor, target user, IP address, and associated context to support detection and incident response.

How teams detect issues like this

Detection efforts can focus on both code-level indicators and runtime behavior:

  • Static/code review: Search for endpoints that accept a user, user_id, or similar field from the client and then perform actions on user-linked objects without comparing it to the authenticated user or enforcing role checks.
  • Authorization policy checks: Verify that token-issuance logic always consults a centralized permission layer and does not bypass it for convenience or reuse internal-only APIs in public contexts.
  • Automated analysis: Configure SAST or API-linter rules to flag patterns where user identifiers from requests are used directly to select user accounts or security-sensitive resources.
  • Runtime monitoring: Analyze logs for suspicious patterns, such as low-privilege accounts creating tokens for higher-privilege users, sudden surges in token creation, or tokens for privileged accounts being created from atypical IP ranges or user agents.

Sources

SourceLink
github.comgithub.com/inventree/InvenTree/security/advisories/GHSA-qh5j-c28q-c4rg

Frequently asked

questions

Yes. Any user who can remotely authenticate to the InvenTree API can exploit this issue by calling the token-creation endpoint with another user's ID. Once obtained, the forged token can be used from any network location.

No. The vulnerability can be exploited by any authenticated user, including low-privileged accounts, because the API does not properly restrict which user IDs can be associated with newly created tokens.

The safest approach is to derive token ownership exclusively from the authenticated session and disallow arbitrary selection of a different user account. If administrative token creation is required, wrap it in explicit role checks and limit it to designated administrator roles.

Design APIs so that user and resource identifiers from clients are always treated as untrusted references: consistently compare them to the authenticated principal, enforce role- and scope-based authorization, and subject user-management operations to heightened review and testing. Incorporating centralized access control, security-focused code review, and automated checks for IDOR patterns helps prevent regressions.

Find out what's already
exploitable in your codebase.