/

CVE-2026-55585

Severity:

HIGH RISK

(8.8)

Code Injection (CWE-94) in QWED Math Verification API

CVE-2026-55585

Deferred

Vulnerability type

Category:

Code Injection

CWE:

CWE-94

Impact:

Arbitrary 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

QWED passes caller-controlled mathematical expressions to SymPy's parse_expr() without restricting the namespaces available during evaluation. An attacker with a valid tenant API key, including one obtained through an enabled self-service signup flow, may execute arbitrary Python code in the API server process through the math or batch verification endpoints.

Affected context

The vulnerability occurs in QWED deployments that expose the math verification or batch verification APIs and use the affected expression-processing behavior. It becomes risky when an attacker can obtain a tenant API key and submit expressions that reach parse_expr() without strict parsing, validation, or restricted global and local namespaces.

Exploit preconditions

  • Attack surface: Network-accessible QWED verification API
  • Required access: A valid tenant API key; the default signup flow may allow an attacker to create a standard tenant account and obtain one
  • Trigger point: Submission of caller-controlled input to the math verification endpoint or a batch item processed as a math verification request
  • Why exploitation is possible: Expressions are passed to a Python-backed evaluator without restricted namespaces, allowing evaluation behavior to resolve builtins and execute code in the API server process

Why this happens

The underlying bug is code injection caused by treating untrusted mathematical expressions as executable Python-like input. QWED invokes SymPy parse_expr() without constrained global_dict and local_dict namespaces, while its normalization step does not provide meaningful security validation. This maps to CWE-94: Improper Control of Generation of Code, because attacker-controlled data can influence code evaluation and execution.

Potential impact

  • Arbitrary Python or operating system command execution in the API server process
  • Reading, modifying, or deleting application and host-accessible files
  • Modification or poisoning of tenant and application data
  • Service termination or denial of service
  • Compromise of other tenants in a shared deployment
  • Exposure of credentials and other sensitive runtime information

General mitigation guidance

Mitigation generally focuses on preventing untrusted expressions from reaching general-purpose evaluators.

Common defensive patterns include:

  • Replace dynamic expression evaluation with a purpose-built mathematical parser or an allowlisted expression language
  • Use strictly restricted namespaces and disable access to builtins when symbolic parsing is unavoidable
  • Validate expressions against an explicit grammar and permitted operation set before parsing
  • Apply the same controls consistently to individual and batch verification paths
  • Treat tenant-supplied input as untrusted regardless of API-key validity
  • Disable or tightly control self-service account and API-key issuance where it is not required
  • Run the API with least-privilege service accounts, isolated credentials, and restricted filesystem access
  • Enforce tenant isolation and network segmentation to limit cross-tenant impact

How teams detect issues like this

Organizations can identify related risks through:

  • Static analysis rules for eval(), unrestricted SymPy parse_expr(), and dynamic parser calls lacking constrained namespaces
  • Code review checks for caller-controlled expressions reaching interpreters or symbolic evaluators
  • Data-flow analysis tracing API fields and batch items into expression-processing functions
  • Policy enforcement that requires approved parsers and explicit allowlists for executable input
  • Runtime monitoring for unusual verification requests, process spawning, file access, or unexpected outbound connections from the API service
  • Automated code review tools configured to flag dynamic evaluation and missing tenant-boundary controls

Sources

SourceLink
github.comgithub.com/QWED-AI/qwed-verification/commit/6066b68c0c4f4cc2c3771824822aaa864d082ef8
github.comgithub.com/QWED-AI/qwed-verification/commit/dc9d4db72ca4b4ae3f96d0e6a0c27a9e38a06f61
github.comgithub.com/QWED-AI/qwed-verification/pull/200
github.comgithub.com/QWED-AI/qwed-verification/security/advisories/GHSA-q27q-98j4-9pfv

Frequently asked

questions

Yes. A remotely reachable verification endpoint can be abused when the attacker has a valid tenant API key and the submitted expression reaches the vulnerable evaluator.

Not necessarily. If self-service signup and API-key issuance are enabled, an attacker may be able to create a standard tenant account and obtain the required key. Otherwise, access to another valid tenant credential is generally required.

Avoid evaluating caller-controlled expressions as Python. Prefer a dedicated mathematical grammar with explicit operation allowlists; if symbolic parsing is required, use tightly restricted namespaces and validate input before parsing.

Review all data flows into interpreters and dynamic parsers, apply identical validation to single-item and batch APIs, limit API-key creation, and run services with least privilege and strong tenant isolation.

Find out what's already
exploitable in your codebase.