# CVE-2021-42387: clickhouse: Heap out-of-bounds read in Clickhouse's LZ4 compression codec when parsing a malicious query

CVE-2021-42387 is fixed in 5 products on 1 platform, first by clickhouse-client 18.16.1+ds-7ubuntu0.1, released March 14, 2022. It is not reported as exploited. Patch Radar priority: High.

- Web page: https://patchblox.com/security/cve/CVE-2021-42387
- Priority: High
- CVSS: 8.1 (high)
- EPSS: 0.0157
- CISA KEV: not listed
- Exploited (vendor report): no
- Publicly disclosed: no
- Published: Mar 14, 2022

## Description

Heap out-of-bounds read in Clickhouse's LZ4 compression codec when parsing a malicious query. As part of the LZ4::decompressImpl() loop, a 16-bit unsigned user-supplied value ('offset') is read from the compressed data. The offset is later used in the length of a copy operation, without checking the upper bounds of the source of the copy operation.

## Where it's fixed

| Platform | Product | Fixed in | Fix | Released |
|---|---|---|---|---|
| Linux | clickhouse Debian 12.15 (bookworm) | 18.16.1+ds-7.3 | [DEBIAN-CVE-2021-42387](https://patchblox.com/security/data/fix/linux/debian-cve-2021-42387.md) | Mar 14, 2022 |
| Linux | clickhouse-client Ubuntu 20.04 LTS (focal) | 18.16.1+ds-7ubuntu0.1 | [clickhouse-client 18.16.1+ds-7ubuntu0.1](https://patchblox.com/security/data/fix/linux/ubuntu-focal-clickhouse-client-18.16.1-ds-7ubuntu0.1.md) | Mar 14, 2022 |
| Linux | clickhouse-common Ubuntu 20.04 LTS (focal) | 18.16.1+ds-7ubuntu0.1 | [clickhouse-common 18.16.1+ds-7ubuntu0.1](https://patchblox.com/security/data/fix/linux/ubuntu-focal-clickhouse-common-18.16.1-ds-7ubuntu0.1.md) | Mar 14, 2022 |
| Linux | clickhouse-server Ubuntu 20.04 LTS (focal) | 18.16.1+ds-7ubuntu0.1 | [clickhouse-server 18.16.1+ds-7ubuntu0.1](https://patchblox.com/security/data/fix/linux/ubuntu-focal-clickhouse-server-18.16.1-ds-7ubuntu0.1.md) | Mar 14, 2022 |
| Linux | clickhouse-tools Ubuntu 20.04 LTS (focal) | 18.16.1+ds-7ubuntu0.1 | [clickhouse-tools 18.16.1+ds-7ubuntu0.1](https://patchblox.com/security/data/fix/linux/ubuntu-focal-clickhouse-tools-18.16.1-ds-7ubuntu0.1.md) | Mar 14, 2022 |

---

Data as of 2026-11-08T13:06:02Z UTC. Source: Patchblox Patch Radar (https://patchblox.com/security/patch-radar). Patchblox finds out-of-date software on Windows, macOS and Linux and updates it through release rings: https://patchblox.com/demo

Free to use with attribution: show "Data: Patchblox Patch Radar" with a link to https://patchblox.com/security/patch-radar. Terms, including what needs a written agreement: https://patchblox.com/security/patch-radar/use-the-data

Product names, logos and trademarks shown on Patch Radar belong to their respective owners. They are used only to identify the software each security fix applies to and to help readers find their platform. Their use does not imply any affiliation with, or endorsement by, those owners, and Patchblox is not affiliated with any of them.
