diff options
| -rw-r--r-- | meta/recipes-devtools/python/python3-cryptography/CVE-2023-23931.patch | 49 | ||||
| -rw-r--r-- | meta/recipes-devtools/python/python3-cryptography_36.0.2.bb | 1 |
2 files changed, 50 insertions, 0 deletions
diff --git a/meta/recipes-devtools/python/python3-cryptography/CVE-2023-23931.patch b/meta/recipes-devtools/python/python3-cryptography/CVE-2023-23931.patch new file mode 100644 index 0000000000..5fc4878978 --- /dev/null +++ b/meta/recipes-devtools/python/python3-cryptography/CVE-2023-23931.patch | |||
| @@ -0,0 +1,49 @@ | |||
| 1 | From 9fbf84efc861668755ab645530ec7be9cf3c6696 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Alex Gaynor <alex.gaynor@gmail.com> | ||
| 3 | Date: Tue, 7 Feb 2023 11:34:18 -0500 | ||
| 4 | Subject: [PATCH] Don't allow update_into to mutate immutable objects (#8230) | ||
| 5 | |||
| 6 | CVE: CVE-2023-23931 | ||
| 7 | |||
| 8 | Upstream-Status: Backport [https://github.com/pyca/cryptography/commit/9fbf84efc861668755ab645530ec7be9cf3c6696] | ||
| 9 | |||
| 10 | Signed-off-by: Narpat Mali <narpat.mali@windriver.com> | ||
| 11 | --- | ||
| 12 | src/cryptography/hazmat/backends/openssl/ciphers.py | 2 +- | ||
| 13 | tests/hazmat/primitives/test_ciphers.py | 8 ++++++++ | ||
| 14 | 2 files changed, 9 insertions(+), 1 deletion(-) | ||
| 15 | |||
| 16 | diff --git a/src/cryptography/hazmat/backends/openssl/ciphers.py b/src/cryptography/hazmat/backends/openssl/ciphers.py | ||
| 17 | index 286583f93..075d68fb9 100644 | ||
| 18 | --- a/src/cryptography/hazmat/backends/openssl/ciphers.py | ||
| 19 | +++ b/src/cryptography/hazmat/backends/openssl/ciphers.py | ||
| 20 | @@ -156,7 +156,7 @@ class _CipherContext: | ||
| 21 | data_processed = 0 | ||
| 22 | total_out = 0 | ||
| 23 | outlen = self._backend._ffi.new("int *") | ||
| 24 | - baseoutbuf = self._backend._ffi.from_buffer(buf) | ||
| 25 | + baseoutbuf = self._backend._ffi.from_buffer(buf, require_writable=True) | ||
| 26 | baseinbuf = self._backend._ffi.from_buffer(data) | ||
| 27 | |||
| 28 | while data_processed != total_data_len: | ||
| 29 | diff --git a/tests/hazmat/primitives/test_ciphers.py b/tests/hazmat/primitives/test_ciphers.py | ||
| 30 | index 02127dd9c..bf3b047de 100644 | ||
| 31 | --- a/tests/hazmat/primitives/test_ciphers.py | ||
| 32 | +++ b/tests/hazmat/primitives/test_ciphers.py | ||
| 33 | @@ -318,6 +318,14 @@ class TestCipherUpdateInto: | ||
| 34 | with pytest.raises(ValueError): | ||
| 35 | encryptor.update_into(b"testing", buf) | ||
| 36 | |||
| 37 | + def test_update_into_immutable(self, backend): | ||
| 38 | + key = b"\x00" * 16 | ||
| 39 | + c = ciphers.Cipher(AES(key), modes.ECB(), backend) | ||
| 40 | + encryptor = c.encryptor() | ||
| 41 | + buf = b"\x00" * 32 | ||
| 42 | + with pytest.raises((TypeError, BufferError)): | ||
| 43 | + encryptor.update_into(b"testing", buf) | ||
| 44 | + | ||
| 45 | @pytest.mark.supported( | ||
| 46 | only_if=lambda backend: backend.cipher_supported( | ||
| 47 | AES(b"\x00" * 16), modes.GCM(b"\x00" * 12) | ||
| 48 | -- | ||
| 49 | 2.40.0 | ||
diff --git a/meta/recipes-devtools/python/python3-cryptography_36.0.2.bb b/meta/recipes-devtools/python/python3-cryptography_36.0.2.bb index 9ef5ff39c8..c3ae0c1ab9 100644 --- a/meta/recipes-devtools/python/python3-cryptography_36.0.2.bb +++ b/meta/recipes-devtools/python/python3-cryptography_36.0.2.bb | |||
| @@ -17,6 +17,7 @@ SRC_URI += " \ | |||
| 17 | file://0001-Cargo.toml-specify-pem-version.patch \ | 17 | file://0001-Cargo.toml-specify-pem-version.patch \ |
| 18 | file://0002-Cargo.toml-edition-2018-2021.patch \ | 18 | file://0002-Cargo.toml-edition-2018-2021.patch \ |
| 19 | file://fix-leak-metric.patch \ | 19 | file://fix-leak-metric.patch \ |
| 20 | file://CVE-2023-23931.patch \ | ||
| 20 | " | 21 | " |
| 21 | 22 | ||
| 22 | inherit pypi python_setuptools3_rust | 23 | inherit pypi python_setuptools3_rust |
