JLSEC-2026-2260: Passing too large an alignment to the memalign suite of functions (memalign, posix_memalign,...
Passing too large an alignment to the memalign suite of functions (memalign, posixmemalign, alignedalloc) in the GNU C Library version 2.30 to 2.42 may result in an integer overflow, which could consequently result in a heap corruption.
Note that the attacker must have control over both, the size as well as the alignment arguments of the memalign function to be able to exploit this. The size parameter must be close enough to PTRDIFFMAX so as to overflow sizet along with the large alignment argument. This limits the malicious inputs for the alignment for memalign to the range [1<<62+ 1, 1<<63] and exactly 1<<63 for posixmemalign and alignedalloc.
Typically the alignment argument passed to such functions is a known constrained quantity (e.g. page size, block size, struct sizes) and is not attacker controlled, because of which this may not be easily exploitable in practice. An application bug could potentially result in the input alignment being too large, e.g. due to a different buffer overflow or integer overflow in the application or its dependent libraries, but that is again an uncommon usage pattern given typical sources of alignments.
In GCCBootstrapjll, only the riscv64 glibc sysroot is affected.
Affected Software
Event History
Child vulnerabilities
Contains the following vulnerabilities.
Frequently Asked Questions
What conditions are required for exploitation?
An attacker must control both the allocation size and alignment arguments passed to memalign, posix_memalign, or aligned_alloc. The size must be sufficiently close to PTRDIFF_MAX, and the alignment must be exceptionally large.
Which alignment values are relevant to the overflow condition?
For memalign, the malicious alignment range is [1<<62 + 1, 1<<63]. For posix_memalign and aligned_alloc, the relevant alignment is exactly 1<<63.
How can teams assess whether their application is realistically exposed?
Review calls to the affected allocation functions and trace the sources of both size and alignment values. Exposure is most plausible where both values can be influenced by untrusted input or by another application or dependency bug that produces an oversized alignment.
Is this likely to affect ordinary uses of aligned allocation?
Typically, no: alignment values are commonly fixed or constrained values such as page sizes, block sizes, or structure sizes. The required attacker-controlled, near-limit size and extremely large alignment make exploitation less likely in typical usage patterns.