CVE-2026-32611: Glances has a SQL Injection in DuckDB Export via Unparameterized DDL Statements

Published Mar 16, 2026
·
Updated

Summary

The GHSA-x46r fix (commit 39161f0) addressed SQL injection in the TimescaleDB export module by converting all SQL operations to use parameterized queries and psycopg.sql composable objects. However, the DuckDB export module (glances/exports/glancesduckdb/init.py) was not included in this fix and contains the same class of vulnerability: table names and column names derived from monitoring statistics are directly interpolated into SQL statements via f-strings. While DuckDB INSERT values already use parameterized queries (? placeholders), the DDL construction and table name references do not escape or parameterize identifier names.

Details

The DuckDB export module constructs SQL DDL statements by directly interpolating stat field names and plugin names into f-strings.

Vulnerable CREATE TABLE construction (glances/exports/glancesduckdb/init.py:156-162):

python createquery = f""" CREATE TABLE {plugin} ( {', '.join(creationlist)} );""" self.client.execute(createquery)

The creationlist is built from stat dictionary keys in the update() method (glances/exports/glancesduckdb/init.py:117-118):

python for key, value in pluginstats.items(): creationlist.append(f"{key} {converttypes[type(self.normalize(value)).name]}")

The INSERT statement also uses the unescaped plugin name (glances/exports/glancesduckdb/init.py:172-174):

python insertquery = f""" INSERT INTO {plugin} VALUES ( {', '.join(['?' for in values])} );"""

While INSERT values use ? placeholders (safe), the table name {plugin} is directly interpolated in both CREATE TABLE and INSERT INTO statements. Column names in creationlist are also directly interpolated without quoting.

Comparison with the TimescaleDB fix (commit 39161f0):

The TimescaleDB fix addressed this exact pattern by: 1. Using psycopg.sql.Identifier() for table and column names 2. Using psycopg.sql.SQL() for composing queries 3. Using %s placeholders for all values

The DuckDB module was not part of this fix despite having the same vulnerability class.

Attack vector:

The primary attack vector is through stat dictionary keys. While most keys come from hardcoded psutil field names (e.g., cpupercent, memoryusage), any future plugin that introduces dynamic keys from external data (container labels, custom metrics, user-defined sensor names) would create an exploitable injection path. Additionally, the table name (plugin) comes from the internal plugins list, but any custom plugin with a crafted name could inject SQL.

PoC

The injection is demonstrable when column or table names contain SQL metacharacters:

python Simulated injection via a hypothetical plugin with dynamic keys If a stat dict contained a key like: "cpupercent BIGINT); DROP TABLE cpu; --" The creationlist would produce: "cpupercent BIGINT); DROP TABLE cpu; -- VARCHAR" Which in the CREATE TABLE f-string becomes: CREATE TABLE pluginname ( time TIMETZ, hostnameid VARCHAR, cpupercent BIGINT); DROP TABLE cpu; -- VARCHAR );

bash Verify with DuckDB export enabled: 1. Configure DuckDB export in glances.conf: [duckdb] database=/tmp/glances.duckdb

2. Start Glances with DuckDB export and debug logging glances --export duckdb --debug 2>&1 | grep "Create table"

3. Observe the unescaped SQL in debug output

Impact

- Defense-in-depth gap: The identical vulnerability pattern was identified and fixed in TimescaleDB (GHSA-x46r) but the fix was not applied to the sibling DuckDB module. This represents an incomplete patch that leaves the same attack surface open through a different code path.

- Future exploitability: If any Glances plugin is added or modified to produce stat dictionary keys from external/user-controlled data (e.g., container metadata, custom metric names, SNMP OID labels), the DuckDB export would become immediately exploitable for SQL injection without any additional code changes.

- Data integrity: A successful injection in the CREATE TABLE statement could corrupt the DuckDB database, create unauthorized tables, or modify schema in ways that affect other applications reading from the same database file.

Recommended Fix

Apply the same parameterization approach used in the TimescaleDB fix. DuckDB supports identifier quoting with double quotes:

python glances/exports/glancesduckdb/init.py

def quoteidentifier(name): """Quote a SQL identifier to prevent injection.""" # DuckDB uses double-quote escaping for identifiers return '"' + name.replace('"', '""') + '"'

def export(self, plugin, creationlist, valueslist): """Export the stats to the DuckDB server.""" logger.debug(f"Export {plugin} stats to DuckDB")

tablelist = [t[0] for t in self.client.sql("SHOW TABLES").fetchall()] if plugin not in tablelist: # Quote table and column names to prevent injection quotedplugin = quoteidentifier(plugin) quotedfields = [] for item in creationlist: parts = item.split(' ', 1) colname = quoteidentifier(parts[0]) coltype = parts[1] if len(parts) > 1 else 'VARCHAR' quotedfields.append(f"{colname} {coltype}")

createquery = f"CREATE TABLE {quotedplugin} ({', '.join(quotedfields)});" try: self.client.execute(createquery) except Exception as e: logger.error(f"Cannot create table {plugin}: {e}") return

self.client.commit()

# Insert with quoted table name quotedplugin = quoteidentifier(plugin) for values in valueslist: insertquery = f"INSERT INTO {quotedplugin} VALUES ({', '.join(['?' for in values])});" try: self.client.execute(insertquery, values) except Exception as e: logger.error(f"Cannot insert data into table {plugin}: {e}")

self.client.commit()

Other sources

Glances is an open-source system cross-platform monitoring tool. The GHSA-x46r fix (commit 39161f0) addressed SQL injection in the TimescaleDB export module by converting all SQL operations to use parameterized queries and psycopg.sql composable objects. However, the DuckDB export module (glances/exports/glancesduckdb/init.py) was not included in this fix and contains the same class of vulnerability: table names and column names derived from monitoring statistics are directly interpolated into SQL statements via f-strings. While DuckDB INSERT values already use parameterized queries (? placeholders), the DDL construction and table name references do not escape or parameterize identifier names. Version 4.5.3 provides a more complete fix.

MITRE

Affected Software

2 affected componentsFixes available
pip/Glances<4.5.2
4.5.2
nicolargo Glances<4.5.2

Event History

Mar 16, 2026
Advisory Published
via GitHub·04:34 PM
Data Sourced
via GitHub·04:34 PM
DescriptionSeverityWeaknessAffected Software
Mar 18, 2026
CVE Published
via MITRE·05:21 PM
Data Sourced
via MITRE·05:21 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·06:16 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·06:16 PM
RemedyAffected Software
Apr 18, 58186
Event
via FIRST·11:31 PM
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2026-32611?

CVE-2026-32611 has been identified as a critical vulnerability due to its potential for SQL injection attacks.

2

How do I fix CVE-2026-32611?

To fix CVE-2026-32611, upgrade Glances to version 4.5.2 or later, which includes the patch for this vulnerability.

3

What versions of Glances are affected by CVE-2026-32611?

CVE-2026-32611 affects all versions of Glances prior to 4.5.2.

4

What type of vulnerability is CVE-2026-32611?

CVE-2026-32611 is a SQL injection vulnerability due to unparameterized SQL DDL statements.

5

Who is impacted by CVE-2026-32611?

Developers and users of the Glances application using affected versions are impacted by CVE-2026-32611.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203