High severity7.5NVD Advisory· Published Mar 27, 2017· Updated May 13, 2026
CVE-2016-9243
CVE-2016-9243
Description
HKDF in cryptography before 1.5.2 returns an empty byte-string if used with a length less than algorithm.digest_size.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
cryptographyPyPI | < 1.5.3 | 1.5.3 |
Patches
1b924696b2e87Fixes #3211 -- fixed hkdf's output with short length (#3215)
2 files changed · +12 −1
src/cryptography/hazmat/primitives/kdf/hkdf.py+1 −1 modified@@ -91,7 +91,7 @@ def _expand(self, key_material): output = [b""] counter = 1 - while (self._algorithm.digest_size // 8) * len(output) < self._length: + while self._algorithm.digest_size * (len(output) - 1) < self._length: h = hmac.HMAC(key_material, self._algorithm, backend=self._backend) h.update(output[-1]) h.update(self._info)
tests/hazmat/primitives/test_hkdf.py+11 −0 modified@@ -142,6 +142,17 @@ def test_unicode_typeerror(self, backend): hkdf.verify(b"foo", u"bar") + def test_derive_short_output(self, backend): + hkdf = HKDF( + hashes.SHA256(), + 4, + salt=None, + info=None, + backend=backend + ) + + assert hkdf.derive(b"\x01" * 16) == b"gJ\xfb{" + @pytest.mark.requires_backend_interface(interface=HMACBackend) class TestHKDFExpand(object):
Vulnerability mechanics
Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
19- www.openwall.com/lists/oss-security/2016/11/09/2nvdMailing ListPatchVDB EntryWEB
- github.com/pyca/cryptography/commit/b924696b2e8731f39696584d12cceeb3aeb2d874nvdPatchThird Party AdvisoryWEB
- www.securityfocus.com/bid/94216nvdBroken LinkThird Party AdvisoryVDB EntryWEB
- www.ubuntu.com/usn/USN-3138-1nvdThird Party AdvisoryWEB
- cryptography.io/en/latest/changelognvdRelease NotesThird Party AdvisoryWEB
- github.com/advisories/GHSA-q3cj-2r34-2cwcghsaADVISORY
- github.com/pyca/cryptography/issues/3211nvdIssue TrackingThird Party AdvisoryWEB
- lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/5R2ZOBMPWDFFHUZ6QOZZY36A6H5CGJXL/nvdMailing ListThird Party Advisory
- lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/U23KDR2M2N7W2ZSREG63BVW7D4VC6CIZ/nvdMailing ListThird Party Advisory
- lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/WQ5G7KHKZC4SI23JE7277KZXM57GEQKT/nvdMailing ListThird Party Advisory
- nvd.nist.gov/vuln/detail/CVE-2016-9243ghsaADVISORY
- cryptography.io/en/latest/changelog/ghsaWEB
- github.com/pypa/advisory-database/tree/main/vulns/cryptography/PYSEC-2017-8.yamlghsaWEB
- lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/5R2ZOBMPWDFFHUZ6QOZZY36A6H5CGJXLghsaWEB
- lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/U23KDR2M2N7W2ZSREG63BVW7D4VC6CIZghsaWEB
- lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/WQ5G7KHKZC4SI23JE7277KZXM57GEQKTghsaWEB
- lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/5R2ZOBMPWDFFHUZ6QOZZY36A6H5CGJXLghsaWEB
- lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/U23KDR2M2N7W2ZSREG63BVW7D4VC6CIZghsaWEB
- lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/WQ5G7KHKZC4SI23JE7277KZXM57GEQKTghsaWEB
News mentions
0No linked articles in our index yet.