{"id":"GHSA-grp3-h8m8-45p7","summary":"Glances has CQL Injection in its Cassandra Export Module via Unsanitized Config Values","details":"## Summary\n\nThe Cassandra export module (`glances/exports/glances_cassandra/__init__.py`) interpolates `keyspace`, `table`, and `replication_factor` configuration values directly into CQL statements without validation. A user with write access to `glances.conf` can redirect all monitoring data to an attacker-controlled Cassandra keyspace.\n\n## Vulnerable Code\n\n```python\n# Line 80\nf\"CREATE KEYSPACE {self.keyspace} WITH \"\nf\"replication = {{ 'class': 'SimpleStrategy', 'replication_factor': '{self.replication_factor}' }}\"\n\n# Line 94\nf\"CREATE TABLE {self.table} (plugin text, time timeuuid, stat map\u003ctext,float\u003e, PRIMARY KEY (plugin, time)) WITH CLUSTERING ORDER BY (time DESC)\"\n\n# Line 112\nstmt = f\"INSERT INTO {self.table} (plugin, time, stat) VALUES (?, ?, ?)\"\n```\n\n## Steps to Reproduce\n\n1. Configure `glances.conf` with malicious `table` value:\n```ini\n[cassandra]\nhost = 127.0.0.1\nport = 9042\nkeyspace = glances\ntable = attacker_ks.captured_stats\n```\n2. Create attacker keyspace in Cassandra\n3. Run `glances --export cassandra`\n4. All monitoring data is written to `attacker_ks.captured_stats` instead of the legitimate table\n\n**Confirmed output:**\n```\nINSERT stmt: INSERT INTO attacker_ks.captured_stats (plugin, time, stat) VALUES (?, ?, ?)\nLegitimate table row count: 0\nAttacker table row count: 1\n[CONFIRMED] plugin=cpu, stat={'user': 50.0}\n```\n\n## Impact\n\nAll exported monitoring data (CPU, memory, network, disk I/O) is silently redirected to an attacker-controlled Cassandra keyspace — both data exfiltration and data loss.\n\n## Proposed Fix\n\n```python\nimport re\n\ndef _validate_cql_identifier(name: str) -\u003e str:\n    if not re.match(r'^[a-zA-Z_][a-zA-Z0-9_.]*$', name):\n        raise ValueError(f\"Invalid CQL identifier: {name!r}\")\n    return name\n\n# In __init__(): validate before use\nself.keyspace = _validate_cql_identifier(self.keyspace)\nself.table = _validate_cql_identifier(self.table)\n```\n\n![PoC](https://raw.githubusercontent.com/n0z0/cve-evidence/main/2026-04/20260403_004238_glances_cassandra_cql_injection_poc.png)","aliases":["CVE-2026-35588","PYSEC-2026-2177"],"modified":"2026-07-13T07:26:16.616294022Z","published":"2026-04-21T15:18:58Z","database_specific":{"github_reviewed":true,"github_reviewed_at":"2026-04-21T15:18:58Z","nvd_published_at":"2026-04-21T00:16:29Z","cwe_ids":["CWE-89"],"severity":"MODERATE"},"references":[{"type":"WEB","url":"https://github.com/nicolargo/glances/security/advisories/GHSA-grp3-h8m8-45p7"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-35588"},{"type":"WEB","url":"https://github.com/nicolargo/glances/commit/d339181f03a14bb15506307e9d58f876e23d8160"},{"type":"WEB","url":"https://github.com/nicolargo/glances/commit/e41b665576f9fd5374e3152078726cc59a01e48c"},{"type":"PACKAGE","url":"https://github.com/nicolargo/glances"}],"affected":[{"package":{"name":"glances","ecosystem":"PyPI","purl":"pkg:pypi/glances"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"4.5.4"}]}],"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","1.7.3","1.7.4","1.7.5","1.7.6","1.7.7","2.0","2.0.1","2.1","2.1.1","2.1.2","2.10","2.11","2.11.1","2.2","2.2.1","2.3","2.4","2.4.1","2.4.2","2.5","2.5.1","2.6","2.6.1","2.6.2","2.7","2.7.1","2.8","2.8.1","2.8.2","2.8.3","2.8.4","2.8.5","2.8.6","2.8.7","2.8.8","2.9.0","2.9.1","3.0","3.0.1","3.0.2","3.1.0","3.1.1","3.1.2","3.1.3","3.1.4","3.1.4.1","3.1.5","3.1.6","3.1.6.1","3.1.6.2","3.1.7","3.2.0","3.2.1","3.2.2","3.2.3","3.2.3.1","3.2.4","3.2.4.1","3.2.4.2","3.2.5","3.2.6.1","3.2.6.2","3.2.6.3","3.2.6.4","3.2.7","3.3.0","3.3.0.1","3.3.0.2","3.3.0.3","3.3.0.4","3.3.1","3.3.1.1","3.4.0","3.4.0.1","3.4.0.2","3.4.0.3","3.4.0.4","3.4.0.5","4.0.1","4.0.2","4.0.3","4.0.4","4.0.5","4.0.6","4.0.7","4.0.8","4.1.0","4.1.1","4.1.2","4.2.0","4.2.1","4.3.0","4.3.0.1","4.3.0.3","4.3.0.4","4.3.0.5","4.3.0.6","4.3.0.7","4.3.0.8","4.3.1","4.3.2","4.3.3","4.4.0","4.4.1","4.5.0","4.5.0.1","4.5.0.2","4.5.0.3","4.5.0.4","4.5.0.5","4.5.1","4.5.2","4.5.3"],"database_specific":{"source":"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/04/GHSA-grp3-h8m8-45p7/GHSA-grp3-h8m8-45p7.json"}}],"schema_version":"1.9.0","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:L/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:L"}]}