/

CVE-2026-58449

Severity:

CRITICAL RISK

(9.8)

Code Injection (CWE-94) via txtai /reindex API Resolver

CVE-2026-58449

Deferred

Vulnerability type

Category:

Code Injection

CWE:

CWE-94

Impact:

Remote Code Execution

Severity:

CRITICAL RISK

(9.8)

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

txtai exposes a /reindex API endpoint whose function parameter is dynamically imported and invoked based on a caller-supplied dotted path, without any allowlist or validation.

When the API is reachable without authentication and the index is writable, a remote attacker can bind this parameter to arbitrary callables like subprocess utilities and execute code as the server process during reindexing.

Affected context

This vulnerability manifests in txtai deployments where:

  • The HTTP API, including the /reindex endpoint, is exposed to untrusted networks
  • No TOKEN-based authentication is configured (authentication is opt-in)
  • The index is configured as writable, allowing reindex operations

Under these non-default conditions, user-supplied function paths provided to the /reindex endpoint are treated as trusted code and imported dynamically.

Exploit preconditions

  • Attack surface: Network-exposed txtai API, specifically the /reindex endpoint
  • Required access: Ability to send HTTP requests to the /reindex endpoint when no TOKEN is configured
  • Configuration conditions: Writable index and /reindex enabled so that reindex operations are permitted
  • Trigger point: Invocation of /reindex with a function body parameter containing an attacker-controlled dotted path
  • Why exploitation is possible: txtai.util.Resolver performs __import__ and getattr on the supplied path without an allowlist or validation, allowing arbitrary callables to be resolved and executed during reindexing.

Why this happens

The core issue is a dynamic code resolution pattern that treats user input as a trusted reference to executable code.

The /reindex endpoint passes a caller-supplied dotted path into txtai.util.Resolver, which uses __import__ and getattr to resolve the path into a callable.

Because there is no allowlist, scoping, or validation of the modules and attributes that can be targeted, attackers can select powerful built-in or standard library functions, effectively injecting arbitrary behavior.

This aligns with CWE-94 (Improper Control of Generation of Code), where untrusted input directly influences what code is loaded and executed in the application context.

Potential impact

  • Remote execution of arbitrary OS commands under the txtai server's privileges
  • Full compromise of the txtai process and associated data
  • Unauthorized modification or destruction of indexed content
  • Use of the txtai host as a pivot for lateral movement inside the network
  • Deployment of backdoors or persistence mechanisms in the hosting environment

General mitigation guidance

Effective mitigation focuses on eliminating the ability for user input to select arbitrary executable code and tightening exposure of sensitive administrative endpoints.

Recommended defensive patterns include:

  • Restricting dynamic code resolution to a small, explicit allowlist of safe, internally defined functions
  • Avoiding the use of __import__ and getattr on untrusted strings and favoring static mappings or configuration-driven registries
  • Treating administrative endpoints like /reindex as privileged operations, gated by configuration flags, authentication, and authorization checks
  • Running the txtai service with least privilege so that, if compromised, the process has minimal OS-level capabilities
  • Limiting write access to the index to trusted components and using network segmentation to keep the API away from untrusted clients

How teams detect issues like this

Organizations can detect similar issues and potential exploitation through a combination of code-focused and runtime signals:

  • Static analysis rules that flag use of __import__, getattr, or dynamic module loading where parameters originate from request data or other untrusted sources
  • Code review practices that scrutinize administrative endpoints and configuration-driven execution paths, looking for places where user input influences callable selection
  • Logging and monitoring of /reindex usage, alerting on unusual function values, unexpected modules, or high-risk standard library callables
  • Security policies in CI/CD that require explicit allowlists for dynamic function registries and that block deployment when unsafe patterns are detected

Sources

SourceLink
github.comgithub.com/neuml/txtai/commit/11b32da720f03276199ebc5583c15fc5d1ccafd3
github.comgithub.com/neuml/txtai/issues/1111
github.comgithub.com/neuml/txtai/issues/1122
vulncheck.comvulncheck.com/advisories/txtai-unauthenticated-remote-code-execution-via-unsafe-reflection-in-api-reindex-function-parameter

Frequently asked

questions

Yes. When the txtai API is exposed to a network, no TOKEN-based authentication is configured, and the index is writable, an attacker can remotely send crafted /reindex requests and trigger arbitrary code execution.

An attacker needs network access to the txtai API and the ability to reach the /reindex endpoint in a deployment where authentication is disabled and reindexing is allowed. No local shell or prior foothold is required under those conditions.

The most robust approach is to remove or strictly limit dynamic code resolution based on user input. Use a fixed registry of allowed functions, enforce authentication and authorization on administrative endpoints, and gate sensitive operations behind explicit configuration flags.

Avoid designs where request parameters directly influence what code is imported or executed. Apply strong input validation, prefer static mappings over dynamic imports, require authentication for administrative APIs, and include checks in code review and automated analysis to flag unsafe dynamic execution patterns.

Find out what's already
exploitable in your codebase.