---
id: "CVE-2022-37454"
page: "https://infrastack.ai/live/CVE-2022-37454"
kind: "vulnerability"
aliases: ["CVE-2022-37454", "GHSA-6w4m-2xhg-2658"]
title: "Buffer overflow in sponge queue functions"
severity: "critical"
cvss: 9.8
epss: 0.07413
exploited: false
status: "open"
category: "package"
products: [{"name": "pysha3", "fixed": [], "affected": "<= 1.0.2", "ecosystem": "pypi"}, {"name": "sha3", "fixed": ["1.0.5"], "affected": "< 1.0.5", "ecosystem": "rubygems"}, {"name": "extended keccak code package project extended keccak code package", "fixed": [], "affected": "", "ecosystem": "vendor"}, {"name": "debian linux", "fixed": [], "affected": "= 10.0", "ecosystem": "vendor"}, {"name": "debian linux", "fixed": [], "affected": "= 11.0", "ecosystem": "vendor"}, {"name": "fedoraproject fedora", "fixed": [], "affected": "= 35", "ecosystem": "vendor"}, {"name": "fedoraproject fedora", "fixed": [], "affected": "= 36", "ecosystem": "vendor"}, {"name": "php", "fixed": ["7.4.33"], "affected": ">= 7.2.0, < 7.4.33", "ecosystem": "vendor"}, {"name": "php", "fixed": ["8.0.25"], "affected": ">= 8.0.0, < 8.0.25", "ecosystem": "vendor"}, {"name": "php", "fixed": ["8.1.12"], "affected": ">= 8.1.0, < 8.1.12", "ecosystem": "vendor"}, {"name": "python", "fixed": ["3.7.16"], "affected": ">= 3.6.0, < 3.7.16", "ecosystem": "vendor"}, {"name": "python", "fixed": ["3.8.16"], "affected": ">= 3.8.0, < 3.8.16", "ecosystem": "vendor"}, {"name": "python", "fixed": ["3.9.16"], "affected": ">= 3.9.0, < 3.9.16", "ecosystem": "vendor"}, {"name": "python", "fixed": ["3.10.9"], "affected": ">= 3.10.0, < 3.10.9", "ecosystem": "vendor"}, {"name": "sha3 project sha3", "fixed": ["1.0.5"], "affected": "< 1.0.5", "ecosystem": "vendor"}, {"name": "pysha3 project pysha3", "fixed": [], "affected": "", "ecosystem": "vendor"}, {"name": "pypy", "fixed": [], "affected": ">= 7.0.0", "ecosystem": "vendor"}]
ecosystems: ["pypi", "rubygems", "vendor"]
tags: ["cwe-190", "package", "pysha3", "python", "ruby", "sha3"]
not_affected_if: ["default-config", "input-size-capped"]
published_at: "2022-10-21T06:15:09+00:00"
first_seen_at: "2026-11-16T16:08:25+00:00"
updated_at: "2026-11-16T16:38:06+00:00"
sources: [{"source": "ghsa", "url": "https://github.com/advisories/GHSA-6w4m-2xhg-2658", "first_seen_at": "2026-11-16T16:08:25+00:00"}, {"source": "nvd", "url": "https://nvd.nist.gov/vuln/detail/CVE-2022-37454", "first_seen_at": "2026-11-16T16:38:06+00:00"}]
exploit_sources: [{"type": "poc", "url": "https://mouha.be/sha-3-buffer-overflow/"}, {"type": "epss", "score": 0.07413, "url": "https://api.first.org/data/v1/epss?cve=CVE-2022-37454"}]
---

# Buffer overflow in sponge queue functions

Link for people: https://infrastack.ai/live/CVE-2022-37454 (this .md is for agents)

The sha3 Ruby gem and pysha3 Python package, which wrap the Keccak sponge code, can overflow a buffer when partial input of about 2^32 - 200 bytes or more is queued. An attacker who controls that input may be able to corrupt memory and run code.

_Summary, check and fix written by a model from the sources; labelled as such._

## Affected

- pypi:pysha3 affected <= 1.0.2 fixed no fixed version listed
- rubygems:sha3 affected < 1.0.5 fixed 1.0.5
- vendor:extended keccak code package project extended keccak code package affected range not listed fixed no fixed version listed
- vendor:debian linux affected = 10.0 fixed no fixed version listed
- vendor:debian linux affected = 11.0 fixed no fixed version listed
- vendor:fedoraproject fedora affected = 35 fixed no fixed version listed
- vendor:fedoraproject fedora affected = 36 fixed no fixed version listed
- vendor:php affected >= 7.2.0, < 7.4.33 fixed 7.4.33
- vendor:php affected >= 8.0.0, < 8.0.25 fixed 8.0.25
- vendor:php affected >= 8.1.0, < 8.1.12 fixed 8.1.12
- vendor:python affected >= 3.6.0, < 3.7.16 fixed 3.7.16
- vendor:python affected >= 3.8.0, < 3.8.16 fixed 3.8.16
- vendor:python affected >= 3.9.0, < 3.9.16 fixed 3.9.16
- vendor:python affected >= 3.10.0, < 3.10.9 fixed 3.10.9
- vendor:sha3 project sha3 affected < 1.0.5 fixed 1.0.5
- vendor:pysha3 project pysha3 affected range not listed fixed no fixed version listed
- vendor:pypy affected >= 7.0.0 fixed no fixed version listed

## How to check

- Check the installed `sha3` gem version with `gem list sha3`; affected below `1.0.5`.
- Check the installed `pysha3` version with `pip show pysha3`; affected at `1.0.2` and below.
- Look for code that calls the queue (partial absorb or squeeze) functions with very large inputs fed from outside.

## Fix

- `sha3` (RubyGems): `1.0.5`
- `pysha3` (PyPI): unknown

## Timeline

- 2026-11-16T16:08:25+00:00 ghsa https://github.com/advisories/GHSA-6w4m-2xhg-2658
- 2026-11-16T16:38:06+00:00 nvd https://nvd.nist.gov/vuln/detail/CVE-2022-37454

## Documents

- [advisory] Maintainer's advisory: api.github.com https://api.github.com/repos/XKCP/XKCP/security-advisories/GHSA-6w4m-2xhg-2658
- [advisory] Third-party advisory: csrc.nist.gov https://csrc.nist.gov/projects/hash-functions/sha-3-project
- [advisory] Third-party advisory: lists.debian.org https://lists.debian.org/debian-lts-announce/2022/10/msg00041.html
- [advisory] Third-party advisory: lists.debian.org https://lists.debian.org/debian-lts-announce/2022/11/msg00000.html
- [advisory] Third-party advisory: lists.fedoraproject.org https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/3ALQ6BDDPX5HU5YBQOBMDVAA2TSGDKIJ/
- [advisory] Third-party advisory: lists.fedoraproject.org https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/CMIEXLMTW5GO36HTFFWIPB3OHZXCT3G4/
- [advisory] Third-party advisory: www.debian.org https://www.debian.org/security/2022/dsa-5269
- [advisory] Third-party advisory: news.ycombinator.com https://news.ycombinator.com/item?id=33281106
- [advisory] Third-party advisory: www.debian.org https://www.debian.org/security/2022/dsa-5267
- [fix] Patch: github.com https://github.com/XKCP/XKCP/security/advisories/GHSA-6w4m-2xhg-2658
- [poc] Exploit: mouha.be https://mouha.be/sha-3-buffer-overflow/

## From the sources

### 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](https://github.com/XKCP/XKCP/commit/fdc6fef075f4e81d6b1bc38364248975e08e340a).

### 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](https://github.com/XKCP/XKCP/issues/105) for more details.

---

_Free to read, with fair use of about 60 pages a minute. For higher limits or API access: sales@infrastack.ai_
