CVE-2026-30930: Glances SQL Injection Vulnerability

HIGH
Advisory Identifier: GHSA-x46r-mf5g-xpr6
CWE-89
Published
Advisory Summary

CVE-2026-30930 is a HIGH sql injection vulnerability (CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')) affecting Glances libraries in the PyPI ecosystem. The issue involves glances has sql injection via process names in timescaledb export. Remediation is available by upgrading affected packages to version 4.5.1.

CVE-2026-30930 at a Glance

CVE Identifier CVE-2026-30930
GHSA Identifier GHSA-x46r-mf5g-xpr6
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
Affected Product Glances
Package Ecosystem PyPI
Published Date
Last Updated

How to Fix CVE-2026-30930

To remediate this vulnerability, upgrade all affected Glances dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

Glances fixed: 4.5.1
pip install Glances>=4.5.1
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show Glances

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2026-30930, inspect your installed packages using pip:

pip show Glances

Analyze the terminal output to locate any version of Glances in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.5.1), your application is affected.

Note: The pip show Glances command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'), where the product 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 when it is sent to a downstream component. without sufficient removal or quoting of sql syntax in user-controllable inputs, the generated sql query can cause those inputs to be interpreted as sql instead of ordinary user data. In Glances, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### 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.

CVE-2026-30930 Affected Glances Versions

1 component(s)
Fixed Versions:
4.5.1
Product / Package Ecosystem Affected Versions Fixed Version
Glances
PyPI
< 4.5.1
4.5.1

References

Frequently Asked Questions

What is CVE-2026-30930?
CVE-2026-30930 is a security vulnerability in Glances involving Glances has SQL Injection via Process Names in TimescaleDB Export under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
Which Glances versions are affected?
Affected versions include releases prior to 4.5.1 across affected packages: Glances.
What version fixes CVE-2026-30930?
Upgrading to 4.5.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is Glances affected?
Yes, Glances is affected in releases prior to 4.5.1. Upgrade your dependency to 4.5.1 or later.
What CWE is associated with CVE-2026-30930?
CVE-2026-30930 is classified under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') (The product 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 when it is sent to a downstream component. Without sufficient removal or quoting of SQL syntax in user-controllable inputs, the generated SQL query can cause those inputs to be interpreted as SQL instead of ordinary user data.).
How can I check PyPI dependencies for CVE-2026-30930?
Run the dependency tree command: 'pip show Glances'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-x46r-mf5g-xpr6",
  "modified" : "2026-03-10T18:44:40Z",
  "published" : "2026-03-09T19:51:35Z",
  "aliases" : [ "CVE-2026-30930" ],
  "summary" : "Glances has SQL Injection via Process Names in TimescaleDB Export",
  "details" : "### Summary\n\nThe 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.\n\nRoot 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.\n\n#### Affected Code\n- _File: glances/exports/glances_timescaledb/__init__.py, lines 79-93 (normalize function)_\n```\ndef normalize(self, value):\n    \"\"\"Normalize the value to be exportable to TimescaleDB.\"\"\"\n    if value is None:\n        return 'NULL'\n    if isinstance(value, bool):\n        return str(value).upper()\n    if isinstance(value, (list, tuple)):\n        # Special case for list of one boolean\n        if len(value) == 1 and isinstance(value[0], bool):\n            return str(value[0]).upper()\n        return ', '.join([f\"'{v}'\" for v in value])\n    if isinstance(value, str):\n        return f\"'{value}'\"  # <-- NO ESCAPING of single quotes within value\n\n    return f\"{value}\"\n```\n\n- _File: glances/exports/glances_timescaledb/__init__.py, lines 201-205 (query construction)_\n```\n# Insert the data\ninsert_list = [f\"({','.join(i)})\" for i in values_list]\ninsert_query = f\"INSERT INTO {plugin} VALUES {','.join(insert_list)};\"\nlogger.debug(f\"Insert data into table: {insert_query}\")\ntry:\n    cur.execute(insert_query)  # <-- Direct execution of concatenated SQL\n```\n\n### PoC\n- As a normal user, create a process with the name containing the SQL Injection payload:\n```\nexec -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)]'\n```\n- Start Glances with TimescaleDB export as root user:\n```\nglances --export timescaledb --export-process-filter \".*\" --time 5 --stdout cpu\n```\n- Observe that sqli_proof.txt is created in /tmp directory.\n\n### Impact\n\n- Data Destruction: DROP TABLE, DELETE, TRUNCATE operations against the TimescaleDB database.\n- Data Exfiltration: Using COPY ... TO or subqueries to extract data from other tables.\n- Potential RCE: Via PostgreSQL extensions like COPY ... PROGRAM which executes OS commands.\n- 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.",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "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"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "Glances"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "4.5.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/nicolargo/glances/security/advisories/GHSA-x46r-mf5g-xpr6"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-30930"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nicolargo/glances/commit/39161f0d6fd723d83f534b48f24cdca722573336"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/nicolargo/glances"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nicolargo/glances/releases/tag/v4.5.1"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-89" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-03-09T19:51:35Z",
    "nvd_published_at" : "2026-03-10T18:18:52Z"
  }
}