CVE-2022-31124: Openssh key parser Possible Leak Of Key's Raw Vulnerability

MODERATE
Advisory Identifier: GHSA-hm37-9xh2-q499
CVSS 7.7
CWE-209
Published
Advisory Summary

CVE-2022-31124 is a MODERATE (CVSS 7.7) possible leak of key's raw vulnerability (CWE-209: Generation of Error Message Containing Sensitive Information) affecting Openssh key parser libraries in the PyPI ecosystem. The issue involves possible leak of key's raw field if declared length is incorrect. Remediation is available by upgrading affected packages to version 0.0.6.

CVE-2022-31124 at a Glance

CVE Identifier CVE-2022-31124
GHSA Identifier GHSA-hm37-9xh2-q499
Severity MODERATE
CVSS v3.1 Base Score 7.7
CWE Classification CWE-209: Generation of Error Message Containing Sensitive Information
Affected Product Openssh key parser
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 7.7

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

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

How to Fix CVE-2022-31124

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

openssh-key-parser fixed: 0.0.6
pip install openssh-key-parser>=0.0.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 openssh-key-parser

How to Check if You Are Affected

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

pip show openssh-key-parser

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

Note: The pip show openssh-key-parser command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-209: Generation of Error Message Containing Sensitive Information, where the product generates an error message that includes sensitive information about its environment, users, or associated data. In Openssh key parser, 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

### Impact If a field of a key is shorter than it is declared to be, the parser raises an error with a message containing the raw field value. An attacker able to modify the declared length of a key's sensitive field can thus expose the raw value of that field. ### Patches Upgrade to version 0.0.6, which no longer includes the raw field value in the error message. ### Workarounds N/A ### References N/A ### For more information If you have any questions or comments about this advisory: * Open an issue in [openssh_key_parser](https://github.com/scottcwang/openssh_key_parser)

CVE-2022-31124 Affected Openssh key parser Versions

1 component(s)
Fixed Versions:
0.0.6
Product / Package Ecosystem Affected Versions Fixed Version
openssh-key-parser
PyPI
< 0.0.6
0.0.6

References

Frequently Asked Questions

What is CVE-2022-31124?
CVE-2022-31124 is a security vulnerability in Openssh key parser involving Possible leak of key's raw field if declared length is incorrect under CWE-209: Generation of Error Message Containing Sensitive Information.
Which Openssh key parser versions are affected?
Affected versions include releases prior to 0.0.6 across affected packages: openssh-key-parser.
What version fixes CVE-2022-31124?
Upgrading to 0.0.6 (or the latest patched release for your respective branch) resolves the vulnerability.
Is openssh-key-parser affected?
Yes, openssh-key-parser is affected in releases prior to 0.0.6. Upgrade your dependency to 0.0.6 or later.
What is the CVSS score of CVE-2022-31124?
CVE-2022-31124 has a CVSS v3.1 base score of 7.7 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:N.
What CWE is associated with CVE-2022-31124?
CVE-2022-31124 is classified under CWE-209: Generation of Error Message Containing Sensitive Information (The product generates an error message that includes sensitive information about its environment, users, or associated data.).
How can I check PyPI dependencies for CVE-2022-31124?
Run the dependency tree command: 'pip show openssh-key-parser'. 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-hm37-9xh2-q499",
  "modified" : "2024-10-07T21:17:17Z",
  "published" : "2022-07-06T19:24:12Z",
  "aliases" : [ "CVE-2022-31124" ],
  "summary" : "Possible leak of key's raw field if declared length is incorrect",
  "details" : "### Impact\nIf a field of a key is shorter than it is declared to be, the parser raises an error with a message containing the raw field value. An attacker able to modify the declared length of a key's sensitive field can thus expose the raw value of that field.\n\n### Patches\nUpgrade to version 0.0.6, which no longer includes the raw field value in the error message.\n\n### Workarounds\nN/A\n\n### References\nN/A\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open an issue in [openssh_key_parser](https://github.com/scottcwang/openssh_key_parser)\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:N"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:N/VI:N/VA:N/SC:H/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "openssh-key-parser"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.0.6"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/scottcwang/openssh_key_parser/security/advisories/GHSA-hm37-9xh2-q499"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-31124"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/scottcwang/openssh_key_parser/pull/5"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/scottcwang/openssh_key_parser/commit/26e0a471e9fdb23e635bc3014cf4cbd2323a08d3"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/scottcwang/openssh_key_parser/commit/274447f91b4037b7050ae634879b657554523b39"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/scottcwang/openssh_key_parser/commit/d5b53b4b7e76c5b666fc657019dbf864fb04076c"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/openssh-key-parser/PYSEC-2022-233.yaml"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/scottcwang/openssh_key_parser"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-209" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-07-06T19:24:12Z",
    "nvd_published_at" : "2022-07-06T18:15:00Z"
  }
}