/

CVE-2026-115330

Severity:

HIGH RISK

(8.8)

SQL Injection (CWE-89) in Lotus Custom Metrics API Endpoint

CVE-2026-115330

Deferred

Vulnerability type

Category:

SQL Injection

CWE:

CWE-89

Impact:

Cross-Tenant Data Access and Modification

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

Lotus contains a SQL injection vulnerability in custom metric queries that allows authenticated organization users to submit stacked SQL statements.

When the metrics endpoint accepts attacker-controlled query content without reliably preventing additional statements, an attacker may read or modify data across tenants.

Lotus contains a SQL injection vulnerability in custom metric queries that allows authenticated organization users to submit stacked SQL statements.

When the metrics endpoint accepts attacker-controlled query content without reliably preventing additional statements, an attacker may read or modify data across tenants.

Affected context

The vulnerability occurs in Lotus custom metric query processing through the POST /app/metrics/ endpoint. It becomes risky when authenticated organization users can submit metric expressions that are incorporated into SQL statements and validation checks only the first statement, allowing appended statements to reach the database.

The vulnerability occurs in Lotus custom metric query processing through the POST /app/metrics/ endpoint. It becomes risky when authenticated organization users can submit metric expressions that are incorporated into SQL statements and validation checks only the first statement, allowing appended statements to reach the database.

Exploit preconditions

  • Attack surface: The custom metrics HTTP endpoint
  • Required access: Valid authentication as an organization user
  • Trigger point: Submission of a crafted custom metric query
  • Why exploitation is possible: Query validation does not reliably prevent stacked statements before user-controlled content reaches SQL execution
  • Attack surface: The custom metrics HTTP endpoint
  • Required access: Valid authentication as an organization user
  • Trigger point: Submission of a crafted custom metric query
  • Why exploitation is possible: Query validation does not reliably prevent stacked statements before user-controlled content reaches SQL execution

Why this happens

The underlying flaw is the construction or execution of SQL using insufficiently constrained user-controlled metric query content. Validation that examines only the first SQL statement can be bypassed when the database interface accepts additional semicolon-separated statements.

This behavior maps to CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'), because input is treated as executable SQL syntax rather than as strictly bounded data or a validated query structure.

The underlying flaw is the construction or execution of SQL using insufficiently constrained user-controlled metric query content. Validation that examines only the first SQL statement can be bypassed when the database interface accepts additional semicolon-separated statements.

This behavior maps to CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'), because input is treated as executable SQL syntax rather than as strictly bounded data or a validated query structure.

Potential impact

  • An attacker may read sensitive records from the database
  • Tenant isolation may be bypassed
  • Data belonging to other organizations could be modified or deleted
  • Application integrity and reporting accuracy could be affected
  • Database credentials or other sensitive values could be exposed
  • The application or connected services may experience disruption
  • An attacker may read sensitive records from the database
  • Tenant isolation may be bypassed
  • Data belonging to other organizations could be modified or deleted
  • Application integrity and reporting accuracy could be affected
  • Database credentials or other sensitive values could be exposed
  • The application or connected services may experience disruption

General mitigation guidance

Mitigation generally focuses on ensuring that metric definitions cannot alter SQL structure.

Common defensive patterns include:

  • Use parameterized queries and trusted query builders for all variable values
  • Represent metric expressions through an allowlisted, structured query model instead of accepting raw SQL fragments
  • Reject stacked statements and enforce complete-query validation where query text must be supported
  • Apply strict type, identifier, operator, and function allowlists
  • Enforce database permissions that limit each application component to the minimum required operations
  • Apply database-level tenant isolation as defense in depth
  • Avoid returning detailed database errors to clients
  • Treat authenticated users as untrusted for query construction purposes

Mitigation generally focuses on ensuring that metric definitions cannot alter SQL structure.

Common defensive patterns include:

  • Use parameterized queries and trusted query builders for all variable values
  • Represent metric expressions through an allowlisted, structured query model instead of accepting raw SQL fragments
  • Reject stacked statements and enforce complete-query validation where query text must be supported
  • Apply strict type, identifier, operator, and function allowlists
  • Enforce database permissions that limit each application component to the minimum required operations
  • Apply database-level tenant isolation as defense in depth
  • Avoid returning detailed database errors to clients
  • Treat authenticated users as untrusted for query construction purposes

How teams detect issues like this

Detection can include static analysis for string concatenation, interpolation, or formatting used to build SQL from request parameters. Code review should examine custom metric parsing, statement validation, database API usage, and whether parameter binding is used consistently.

Runtime monitoring may alert on semicolon-separated statements, unexpected SQL keywords, abnormal cross-tenant access patterns, and metric requests that produce database errors. Policy enforcement in CI can require approved query-building libraries and block raw SQL execution paths fed by HTTP input. Automated code review and software composition analysis tools may help identify related patterns.

Detection can include static analysis for string concatenation, interpolation, or formatting used to build SQL from request parameters. Code review should examine custom metric parsing, statement validation, database API usage, and whether parameter binding is used consistently.

Runtime monitoring may alert on semicolon-separated statements, unexpected SQL keywords, abnormal cross-tenant access patterns, and metric requests that produce database errors. Policy enforcement in CI can require approved query-building libraries and block raw SQL execution paths fed by HTTP input. Automated code review and software composition analysis tools may help identify related patterns.

Sources

SourceLink
github.comgithub.com/uselotus/lotus
github.comgithub.com/uselotus/lotus/blob/0.10.2/backend/metering_billing/aggregation/billable_metrics.py#L643-L656
hackmd.iohackmd.io/@leediay/BkUc3WL2Mx
vulncheck.comvulncheck.com/advisories/lotus-through-0.10.2-sql-injection-via-custom-sql-billable-metrics

Frequently asked

questions

Exploitation generally requires authentication as an organization user with access to custom metric functionality. The effective scope depends on endpoint authorization and database permissions.

No. The vulnerable behavior is reachable through the metrics HTTP endpoint, although the attacker still needs the required application access.

Use parameterized database operations and a structured, allowlisted representation for metric definitions. Raw user-controlled SQL should not be executed.

Combine secure query construction with strict input validation, tenant-aware authorization, least-privilege database accounts, code review checks, and testing for stacked statements and cross-tenant access.

Exploitation generally requires authentication as an organization user with access to custom metric functionality. The effective scope depends on endpoint authorization and database permissions.

No. The vulnerable behavior is reachable through the metrics HTTP endpoint, although the attacker still needs the required application access.

Use parameterized database operations and a structured, allowlisted representation for metric definitions. Raw user-controlled SQL should not be executed.

Combine secure query construction with strict input validation, tenant-aware authorization, least-privilege database accounts, code review checks, and testing for stacked statements and cross-tenant access.

Find out what's already
exploitable in your codebase.