Crypt::Sodium::XS Integer Overflow Vulnerability in Perl

Vulnerability

A vulnerability exists in Crypt::Sodium::XS versions prior to 0.001000 for Perl, where certain functions do not properly validate output sizes, potentially leading to integer overflows. This issue arises in combined aead encryption, signature creation, and bin2hex functions, where the output size may exceed SIZE_MAX, causing an undersized output buffer. Such a condition can result in crashes for the bin2hex function and encryption algorithms, except for aes256gcm. In the case of aes256gcm encryption and signatures, the undersized buffer could cause a buffer overflow. While this vulnerability is unlikely to be encountered under normal circumstances, as it requires very large message lengths, it poses a significant risk when the input size exceeds specific thresholds related to SIZE_MAX.

Impact

Exploitation of this vulnerability could lead to integer overflow, causing an undersized output buffer. This condition can disrupt the bin2hex function and encryption algorithms, except for aes256gcm. However, for aes256gcm encryption and signatures, the undersized buffer could result in a buffer overflow, creating a more severe risk.

Remediation

Users of Crypt::Sodium::XS should update to version 0.001001 or later. Instructions for updating can be found on MetaCPAN.

Added: Mar 8, 2026, 2:18 AM
Updated: Mar 8, 2026, 2:18 AM

Vulnerability Rating

Custom Algorithm
spread
0.0
impact
7.5
exploitability
6.6
remediation
0.0
relevance
3.8
threat
0.0
urgency
2.9
incentive
0.0

Our algorithm analyzes dozens of metrics to generate these 8 key vulnerability categories, which are then combined to calculate the overall risk score.