Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 2172416

Summary: Backport from_buffer(..., require_writable=True) for python-cryptography CVE-2023-23931 fix [rhel-8.9]
Product: Red Hat Enterprise Linux 8 Reporter: Christian Heimes <cheimes>
Component: python-cffiAssignee: Christian Heimes <cheimes>
Status: CLOSED ERRATA QA Contact: ipa-qe <ipa-qe>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.8CC: frenaud, maxwell, mpolovka, myusuf, ovasik, sumenon
Target Milestone: rcKeywords: Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-cffi-1.11.5-6.el8 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-11-14 15:48:23 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2172404    

Description Christian Heimes 2023-02-22 10:45:13 UTC
Description of problem:
cffi 1.12 added a new keyword argument "require_writable=True" to its from_buffer() API. The feature is required to fix python-cryptography CVE-2023-23931.

Version-Release number of selected component (if applicable):
python3-cffi-1.11.5-5.el8

How reproducible:
always

Steps to Reproduce:
$ python3
>>> from cryptography.hazmat.backends.openssl import backend
>>> b = b'bytes'
>>> buf = backend._ffi.from_buffer(b)
>>> buf[0] = b'a'
>>> b
b'aytes'
>>> buf = backend._ffi.from_buffer(b, require_writable=True)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: from_buffer() takes no keyword arguments

Actual results:
TypeError: from_buffer() takes no keyword arguments

Expected results:
from_buffer(b, require_writable=True) is supported

Additional info:
changelog: https://cffi.readthedocs.io/en/latest/whatsnew.html?highlight=require_writable#v1-12
upstream issue: https://foss.heptapod.net/pypy/cffi/-/issues/394
upstream commit: https://foss.heptapod.net/pypy/cffi/-/commit/c5c4d32c3e3ec0fbaabc4b9890fd17c9c58407d2

Comment 17 Michal Polovka 2023-04-21 12:31:00 UTC
Preverified using test compose http://artifacts.osci.redhat.com/comp/rhel-8.9.0/52100464-4011-python-cryptography/ with python3-cryptography-3.2.1-6.el8.x86_64  and python3-cffi-1.11.5-6.el8.x86_64     

Python 3.6.8 (default, Jan 23 2023, 22:31:05) 
[GCC 8.5.0 20210514 (Red Hat 8.5.0-18)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from cryptography.hazmat.backends.openssl import backend
>>> b = b'bytes'
>>> buf = backend._ffi.from_buffer(b)
>>> buf[0] = b'a'
>>> b
b'aytes'
>>> buf = backend._ffi.from_buffer(b, require_writable=True)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
BufferError: Object is not writable.
>>> 

parameter require_writable supported, marking as tested.

Comment 21 Michal Polovka 2023-04-24 08:27:13 UTC
Verified manually using nightly RHEL8.9 machine with python3-cffi-1.11.5-6.el8.x86_64 and python3-cryptography-3.2.1-6.el8.x86_64.


# python3
Python 3.6.8 (default, Jan 23 2023, 22:31:05) 
[GCC 8.5.0 20210514 (Red Hat 8.5.0-18)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from cryptography.hazmat.backends.openssl import backend
>>> b = b'bytes'
>>> buf = backend._ffi.from_buffer(b)
>>> buf[0] = b'a'
>>> b
b'aytes'
>>> buf = backend._ffi.from_buffer(b, require_writable=True)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
BufferError: Object is not writable.

Marking as verified.

Comment 24 errata-xmlrpc 2023-11-14 15:48:23 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 (python-cffi bug fix and enhancement 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/RHBA-2023:7095