CVE-2018-18713

7.5 HIGH

📋 TL;DR

This vulnerability allows remote attackers to read arbitrary files on PHPYun systems through directory traversal in the down_sql_action() function. Attackers can access sensitive files like configuration files, password files, and source code by manipulating the 'name' parameter. All PHPYun 4.6 installations with the vulnerable component exposed are affected.

💻 Affected Systems

Products:
  • PHPYun
Versions: 4.6
Operating Systems: All operating systems running PHP
Default Config Vulnerable: ⚠️ Yes
Notes: Requires the /admin/ directory to be accessible, which is typically part of standard installations.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete system compromise through reading sensitive configuration files containing database credentials, followed by database takeover and potential lateral movement.

🟠

Likely Case

Exfiltration of sensitive configuration files, database credentials, and application source code leading to data breaches.

🟢

If Mitigated

Limited impact with proper file permissions and web server restrictions preventing access to critical system files.

🌐 Internet-Facing: HIGH - The vulnerability is remotely exploitable without authentication via web interface.
🏢 Internal Only: MEDIUM - Internal attackers could exploit this to escalate privileges or access sensitive data.

🎯 Exploit Status

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

Simple directory traversal attack requiring only web access to the vulnerable endpoint.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: PHPYun 4.7 or later

Vendor Advisory: Not publicly documented by vendor

Restart Required: No

Instructions:

1. Upgrade to PHPYun 4.7 or later. 2. If upgrade not possible, manually patch /admin/model/database.class.php by adding input validation to the down_sql_action() function.

🔧 Temporary Workarounds

Restrict admin directory access

all

Block external access to the /admin/ directory using web server configuration

# For Apache: add to .htaccess
Deny from all
# For Nginx: add to server block
location /admin/ { deny all; }

Input validation patch

all

Add directory traversal protection to the vulnerable function

# In /admin/model/database.class.php, modify down_sql_action()
# Add: if (strpos($name, '..') !== false) { die('Invalid request'); }

🧯 If You Can't Patch

  • Implement web application firewall (WAF) rules to block directory traversal patterns
  • Restrict file system permissions to prevent reading sensitive files even if vulnerability is exploited

🔍 How to Verify

Check if Vulnerable:

Attempt to access /admin/index.php?m=database&c=down_sql&name=../../../../etc/passwd and check if file contents are returned.

Check Version:

Check PHPYun version in admin panel or look for version information in source files.

Verify Fix Applied:

Test the same exploit attempt after patching - should return error or empty response.

📡 Detection & Monitoring

Log Indicators:

  • HTTP requests containing 'm=database&c=down_sql&name=' with directory traversal patterns
  • Multiple failed attempts to access sensitive file paths

Network Indicators:

  • Unusual GET requests to admin endpoints with ../ patterns
  • Traffic spikes to /admin/index.php with database parameters

SIEM Query:

source="web_logs" AND uri="*m=database&c=down_sql&name=*" AND (uri="*../*" OR uri="*..\\*" OR uri="*%2e%2e%2f*")

🔗 References

📤 Share & Export