Hash function not randomized properly


This resource is maintained for historical reference and does not contain the latest vulnerability info for Python.

The canonical database for vulnerabilities affecting Python is available on GitHub in the Open Source Vulnerability (OSV) format. This vulnerability can be viewed online at the Open Source Vulnerability Database.

The hash function is not randomized properly.

Python 3.4 now used SipHash (PEP 456).

Python 3.3 and Python 2.7 are still affected.


  • Disclosure date: 2012-04-19 (Python issue bpo-14621 reported)

Fixed In

Python issue

Hash function is not randomized properly.

  • Python issue: bpo-14621
  • Creation date: 2012-04-19
  • Reporter: Vlado Boza


Python 2.7 before 3.4 only uses the last eight bits of the prefix to randomize hash values, which causes it to compute hash values without restricting the ability to trigger hash collisions predictably and makes it easier for context-dependent attackers to cause a denial of service (CPU consumption) via crafted input to an application that maintains a hash table. NOTE: this vulnerability exists because of an incomplete fix for CVE-2012-1150.


Timeline using the disclosure date 2012-04-19 as reference: