/

CVE-2026-31225

Severity:

HIGH RISK

(8.8)

Code Injection in superduper Query Parser

CVE-2026-31225

Awaiting Analysis

Vulnerability type

Category:

Code Injection

CWE:

CWE-94

Impact:

Remote Code Execution

Severity:

HIGH RISK

(8.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

The superduper project up to version 0.10.0 contains a code injection vulnerability in its query parsing logic, where user-supplied operands are evaluated using Python's eval() without sufficient restrictions.

An attacker who can send crafted query strings to the server can inject Python code that imports sensitive modules and executes arbitrary system commands, potentially leading to full server compromise.

Affected context

This vulnerability exists in deployments of the superduper project that:

  • Expose the query parsing interface to remote clients (e.g., via HTTP APIs, RPC, or similar endpoints).
  • Route user-controlled query strings to the _parse_op_part() function in query.py.
  • Execute backend logic in a Python runtime where eval() can access built-ins and import modules.

The issue becomes most severe when the superduper process runs with high privileges or has access to sensitive data, filesystems, or internal networks.

Exploit preconditions

  • Attack surface: Remote, through any interface that accepts and processes query strings using the vulnerable parser.
  • Required access: Ability to submit arbitrary or semi-controlled query strings (e.g., authenticated or unauthenticated API clients, depending on deployment).
  • Trigger point: The _parse_op_part() function in query.py, which calls eval() on user-supplied operands.
  • Why exploitation is possible: The eval() call executes attacker-controlled Python expressions in a context that still exposes powerful built-ins and allows module imports, enabling arbitrary code execution despite attempts at namespace restriction.

Why this happens

The core issue is the use of eval() on untrusted input in the query parsing layer.

This aligns with CWE-94: Improper Control of Generation of Code ('Code Injection'), where user input is interpreted as executable code rather than treated as data.

While the implementation attempts to constrain eval() by providing a limited global namespace, it fails to fully prevent access to Python built-ins and the import mechanism.

As a result, attackers can craft query operands that perform imports (such as os or subprocess) and invoke system-level commands, turning what should be a data parsing step into a general-purpose code execution primitive.

Potential impact

  • Execution of arbitrary system commands under the privileges of the superduper server process.
  • Reading, modifying, or deleting application and system files accessible to the service.
  • Exfiltration of sensitive data, including credentials, configuration secrets, and user records.
  • Lateral movement within the hosting environment or internal network using the compromised server as a pivot.
  • Denial of service by terminating the process, exhausting resources, or corrupting application state.

General mitigation guidance

Effective mitigation focuses on eliminating dynamic code evaluation of user input and treating query operands as data, not executable logic.

Useful defensive patterns include:

  • Replacing eval() with explicit, structured parsing: define a strict grammar or use a parser/AST that maps tokens to allowed operations rather than executing arbitrary Python expressions.
  • Implementing a whitelist-based operator model: only permit a predefined set of safe operators and operand types, and reject anything outside that set.
  • Decoupling query semantics from the programming language: represent queries in a data format (e.g., JSON, limited DSL) and interpret them using regular control flow and data structures.
  • Applying strict validation and normalization to query fields before processing, ensuring they conform to expected types and formats.
  • Running the application with least privilege, limiting filesystem and network access so that, even if logic is misused, the blast radius is reduced.

These patterns aim to ensure that user-controlled query content cannot influence the execution of arbitrary code.

How teams detect issues like this

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

  • Static analysis rules that flag uses of eval(), exec(), or similar dynamic execution functions, especially when arguments originate from request or query parameters.
  • Code review checklists that explicitly call out dynamic evaluation, reflection, and expression parsing paths as high-risk areas requiring justification and hardening.
  • Enforcement of internal security guidelines that forbid using eval() with user input, with automated linting in CI pipelines to prevent regressions.
  • Runtime monitoring for anomalous behavior, such as unexpected shell command invocation, unusual file access patterns, or atypical outbound network connections originating from the query parsing path.
  • Periodic security testing, including fuzzing and penetration tests targeting query interfaces with payloads designed to exercise potential evaluation or injection behavior.

Sources

SourceLink
github.comgithub.com/superduper-io/superduper
notion.sonotion.so/CVE-2026-31225-35d1e1393188814f99b5eec7b6517190

Frequently asked

questions

Yes. If the query interface is exposed over the network and accepts user-supplied query strings, a remote attacker can leverage this path to trigger code execution.

It depends on how the superduper instance is deployed. If the query endpoint is public, anonymous attackers may exploit it; if it is behind authentication, an attacker would first need valid credentials or another way to reach the interface.

Remove the use of eval() (and similar dynamic execution functions) for parsing queries, replacing it with a structured parser or a restricted domain-specific language that interprets operands as data only, using explicit operator mappings.

Establish a development policy that forbids dynamic code execution on untrusted data, combine that with automated checks for eval/exec usage, emphasize code injection risks in code reviews, and design query and configuration formats that are inherently non-executable.

Find out what's already
exploitable in your codebase.