Skip to content

Commit f09c261

Browse files
authored
41.0.6 release (#9927)
* Fixed crash when loading a PKCS#7 bundle with no certificates (#9926) * Version bump for 41.0.6 * Temporarily allow a new clippy warning (#9835) * Temporarily allow a new clippy warning * Update lib.rs * Update lib.rs * Need to accept this to skip test * It's a word
1 parent 5012bed commit f09c261

File tree

9 files changed

+26
-5
lines changed

9 files changed

+26
-5
lines changed

CHANGELOG.rst

+9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
Changelog
22
=========
33

4+
.. _v41-0-6:
5+
6+
41.0.6 - 2023-11-27
7+
~~~~~~~~~~~~~~~~~~~
8+
9+
* Fixed a null-pointer-dereference and segfault that could occur when loading
10+
certificates from a PKCS#7 bundle. Credit to **pkuzco** for reporting the
11+
issue. **CVE-2023-49083**
12+
413
.. _v41-0-5:
514

615
41.0.5 - 2023-10-24

docs/spelling_wordlist.txt

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ decrypted
3838
decrypting
3939
deprecations
4040
DER
41+
dereference
4142
deserialize
4243
deserialized
4344
Deserialization

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ build-backend = "setuptools.build_meta"
1111

1212
[project]
1313
name = "cryptography"
14-
version = "41.0.5"
14+
version = "41.0.6"
1515
authors = [
1616
{name = "The Python Cryptographic Authority and individual contributors", email = "[email protected]"}
1717
]

src/cryptography/__about__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"__copyright__",
1111
]
1212

13-
__version__ = "41.0.5"
13+
__version__ = "41.0.6"
1414

1515

1616
__author__ = "The Python Cryptographic Authority and individual contributors"

src/cryptography/hazmat/backends/openssl/backend.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -1890,9 +1890,12 @@ def _load_pkcs7_certificates(self, p7) -> typing.List[x509.Certificate]:
18901890
_Reasons.UNSUPPORTED_SERIALIZATION,
18911891
)
18921892

1893+
certs: list[x509.Certificate] = []
1894+
if p7.d.sign == self._ffi.NULL:
1895+
return certs
1896+
18931897
sk_x509 = p7.d.sign.cert
18941898
num = self._lib.sk_X509_num(sk_x509)
1895-
certs = []
18961899
for i in range(num):
18971900
x509 = self._lib.sk_X509_value(sk_x509, i)
18981901
self.openssl_assert(x509 != self._ffi.NULL)

src/rust/src/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
// for complete details.
44

55
#![deny(rust_2018_idioms)]
6+
// Work-around for https://github.com/PyO3/pyo3/issues/3561
7+
#![allow(unknown_lints, clippy::unnecessary_fallible_conversions)]
68

79
mod asn1;
810
mod backend;

tests/hazmat/primitives/test_pkcs7.py

+6
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,12 @@ def test_load_pkcs7_unsupported_type(self, backend):
8989
mode="rb",
9090
)
9191

92+
def test_load_pkcs7_empty_certificates(self, backend):
93+
der = b"\x30\x0B\x06\x09\x2A\x86\x48\x86\xF7\x0D\x01\x07\x02"
94+
95+
certificates = pkcs7.load_der_pkcs7_certificates(der)
96+
assert certificates == []
97+
9298

9399
# We have no public verification API and won't be adding one until we get
94100
# some requirements from users so this function exists to give us basic

vectors/cryptography_vectors/__about__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
"__version__",
77
]
88

9-
__version__ = "41.0.5"
9+
__version__ = "41.0.6"

vectors/pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "cryptography_vectors"
7-
version = "41.0.5"
7+
version = "41.0.6"
88
authors = [
99
{name = "The Python Cryptographic Authority and individual contributors", email = "[email protected]"}
1010
]

0 commit comments

Comments
 (0)