# CVE-2026-40200: Memory corruption in musl

> Stack-based memory corruption in musl libc qsort allows code execution or denial of service when sorting extremely large arrays.

- **Severity:** High 8.1 (`CVSS:3.1/AV:L/AC:H/PR:N/UI:N/S:C/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:** Not needed
- **Fix available:** Yes
- **Published:** 10 Apr 2026
- **Updated:** 14 Apr 2026
- **Also known as:** ALPINE-CVE-2026-40200, BELL-CVE-2026-40200, DEBIAN-CVE-2026-40200, ECHO-44b5-f48b-3822, GHSA-qrwv-475h-2439, ROOT-OS-ALPINE-315-CVE-2026-40200, ROOT-OS-ALPINE-317-CVE-2026-40200, ROOT-OS-ALPINE-318-CVE-2026-40200, UBUNTU-CVE-2026-40200

## What is CVE-2026-40200?

CVE-2026-40200 is a high-severity memory corruption vulnerability in musl-libc musl, published on 10 Apr 2026. It can only be exploited from the same machine or local network, with no action from the victim.

### Official description

An issue was discovered in musl libc 0.7.10 through 1.2.6. Stack-based memory corruption can occur during qsort of very large arrays, due to incorrectly implemented double-word primitives. The number of elements must exceed about seven million, i.e., the 32nd Leonardo number on 32-bit platforms (or the 64th Leonardo number on 64-bit platforms, which is not practical).

Weakness: CWE-670 (Always-Incorrect Control Flow Implementation)

## Which versions are affected by CVE-2026-40200?


## How do I fix CVE-2026-40200?

Apply the vendor's patch.

## Is CVE-2026-40200 being exploited?

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

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-40200 and fix it if it is affected.

What it is: CVE-2026-40200 is a high-severity memory corruption vulnerability in musl-libc musl, published on 10 Apr 2026. It can only be exploited from the same machine or local network, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2026-40200 in the wild and no public exploit code.

Affected product: musl-libc musl. 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-2026-40200/ (Markdown: https://insights.sbomify.com/CVE-2026-40200/index.md)
```

## Sources

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

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