CVE-2023-52892: Name confusion in x509 Subject Alternative Name fields in phpseclib

phpseclib/phpseclib Updated 02 Oct 2025

Summary

28/06/2024
Yes i
High
7.5

CVE-2023-52892: Name confusion in x509 Subject Alternative Name fields. Affects phpseclib/phpseclib across 3 version ranges.

< 1.0.22 >= 2.0.0, < 2.0.46 >= 3.0.0, < 3.0.33

Fixed in 1.0.22, 2.0.46 or 3.0.33, depending on the release line you run. How to fix ↓

Also tracked for

The same CVE-2023-52892 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Sponsored Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

phpseclib is a PHP library that provides a secure implementation of various cryptographic protocols, including SSH, SFTP, and TLS. It is widely used in PHP applications for secure communication. However, a vulnerability has been discovered in versions before 1.0.22, 2.x before 2.0.46, and 3.x before 3.0.33 of phpseclib. This vulnerability allows certain characters in the Subject Alternative Name fields of TLS certificates to be incorrectly interpreted as special characters in regular expressions, leading to name confusion in X.509 certificate host verification.

Vulnerability Detail

The vulnerability arises from the incorrect interpretation of certain characters in the Subject Alternative Name fields of TLS certificates. These characters, which should be treated as literal characters, are mistakenly allowed to have a special meaning in regular expressions. This can result in name confusion during X.509 certificate host verification. An attacker could exploit this vulnerability to bypass certificate validation and potentially perform man-in-the-middle attacks or other malicious activities.

How To Fix

Fixed versions by release line

The minimum fixed version depends on the release line you run.

  • < 1.0.22 1.0.22
    composer require phpseclib/phpseclib:1.0.22
  • >= 2.0.0, < 2.0.46 2.0.46
    composer require phpseclib/phpseclib:2.0.46
  • >= 3.0.0, < 3.0.33 3.0.33
    composer require phpseclib/phpseclib:3.0.33

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Workaround

There is no known workaround for this vulnerability. It is essential to update the phpseclib library to the fixed version as soon as possible.

Conclusion

The vulnerability in phpseclib allows for name confusion in X.509 certificate host verification, potentially leading to man-in-the-middle attacks or other malicious activities. It is crucial to update the library to the fixed version to mitigate this vulnerability.

See every vulnerability recorded for phpseclib/phpseclib →

Share this vulnerability

FAQ

phpseclib is a PHP library that provides a secure implementation of various cryptographic protocols, including SSH, SFTP, and TLS.

The vulnerability allows for name confusion in X.509 certificate host verification, potentially enabling man-in-the-middle attacks or other malicious activities.

Versions before 1.0.22, 2.x before 2.0.46, and 3.x before 3.0.33 of phpseclib are affected.

To fix this vulnerability, update phpseclib to version 1.0.22 or later (for versions before 1.0.22), version 2.0.46 or later (for versions 2.x before 2.0.46), or version 3.0.33 or later (for versions 3.x before 3.0.33).

No, there is no known workaround. Updating the library to the fixed version is the recommended solution.

Related vulnerabilities

Recent vulnerabilities recorded for phpseclib/phpseclib.

How To Fix

Fixed versions by release line

The minimum fixed version depends on the release line you run.

  • < 1.0.22 1.0.22
    composer require phpseclib/phpseclib:1.0.22
  • >= 2.0.0, < 2.0.46 2.0.46
    composer require phpseclib/phpseclib:2.0.46
  • >= 3.0.0, < 3.0.33 3.0.33
    composer require phpseclib/phpseclib:3.0.33

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback