/

CVE-2026-30930

Severity:

CRITICAL RISK

(9.8)

SQL Injection in Glances TimescaleDB Export Module

CVE-2026-30930

Analyzed

Vulnerability type

Category:

SQL Injection

CWE:

CWE-89

Impact:

Arbitrary SQL Execution on TimescaleDB Backend

Severity:

CRITICAL RISK

(9.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

The TimescaleDB export module in Glances constructs SQL queries using raw string concatenation with unsanitized system monitoring data, enabling SQL injection.

An attacker who can influence monitored values such as process names, filesystem mount points, network interface names, or container names may inject arbitrary SQL into TimescaleDB, potentially leading to data compromise or remote code execution via database features.

Affected context

This vulnerability appears in Glances deployments that:

  • Use the TimescaleDB export module to push monitoring metrics into a PostgreSQL/TimescaleDB backend
  • Collect system and container metadata from sources where an attacker can control or influence values (e.g., process names, mount points, interface names, container names)
  • Build SQL INSERT/UPDATE statements by string concatenation instead of using parameterized queries

The issue is specifically tied to the normalize() method, which wraps string values in single quotes without properly escaping embedded quotes.

Exploit preconditions

  • Attack surface: Indirect, via system attributes ingested by Glances and later written to TimescaleDB (e.g., process list, filesystem mounts, network interfaces, container metadata).
  • Required access: Ability to create or modify system entities whose names or attributes will be monitored by Glances (such as starting processes, containers, or defining mount points with crafted names). This may be local OS access, container orchestration access, or control over a monitored environment.
  • Trigger point: When the TimescaleDB export module constructs and executes SQL statements that include the crafted attribute values.
  • Why exploitation is possible: The code concatenates attacker-controlled strings directly into SQL and only wraps them in single quotes without escaping internal quotes or using bind parameters, allowing crafted input to break out of the intended literal and inject arbitrary SQL.

Why this happens

The core bug is the use of manual string concatenation to build SQL statements containing untrusted data.

Instead of using parameterized queries or proper escaping, the normalize() method simply surrounds strings with single quotes, assuming they are safe. When an attacker-controlled value includes a quote character or SQL syntax, it alters the structure of the query.

This pattern maps directly to CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'), where application logic fails to neutralize metacharacters before injecting user-controlled data into a SQL command.

Potential impact

  • Execution of arbitrary SQL statements on the TimescaleDB/PostgreSQL backend
  • Unauthorized reading, modification, or deletion of monitoring data and other database contents
  • Creation or alteration of database roles, permissions, or configuration if the database user has elevated privileges
  • Potential remote code execution via database-specific features (e.g., unsafe extensions, COPY to server files, or PL/pgSQL/other procedural languages), depending on database configuration
  • Data corruption or loss impacting observability, incident response, and downstream analytics that rely on Glances metrics

General mitigation guidance

Effective mitigation focuses on removing direct string concatenation from SQL construction and reducing the trust boundary around monitored data:

  • Replace ad-hoc string-built SQL with parameterized queries or prepared statements, letting the driver handle quoting and escaping.
  • Treat all monitoring-derived attributes (process names, mount points, interface names, container identifiers) as untrusted, even when they originate from the local system.
  • Introduce a strict normalization layer that validates type and character sets for all values before they reach the database layer, rejecting or sanitizing unexpected characters.
  • Enforce least privilege for the TimescaleDB/DB user used by Glances, restricting it to minimal required operations on a dedicated schema or database.
  • Consider logging and alerting on SQL errors and anomalous queries originating from the monitoring exporter to catch misuse early.

How teams detect issues like this

Organizations can look for this vulnerability and similar issues with a combination of code-centric and runtime techniques:

  • Static analysis: Use SAST tools or custom rules to flag SQL construction via string concatenation, especially when untrusted or external data flows into query strings.
  • Code review: In review checklists, explicitly look for:
  • Calls that build SQL via + or string formatting
  • Helper functions that wrap values in quotes instead of using parameters
  • Any use of raw metadata (process names, mount points, interface names, container IDs) in SQL without validation.
  • Policy enforcement: Add CI/CD guardrails that prohibit merging changes when unsafe SQL patterns are detected, or require security sign-off for database access code.
  • Runtime monitoring: Enable database audit logging and anomaly detection for unusual statements originating from the monitoring service account, such as DDL, privilege changes, or queries against unexpected schemas.

Sources

SourceLink
github.comgithub.com/nicolargo/glances/commit/39161f0d6fd723d83f534b48f24cdca722573336
github.comgithub.com/nicolargo/glances/releases/tag/v4.5.1
github.comgithub.com/nicolargo/glances/security/advisories/GHSA-x46r-mf5g-xpr6

Frequently asked

questions

It can be, depending on how Glances is deployed. If an attacker can remotely influence system attributes that Glances monitors (for example, by creating containers, processes, or mounts in a shared or multi-tenant environment), they may be able to trigger SQL injection without direct access to the Glances host.

An attacker needs the ability to control or create entities whose names or metadata are collected by Glances and exported to TimescaleDB. This may be local OS user access, access to a container platform, or any mechanism that lets them influence monitored values.

The safest pattern is to use parameterized queries or prepared statements everywhere, never constructing SQL commands with string concatenation that includes untrusted data. Combined with strict input validation and least-privilege database accounts, this significantly reduces injection risk.

Establish development practices that forbid manual query string assembly with external data, enforce parameterized access through shared database utilities, and integrate static analysis and security-focused code review to catch violations early. Regular training on injection risks and secure database programming further helps teams avoid reintroducing these patterns.

Find out what's already
exploitable in your codebase.