# CVE-2020-14382: Integer overflow in cryptsetup

> An integer overflow in cryptsetup's LUKS2 validation allows attackers to cause memory corruption via crafted images, potentially leading to code execution or crashes.

- **Severity:** High 7.8 (`CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Local or same network only
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 16 Sep 2020
- **Updated:** 4 Aug 2024
- **Also known as:** ALPINE-CVE-2020-14382, DEBIAN-CVE-2020-14382, GHSA-v8mw-xqhr-2vqp, RHSA-2020:4542, RHSA-2020:4900, RHSA-2021:0258, UBUNTU-CVE-2020-14382, USN-4493-1, openSUSE-SU-2024:10704-1

## What is CVE-2020-14382?

CVE-2020-14382 is a high-severity vulnerability in Canonical Ubuntu Linux, published on 16 Sep 2020. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.

### Official description

A vulnerability was found in upstream release cryptsetup-2.2.0 where, there's a bug in LUKS2 format validation code, that is effectively invoked on every device/image presenting itself as LUKS2 container. The bug is in segments validation code in file 'lib/luks2/luks2_json_metadata.c' in function hdr_validate_segments(struct crypt_device *cd, json_object *hdr_jobj) where the code does not check for possible overflow on memory allocation used for intervals array (see statement "intervals = malloc(first_backup * sizeof(*intervals));"). Due to the bug, library can be *tricked* to expect such allocation was successful but for far less memory then originally expected. Later it may read data FROM image crafted by an attacker and actually write such data BEYOND allocated memory.

Weakness: CWE-787 (Out-of-bounds Write)

## Which versions are affected by CVE-2020-14382?

It affects 4 products.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `cryptsetup-debuginfo` | Red Hat:enterprise_linux:8::appstream | All versions | 0:2.3.3-2.el8 |
| `cryptsetup-debugsource` | Red Hat:enterprise_linux:8::appstream | All versions | 0:2.3.3-2.el8 |
| `cryptsetup-devel` | Red Hat:enterprise_linux:8::appstream | All versions | 0:2.3.3-2.el8 |
| `cryptsetup-libs-debuginfo` | Red Hat:enterprise_linux:8::appstream | All versions | 0:2.3.3-2.el8 |
| `cryptsetup-reencrypt-debuginfo` | Red Hat:enterprise_linux:8::appstream | All versions | 0:2.3.3-2.el8 |
| `integritysetup-debuginfo` | Red Hat:enterprise_linux:8::appstream | All versions | 0:2.3.3-2.el8 |
| `veritysetup-debuginfo` | Red Hat:enterprise_linux:8::appstream | All versions | 0:2.3.3-2.el8 |
| `cryptsetup` | Red Hat:enterprise_linux:8::baseos | All versions | 0:2.3.3-2.el8 |
| `cryptsetup-debuginfo` | Red Hat:enterprise_linux:8::baseos | All versions | 0:2.3.3-2.el8 |
| `cryptsetup-debugsource` | Red Hat:enterprise_linux:8::baseos | All versions | 0:2.3.3-2.el8 |
| `cryptsetup-libs` | Red Hat:enterprise_linux:8::baseos | All versions | 0:2.3.3-2.el8 |
| `cryptsetup-libs-debuginfo` | Red Hat:enterprise_linux:8::baseos | All versions | 0:2.3.3-2.el8 |
| `cryptsetup-reencrypt` | Red Hat:enterprise_linux:8::baseos | All versions | 0:2.3.3-2.el8 |
| `cryptsetup-reencrypt-debuginfo` | Red Hat:enterprise_linux:8::baseos | All versions | 0:2.3.3-2.el8 |
| `integritysetup` | Red Hat:enterprise_linux:8::baseos | All versions | 0:2.3.3-2.el8 |
| `integritysetup-debuginfo` | Red Hat:enterprise_linux:8::baseos | All versions | 0:2.3.3-2.el8 |
| `veritysetup` | Red Hat:enterprise_linux:8::baseos | All versions | 0:2.3.3-2.el8 |
| `veritysetup-debuginfo` | Red Hat:enterprise_linux:8::baseos | All versions | 0:2.3.3-2.el8 |
| `cryptsetup-debuginfo` | Red Hat:rhel_eus:8.1::appstream | All versions | 0:2.2.0-2.el8_1.1 |
| `cryptsetup-debugsource` | Red Hat:rhel_eus:8.1::appstream | All versions | 0:2.2.0-2.el8_1.1 |
| `cryptsetup-devel` | Red Hat:rhel_eus:8.1::appstream | All versions | 0:2.2.0-2.el8_1.1 |
| `cryptsetup-libs-debuginfo` | Red Hat:rhel_eus:8.1::appstream | All versions | 0:2.2.0-2.el8_1.1 |
| `cryptsetup-reencrypt-debuginfo` | Red Hat:rhel_eus:8.1::appstream | All versions | 0:2.2.0-2.el8_1.1 |
| `integritysetup-debuginfo` | Red Hat:rhel_eus:8.1::appstream | All versions | 0:2.2.0-2.el8_1.1 |
| `veritysetup-debuginfo` | Red Hat:rhel_eus:8.1::appstream | All versions | 0:2.2.0-2.el8_1.1 |
| `cryptsetup` | Red Hat:rhel_eus:8.1::baseos | All versions | 0:2.2.0-2.el8_1.1 |
| `cryptsetup-debuginfo` | Red Hat:rhel_eus:8.1::baseos | All versions | 0:2.2.0-2.el8_1.1 |
| `cryptsetup-debugsource` | Red Hat:rhel_eus:8.1::baseos | All versions | 0:2.2.0-2.el8_1.1 |
| `cryptsetup-libs` | Red Hat:rhel_eus:8.1::baseos | All versions | 0:2.2.0-2.el8_1.1 |
| `cryptsetup-libs-debuginfo` | Red Hat:rhel_eus:8.1::baseos | All versions | 0:2.2.0-2.el8_1.1 |
| `cryptsetup-reencrypt` | Red Hat:rhel_eus:8.1::baseos | All versions | 0:2.2.0-2.el8_1.1 |
| `cryptsetup-reencrypt-debuginfo` | Red Hat:rhel_eus:8.1::baseos | All versions | 0:2.2.0-2.el8_1.1 |
| `integritysetup` | Red Hat:rhel_eus:8.1::baseos | All versions | 0:2.2.0-2.el8_1.1 |
| `integritysetup-debuginfo` | Red Hat:rhel_eus:8.1::baseos | All versions | 0:2.2.0-2.el8_1.1 |
| `veritysetup` | Red Hat:rhel_eus:8.1::baseos | All versions | 0:2.2.0-2.el8_1.1 |
| `veritysetup-debuginfo` | Red Hat:rhel_eus:8.1::baseos | All versions | 0:2.2.0-2.el8_1.1 |
| `cryptsetup-debuginfo` | Red Hat:rhel_eus:8.2::appstream | All versions | 0:2.2.2-1.el8_2.1 |
| `cryptsetup-debugsource` | Red Hat:rhel_eus:8.2::appstream | All versions | 0:2.2.2-1.el8_2.1 |
| `cryptsetup-devel` | Red Hat:rhel_eus:8.2::appstream | All versions | 0:2.2.2-1.el8_2.1 |
| `cryptsetup-libs-debuginfo` | Red Hat:rhel_eus:8.2::appstream | All versions | 0:2.2.2-1.el8_2.1 |

Products: Canonical Ubuntu Linux, Cryptsetup Project Cryptsetup, Fedoraproject Fedora, Redhat Enterprise Linux.

## How do I fix CVE-2020-14382?

Apply the vendor's patch.

## Is CVE-2020-14382 being exploited?

There is no known exploitation of CVE-2020-14382 in the wild and no public exploit code.

## Other vulnerabilities in Canonical Ubuntu Linux

- [CVE-2020-11651](https://insights.sbomify.com/CVE-2020-11651/): SaltStack Salt Authentication Bypass (critical 9.8, exploited in the wild)
- [CVE-2020-7247](https://insights.sbomify.com/CVE-2020-7247/): OpenSMTPD Remote Code Execution (critical 9.8, exploited in the wild)
- [CVE-2019-16928](https://insights.sbomify.com/CVE-2019-16928/): Exim Out-of-bounds Write (critical 9.8, exploited in the wild)
- [CVE-2018-6789](https://insights.sbomify.com/CVE-2018-6789/): Exim Buffer Overflow (critical 9.8, exploited in the wild)
- [CVE-2015-2590](https://insights.sbomify.com/CVE-2015-2590/): Oracle Java SE and Java SE Embedded Remote Code Execution (critical 9.8, exploited in the wild)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2020-14382 and fix it if it is affected.

What it is: CVE-2020-14382 is a high-severity vulnerability in Canonical Ubuntu Linux, published on 16 Sep 2020. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2020-14382 in the wild and no public exploit code.

Affected product: Canonical Ubuntu Linux. No package-level version data is available, so check the vendor advisory linked from the reference page.

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2020-14382/ (Markdown: https://insights.sbomify.com/CVE-2020-14382/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2020-14382
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2020-14382
- OSV: https://osv.dev/vulnerability/CVE-2020-14382

---
From sbomify Insights: https://insights.sbomify.com/CVE-2020-14382/
Summaries are generated and may contain mistakes; the official description above is the record.
