CVE-2012-2417: PyCrypto PyCrypto Makes Use Of Insufficiently Vulnerability

MODERATE
Advisory Identifier: GHSA-v367-p58w-98h5
CVSS 5.3
Published
Advisory Summary

CVE-2012-2417 is a MODERATE (CVSS 5.3) pycrypto makes use of insufficiently vulnerability (General Security Weakness) affecting PyCrypto libraries in the PyPI ecosystem. The issue involves pycrypto makes use of insufficiently random values. Remediation is available by upgrading affected packages to version 2.6.

CVE-2012-2417 at a Glance

CVE Identifier CVE-2012-2417
GHSA Identifier GHSA-v367-p58w-98h5
Severity MODERATE
CVSS v3.1 Base Score 5.3
CWE Classification General Security Weakness
Affected Product PyCrypto
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 5.3

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality Low (C:L)
Integrity None (I:N)
Availability None (A:N)

How to Fix CVE-2012-2417

To remediate this vulnerability, upgrade all affected PyCrypto dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

PyCrypto fixed: 2.6
pip install PyCrypto>=2.6
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show PyCrypto

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2012-2417, inspect your installed packages using pip:

pip show PyCrypto

Analyze the terminal output to locate any version of PyCrypto in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.6), your application is affected.

Note: The pip show PyCrypto command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under General Security Weakness. In PyCrypto, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

PyCrypto before 2.6 does not produce appropriate prime numbers when using an ElGamal scheme to generate a key, which reduces the signature space or public key space and makes it easier for attackers to conduct brute force attacks to obtain the private key.

CVE-2012-2417 Affected PyCrypto Versions

1 component(s)
Fixed Versions:
2.6
Product / Package Ecosystem Affected Versions Fixed Version
PyCrypto
PyPI
< 2.6
2.6

References

NVD — CVE-2012-2417 NVD
https://nvd.nist.gov/vuln/detail/CVE-2012-2417
Security Fix Commit FIX COMMIT
https://github.com/Legrandin/pycrypto/commit/9f912f13df99ad3421eff360d6a62d7dbec755c2
bugs.launchpad.net/pycrypto/+bug/98516... WEB
https://bugs.launchpad.net/pycrypto/+bug/985164
exchange.xforce.ibmcloud.com/vulnerabilities/758... WEB
https://exchange.xforce.ibmcloud.com/vulnerabilities/75871
PyCrypto Source Repository REPOSITORY
https://github.com/Legrandin/pycrypto
PyCrypto Source Repository REPOSITORY
https://github.com/dlitz/pycrypto/blob/373ea760f21701b162e8c4912a66928ee30d401a/ChangeLog
PyCrypto Source Repository REPOSITORY
https://github.com/pypa/advisory-database/tree/main/vulns/pycrypto/PYSEC-2012-16.yaml
hermes.opensuse.org/messages/15083589 WEB
https://hermes.opensuse.org/messages/15083589
web.archive.org/web/20140724111917/... WEB
https://web.archive.org/web/20140724111917/http://secunia.com/advisories/49263
PyCrypto Security Information SECURITY
https://web.archive.org/web/20200228184120/http://www.securityfocus.com/bid/53687
lists.fedoraproject.org/pipermail/package-a... WEB
http://lists.fedoraproject.org/pipermail/package-announce/2012-June/081713.html
lists.fedoraproject.org/pipermail/package-a... WEB
http://lists.fedoraproject.org/pipermail/package-announce/2012-June/081759.html
lists.fedoraproject.org/pipermail/package-a... WEB
http://lists.fedoraproject.org/pipermail/package-announce/2012-June/081789.html
PyCrypto Security Information SECURITY
http://www.debian.org/security/2012/dsa-2502
PyCrypto Security Information SECURITY
http://www.mandriva.com/security/advisories?name=MDVSA-2012:117
PyCrypto Security Information SECURITY
http://www.openwall.com/lists/oss-security/2012/05/25/1

Frequently Asked Questions

What is CVE-2012-2417?
CVE-2012-2417 is a security vulnerability in PyCrypto involving PyCrypto makes Use of Insufficiently Random Values under General Security Weakness.
Which PyCrypto versions are affected?
Affected versions include releases prior to 2.6 across affected packages: PyCrypto.
What version fixes CVE-2012-2417?
Upgrading to 2.6 (or the latest patched release for your respective branch) resolves the vulnerability.
Is PyCrypto affected?
Yes, PyCrypto is affected in releases prior to 2.6. Upgrade your dependency to 2.6 or later.
What is the CVSS score of CVE-2012-2417?
CVE-2012-2417 has a CVSS v3.1 base score of 5.3 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N.
What CWE is associated with CVE-2012-2417?
CVE-2012-2417 is classified under General Security Weakness.
How can I check PyPI dependencies for CVE-2012-2417?
Run the dependency tree command: 'pip show PyCrypto'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-v367-p58w-98h5",
  "modified" : "2024-10-21T20:04:17Z",
  "published" : "2022-05-17T01:46:08Z",
  "aliases" : [ "CVE-2012-2417" ],
  "summary" : "PyCrypto makes Use of Insufficiently Random Values",
  "details" : "PyCrypto before 2.6 does not produce appropriate prime numbers when using an ElGamal scheme to generate a key, which reduces the signature space or public key space and makes it easier for attackers to conduct brute force attacks to obtain the private key.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "PyCrypto"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.6"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2012-2417"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/Legrandin/pycrypto/commit/9f912f13df99ad3421eff360d6a62d7dbec755c2"
  }, {
    "type" : "WEB",
    "url" : "https://bugs.launchpad.net/pycrypto/+bug/985164"
  }, {
    "type" : "WEB",
    "url" : "https://exchange.xforce.ibmcloud.com/vulnerabilities/75871"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/Legrandin/pycrypto"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/dlitz/pycrypto/blob/373ea760f21701b162e8c4912a66928ee30d401a/ChangeLog"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/pycrypto/PYSEC-2012-16.yaml"
  }, {
    "type" : "WEB",
    "url" : "https://hermes.opensuse.org/messages/15083589"
  }, {
    "type" : "WEB",
    "url" : "https://web.archive.org/web/20140724111917/http://secunia.com/advisories/49263"
  }, {
    "type" : "WEB",
    "url" : "https://web.archive.org/web/20200228184120/http://www.securityfocus.com/bid/53687"
  }, {
    "type" : "WEB",
    "url" : "http://lists.fedoraproject.org/pipermail/package-announce/2012-June/081713.html"
  }, {
    "type" : "WEB",
    "url" : "http://lists.fedoraproject.org/pipermail/package-announce/2012-June/081759.html"
  }, {
    "type" : "WEB",
    "url" : "http://lists.fedoraproject.org/pipermail/package-announce/2012-June/081789.html"
  }, {
    "type" : "WEB",
    "url" : "http://www.debian.org/security/2012/dsa-2502"
  }, {
    "type" : "WEB",
    "url" : "http://www.mandriva.com/security/advisories?name=MDVSA-2012:117"
  }, {
    "type" : "WEB",
    "url" : "http://www.openwall.com/lists/oss-security/2012/05/25/1"
  } ],
  "database_specific" : {
    "cwe_ids" : [ ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-04-30T14:35:18Z",
    "nvd_published_at" : "2012-06-17T03:41:00Z"
  }
}