CVE-2024-22412
ClickHouse vulnerability analysis and mitigation

Overview

ClickHouse is an open-source column-oriented database management system that contains a security vulnerability in its query caching mechanism. The vulnerability (CVE-2024-22412) affects the cloud ClickHouse offering prior to version 24.0.2.54535 and github.com/clickhouse/clickhouse version 23.1. The issue was discovered where query caching bypasses role-based access controls and the policies being enforced on roles (GitHub Advisory).

Technical details

The vulnerability stems from the cache key only incorporating the username without considering the role name in the implementation. In affected versions, the query cache only respects separate users but does not properly handle role-based access controls. This occurs because the cache key is generated using only the AST and userName (QueryCache::Key key(ast, context->getUserName())), while ignoring the role information available in the context's EnabledRolesInfo. The issue has been assigned a CVSS v3.1 score of 2.4 (Low) with the vector string CVSS:3.1/AV:A/AC:L/PR:H/UI:N/S:U/C:L/I:N/A:N (GitHub Advisory).

Impact

When query caching is enabled, users can bypass role-based access control lists (ACLs) by switching between different roles. Attackers who have control of a role could potentially guess queries and access data they shouldn't have access to, even when proper role-based policies are in place. This particularly affects scenarios where applications dynamically switch between various roles (GitHub Advisory).

Exploitability

The vulnerability can be exploited by an authenticated user with the ability to switch between roles. The attack requires the query cache to be enabled (use_query_cache=1) and involves switching between different roles that have different row-level security policies. The exploitation is relatively straightforward as it only requires normal query operations with role switching (GitHub Advisory).

Mitigation and workarounds

The issue has been patched in ClickHouse version 24.1 and ClickHouse Cloud version 24.0.2.54535. For users unable to upgrade, the recommended workaround is to avoid using query cache when the application dynamically switches between various roles. Alternatively, users can employ multiple user accounts with distinct roles assigned to them instead of switching roles within a single user account (GitHub Advisory).

Additional resources

Linux Distribution fix status

Fix availability across major Linux distributions and their releases.

Debian

Affected

bookworm

clickhouse

Affected

bullseye

clickhouse

Affected

SourceThis report was generated using AI

Related ClickHouse vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2019-16536HIGH8.2
  • ClickHouse logoClickHouse
  • clickhouse
NoYesMay 21, 2025
CVE-2024-6873HIGH8.1
  • ClickHouse logoClickHouse
  • clickhouse
NoNoAug 01, 2024
CVE-2025-1385HIGH7.5
  • ClickHouse logoClickHouse
  • clickhouse
NoNoMar 20, 2025
CVE-2024-41436HIGH7.5
  • ClickHouse logoClickHouse
  • clickhouse
NoYesSep 03, 2024
CVE-2025-52969NONEN/A
  • ClickHouse logoClickHouse
  • clickhouse
NoNoJun 23, 2025

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management