CVE-2021-30130

7.5 HIGH

📋 TL;DR

This vulnerability in phpseclib allows attackers to forge RSA PKCS#1 v1.5 signatures, potentially bypassing authentication or authorization checks. It affects applications using phpseclib for cryptographic operations like SSH, SFTP, or TLS certificate validation. Any system using vulnerable versions of phpseclib for signature verification is at risk.

💻 Affected Systems

Products:
  • phpseclib
Versions: phpseclib < 2.0.31, phpseclib 3.x < 3.0.7
Operating Systems: All
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects systems using phpseclib's RSA PKCS#1 v1.5 signature verification functionality. Applications using other cryptographic methods or libraries are not affected.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete authentication bypass, unauthorized access to systems, data exfiltration, or privilege escalation through forged cryptographic signatures.

🟠

Likely Case

Authentication bypass in applications relying on phpseclib for signature verification, potentially allowing unauthorized API access or system entry.

🟢

If Mitigated

Limited impact if additional authentication layers exist, but cryptographic integrity would still be compromised.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

The vulnerability is in signature verification logic, making exploitation straightforward once the flaw is understood. Public proof-of-concept exists in the GitHub pull request.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 2.0.31 or 3.0.7

Vendor Advisory: https://github.com/phpseclib/phpseclib/releases/tag/2.0.31

Restart Required: No

Instructions:

1. Update phpseclib via Composer: composer require phpseclib/phpseclib:^2.0.31 or composer require phpseclib/phpseclib:^3.0.7
2. For manual installation, download and replace the library files from GitHub releases.
3. Test signature verification functionality after update.

🔧 Temporary Workarounds

Disable RSA PKCS#1 v1.5 signature verification

all

Temporarily disable or replace RSA PKCS#1 v1.5 signature verification with alternative methods if possible.

🧯 If You Can't Patch

  • Implement additional authentication layers (multi-factor authentication, IP whitelisting)
  • Monitor for unusual authentication patterns or signature verification failures

🔍 How to Verify

Check if Vulnerable:

Check composer.json or the phpseclib library version in your project. If using Composer: composer show phpseclib/phpseclib

Check Version:

composer show phpseclib/phpseclib | grep version

Verify Fix Applied:

Verify the installed version is 2.0.31+ or 3.0.7+. Test RSA PKCS#1 v1.5 signature verification with known valid and invalid signatures.

📡 Detection & Monitoring

Log Indicators:

  • Failed signature verification attempts
  • Unexpected successful authentications
  • Authentication logs showing unusual patterns

Network Indicators:

  • Unusual SSH/SFTP connections
  • API requests with forged signatures

SIEM Query:

source="authentication_logs" AND (event="signature_verification_failed" OR event="unexpected_authentication_success")

🔗 References

📤 Share & Export