{"id":"CVE-2023-23931","aliases":["CVE-2023-23931","GHSA-w7pp-m8wf-vj6r","PYSEC-2023-11"],"related":[],"kind":"vulnerability","state":"published","title":"Cipher.update_into can corrupt memory in pyca cryptography","summary":"cryptography is a package designed to expose cryptographic primitives and recipes to Python developers. In affected versions `Cipher.update_into` would accept Python objects which implement the buffer protocol, but provide only immutable buffers. This would allow immutable objects (such as `bytes`) to be mutated, thus violating fundamental rules of Python and resulting in corrupted output. This now correctly raises an exception. This issue has been present since `update_into` was originally introduced in cryptography 1.8.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"cryptography is a package designed to expose cryptographic primitives and recipes to Python developers. In affected versions `Cipher.update_into` would accept Python objects which implement the buffer protocol, but provide only immutable buffers. This would allow immutable objects (such as `bytes`) to be mutated, thus violating fundamental rules of Python and resulting in corrupted output. This now correctly raises an exception. This issue has been present since `update_into` was originally introduced in cryptography 1.8.","source":"cvelist"},{"lang":"en","text":"Previously, `Cipher.update_into` would accept Python objects which implement the buffer protocol, but provide only immutable buffers:\n\n```pycon\n>>> outbuf = b\"\\x00\" * 32\n>>> c = ciphers.Cipher(AES(b\"\\x00\" * 32), modes.ECB()).encryptor()\n>>> c.update_into(b\"\\x00\" * 16, outbuf)\n16\n>>> outbuf\nb'\\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'\n```\n\nThis 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.\n\nThis now correctly raises an exception.\n\nThis issue has been present since `update_into` was originally introduced in cryptography 1.8.","format":"markdown","source":"ghsa"}],"published":"2023-02-07T20:54:03.628Z","modified":"2026-09-10T03:49:52.124Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:L","score":4.8,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:L","score":4.8,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:L","score":6.5,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:L/VA:L/SC:N/SI:N/SA:N","rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:L","score":6.5,"rating":"MEDIUM"}],"cwes":["CWE-754"],"affected":[{"ranges":[{"version":">=1.8, < 39.0.1","status":"affected"}],"vendor":"pyca","product":"cryptography","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"1.8","status":"affected","fixed":"39.0.1"}],"ecosystem":"PyPI","package":"cryptography","purl":"pkg:pypi/cryptography","source":"ghsa"},{"ranges":[{"status":"affected","introduced":"1.8","fixed":"39.0.1"}],"vendor":"cryptography.io","product":"cryptography","cpe":"cpe:2.3:a:cryptography.io:cryptography:*:*:*:*:*:python:*:*","source":"nvd"},{"ranges":[{"type":"git","introduced":"0","status":"affected","fixed":"94a50a9731f35405f0357fa5f3b177d46a726ab3"},{"type":"ecosystem","introduced":"1.8","status":"affected","fixed":"39.0.1"}],"ecosystem":"PyPI","package":"cryptography","purl":"pkg:pypi/cryptography","repo":"https://github.com/pyca/cryptography","source":"pysec"}],"references":[{"url":"https://github.com/pyca/cryptography/security/advisories/GHSA-w7pp-m8wf-vj6r","tags":["advisory","evidence","exploit","vendor-advisory","web","x-refsource-confirm","x-transferred"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/pyca/cryptography/pull/8230/commits/94a50a9731f35405f0357fa5f3b177d46a726ab3","tags":["fix","patch","x-refsource-misc","x-transferred"],"sources":["cvelist","nvd","pysec"]},{"url":"https://security.netapp.com/advisory/ntap-20230324-0007/","tags":[],"sources":["cvelist","nvd"]},{"url":"https://lists.debian.org/debian-lts-announce/2024/10/msg00012.html","tags":["web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2023-23931","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/pyca/cryptography/pull/8230","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/pyca/cryptography/commit/d6951dca25de45abd52da51b608055371fbcde4e","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/pyca/cryptography","tags":["package"],"sources":["ghsa"]},{"url":"https://github.com/pypa/advisory-database/tree/main/vulns/cryptography/PYSEC-2023-11.yaml","tags":["web"],"sources":["ghsa"]},{"url":"https://security.netapp.com/advisory/ntap-20230324-0007","tags":["web"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"partial","date":"2025-03-10T21:01:11.762Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2023-23931","url":"https://www.cve.org/CVERecord?id=CVE-2023-23931","licence":"CVE Terms of Use","modified":"2025-11-03T21:47:19.856Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-w7pp-m8wf-vj6r","url":"https://github.com/advisories/GHSA-w7pp-m8wf-vj6r","licence":"CC-BY-4.0","modified":"2026-09-10T03:49:52.124Z"},{"source":"nvd","name":"NVD","id":"CVE-2023-23931","url":"https://nvd.nist.gov/vuln/detail/CVE-2023-23931","licence":"Public domain","modified":"2026-06-17T05:38:18.920Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2023-11","url":"https://osv.dev/vulnerability/PYSEC-2023-11","licence":"CC-BY-4.0","modified":"2026-02-22T22:48:42.243Z"}],"updatedAt":"2026-11-25T22:58:21.864Z","epss":{"score":0.01315,"percentile":0.71622,"date":"2026-12-02T12:00:21.000Z"}}