CVE-2026-141548: pymonocypher: argon2i_32 can overflow the heap on 32-bit builds when nb_blocks >= 2**22 (work area size wraps)
pymonocypher uses cython to wrap the Monocypher C library. From 4.0.2.4 until 4.0.3.6, argon2i32 in cmonocypher.pyx multiplies nbblocks by 1024 in a 32-bit sizet, causing the allocated work-area size to wrap when nbblocks is at least 222. When the smaller allocation succeeds, cryptoargon2 fills 1024-byte blocks up to nbblocks rounded down to a multiple of four, causing an out-of-bounds heap write that can crash the calling process. If the allocation fails, the call instead raises MemoryError. An affected application must run a 32-bit build and pass an attacker-influenced nbblocks value without bounding it below 222; 64-bit builds and callers enforcing that bound are not affected. This issue is fixed in version 4.0.3.6.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 4.0.3.6
Event History
Frequently Asked Questions
Which deployments are exposed to this issue?
Only 32-bit builds are affected, and only when the application can pass an attacker-influenced nb_blocks value of at least 2**22 to argon2i_32. 64-bit builds and callers that enforce a lower bound are not affected.
What does an attacker need to trigger the flaw?
An attacker needs a way to influence the nb_blocks argument passed to argon2i_32 and set it to at least 2**22. Exploitation also requires user interaction according to the supplied severity vector.
What happens when the vulnerable call is made?
If the undersized wrapped allocation succeeds, crypto_argon2 writes beyond the heap allocation and can crash the calling process. If allocation fails instead, the call raises MemoryError.
What can be done before upgrading?
Ensure nb_blocks is bounded below 2**22 before it reaches argon2i_32, particularly for values derived from untrusted input. Upgrading to version 4.0.3.6 fixes the issue.