CVE-2023-52892: Phpseclib/phpseclib Name Confusion Vulnerability

HIGH
Advisory Identifier: GHSA-ff7q-6vwh-v9m4
CVSS 7.5
CWE-436
Published
Advisory Summary

CVE-2023-52892 is a HIGH (CVSS 7.5) name confusion vulnerability (CWE-436: Interpretation Conflict) affecting Phpseclib/phpseclib libraries in the Packagist ecosystem. The issue involves name confusion in x509 subject alternative name fields. Remediation is available by upgrading affected packages to version 1.0.22, 2.0.46, 3.0.33.

CVE-2023-52892 at a Glance

CVE Identifier CVE-2023-52892
GHSA Identifier GHSA-ff7q-6vwh-v9m4
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-436: Interpretation Conflict
Affected Product Phpseclib/phpseclib
Package Ecosystem Packagist
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.1/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-2023-52892

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

phpseclib/phpseclib fixed: 1.0.22
Upgrade phpseclib/phpseclib to 1.0.22
phpseclib/phpseclib fixed: 2.0.46
Upgrade phpseclib/phpseclib to 2.0.46
phpseclib/phpseclib fixed: 3.0.33
Upgrade phpseclib/phpseclib to 3.0.33
Verify Direct and Transitive Dependencies

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

inspect dependencies for phpseclib/phpseclib

How to Check if You Are Affected

To determine whether your application is affected by CVE-2023-52892, inspect your project dependencies for Phpseclib/phpseclib:

inspect dependencies for phpseclib/phpseclib

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

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-436: Interpretation Conflict, where product a handles inputs or steps differently than product b, which causes a to perform incorrect actions based on its perception of b's state. In Phpseclib/phpseclib, 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

In phpseclib before 1.0.22, 2.x before 2.0.46, and 3.x before 3.0.33, some characters in Subject Alternative Name fields in TLS certificates are incorrectly allowed to have a special meaning in regular expressions (such as a + wildcard), leading to name confusion in X.509 certificate host verification.

CVE-2023-52892 Affected Phpseclib/phpseclib Versions

3 component(s)
Fixed Versions:
1.0.222.0.463.0.33
Product / Package Ecosystem Affected Versions Fixed Version
phpseclib/phpseclib
Packagist
< 1.0.22
1.0.22
phpseclib/phpseclib
Packagist
≥ 2.0.0
< 2.0.46
2.0.46
phpseclib/phpseclib
Packagist
≥ 3.0.0
< 3.0.33
3.0.33

References

Frequently Asked Questions

What is CVE-2023-52892?
CVE-2023-52892 is a security vulnerability in Phpseclib/phpseclib involving Name confusion in x509 Subject Alternative Name fields under CWE-436: Interpretation Conflict.
Which Phpseclib/phpseclib versions are affected?
Affected versions include releases prior to 1.0.22, 2.0.46, 3.0.33 across affected packages: phpseclib/phpseclib.
What version fixes CVE-2023-52892?
Upgrading to 1.0.22, 2.0.46, 3.0.33 (or the latest patched release for your respective branch) resolves the vulnerability.
Is phpseclib/phpseclib affected?
Yes, phpseclib/phpseclib is affected in releases prior to 1.0.22, 2.0.46, 3.0.33. Upgrade your dependency to 1.0.22, 2.0.46, 3.0.33 or later.
What is the CVSS score of CVE-2023-52892?
CVE-2023-52892 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N.
What CWE is associated with CVE-2023-52892?
CVE-2023-52892 is classified under CWE-436: Interpretation Conflict (Product A handles inputs or steps differently than Product B, which causes A to perform incorrect actions based on its perception of B's state.).
How can I check Packagist dependencies for CVE-2023-52892?
Run the dependency tree command: 'inspect dependencies for phpseclib/phpseclib'. 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-ff7q-6vwh-v9m4",
  "modified" : "2024-06-28T18:57:31Z",
  "published" : "2024-06-28T00:33:31Z",
  "aliases" : [ "CVE-2023-52892" ],
  "summary" : "Name confusion in x509 Subject Alternative Name fields",
  "details" : "In phpseclib before 1.0.22, 2.x before 2.0.46, and 3.x before 3.0.33, some characters in Subject Alternative Name fields in TLS certificates are incorrectly allowed to have a special meaning in regular expressions (such as a + wildcard), leading to name confusion in X.509 certificate host verification.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/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" : "Packagist",
      "name" : "phpseclib/phpseclib"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.0.22"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "phpseclib/phpseclib"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.0.0"
      }, {
        "fixed" : "2.0.46"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "phpseclib/phpseclib"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.0.0"
      }, {
        "fixed" : "3.0.33"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-52892"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/phpseclib/phpseclib/issues/1943"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/phpseclib/phpseclib/commit/6cd6e8ceab9f2b55c8cd81d2192bf98cbeaf4627"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/phpseclib/phpseclib"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/phpseclib/phpseclib/releases/tag/3.0.33"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/x509-name-testing/name_testing_artifacts"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-436" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-06-28T18:57:31Z",
    "nvd_published_at" : "2024-06-27T22:15:10Z"
  }
}