CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



GHSA-V529-VHWC-WFC5
9.1

GHSA-v529-vhwc-wfc5: Authenticated SQL Injection in OpenC3 COSMOS QuestDB Integration

Alon Barad
Alon Barad
Software Engineer

Apr 23, 2026·6 min read·6 visits

PoC Available

Executive Summary (TL;DR)

An authenticated SQL injection vulnerability (CVSS 9.1) in OpenC3 COSMOS allows users with low privileges (e.g., Viewer or Runner) to execute arbitrary SQL queries against the backend QuestDB database via the JSON-RPC API, enabling data exfiltration and destruction.

OpenC3 COSMOS versions prior to 7.0.0-rc3 contain a critical SQL injection vulnerability in the telemetry retrieval functions interfacing with the QuestDB time-series database. The flaw permits low-privileged authenticated users to execute arbitrary SQL commands against the database backend, resulting in complete database compromise, arbitrary data disclosure, and the capability to perform destructive operations.

Vulnerability Overview

OpenC3 COSMOS provides command and control (C2) functionality for embedded systems. The platform utilizes QuestDB, a high-performance time-series database, to store and query system telemetry data. Access to this data is exposed via a JSON-RPC application programming interface (API), which handles requests from various frontend clients and internal services.

The vulnerability exists within the application's API endpoints that process telemetry retrieval requests. Specifically, the vulnerability affects the get_tlm_values RPC method. This method accepts time-based parameters to filter the telemetry records returned to the client. The application fails to properly neutralize these parameters before integrating them into SQL queries.

This flaw is classified as CWE-89 (Improper Neutralization of Special Elements used in an SQL Command). Because the vulnerability resides in the core telemetry retrieval logic, any authenticated user with base telemetry permissions (tlm) can trigger the injection. This includes low-privileged roles such as Viewer or Runner, greatly expanding the population of potential attackers.

Technical Root Cause Analysis

The root cause of the vulnerability is the unsafe construction of SQL queries using string interpolation. The vulnerability resides in the tsdb_lookup function, which is implemented in both the Ruby component (openc3/lib/openc3/models/cvt_model.rb) and the Python component (openc3/python/openc3/models/cvt_model.py).

When a client issues a request to the get_tlm_values endpoint, the API extracts the start_time and end_time parameters from the JSON payload. The application passes these parameters directly to the tsdb_lookup function. The function then dynamically builds a SQL query string by concatenating the unvalidated parameters directly into the WHERE clause.

The implementation assumed that time-based input parameters would conform to expected date-time formats. The application implemented no input validation or sanitization routines to enforce this assumption. Furthermore, the application failed to utilize parameterized queries or prepared statements, which are the industry standard defense against SQL injection.

Code Analysis and Patch Review

The vulnerability mechanics are evident in the source code of both language implementations. The vulnerable code constructs queries by directly interpolating the start_time and end_time variables into the SQL string.

In the vulnerable Ruby implementation (cvt_model.rb), the code dynamically constructs the query based on the presence of the time parameters:

if start_time && !end_time
  query += "WHERE T0.PACKET_TIMESECONDS < '#{start_time}' LIMIT -1"
elsif start_time && end_time
  query += "WHERE T0.PACKET_TIMESECONDS >= '#{start_time}' AND T0.PACKET_TIMESECONDS < '#{end_time}'"
end
# ...
result = @@conn.exec(query)

The Python implementation (cvt_model.py) contains identical logic, utilizing f-strings for interpolation:

if start_time and not end_time:
    query += f"WHERE T0.PACKET_TIMESECONDS < '{start_time}' LIMIT -1"
elif start_time and end_time:
    query += f"WHERE T0.PACKET_TIMESECONDS >= '{start_time}' AND T0.PACKET_TIMESECONDS < '{end_time}'"
# ...
cursor.execute(query)

The patch, applied in commit 9ba60c09c8836a37a2e4ea67ab35fe403e041415, resolves the primary SQL injection vector by migrating to native database driver parameter binding. The Ruby implementation now utilizes exec_params(query, query_params) with $1, $2 positional placeholders. The Python implementation adopts cursor.execute(query, query_params) using %s placeholders.

The patch also attempts to address secondary injection vectors by adding identifier quoting in questdb_client.py for Data Definition Language (DDL) statements (e.g., ALTER TABLE ... ADD COLUMN "{col_name}"). However, the identifier quoting mechanism does not escape internal double quotes. If the application permits users to define custom telemetry items with names containing double quotes, a secondary injection vector may still exist during schema modification operations.

Exploitation Methodology

Exploitation requires the attacker to possess valid credentials for any role that grants tlm (telemetry) permissions. The attacker must also possess network routing to the OpenC3 COSMOS API. The vulnerability requires no user interaction and is highly reliable.

The attacker initiates the exploit by sending a crafted HTTP POST request to the JSON-RPC interface. The request targets the get_tlm_values method. The attacker injects the payload into the start_time parameter within the JSON body.

To perform data exfiltration, the attacker breaks out of the expected single-quoted string and alters the query logic to evaluate as true. A standard tautology payload accomplishes this:

{
  "jsonrpc": "2.0",
  "method": "get_tlm_values",
  "params": {
    "start_time": "' OR 1=1 --"
  },
  "id": 1
}

The application interpolates this payload, resulting in the query: SELECT ... WHERE T0.PACKET_TIMESECONDS >= '' OR 1=1 --' AND .... This bypasses the time constraint, causing the database to return all records accessible to the executed query.

The attacker can also execute stacked queries or DDL commands to destroy data. By terminating the primary SELECT statement, the attacker can execute arbitrary subsequent commands. The following payload demonstrates a destructive attack against the telemetry tables:

'; DROP TABLE 'some_telemetry_table'; --

Impact Assessment

The vulnerability carries a CVSS v3.1 base score of 9.1 (Critical). The CVSS vector (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:N) highlights the low access complexity, network attack vector, and high impact on confidentiality and integrity. The scope metric evaluates to Changed (S:C) because the vulnerability exists within the OpenC3 application but impacts a separate infrastructure component, the QuestDB database.

The confidentiality impact is severe. An attacker can leverage the SQL injection to extract arbitrary records from the QuestDB database. This includes sensitive telemetry data from managed embedded systems, which often constitutes proprietary or classified operational intelligence.

The integrity impact is equally critical. The vulnerability allows an attacker to execute arbitrary DDL operations, such as dropping tables or altering schemas. This capability permits an attacker to permanently destroy historical telemetry data or manipulate records to obscure operational anomalies. The availability impact is rated as None in the primary vector, though data destruction intrinsically degrades system availability from an operational perspective.

Remediation and Mitigation Guidance

The definitive remediation strategy is upgrading the OpenC3 COSMOS platform to version 7.0.0-rc3 or later. This release incorporates the necessary code modifications to implement parameterized database queries, neutralizing the primary injection vectors.

Organizations unable to immediately apply the patch must implement defense-in-depth mitigations. Administrators should restrict access to the get_tlm_values RPC endpoint to essential personnel. Administrators must audit user roles to ensure the principle of least privilege is strictly enforced across all accounts with telemetry permissions.

Security teams should deploy network-based detections to identify exploitation attempts. Web Application Firewalls (WAF) must inspect incoming JSON bodies for common SQL injection syntax (e.g., single quotes, double dashes, semicolons, and SQL keywords like DROP or UNION) within time-based parameters. Furthermore, security information and event management (SIEM) systems should monitor database logs for anomalous DDL operations originating from the OpenC3 application context.

Official Patches

OpenC3Commit 9ba60c09c8836a37a2e4ea67ab35fe403e041415
OpenC3v7.0.0-rc3 Release

Fix Analysis (1)

Technical Appendix

CVSS Score
9.1/ 10
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:N

Affected Systems

OpenC3 COSMOSQuestDB Integration Module

Affected Versions Detail

Product
Affected Versions
Fixed Version
OpenC3 COSMOS
OpenC3
>= 6.7.0, < 7.0.0-rc3v7.0.0-rc3
AttributeDetail
CVSS Score9.1 (Critical)
CVSS VectorCVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:N
CWE IDCWE-89
Attack VectorNetwork
Privileges RequiredLow (Authenticated)
Exploit StatusProof of Concept Available

MITRE ATT&CK Mapping

T1190Exploit Public-Facing Application
Initial Access
T1020Automated Exfiltration
Exfiltration
T1485Data Destruction
Impact
CWE-89
Improper Neutralization of Special Elements used in an SQL Command

The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command.

Known Exploits & Detection

Research ContextProof of Concept leveraging the start_time parameter for boolean-based extraction and stacked queries

Vulnerability Timeline

Fix commit pushed to OpenC3 COSMOS repository
2026-03-02
GHSA-v529-vhwc-wfc5 advisory published
2026-04-23
OSV record created
2026-04-23

References & Sources

  • [1]GitHub Security Advisory: GHSA-v529-vhwc-wfc5
  • [2]Patch Commit: 9ba60c0
  • [3]OpenC3 COSMOS Release v7.0.0-rc3

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.