7.3high
Glances has SQL Injection via Process Names in TimescaleDB Export
- Severity
- 7.3high CVSS:4.0 by GitHub_M
- Exploit likelihood
- 0.42% (higher than 38% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-x46r-mf5g-xpr6PYSEC-2026-2165
Description
Glances is an open-source system cross-platform monitoring tool. Prior to 4.5.1, The TimescaleDB export module constructs SQL queries using string concatenation with unsanitized system monitoring data. The normalize() method wraps string values in single quotes but does not escape embedded single quotes, making SQL injection trivial via attacker-controlled data such as process names, filesystem mount points, network interface names, or container names. This vulnerability is fixed in 4.5.1.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| nicolargo glances | < 4.5.1, before 4.5.1 | CVE List, NVD |
| glances (PyPI) | before 4.5.1 | GitHub Advisory Database, PyPA Advisory Database |
All scores
| GitHub_M | 7.3high CVSS:4.0 | CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:P |
| GitHub | high CVSS:4.0 | CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:P |
| NVD | 9.8critical CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
| PyPA Advisory Database | 9.8critical CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
Classification
SSVC (CISA-ADP): exploitation poc, automatable no, technical impact total.
What each source says
CVE List
Glances is an open-source system cross-platform monitoring tool. Prior to 4.5.1, The TimescaleDB export module constructs SQL queries using string concatenation with unsanitized system monitoring data. The normalize() method wraps string values in single quotes but does not escape embedded single quotes, making SQL injection trivial via attacker-controlled data such as process names, filesystem mount points, network interface names, or container names. This vulnerability is fixed in 4.5.1.
GitHub Advisory Database
Summary
The TimescaleDB export module constructs SQL queries using string concatenation with unsanitized system monitoring data. The normalize() method wraps string values in single quotes but does not escape embedded single quotes, making SQL injection trivial via attacker-controlled data such as process names, filesystem mount points, network interface names, or container names.
Root Cause: The normalize() function uses f"'{value}'" for string values without escaping single quotes within the value. The resulting strings are concatenated into INSERT queries via string formatting and executed directly with cur.execute() — no parameterized queries are used.
Affected Code
- File: glances/exports/glances_timescaledb/init.py, lines 79-93 (normalize function)
def normalize(self, value):
"""Normalize the value to be exportable to TimescaleDB."""
if value is None:
return 'NULL'
if isinstance(value, bool):
return str(value).upper()
if isinstance(value, (list, tuple)):
# Special case for list of one boolean
if len(value) == 1 and isinstance(value[0], bool):
return str(value[0]).upper()
return ', '.join([f"'{v}'" for v in value])
if isinstance(value, str):
return f"'{value}'" # <-- NO ESCAPING of single quotes within value
return f"{value}"
- File: glances/exports/glances_timescaledb/init.py, lines 201-205 (query construction)
# Insert the data
insert_list = [f"({','.join(i)})" for i in values_list]
insert_query = f"INSERT INTO {plugin} VALUES {','.join(insert_list)};"
logger.debug(f"Insert data into table: {insert_query}")
try:
cur.execute(insert_query) # <-- Direct execution of concatenated SQL
PoC
- As a normal user, create a process with the name containing the SQL Injection payload:
exec -a "x'); COPY (SELECT version()) TO '/tmp/sqli_proof.txt' --" python3 -c 'import time; [sum(range(500000)) or time.sleep(0.01) for _ in iter(int, 1)]'
- Start Glances with TimescaleDB export as root user:
glances --export timescaledb --export-process-filter ".*" --time 5 --stdout cpu
- Observe that sqli_proof.txt is created in /tmp directory.
Impact
- Data Destruction: DROP TABLE, DELETE, TRUNCATE operations against the TimescaleDB database.
- Data Exfiltration: Using COPY ... TO or subqueries to extract data from other tables.
- Potential RCE: Via PostgreSQL extensions like COPY ... PROGRAM which executes OS commands.
- Privilege Escalation: Any local user who can create a process with a crafted name can inject SQL into the database, potentially compromising the entire PostgreSQL instance.
NVD (es)
Glances es una herramienta de monitoreo de sistema de código abierto multiplataforma. Antes de la versión 4.5.1, el módulo de exportación de TimescaleDB construye consultas SQL utilizando concatenación de cadenas con datos de monitoreo del sistema no saneados. El método normalize() envuelve los valores de cadena entre comillas simples pero no escapa las comillas simples incrustadas, lo que hace que la inyección SQL sea trivial a través de datos controlados por el atacante, como nombres de procesos, puntos de montaje del sistema de archivos, nombres de interfaces de red o nombres de contenedores. Esta vulnerabilidad se corrige en la versión 4.5.1.
References
| https://github.com/nicolargo/glances/security/advisories/GHSA-x46r-mf5g-xpr6 | evidence, exploit, vendor-advisory, web | |
| https://github.com/nicolargo/glances/commit/39161f0d6fd723d83f534b48f24cdca722573336 | fix, patch, web | |
| https://github.com/nicolargo/glances/releases/tag/v4.5.1 | product, web | |
| https://nvd.nist.gov/vuln/detail/CVE-2026-30930 | advisory | |
| https://github.com/nicolargo/glances | package | |
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-30930 changed 2026-03-11 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-x46r-mf5g-xpr6 changed 2026-07-13 | CC-BY-4.0 |
| NVD | CVE-2026-30930 changed 2026-06-17 | Public domain |
| PyPA Advisory Database | PYSEC-2026-2165 changed 2026-07-13 | CC-BY-4.0 |