CVE-2022-37454: Buffer overflow in sponge queue functions
Impact
The Keccak sponge function interface accepts partial inputs to be absorbed and partial outputs to be squeezed. A buffer can overflow when partial data with some specific sizes are queued, where at least one of them has a length of 2^32 - 200 bytes or more.
Patches
Yes, see commit fdc6fef0.
Workarounds
The problem can be avoided by limiting the size of the partial input data (or partial output digest) below 2^32 - 200 bytes. Multiple calls to the queue system can be chained at a higher level to retain the original functionality. Alternatively, one can process the entire input (or produce the entire output) at once, avoiding the queuing functions altogether.
References
See issue #105 for more details.
Other sources
Fixed bug : buffer overflow in hashupdate() on long parameter. (CVE-2022-37454)
— PHP
The Keccak XKCP SHA-3 reference implementation before fdc6fef has an integer overflow and resultant buffer overflow that allows attackers to execute arbitrary code or eliminate expected cryptographic properties. This occurs in the sponge function interface.
— Launchpad
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
debian/pysha3to a version that resolves this vulnerability.Fixed in 1.0.2-4.1+deb11u1Fixed in 1.0.2-5 - Upgrade
Upgrade
PHPto a version that resolves this vulnerability.Fixed in 8.0.25 - Upgrade
Upgrade
rubygems/sha3to a version that resolves this vulnerability.Fixed in 1.0.5 - Upgrade
Upgrade
ubuntu/pysha3to a version that resolves this vulnerability.Fixed in 1.0.0-0ubuntu1~ubuntu16.04.2+esm1 - Upgrade
Upgrade
ubuntu/php7.2to a version that resolves this vulnerability.Fixed in 7.2.24-0ubuntu0.18.04.15 - Upgrade
Upgrade
ubuntu/python3.6to a version that resolves this vulnerability.Fixed in 3.6.9-1~18.04ubuntu1.10 - Upgrade
Upgrade
ubuntu/pysha3to a version that resolves this vulnerability.Fixed in 1.0.2-2ubuntu2+esm1 - Upgrade
Upgrade
ubuntu/python3.7to a version that resolves this vulnerability.Fixed in 3.7.5-2ubuntu1~18.04.2+esm2 - Upgrade
Upgrade
ubuntu/python3.8to a version that resolves this vulnerability.Fixed in 3.8.0-3ubuntu1~18.04.2+esm1 - Upgrade
Upgrade
ubuntu/php7.4to a version that resolves this vulnerability.Fixed in 7.4.3-4ubuntu2.15 - Upgrade
Upgrade
ubuntu/pypy3to a version that resolves this vulnerability.Fixed in 7.3.1+dfsg-4ubuntu0.1 - Upgrade
Upgrade
ubuntu/pysha3to a version that resolves this vulnerability.Fixed in 1.0.2-4ubuntu0.1 - Upgrade
Upgrade
ubuntu/python3.8to a version that resolves this vulnerability.Fixed in 3.8.10-0ubuntu1~20.04.6 - Upgrade
Upgrade
ubuntu/python3.9to a version that resolves this vulnerability.Fixed in 3.9.5-3ubuntu0~20.04.1+esm1 - Upgrade
Upgrade
ubuntu/php8.1to a version that resolves this vulnerability.Fixed in 8.1.2-1ubuntu2.8 - Upgrade
Upgrade
ubuntu/pypy3to a version that resolves this vulnerability.Fixed in 7.3.9+dfsg-1ubuntu0.1 - Upgrade
Upgrade
ubuntu/pysha3to a version that resolves this vulnerability.Fixed in 1.0.2-4.2ubuntu0.22.04.1 - Upgrade
Upgrade
ubuntu/python3.10to a version that resolves this vulnerability.Fixed in 3.10.6-1~22.04.2 - Upgrade
Upgrade
debian/pypy3to a version that resolves this vulnerability.Fixed in 7.3.9+dfsg-5 - Upgrade
Upgrade
alpine/php7to a version that resolves this vulnerability.Fixed in 7.4.33-r0 - Upgrade
Upgrade
alpine/php8to a version that resolves this vulnerability.Fixed in 8.0.25-r0 - Upgrade
Upgrade
alpine/php81to a version that resolves this vulnerability.Fixed in 8.1.12-r0 - Upgrade
Upgrade
alpine/php82to a version that resolves this vulnerability.Fixed in 8.2.0_rc5-r0 - Upgrade
Upgrade
alpine/python3to a version that resolves this vulnerability.Fixed in 3.10.9-r0 - Upgrade
Upgrade
debian/pypy3to a version that resolves this vulnerability.Fixed in 7.3.5+dfsg-2+deb11u2Fixed in 7.3.9+dfsg-5 - Upgrade
Upgrade
debian/php7.3to a version that resolves this vulnerability.Fixed in 7.3.31-1~deb10u2 - Upgrade
Upgrade
debian/php7.4to a version that resolves this vulnerability.Fixed in 7.4.33-1+deb11u1 - Upgrade
Upgrade
debian/php8.1to a version that resolves this vulnerability.Fixed in 8.1.12-1 - Upgrade
Upgrade
debian/pysha3to a version that resolves this vulnerability.Fixed in 1.0.2-2+deb10u1Fixed in 1.0.2-4.1+deb11u1Fixed in 1.0.2-5 - Upgrade
Upgrade
debian/python3.10to a version that resolves this vulnerability.Fixed in 3.10.9-1 - Upgrade
Upgrade
debian/python3.7to a version that resolves this vulnerability.Fixed in 3.7.3-2+deb10u4 - Upgrade
Upgrade
debian/python3.9to a version that resolves this vulnerability.Fixed in 3.9.2-1+deb11u4 - Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Patch fdc6fef075f4e81d6b1bc38364248975e08e340a - Compensating control
Until patched, avoid the sponge queue functions by processing the entire input or output at once, or keep each partial input or output below 2^32 - 200 bytes. To retain queue functionality, chain multiple calls to the queue system at a higher level.
Event History
Peer vulnerabilities
Found alongside the following vulnerabilities.
Frequently Asked Questions
What is CVE-2022-37454?
CVE-2022-37454 is a fixed bug in the Keccak XKCP SHA-3 reference implementation that allows attackers to execute arbitrary code or eliminate expected cryptographic properties.
How does CVE-2022-37454 impact PHP?
CVE-2022-37454 affects PHP versions up to 7.4.33 and can be exploited to execute arbitrary code.
How can I fix CVE-2022-37454 in PHP?
To fix CVE-2022-37454 in PHP, update to version 7.4.33 or later.
What is the affected software for CVE-2022-37454?
The affected software includes PHP versions up to 7.4.33, PHP 7.3.31-1~deb10u4, PHP 7.4.33-1+deb11u3 and 7.4.33-1+deb11u4, PyPy3 versions 7.0.0+dfsg-3, 7.3.5+dfsg-2+deb11u2, 7.3.11+dfsg-2, and 7.3.12+dfsg-1, pysha3 versions 1.0.2-2+deb10u1 and 1.0.2-4.1+deb11u1, Python 2.7.16-2+deb10u1, 2.7.16-2+deb10u2, and 2.7.18-8, Python 3.10.12-1, Python 3.7.3-2+deb10u5, and Python 3.9 versions up to 3.9.2-1.
Where can I find more information about CVE-2022-37454?
More information about CVE-2022-37454 can be found in the PHP changelog at https://www.php.net/ChangeLog-7.php#7.4.33 and the XKCP/XKCP GitHub repository at https://github.com/XKCP/XKCP/security/advisories/GHSA-6w4m-2xhg-2658. The specific fix is available in the commit fdc6fef075f4e81d6b1bc38364248975e08e340a.