CVE-2022-31140

7.5 HIGH

📋 TL;DR

This vulnerability in the Valinor PHP library allows attackers to extract sensitive information from error messages that should not be exposed. Attackers can obtain database credentials, SQL queries, system details, and other confidential data through crafted inputs. Any PHP application using Valinor versions before 0.12.0 is affected.

💻 Affected Systems

Products:
  • Valinor PHP library
Versions: All versions before 0.12.0
Operating Systems: Any OS running PHP with Valinor
Default Config Vulnerable: ⚠️ Yes
Notes: Vulnerability exists in default configuration when using Throwable#getMessage() for error handling.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Full database credential disclosure leading to complete system compromise, sensitive data exfiltration, and potential lateral movement within the infrastructure.

🟠

Likely Case

Exposure of database connection strings, SQL queries, or system error details that could facilitate SQL injection, enumeration attacks, or targeted exploitation.

🟢

If Mitigated

Limited information disclosure with no direct system access, though exposed details could still aid reconnaissance for other attacks.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

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

Exploitation requires triggering error conditions that reveal sensitive information through error messages.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 0.12.0

Vendor Advisory: https://github.com/CuyZ/Valinor/security/advisories/GHSA-5pgm-3j3g-2rc7

Restart Required: No

Instructions:

1. Update Valinor to version 0.12.0 or later via Composer: composer require cuyz/valinor:^0.12.0
2. Verify the update completed successfully
3. Test application functionality to ensure compatibility

🔧 Temporary Workarounds

Disable detailed error reporting

all

Configure PHP to suppress detailed error messages in production environments

php.ini: display_errors = Off
php.ini: log_errors = On
php.ini: error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT

Implement custom error handler

all

Override default error handling to sanitize error messages before display

set_error_handler(function($errno, $errstr, $errfile, $errline) { return sanitize_error($errstr); });

🧯 If You Can't Patch

  • Implement strict input validation and sanitization to prevent triggering error conditions
  • Deploy web application firewall (WAF) rules to detect and block suspicious error message patterns

🔍 How to Verify

Check if Vulnerable:

Check composer.json or run: composer show cuyz/valinor | grep version

Check Version:

composer show cuyz/valinor | grep version

Verify Fix Applied:

Confirm version is 0.12.0 or higher: composer show cuyz/valinor

📡 Detection & Monitoring

Log Indicators:

  • Error logs containing database credentials, SQL queries, or system paths
  • Unusually high rate of error responses from Valinor endpoints

Network Indicators:

  • HTTP responses containing detailed error messages with sensitive information
  • Patterns of crafted requests designed to trigger specific errors

SIEM Query:

source="web_logs" AND (message="*database*" OR message="*password*" OR message="*SQL*" OR message="*exception*") AND status_code>=500

🔗 References

📤 Share & Export