/

CVE-2026-32698

Severity:

CRITICAL RISK

(9.1)

SQL Injection in OpenProject Cost Report Custom Fields

CVE-2026-32698

Analyzed

Vulnerability type

Category:

SQL Injection

CWE:

CWE-89

Impact:

Remote Code Execution via SQL Injection and Filesystem Manipulation

Severity:

CRITICAL RISK

(9.1)

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

OpenProject versions prior to 16.6.9, 17.0.6, 17.1.3, and 17.2.1 contain an SQL injection vulnerability in the Cost Report feature when using custom fields. The custom field name is embedded unsafely into SQL queries, allowing an attacker with administrative permissions to execute arbitrary SQL commands and manipulate internal data, including project identifiers, which can ultimately lead to server-side code execution when combined with related filesystem behavior.

Affected context

The vulnerability appears when OpenProject is configured with Cost Reports that reference custom fields whose names are controlled by administrators.

Under these conditions, the application constructs SQL queries for Cost Reports by concatenating the custom field name directly into the query string without proper parameterization or escaping.

In deployments where the Repositories module is enabled and Git repositories can be checked out on the server filesystem, a compromised database (e.g., modified project identifiers) can influence checkout paths and, in some cases, lead to Ruby code being placed under application-controlled directories that are executed on service restart.

Exploit preconditions

  • Attack surface: Web interface of OpenProject, primarily the Cost Reports feature combined with the Repositories module and server-side Git repository checkout.
  • Required access: Ability to create or modify custom fields (typically full administrator privileges) and to trigger Cost Report generation that uses those fields.
  • Trigger point: Generation or execution of a Cost Report query that references a custom field whose name contains crafted SQL content.
  • Why exploitation is possible: The custom field name is interpolated directly into an SQL statement without parameterization or sanitation, allowing an attacker to break query structure and inject arbitrary SQL. Subsequent logic that uses database-backed project identifiers to compute filesystem checkout paths also omits proper validation, enabling path manipulation and, in specific locations, Ruby code injection on application restart.

Why this happens

This issue stems from constructing SQL statements by concatenating user-controlled values—in this case, the names of custom fields—directly into query strings instead of using parameterized queries or carefully escaped identifiers.

This behavior maps to CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'), where the application implicitly trusts data that can contain SQL metacharacters.

The secondary aspect of the vulnerability lies in insufficient validation and normalization of data taken from the database (like project identifiers) before using it to build filesystem paths, allowing path manipulation.

Together, these insecure patterns allow an administrator-level attacker to pivot from SQL injection to persistent manipulation of repository checkout locations, and eventually to the placement of executable Ruby code within the application's load path.

Potential impact

  • Execution of arbitrary SQL commands within the OpenProject database.
  • Unauthorized modification of application data, including project identifiers and configuration values.
  • Manipulation of Git repository checkout paths on the server filesystem.
  • Injection of Ruby code into application directories that may be executed on service restart.
  • Privilege escalation within the application or host environment, depending on deployment and runtime permissions.
  • Potential full compromise of the OpenProject instance and its associated data.

General mitigation guidance

Effective mitigation focuses on eliminating direct string interpolation in queries and tightening trust boundaries between database content and filesystem operations.

Recommended defensive patterns include:

  • Use parameterized queries or query builders for all dynamic SQL, including dynamically referenced fields and identifiers.
  • Introduce strict whitelists or schema-based mapping for reportable fields, resolving user-defined custom fields to internal, validated identifiers instead of embedding raw names in SQL.
  • Normalize and constrain all data read from the database before using it in secondary contexts, such as filesystem paths, by enforcing character whitelists and canonicalization.
  • Avoid using user-controlled or database-controlled values directly in path construction; instead map them to fixed, validated directory names or IDs.
  • Run the application and repository checkout processes under least-privileged service accounts and restrict write access to application code directories to reduce the blast radius of any filesystem misuse.
  • Incorporate defense-in-depth checks in the reporting and repository subsystems (e.g., rejecting unexpected patterns in project identifiers or checkout paths).

How teams detect issues like this

Organizations can detect similar vulnerabilities through a combination of static analysis, code review, and runtime monitoring:

  • Static analysis: Configure scanning rules to flag raw string concatenation in SQL query construction, especially where user-controlled or database-derived fields (e.g., names of custom objects) are inserted without parameterization.
  • Code review signals: During manual reviews, scrutinize report builders, custom-field handling, and repository integration code for:
  • Direct interpolation of names or identifiers into SQL.
  • Any use of database values to form filesystem paths, command-line parameters, or configuration files without validation.
  • Policy enforcement: Adopt internal coding standards that mandate parameterized queries and disallow raw SQL construction in application layers, enforcing these rules in CI pipelines.
  • Runtime monitoring: Monitor database logs for anomalous queries containing unexpected SQL fragments or control characters, and review application logs for unusual repository checkout paths or code directories being modified by automated processes.
  • Automated tooling: Use security-focused linters and application security testing tools that specifically look for SQL injection patterns and unsafe path construction, integrating them into the development workflow.

Sources

SourceLink
github.comgithub.com/opf/openproject/security/advisories/GHSA-jqhf-rf9x-9rhx

Frequently asked

questions

Yes, but only by users who have sufficient privileges within the OpenProject web interface. Exploitation occurs through crafted custom field names used in Cost Reports and subsequent features that rely on the manipulated data, such as repository checkouts.

An attacker typically needs full administrator privileges to create or modify custom fields and configure reports. However, once exploited, the SQL injection can be used to alter internal data in ways that exceed the normal capabilities of an administrator and may lead to code execution on the server.

The most robust fix is to remove all direct string concatenation of user-controlled or dynamic identifiers in SQL and replace it with parameterized queries or carefully constrained identifier mapping. Additionally, ensure that data coming from the database is validated and normalized before being used in any filesystem or code-loading context.

Adopt secure coding standards that mandate parameterized queries, rigorous input and identifier validation, and strict separation between data and control instructions. Combine these standards with automated static analysis, regular security code reviews focused on dynamic query and path construction, and defense-in-depth controls that restrict write access to application code directories and sensitive filesystem locations.

Find out what's already
exploitable in your codebase.