RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2172399 - CVE-2023-23931 python-cryptography: memory corruption via immutable objects [rhel-9]
Summary: CVE-2023-23931 python-cryptography: memory corruption via immutable objects [...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: python-cryptography
Version: 9.3
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: Christian Heimes
QA Contact: Michal Polovka
URL:
Whiteboard:
: 2175093 (view as bug list)
Depends On:
Blocks: CVE-2023-23931 2175093
TreeView+ depends on / blocked
 
Reported: 2023-02-22 09:21 UTC by Christian Heimes
Modified: 2023-11-07 11:21 UTC (History)
4 users (show)

Fixed In Version: python-cryptography-36.0.1-4.el9
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-11-07 08:52:12 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github pyca cryptography pull 8230 0 None Merged Don't allow update_into to mutate immutable objects 2023-02-22 09:43:58 UTC
Red Hat Issue Tracker FREEIPA-9489 0 None None None 2023-02-22 09:22:34 UTC
Red Hat Issue Tracker RHELPLAN-149622 0 None None None 2023-02-22 09:22:38 UTC
Red Hat Product Errata RHSA-2023:6615 0 None None None 2023-11-07 08:52:21 UTC

Description Christian Heimes 2023-02-22 09:21:49 UTC
This bug was initially created as a copy of Bug #2171817

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.

Comment 1 Christian Heimes 2023-02-22 09:47:44 UTC
c9s pull request: https://gitlab.com/redhat/centos-stream/rpms/python-cryptography/-/merge_requests/10

Comment 22 Michal Polovka 2023-04-24 08:30:34 UTC
Verified manually on RHEL9.3 nightly machine with python3-cffi-1.14.5-5.el9.x86_64 and python3-cryptography-36.0.1-3.el9.x86_64

# python3
Python 3.9.16 (main, Dec  8 2022, 00:00:00) 
[GCC 11.3.1 20221121 (Red Hat 11.3.1-4)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
>>> c = Cipher(algorithms.AES(os.urandom(16)), modes.ECB())
>>> encryptor = c.encryptor()
>>> buf = b"\x00" * 32
>>> encryptor.update_into(b"\xff" * 16, buf)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python3.9/site-packages/cryptography/hazmat/primitives/ciphers/base.py", line 128, in update_into
    return self._ctx.update_into(data, buf)
  File "/usr/lib64/python3.9/site-packages/cryptography/hazmat/backends/openssl/ciphers.py", line 158, in update_into
    baseoutbuf = self._backend._ffi.from_buffer(buf, require_writable=True)
BufferError: Object is not writable.
>>> buf == b"\x00" * 32
True


Marking as verified.

Comment 23 Florence Blanc-Renaud 2023-07-31 13:16:10 UTC
*** Bug 2175093 has been marked as a duplicate of this bug. ***

Comment 26 errata-xmlrpc 2023-11-07 08:52:12 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: python-cryptography security update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2023:6615


Note You need to log in before you can comment on or make changes to this bug.