Bug 2588723 (CVE-2026-142394)

Summary: CVE-2026-142394 observatorium/api: observatorium/api: LogQL lexer infinite loop with unbounded memory growth on -- token at end-of-input
Product: [Other] Security Response Reporter: OSIDB Bzimport <bzimport>
Component: vulnerabilityAssignee: Product Security DevOps Team <prodsec-dev>
Status: NEW --- QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: dfreiber, drow, jburrell, jcantril, rojacob, vkumar
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: ---
Doc Text:
A flaw was found in observatorium/api. An authenticated remote attacker can exploit this issue by submitting a specially crafted LogQL query containing an incomplete flag token at the end of input. This causes the query parser to enter an infinite loop and consume system memory, resulting in a Denial of Service (DoS) condition.
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description OSIDB Bzimport 2026-12-02 16:15:08 UTC
The LogQL v2 lexer in github.com/observatorium/api (logql/v2/lexer.go) enters an infinite loop with unbounded in-memory string growth when it scans a -- token that reaches end-of-input without trailing whitespace. In the case '-': branch, after confirming a following '-' via Peek, the flag-scanning loop's only exit condition is unicode.IsSpace(r); scanner.Scanner.Next() returns scanner.EOF (-1) at end-of-input, unicode.IsSpace(EOF) is false, and strings.Builder.WriteRune(EOF) appends utf8.RuneError, so the loop never terminates and repeatedly appends to the builder until the process is killed by memory exhaustion. Every other scanning loop in the same file carries an explicit EOF check; this branch alone omits it.

The defect was introduced by commit 8cb4f4d4a4c121130ca81e47964915f01a58d446 (2023-09-13, "Add support for features in Loki v2.9.0"), which added the --strict/--keep-empty flag tokens this code scans for. The latest tagged release is v0.1.2 (2021), which predates the introduction; all downstream consumption is via pseudo-version dependencies of unreleased main revisions from 2023-09-13 onward, and no fix exists upstream.

The parser is reachable from the request path: authorization/query.go passes caller-supplied URL query parameter values directly into logqlv2.ParseExpr for tenant label enforcement. In Red Hat products, the LokiStack gateway (openshift-logging/lokistack-gateway-rhel9, built from the observatorium/api source tree) is affected on OpenShift Logging 6.0, 6.2, 6.5, 6.6, and 6.7; an authenticated tenant submitting a crafted LogQL query can hang the gateway and exhaust memory until OOM, disrupting the logging query path for all tenants of the LokiStack. The backplane managed-scripts component (openshift-hosted-osd4) also bundles the vulnerable module.

Impact is availability only; no authorization bypass or information disclosure was identified in this defect. Remediation: add an EOF check to the flag-scanning loop, consistent with every other loop in the lexer.

Source report: PSIRTSUPT-32024. All claims independently verified against upstream sources at the cited commits.