Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 893576 (CVE-2023-23931) - <dev-python/cryptography-39.0.1: Cipher.update_into can corrupt memory if passed an immutable python object as the outbuf
Summary: <dev-python/cryptography-39.0.1: Cipher.update_into can corrupt memory if pas...
Status: IN_PROGRESS
Alias: CVE-2023-23931
Product: Gentoo Security
Classification: Unclassified
Component: Vulnerabilities (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Security
URL: https://github.com/pyca/cryptography/...
Whiteboard: A3 [glsa?]
Keywords:
Depends on: 893574
Blocks:
  Show dependency tree
 
Reported: 2023-02-08 05:28 UTC by Michał Górny
Modified: 2023-04-30 23:57 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2023-02-08 05:28:51 UTC
Oh no!  Use of Rust did not prevent a "vulnerability"!

From ${URL}:

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.
Comment 1 John Helmert III archtester Gentoo Infrastructure gentoo-dev Security 2023-02-20 19:58:56 UTC
Thanks!
Comment 2 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2023-02-21 17:25:31 UTC
Can't cleanup because of bug 893522.
Comment 3 Larry the Git Cow gentoo-dev 2023-04-21 15:44:33 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=860a9047ef51635cb4b93e2528b25d923dce8d58

commit 860a9047ef51635cb4b93e2528b25d923dce8d58
Author:     Arthur Zamarin <arthurzam@gentoo.org>
AuthorDate: 2023-04-21 15:43:44 +0000
Commit:     Arthur Zamarin <arthurzam@gentoo.org>
CommitDate: 2023-04-21 15:44:26 +0000

    dev-python/cryptography: drop 38.0.4
    
    Bug: https://bugs.gentoo.org/893576
    Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>

 dev-python/cryptography/Manifest                   |  25 ----
 dev-python/cryptography/cryptography-38.0.4.ebuild | 143 ---------------------
 2 files changed, 168 deletions(-)