/

CVE-2026-73069

Severity:

CRITICAL RISK

(9.1)

SQL Injection (CWE-89) in Twenty CRM Search Fields

CVE-2026-73069

Deferred

Vulnerability type

Category:

SQL Injection

CWE:

CWE-89

Impact:

Arbitrary SQL Execution

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

A critical SQL injection vulnerability in Twenty CRM allows an authorized workspace administrator with DATA_MODEL permission to inject unescaped SQL through the system searchVector field configuration.

Under affected configurations, the injected expression may be incorporated into a generated PostgreSQL column definition and executed with the privileges of the application database user.

Affected context

The issue occurs in Twenty deployments that allow workspace field metadata to be updated through the REST metadata endpoint or the GraphQL updateOneField mutation. It becomes risky when a user with the DATA_MODEL permission can supply settings.asExpression for the system TS_VECTOR searchVector field and the server concatenates that value into a generated PostgreSQL expression without adequate escaping or structural validation.

Exploit preconditions

  • Attack surface: REST metadata field updates and the corresponding GraphQL field mutation
  • Required access: An authenticated workspace administrator or other principal holding the DATA_MODEL permission
  • Trigger point: Processing and applying the searchVector field definition through the workspace schema manager
  • Why exploitation is possible: The supplied expression is incorporated into GENERATED ALWAYS AS (...) SQL without sufficient parameterization, allowing database statements to be interpreted as SQL rather than inert configuration

Why this happens

The underlying flaw is SQL construction from attacker-influenced metadata. The schema-generation routine concatenates the settings.asExpression value into a PostgreSQL generated-column definition instead of treating it as constrained data or a safely structured expression.

This behavior maps to CWE-89: Improper Neutralization of Special Elements used in an SQL Command, because input can alter the meaning of a database statement executed by the application connection.

Potential impact

  • Arbitrary SQL statements may execute as the application database user
  • Confidential CRM data may be read or modified
  • Records, schemas, or database settings could be altered or deleted
  • Database integrity and service availability could be disrupted
  • Compromise may extend to other systems reachable through database credentials or integrations

General mitigation guidance

Mitigation generally focuses on preventing user-controlled metadata from becoming executable SQL.

Common defensive patterns include:

  • Allow only predefined, server-controlled expressions for system-generated fields
  • Use structured query-building and parameterization wherever values are inserted into SQL
  • Apply strict allowlists for identifiers, operators, functions, and expression forms when dynamic SQL is unavoidable
  • Reject expression settings that are not valid for the specific field type and lifecycle
  • Enforce authorization and least privilege for schema and metadata operations
  • Use a database role with only the permissions required by normal application behavior
  • Apply defense-in-depth monitoring and isolation around schema-changing operations

How teams detect issues like this

Organizations can detect related risks through:

  • Static analysis rules for string concatenation or interpolation into SQL statements
  • Code review checks for dynamic DDL and generated-column definitions built from API or GraphQL input
  • Tests that submit metacharacters and unexpected SQL constructs to metadata fields and verify rejection
  • API policy enforcement that restricts expression-bearing fields to trusted, predefined values
  • Database audit logging for unusual DDL, schema changes, or statements issued by the application role
  • Automated security review tools that flag unparameterized query construction and missing input allowlists

Sources

SourceLink
github.comgithub.com/twentyhq/twenty/commit/0b8368cd6c1a47711bf52972800f162bde0bbab9
github.comgithub.com/twentyhq/twenty/pull/21947
github.comgithub.com/twentyhq/twenty/security/advisories/GHSA-mm7j-q9q3-qqwj

Frequently asked

questions

It can be exploitable through the CRM's REST or GraphQL interfaces when those interfaces are reachable and the attacker has the required authenticated workspace permission.

The described issue requires a principal with the DATA_MODEL permission, typically a workspace administrator or similarly trusted role. The exact scope depends on the deployment's authorization model.

Treat field expressions as server-controlled or strictly allowlisted structures, and ensure dynamic SQL generation cannot interpret user-provided metadata as executable syntax.

Separate configuration data from SQL code, use parameterized or structured query construction, validate expressions by field type, minimize database privileges, and audit schema-management operations.

Find out what's already
exploitable in your codebase.