Cipher.update_into can corrupt memory if passed an immutable python object as the outbuf
Published 7 Feb 2023 · Updated 10 Sept 2026
Is your project on an affected cryptography?
Look after several Python apps? Indie watches up to 15 repos, private ones too, for $5 a month. See Indie
Affected package
- Affected
- >=1.8 <39.0.1
- Fixed in
- 39.0.1
pip install 'cryptography>=39.0.1'Details
Previously, Cipher.update_into would accept Python objects which implement the buffer protocol, but provide only immutable buffers:
>>> outbuf = b"\x00" * 32 >>> c = ciphers.Cipher(AES(b"\x00" * 32), modes.ECB()).encryptor() >>> c.update_into(b"\x00" * 16, outbuf) 16 >>> outbuf b'\xdc\x95\xc0x\xa2@\x89\x89\xadH\xa2\x14\x92\x84 \x87\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
This would allow immutable objects (such as bytes) to be mutated, thus violating fundamental rules of Python. This is a soundness bug -- it allows programmers to misuse an API, it cannot be exploited by attacker controlled data alone.
This now correctly raises an exception.
This issue has been present since update_into was originally introduced in cryptography 1.8.
Is GHSA-w7pp-m8wf-vj6r in any of your client repos?
Checking one package by hand is fine. Checking it across forty client projects is not. NPMscan reads the lockfiles in every GitHub repo you pick, finds each project with an affected cryptography, and gives you the command that fixes it.
More advisories for cryptography
- MediumCVE-2026-69248python-cryptography verifier accepts wildcard DNS names allowing escape from permittedSubtrees · 3 Aug 2026
- HighCVE-2026-69249python-cryptography: Duplicate self-signed intermediates can cause exponential path-building · 3 Aug 2026
- HighCVE-2026-69247cryptography: PKCS#7 EnvelopedData decryption exposes a Bleichenbacher oracle through distinguishable errors and timing · 3 Aug 2026
- HighGHSA-537c-gmf6-5ccfVulnerable OpenSSL included in cryptography wheels · 15 Jun 2026
- MediumCVE-2026-39892Cryptography vulnerable to buffer overflow if non-contiguous buffers were passed to APIs · 8 Apr 2026
- LowCVE-2026-34073cryptography has incomplete DNS name constraint enforcement on peer names · 27 Mar 2026
References
- Linkgithub.com/pyca/cryptography/security/advisories/GHSA-w7pp-m8wf-vj6r
- Advisorynvd.nist.gov/vuln/detail/CVE-2023-23931
- Linkgithub.com/pyca/cryptography/pull/8230
- Linkgithub.com/pyca/cryptography/commit/d6951dca25de45abd52da51b608055371fbcde4e
- Packagegithub.com/pyca/cryptography
- Linkgithub.com/pypa/advisory-database/tree/main/vulns/cryptography/PYSEC-2023-11.yaml
- Linklists.debian.org/debian-lts-announce/2024/10/msg00012.html
- Linksecurity.netapp.com/advisory/ntap-20230324-0007
Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.