CVE-2018-6594: Pycrypto Pycrypto Generates Weak Key Parameters Vulnerability

HIGH
Advisory Identifier: GHSA-6528-wvf6-f6qg
CVSS 7.5
CWE-326
Published
Advisory Summary

CVE-2018-6594 is a HIGH (CVSS 7.5) pycrypto generates weak key parameters vulnerability (CWE-326: Inadequate Encryption Strength) affecting Pycrypto libraries in the PyPI ecosystem. The issue involves pycrypto generates weak key parameters. Remediation is available in the latest vendor maintenance releases.

CVE-2018-6594 at a Glance

CVE Identifier CVE-2018-6594
GHSA Identifier GHSA-6528-wvf6-f6qg
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-326: Inadequate Encryption Strength
Affected Product Pycrypto
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 7.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/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 High (C:H)
Integrity None (I:N)
Availability None (A:N)

How to Fix CVE-2018-6594

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: Latest secure release
pip install pycrypto>=Latest secure release
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-2018-6594, 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 the patched release), 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 CWE-326: Inadequate Encryption Strength, where the product stores or transmits sensitive data using an encryption scheme that is theoretically sound, but is not strong enough for the level of protection required. 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

lib/Crypto/PublicKey/ElGamal.py in PyCrypto through 2.6.1 generates weak ElGamal key parameters, which allows attackers to obtain sensitive information by reading ciphertext data (i.e., it does not have semantic security in face of a ciphertext-only attack). The Decisional Diffie-Hellman (DDH) assumption does not hold for PyCrypto's ElGamal implementation.

CVE-2018-6594 Affected Pycrypto Versions

1 component(s)
Product / Package Ecosystem Affected Versions Fixed Version
pycrypto
PyPI
≤ 2.6.1

References

Frequently Asked Questions

What is CVE-2018-6594?
CVE-2018-6594 is a security vulnerability in Pycrypto involving Pycrypto generates weak key parameters under CWE-326: Inadequate Encryption Strength.
Which Pycrypto versions are affected?
Affected versions include releases prior to current release patches across affected packages: pycrypto.
What version fixes CVE-2018-6594?
Upgrading to current release patches (or the latest patched release for your respective branch) resolves the vulnerability.
Is pycrypto affected?
Yes, pycrypto is affected in releases prior to Latest secure release. Upgrade your dependency to Latest secure release or later.
What is the CVSS score of CVE-2018-6594?
CVE-2018-6594 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N.
What CWE is associated with CVE-2018-6594?
CVE-2018-6594 is classified under CWE-326: Inadequate Encryption Strength (The product stores or transmits sensitive data using an encryption scheme that is theoretically sound, but is not strong enough for the level of protection required.).
How can I check PyPI dependencies for CVE-2018-6594?
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-6528-wvf6-f6qg",
  "modified" : "2024-10-18T21:58:31Z",
  "published" : "2018-07-12T20:29:26Z",
  "aliases" : [ "CVE-2018-6594" ],
  "summary" : "Pycrypto generates weak key parameters",
  "details" : "lib/Crypto/PublicKey/ElGamal.py in PyCrypto through 2.6.1 generates weak ElGamal key parameters, which allows attackers to obtain sensitive information by reading ciphertext data (i.e., it does not have semantic security in face of a ciphertext-only attack). The Decisional Diffie-Hellman (DDH) assumption does not hold for PyCrypto's ElGamal implementation.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "pycrypto"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "last_affected" : "2.6.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2018-6594"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/dlitz/pycrypto/issues/253"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/TElgamal/attack-on-pycrypto-elgamal"
  }, {
    "type" : "ADVISORY",
    "url" : "https://github.com/advisories/GHSA-6528-wvf6-f6qg"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/dlitz/pycrypto"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/pycrypto/PYSEC-2018-97.yaml"
  }, {
    "type" : "WEB",
    "url" : "https://lists.debian.org/debian-lts-announce/2018/02/msg00018.html"
  }, {
    "type" : "WEB",
    "url" : "https://security.gentoo.org/glsa/202007-62"
  }, {
    "type" : "WEB",
    "url" : "https://usn.ubuntu.com/3616-1"
  }, {
    "type" : "WEB",
    "url" : "https://usn.ubuntu.com/3616-2"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-326" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-06-16T21:18:02Z",
    "nvd_published_at" : null
  }
}