CVE-2023-49316

7.5 HIGH

📋 TL;DR

This vulnerability in phpseclib 3 allows attackers to cause denial of service by providing excessively large degree values to BinaryField.php. It affects applications using phpseclib for cryptographic operations. The vulnerability can be exploited remotely if the affected component is exposed to user input.

💻 Affected Systems

Products:
  • phpseclib
Versions: phpseclib 3 versions before 3.0.34
Operating Systems: All
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects applications that use the BinaryField.php component with user-controlled input.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete service unavailability due to resource exhaustion, potentially affecting all users of the application.

🟠

Likely Case

Degraded performance or temporary service disruption for specific users or functions.

🟢

If Mitigated

Minimal impact with proper input validation and resource limits in place.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

Exploitation requires sending specially crafted input to the vulnerable component.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 3.0.34

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

Restart Required: No

Instructions:

1. Update phpseclib to version 3.0.34 or later using composer: composer require phpseclib/phpseclib:^3.0.34
2. Verify the update completed successfully
3. Test affected functionality

🔧 Temporary Workarounds

Input validation

all

Implement strict input validation to reject excessively large degree values before they reach BinaryField.php

Resource limits

all

Configure PHP memory and execution time limits to prevent resource exhaustion

php -i | grep memory_limit
php -i | grep max_execution_time

🧯 If You Can't Patch

  • Implement WAF rules to block requests with suspiciously large numeric parameters
  • Isolate the vulnerable component behind rate limiting and monitoring

🔍 How to Verify

Check if Vulnerable:

Check composer.json or vendor/phpseclib/phpseclib/VERSION file for version number

Check Version:

composer show phpseclib/phpseclib | grep versions

Verify Fix Applied:

Confirm version is 3.0.34 or higher and test with known malicious inputs

📡 Detection & Monitoring

Log Indicators:

  • Unusually high memory usage
  • PHP fatal errors related to memory exhaustion
  • Long execution times for cryptographic operations

Network Indicators:

  • Large numeric parameters in requests to cryptographic endpoints
  • Repeated requests with varying large numbers

SIEM Query:

source="php_error.log" AND ("Allowed memory size" OR "memory exhausted") AND process="php"

🔗 References

📤 Share & Export